// Copyright 2013 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 github

import (
	
	
)

// The Key type is defined in users_keys.go

// ListKeys lists the deploy keys for a repository.
//
// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys
//
//meta:operation GET /repos/{owner}/{repo}/keys
func ( *RepositoriesService) ( context.Context,  string,  string,  *ListOptions) ([]*Key, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/keys", , )
	,  := addOptions(, )
	if  != nil {
		return nil, nil, 
	}

	,  := .client.NewRequest("GET", , nil)
	if  != nil {
		return nil, nil, 
	}

	var  []*Key
	,  := .client.Do(, , &)
	if  != nil {
		return nil, , 
	}

	return , , nil
}

// GetKey fetches a single deploy key.
//
// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key
//
//meta:operation GET /repos/{owner}/{repo}/keys/{key_id}
func ( *RepositoriesService) ( context.Context,  string,  string,  int64) (*Key, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/keys/%v", , , )

	,  := .client.NewRequest("GET", , nil)
	if  != nil {
		return nil, nil, 
	}

	 := new(Key)
	,  := .client.Do(, , )
	if  != nil {
		return nil, , 
	}

	return , , nil
}

// CreateKey adds a deploy key for a repository.
//
// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key
//
//meta:operation POST /repos/{owner}/{repo}/keys
func ( *RepositoriesService) ( context.Context,  string,  string,  *Key) (*Key, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/keys", , )

	,  := .client.NewRequest("POST", , )
	if  != nil {
		return nil, nil, 
	}

	 := new(Key)
	,  := .client.Do(, , )
	if  != nil {
		return nil, , 
	}

	return , , nil
}

// DeleteKey deletes a deploy key.
//
// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key
//
//meta:operation DELETE /repos/{owner}/{repo}/keys/{key_id}
func ( *RepositoriesService) ( context.Context,  string,  string,  int64) (*Response, error) {
	 := fmt.Sprintf("repos/%v/%v/keys/%v", , , )

	,  := .client.NewRequest("DELETE", , nil)
	if  != nil {
		return nil, 
	}

	return .client.Do(, , nil)
}