forked from ctreminiom/go-atlassian
/
screen.go
167 lines (142 loc) · 6.74 KB
/
screen.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package jira
import (
"context"
model "github.com/ctreminiom/go-atlassian/pkg/infra/models"
)
type ScreenConnector interface {
// Fields returns a paginated list of the screens a field is used in.
//
// GET /rest/api/{2-3}/field/{fieldId}/screens
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#get-screens-for-a-field
Fields(ctx context.Context, fieldId string, startAt, maxResults int) (*model.ScreenFieldPageScheme, *model.ResponseScheme, error)
// Gets returns a paginated list of all screens or those specified by one or more screen IDs.
//
// GET /rest/api/{2-3}/screens
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#get-screens
Gets(ctx context.Context, options *model.ScreenParamsScheme, startAt, maxResults int) (*model.ScreenSearchPageScheme, *model.ResponseScheme, error)
// Create creates a screen with a default field tab
//
// POST /rest/api/{2-3}/screens
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#create-screen
Create(ctx context.Context, name, description string) (*model.ScreenScheme, *model.ResponseScheme, error)
// AddToDefault adds a field to the default tab of the default screen.
//
// POST /rest/api/{2-3}/screens/addToDefault/{fieldId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#add-field-to-default-screen
AddToDefault(ctx context.Context, fieldId string) (*model.ResponseScheme, error)
// Update updates a screen. Only screens used in classic projects can be updated.
//
// PUT /rest/api/{2-3}/screens/{screenId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#update-screen
Update(ctx context.Context, screenId int, name, description string) (*model.ScreenScheme, *model.ResponseScheme, error)
// Delete deletes a screen.
// A screen cannot be deleted if it is used in a screen scheme,
//
// workflow, or workflow draft. Only screens used in classic projects can be deleted.
//
// DELETE /rest/api/{2-3}/screens/{screenId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#delete-screen
Delete(ctx context.Context, screenId int) (*model.ResponseScheme, error)
// Available returns the fields that can be added to a tab on a screen.
//
// GET /rest/api/{2-3}/screens/{screenId}/availableFields
//
// https://docs.go-atlassian.io/jira-software-cloud/screens#get-available-screen-fields
Available(ctx context.Context, screenId int) ([]*model.AvailableScreenFieldScheme, *model.ResponseScheme, error)
}
type ScreenSchemeConnector interface {
// Gets returns a paginated list of screen schemes.
//
// Only screen schemes used in classic projects are returned.
//
// GET /rest/api/{2-3}/screenscheme
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/schemes#get-screen-schemes
Gets(ctx context.Context, options *model.ScreenSchemeParamsScheme, startAt, maxResults int) (*model.ScreenSchemePageScheme, *model.ResponseScheme, error)
// Create creates a screen scheme.
//
// POST /rest/api/{2-3}/screenscheme
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/schemes#create-screen-scheme
Create(ctx context.Context, payload *model.ScreenSchemePayloadScheme) (*model.ScreenSchemeScheme, *model.ResponseScheme, error)
// Update updates a screen scheme. Only screen schemes used in classic projects can be updated.
//
// PUT /rest/api/{2-3}/screenscheme/{screenSchemeId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/schemes#update-screen-scheme
Update(ctx context.Context, screenSchemeId string, payload *model.ScreenSchemePayloadScheme) (*model.ResponseScheme, error)
// Delete deletes a screen scheme. A screen scheme cannot be deleted if it is used in an issue type screen scheme.
//
// Only screens schemes used in classic projects can be deleted.
//
// DELETE /rest/api/{2-3}/screenscheme/{screenSchemeId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/schemes#delete-screen-scheme
Delete(ctx context.Context, screenSchemeId string) (*model.ResponseScheme, error)
}
type ScreenTabConnector interface {
// Gets returns the list of tabs for a screen.
//
// GET /rest/api/{2-3}/screens/{screenId}/tabs
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs#get-all-screen-tabs
Gets(ctx context.Context, screenId int, projectKey string) ([]*model.ScreenTabScheme, *model.ResponseScheme, error)
// Create creates a tab for a screen.
//
// POST /rest/api/{2-3}/screens/{screenId}/tabs
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs#create-screen-tab
Create(ctx context.Context, screenId int, tabName string) (*model.ScreenTabScheme, *model.ResponseScheme, error)
// Update updates the name of a screen tab.
//
// PUT /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs#update-screen-tab
Update(ctx context.Context, screenId, tabId int, newTabName string) (*model.ScreenTabScheme, *model.ResponseScheme, error)
// Delete deletes a screen tab.
//
// DELETE /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs#delete-screen-tab
Delete(ctx context.Context, screenId, tabId int) (*model.ResponseScheme, error)
// Move moves a screen tab.
//
// POST /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}/move/{pos}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs#move-screen-tab
Move(ctx context.Context, screenId, tabId, position int) (*model.ResponseScheme, error)
}
type ScreenTabFieldConnector interface {
// Gets returns all fields for a screen tab.
//
// GET /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}/fields
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs/fields#get-all-screen-tab-fields
Gets(ctx context.Context, screenId, tabId int) ([]*model.ScreenTabFieldScheme, *model.ResponseScheme, error)
// Add adds a field to a screen tab.
//
// POST /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}/fields
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs/fields#add-screen-tab-field
Add(ctx context.Context, screenId, tabId int, fieldId string) (*model.ScreenTabFieldScheme, *model.ResponseScheme, error)
// Remove removes a field from a screen tab.
//
// DELETE /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}/fields/{id}
//
// https://docs.go-atlassian.io/jira-software-cloud/screens/tabs/fields#remove-screen-tab-field
Remove(ctx context.Context, screenId, tabId int, fieldId string) (*model.ResponseScheme, error)
// Move moves a screen tab field.
//
// If after and position are provided in the request, position is ignored.
//
// POST /rest/api/{2-3}/screens/{screenId}/tabs/{tabId}/fields/{id}/move
//
// TODO: Add documentation
Move(ctx context.Context, screenId, tabId int, fieldId, after, position string) (*model.ResponseScheme, error)
}