// Copyright 2017 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// ListBlockedUsers lists all the blocked users by the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user////meta:operation GET /user/blocksfunc ( *UsersService) ( context.Context, *ListOptions) ([]*User, *Response, error) { := "user/blocks" , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeBlockUsersPreview)var []*User , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// IsBlocked reports whether specified user is blocked by the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user////meta:operation GET /user/blocks/{username}func ( *UsersService) ( context.Context, string) (bool, *Response, error) { := fmt.Sprintf("user/blocks/%v", ) , := .client.NewRequest("GET", , nil)if != nil {returnfalse, nil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeBlockUsersPreview) , := .client.Do(, , nil) , := parseBoolResponse()return , , }// BlockUser blocks specified user for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/blocking#block-a-user////meta:operation PUT /user/blocks/{username}func ( *UsersService) ( context.Context, string) (*Response, error) { := fmt.Sprintf("user/blocks/%v", ) , := .client.NewRequest("PUT", , nil)if != nil {returnnil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeBlockUsersPreview)return .client.Do(, , nil)}// UnblockUser unblocks specified user for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/blocking#unblock-a-user////meta:operation DELETE /user/blocks/{username}func ( *UsersService) ( context.Context, string) (*Response, error) { := fmt.Sprintf("user/blocks/%v", ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeBlockUsersPreview)return .client.Do(, , nil)}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.