// Copyright 2022 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 ()// SSHSigningKey represents a public SSH key used to sign git commits.typeSSHSigningKeystruct { ID *int64`json:"id,omitempty"` Key *string`json:"key,omitempty"` Title *string`json:"title,omitempty"` CreatedAt *Timestamp`json:"created_at,omitempty"`}func ( SSHSigningKey) () string {returnStringify()}// ListSSHSigningKeys lists the SSH signing keys for a user. Passing an empty// username string will fetch SSH signing keys for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user////meta:operation GET /user/ssh_signing_keys//meta:operation GET /users/{username}/ssh_signing_keysfunc ( *UsersService) ( context.Context, string, *ListOptions) ([]*SSHSigningKey, *Response, error) {varstringif != "" { = fmt.Sprintf("users/%v/ssh_signing_keys", ) } else { = "user/ssh_signing_keys" } , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var []*SSHSigningKey , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// GetSSHSigningKey fetches a single SSH signing key for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user////meta:operation GET /user/ssh_signing_keys/{ssh_signing_key_id}func ( *UsersService) ( context.Context, int64) (*SSHSigningKey, *Response, error) { := fmt.Sprintf("user/ssh_signing_keys/%v", ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, } := new(SSHSigningKey) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// CreateSSHSigningKey adds a SSH signing key for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user////meta:operation POST /user/ssh_signing_keysfunc ( *UsersService) ( context.Context, *Key) (*SSHSigningKey, *Response, error) { := "user/ssh_signing_keys" , := .client.NewRequest("POST", , )if != nil {returnnil, nil, } := new(SSHSigningKey) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// DeleteSSHSigningKey deletes a SSH signing key for the authenticated user.//// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user////meta:operation DELETE /user/ssh_signing_keys/{ssh_signing_key_id}func ( *UsersService) ( context.Context, int64) (*Response, error) { := fmt.Sprintf("user/ssh_signing_keys/%v", ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }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.