-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathworkspaces.go
More file actions
76 lines (63 loc) · 2.6 KB
/
workspaces.go
File metadata and controls
76 lines (63 loc) · 2.6 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package api
// Workspace is the definition of the workspace object.
type Workspace struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Created string `json:"created"`
Updated string `json:"updated"`
}
// Workspaces defines a collection of workspaces.
type Workspaces []Workspace
func (w Workspaces) Len() int { return len(w) }
func (w Workspaces) Swap(i, j int) { w[i], w[j] = w[j], w[i] }
func (w Workspaces) Less(i, j int) bool { return w[i].Name < w[j].Name }
// WorkspaceCreateRequest is the definition of POST /v2/workspaces.
type WorkspaceCreateRequest struct {
Name string `json:"name"`
Email string `json:"email"`
}
// WorkspaceUpdateRequest is the definition of PATCH /v2/workspaces/<name>.
type WorkspaceUpdateRequest struct {
Email string `json:"email,omitempty"`
}
// WorkspaceMember is the definition of the workspace member object.
type WorkspaceMember struct {
ID int `json:"id"`
User string `json:"user"`
Email string `json:"email"`
Role string `json:"role"`
Alerts bool `json:"alerts"`
Workspace string `json:"workspace"`
Created string `json:"created"`
Updated string `json:"updated"`
}
// WorkspaceMembers defines a collection of workspace member objects.
type WorkspaceMembers []WorkspaceMember
func (w WorkspaceMembers) Len() int { return len(w) }
func (w WorkspaceMembers) Swap(i, j int) { w[i], w[j] = w[j], w[i] }
func (w WorkspaceMembers) Less(i, j int) bool { return w[i].User < w[j].User }
// WorkspaceMemberUpdateRequest is the definition of PATCH /v2/workspaces/<name>/members/<user>.
type WorkspaceMemberUpdateRequest struct {
Role string `json:"role,omitempty"`
Alerts *bool `json:"alerts,omitempty"`
}
// WorkspaceInvitation is the definition of the workspace invitation object.
type WorkspaceInvitation struct {
ID int `json:"id"`
Email string `json:"email"`
Token string `json:"token"`
Inviter string `json:"inviter"`
Created string `json:"created"`
Accepted bool `json:"accepted"`
Workspace string `json:"workspace"`
}
// WorkspaceInvitations defines a collection of workspace invitation objects.
type WorkspaceInvitations []WorkspaceInvitation
func (w WorkspaceInvitations) Len() int { return len(w) }
func (w WorkspaceInvitations) Swap(i, j int) { w[i], w[j] = w[j], w[i] }
func (w WorkspaceInvitations) Less(i, j int) bool { return w[i].Email < w[j].Email }
// WorkspaceInvitationCreateRequest is the definition of POST /v2/workspaces/<name>/invitations.
type WorkspaceInvitationCreateRequest struct {
Email string `json:"email"`
}