// 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 (
	
	
)

// Label represents a GitHub label on an Issue
type Label struct {
	ID          *int64  `json:"id,omitempty"`
	URL         *string `json:"url,omitempty"`
	Name        *string `json:"name,omitempty"`
	Color       *string `json:"color,omitempty"`
	Description *string `json:"description,omitempty"`
	Default     *bool   `json:"default,omitempty"`
	NodeID      *string `json:"node_id,omitempty"`
}

func ( Label) () string {
	return Stringify()
}

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

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

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

	return , , nil
}

// GetLabel gets a single label.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#get-a-label
//
//meta:operation GET /repos/{owner}/{repo}/labels/{name}
func ( *IssuesService) ( context.Context,  string,  string,  string) (*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/labels/%v", , , )
	,  := .client.NewRequest("GET", , nil)
	if  != nil {
		return nil, nil, 
	}

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

	return , , nil
}

// CreateLabel creates a new label on the specified repository.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#create-a-label
//
//meta:operation POST /repos/{owner}/{repo}/labels
func ( *IssuesService) ( context.Context,  string,  string,  *Label) (*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/labels", , )
	,  := .client.NewRequest("POST", , )
	if  != nil {
		return nil, nil, 
	}

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

	return , , nil
}

// EditLabel edits a label.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#update-a-label
//
//meta:operation PATCH /repos/{owner}/{repo}/labels/{name}
func ( *IssuesService) ( context.Context,  string,  string,  string,  *Label) (*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/labels/%v", , , )
	,  := .client.NewRequest("PATCH", , )
	if  != nil {
		return nil, nil, 
	}

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

	return , , nil
}

// DeleteLabel deletes a label.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#delete-a-label
//
//meta:operation DELETE /repos/{owner}/{repo}/labels/{name}
func ( *IssuesService) ( context.Context,  string,  string,  string) (*Response, error) {
	 := fmt.Sprintf("repos/%v/%v/labels/%v", , , )
	,  := .client.NewRequest("DELETE", , nil)
	if  != nil {
		return nil, 
	}
	return .client.Do(, , nil)
}

// ListLabelsByIssue lists all labels for an issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue
//
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/labels
func ( *IssuesService) ( context.Context,  string,  string,  int,  *ListOptions) ([]*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/issues/%d/labels", , , )
	,  := addOptions(, )
	if  != nil {
		return nil, nil, 
	}

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

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

	return , , nil
}

// AddLabelsToIssue adds labels to an issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue
//
//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels
func ( *IssuesService) ( context.Context,  string,  string,  int,  []string) ([]*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/issues/%d/labels", , , )
	,  := .client.NewRequest("POST", , )
	if  != nil {
		return nil, nil, 
	}

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

	return , , nil
}

// RemoveLabelForIssue removes a label for an issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue
//
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}
func ( *IssuesService) ( context.Context,  string,  string,  int,  string) (*Response, error) {
	 := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", , , , )
	,  := .client.NewRequest("DELETE", , nil)
	if  != nil {
		return nil, 
	}

	return .client.Do(, , nil)
}

// ReplaceLabelsForIssue replaces all labels for an issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue
//
//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels
func ( *IssuesService) ( context.Context,  string,  string,  int,  []string) ([]*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/issues/%d/labels", , , )
	,  := .client.NewRequest("PUT", , )
	if  != nil {
		return nil, nil, 
	}

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

	return , , nil
}

// RemoveLabelsForIssue removes all labels for an issue.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue
//
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels
func ( *IssuesService) ( context.Context,  string,  string,  int) (*Response, error) {
	 := fmt.Sprintf("repos/%v/%v/issues/%d/labels", , , )
	,  := .client.NewRequest("DELETE", , nil)
	if  != nil {
		return nil, 
	}

	return .client.Do(, , nil)
}

// ListLabelsForMilestone lists labels for every issue in a milestone.
//
// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone
//
//meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels
func ( *IssuesService) ( context.Context,  string,  string,  int,  *ListOptions) ([]*Label, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", , , )
	,  := addOptions(, )
	if  != nil {
		return nil, nil, 
	}

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

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

	return , , nil
}