mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Update gitea/sdk vendor
This commit is contained in:
		
							
								
								
									
										6
									
								
								vendor/code.gitea.io/sdk/gitea/user_key.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/code.gitea.io/sdk/gitea/user_key.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -11,6 +11,7 @@ import ( | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| // PublicKey publickey is a user key to push code to repository | ||||
| type PublicKey struct { | ||||
| 	ID      int64     `json:"id"` | ||||
| 	Key     string    `json:"key"` | ||||
| @@ -19,21 +20,25 @@ type PublicKey struct { | ||||
| 	Created time.Time `json:"created_at,omitempty"` | ||||
| } | ||||
|  | ||||
| // ListPublicKeys list all the public keys of the user | ||||
| func (c *Client) ListPublicKeys(user string) ([]*PublicKey, error) { | ||||
| 	keys := make([]*PublicKey, 0, 10) | ||||
| 	return keys, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/keys", user), nil, nil, &keys) | ||||
| } | ||||
|  | ||||
| // ListMyPublicKeys list all the public keys of current user | ||||
| func (c *Client) ListMyPublicKeys() ([]*PublicKey, error) { | ||||
| 	keys := make([]*PublicKey, 0, 10) | ||||
| 	return keys, c.getParsedResponse("GET", "/user/keys", nil, nil, &keys) | ||||
| } | ||||
|  | ||||
| // GetPublicKey get current user's public key by key id | ||||
| func (c *Client) GetPublicKey(keyID int64) (*PublicKey, error) { | ||||
| 	key := new(PublicKey) | ||||
| 	return key, c.getParsedResponse("GET", fmt.Sprintf("/user/keys/%d", keyID), nil, nil, &key) | ||||
| } | ||||
|  | ||||
| // CreatePublicKey create public key with options | ||||
| func (c *Client) CreatePublicKey(opt CreateKeyOption) (*PublicKey, error) { | ||||
| 	body, err := json.Marshal(&opt) | ||||
| 	if err != nil { | ||||
| @@ -43,6 +48,7 @@ func (c *Client) CreatePublicKey(opt CreateKeyOption) (*PublicKey, error) { | ||||
| 	return key, c.getParsedResponse("POST", "/user/keys", jsonHeader, bytes.NewReader(body), key) | ||||
| } | ||||
|  | ||||
| // DeletePublicKey delete public key with key id | ||||
| func (c *Client) DeletePublicKey(keyID int64) error { | ||||
| 	_, err := c.getResponse("DELETE", fmt.Sprintf("/user/keys/%d", keyID), nil, nil) | ||||
| 	return err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user