// 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 githubimport ()// 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}/projectsfunc ( *UsersService) ( context.Context, string, *ProjectListOptions) ([]*Project, *Response, error) { := fmt.Sprintf("users/%v/projects", ) , := addOptions(, )if != nil {returnnil, nil, } , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeProjectsPreview)var []*Project , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// CreateUserProjectOptions specifies the parameters to the UsersService.CreateProject method.typeCreateUserProjectOptionsstruct {// 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/projectsfunc ( *UsersService) ( context.Context, *CreateUserProjectOptions) (*Project, *Response, error) { := "user/projects" , := .client.NewRequest("POST", , )if != nil {returnnil, nil, }// TODO: remove custom Accept header when this API fully launches. .Header.Set("Accept", mediaTypeProjectsPreview) := &Project{} , := .client.Do(, , )if != nil {returnnil, , }return , , nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.