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

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

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

	// TODO: remove custom Accept header when this API fully launches.
	.Header.Set("Accept", mediaTypeProjectsPreview)

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

	return , , nil
}

// CreateUserProjectOptions specifies the parameters to the UsersService.CreateProject method.
type CreateUserProjectOptions struct {
	// The name of the project. (Required.)
	Name string `json:"name"`
	// The description of the project. (Optional.)
	Body *string `json:"body,omitempty"`
}

// CreateProject creates a GitHub Project for the current user.
//
// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-user-project
//
//meta:operation POST /user/projects
func ( *UsersService) ( context.Context,  *CreateUserProjectOptions) (*Project, *Response, error) {
	 := "user/projects"
	,  := .client.NewRequest("POST", , )
	if  != nil {
		return nil, nil, 
	}

	// TODO: remove custom Accept header when this API fully launches.
	.Header.Set("Accept", mediaTypeProjectsPreview)

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

	return , , nil
}