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

import (
	
	
)

// ProjectListOptions specifies the optional parameters to the
// OrganizationsService.ListProjects and RepositoriesService.ListProjects methods.
type ProjectListOptions struct {
	// Indicates the state of the projects to return. Can be either open, closed, or all. Default: open
	State string `url:"state,omitempty"`

	ListOptions
}

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

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

	// TODO: remove custom Accept headers when APIs fully launch.
	.Header.Set("Accept", mediaTypeProjectsPreview)

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

	return , , nil
}

// CreateProject creates a GitHub Project for the specified repository.
//
// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-repository-project
//
//meta:operation POST /repos/{owner}/{repo}/projects
func ( *RepositoriesService) ( context.Context, ,  string,  *ProjectOptions) (*Project, *Response, error) {
	 := fmt.Sprintf("repos/%v/%v/projects", , )
	,  := .client.NewRequest("POST", , )
	if  != nil {
		return nil, nil, 
	}

	// TODO: remove custom Accept headers when APIs fully launch.
	.Header.Set("Accept", mediaTypeProjectsPreview)

	 := &Project{}
	,  := .client.Do(, , )
	if  != nil {
		return nil, , 
	}

	return , , nil
}