forked from labd/commercetools-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_project.go
36 lines (31 loc) · 1.08 KB
/
service_project.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package commercetools
import "context"
// ProjectUpdateInput provides the data required to update a project.
type ProjectUpdateInput struct {
// The expected version of the project on which the changes should be
// applied. If the expected version does not match the actual version, a 409
// Conflict will be returned.
Version int
// The list of update actions to be performed on the project.
Actions []ProjectUpdateAction
}
// ProjectGet will return the current project. OAuth2 Scopes:
// view_project_settings:{projectKey}
func (client *Client) ProjectGet() (result *Project, err error) {
ctx := context.TODO()
err = client.get(ctx, "", nil, &result)
if err != nil {
return nil, err
}
return result, nil
}
// ProjectUpdate will update the current project with the defined UpdateActions. OAuth2
// Scopes: manage_project:{projectKey}
func (client *Client) ProjectUpdate(input *ProjectUpdateInput) (result *Project, err error) {
ctx := context.TODO()
err = client.update(ctx, "", nil, input.Version, input.Actions, &result)
if err != nil {
return nil, err
}
return result, nil
}