Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added project.create method #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ for more information on how to use them.
- phid.lookup
- phid.query
- phriction.info
- project.create
- project.query
- remarkup.process
- repository.query
Expand Down
13 changes: 13 additions & 0 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ func (c *Conn) ProjectQuery(

return &res, nil
}

// ProjectCreate performs a call to project.create.
func (c *Conn) ProjectCreate(
req requests.ProjectCreateRequest,
) (*responses.ProjectCreateResponse, error) {
var res responses.ProjectCreateResponse

if err := c.Call("project.create", &req, &res); err != nil {
return nil, err
}

return &res, nil
}
8 changes: 8 additions & 0 deletions requests/project_query.go → requests/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ type ProjectQueryRequest struct {
Offset uint64 `json:"offset"`
Request
}

// ProjectCreateRequest represents a request to project.create.
type ProjectCreateRequest struct {
Name string `json:"name"`
MemberPHIDs []string `json:"member_phids,omitempty"`
MemberAliases []string `json:"member_aliases,omitempty"`
Request
}
3 changes: 3 additions & 0 deletions responses/project_query.go → responses/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ type ProjectQueryResponse struct {
SlugMap map[string]string `json:"sligMap"`
Cursor entities.Cursor `json:"cursor"`
}

// ProjectCreateResponse represents a response from calling project.create.
type ProjectCreateResponse entities.Project