-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathorganizationannouncementbanner.go
More file actions
174 lines (151 loc) · 6.21 KB
/
organizationannouncementbanner.go
File metadata and controls
174 lines (151 loc) · 6.21 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
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
168
169
170
171
172
173
174
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package gitpod
import (
"context"
"net/http"
"slices"
"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/internal/param"
"github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
// OrganizationAnnouncementBannerService contains methods and other services that
// help with interacting with the gitpod API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewOrganizationAnnouncementBannerService] method instead.
type OrganizationAnnouncementBannerService struct {
Options []option.RequestOption
}
// NewOrganizationAnnouncementBannerService generates a new service that applies
// the given options to each request. These options are applied after the parent
// client's options (if there is one), and before any request-specific options.
func NewOrganizationAnnouncementBannerService(opts ...option.RequestOption) (r *OrganizationAnnouncementBannerService) {
r = &OrganizationAnnouncementBannerService{}
r.Options = opts
return
}
// Updates the announcement banner configuration for an organization.
//
// Use this method to configure the announcement banner displayed to all users.
// Only organization admins can update the banner. Requires Enterprise tier.
//
// ### Examples
//
// - Enable announcement banner:
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// message: "Scheduled maintenance on Saturday 10pm-2am UTC"
// enabled: true
// ```
//
// - Disable announcement banner:
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// enabled: false
// ```
func (r *OrganizationAnnouncementBannerService) Update(ctx context.Context, body OrganizationAnnouncementBannerUpdateParams, opts ...option.RequestOption) (res *OrganizationAnnouncementBannerUpdateResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/UpdateAnnouncementBanner"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Retrieves the announcement banner configuration for an organization.
//
// Use this method to fetch the current announcement banner settings. All
// organization members can read the banner configuration.
//
// ### Examples
//
// - Get announcement banner:
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// ```
func (r *OrganizationAnnouncementBannerService) Get(ctx context.Context, body OrganizationAnnouncementBannerGetParams, opts ...option.RequestOption) (res *OrganizationAnnouncementBannerGetResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/GetAnnouncementBanner"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
type AnnouncementBanner struct {
// organization_id is the ID of the organization
OrganizationID string `json:"organizationId" api:"required" format:"uuid"`
// enabled controls whether the banner is displayed
Enabled bool `json:"enabled"`
// message is the banner message displayed to users. Supports basic Markdown.
Message string `json:"message"`
JSON announcementBannerJSON `json:"-"`
}
// announcementBannerJSON contains the JSON metadata for the struct
// [AnnouncementBanner]
type announcementBannerJSON struct {
OrganizationID apijson.Field
Enabled apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AnnouncementBanner) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r announcementBannerJSON) RawJSON() string {
return r.raw
}
type OrganizationAnnouncementBannerUpdateResponse struct {
// banner is the updated announcement banner configuration
Banner AnnouncementBanner `json:"banner" api:"required"`
JSON organizationAnnouncementBannerUpdateResponseJSON `json:"-"`
}
// organizationAnnouncementBannerUpdateResponseJSON contains the JSON metadata for
// the struct [OrganizationAnnouncementBannerUpdateResponse]
type organizationAnnouncementBannerUpdateResponseJSON struct {
Banner apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationAnnouncementBannerUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationAnnouncementBannerUpdateResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationAnnouncementBannerGetResponse struct {
// banner is the announcement banner configuration
Banner AnnouncementBanner `json:"banner" api:"required"`
JSON organizationAnnouncementBannerGetResponseJSON `json:"-"`
}
// organizationAnnouncementBannerGetResponseJSON contains the JSON metadata for the
// struct [OrganizationAnnouncementBannerGetResponse]
type organizationAnnouncementBannerGetResponseJSON struct {
Banner apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationAnnouncementBannerGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationAnnouncementBannerGetResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationAnnouncementBannerUpdateParams struct {
// organization_id is the ID of the organization
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
// enabled controls whether the banner is displayed
Enabled param.Field[bool] `json:"enabled"`
// message is the banner message. Supports basic Markdown. Maximum 1000 characters.
Message param.Field[string] `json:"message"`
}
func (r OrganizationAnnouncementBannerUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationAnnouncementBannerGetParams struct {
// organization_id is the ID of the organization
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
}
func (r OrganizationAnnouncementBannerGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}