-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorganizationinvite.go
204 lines (174 loc) · 6.77 KB
/
organizationinvite.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package gitpod
import (
"context"
"net/http"
"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"
)
// OrganizationInviteService 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 [NewOrganizationInviteService] method instead.
type OrganizationInviteService struct {
Options []option.RequestOption
}
// NewOrganizationInviteService 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 NewOrganizationInviteService(opts ...option.RequestOption) (r *OrganizationInviteService) {
r = &OrganizationInviteService{}
r.Options = opts
return
}
// Creates an invite link for joining an organization. Any existing
// OrganizationInvites are invalidated and can no longer be used.
//
// Use this method to:
//
// - Generate shareable invite links
// - Manage team growth
// - Control organization access
//
// ### Examples
//
// - Create organization invite:
//
// Generates a new invite link for the organization.
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// ```
func (r *OrganizationInviteService) New(ctx context.Context, body OrganizationInviteNewParams, opts ...option.RequestOption) (res *OrganizationInviteNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.OrganizationService/CreateOrganizationInvite"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// GetOrganizationInvite
func (r *OrganizationInviteService) Get(ctx context.Context, body OrganizationInviteGetParams, opts ...option.RequestOption) (res *OrganizationInviteGetResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.OrganizationService/GetOrganizationInvite"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Retrieves organization details and membership info based on an invite link.
//
// Use this method to:
//
// - Preview organization details before joining
// - Validate invite link authenticity
// - Check organization size and activity
// - View team information before accepting
//
// ### Examples
//
// - Get invite summary:
//
// Retrieves organization information from an invite.
//
// ```yaml
// inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
// ```
func (r *OrganizationInviteService) GetSummary(ctx context.Context, body OrganizationInviteGetSummaryParams, opts ...option.RequestOption) (res *OrganizationInviteGetSummaryResponse, err error) {
opts = append(r.Options[:], opts...)
path := "gitpod.v1.OrganizationService/GetOrganizationInviteSummary"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type OrganizationInvite struct {
// invite_id is the unique identifier of the invite to join the organization. Use
// JoinOrganization with this ID to join the organization.
InviteID string `json:"inviteId,required" format:"uuid"`
JSON organizationInviteJSON `json:"-"`
}
// organizationInviteJSON contains the JSON metadata for the struct
// [OrganizationInvite]
type organizationInviteJSON struct {
InviteID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationInvite) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationInviteJSON) RawJSON() string {
return r.raw
}
type OrganizationInviteNewResponse struct {
Invite OrganizationInvite `json:"invite,required"`
JSON organizationInviteNewResponseJSON `json:"-"`
}
// organizationInviteNewResponseJSON contains the JSON metadata for the struct
// [OrganizationInviteNewResponse]
type organizationInviteNewResponseJSON struct {
Invite apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationInviteNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationInviteNewResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationInviteGetResponse struct {
Invite OrganizationInvite `json:"invite,required"`
JSON organizationInviteGetResponseJSON `json:"-"`
}
// organizationInviteGetResponseJSON contains the JSON metadata for the struct
// [OrganizationInviteGetResponse]
type organizationInviteGetResponseJSON struct {
Invite apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationInviteGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationInviteGetResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationInviteGetSummaryResponse struct {
OrganizationID string `json:"organizationId,required" format:"uuid"`
OrganizationMemberCount int64 `json:"organizationMemberCount"`
OrganizationName string `json:"organizationName"`
JSON organizationInviteGetSummaryResponseJSON `json:"-"`
}
// organizationInviteGetSummaryResponseJSON contains the JSON metadata for the
// struct [OrganizationInviteGetSummaryResponse]
type organizationInviteGetSummaryResponseJSON struct {
OrganizationID apijson.Field
OrganizationMemberCount apijson.Field
OrganizationName apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationInviteGetSummaryResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationInviteGetSummaryResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationInviteNewParams struct {
OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationInviteNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationInviteGetParams struct {
OrganizationID param.Field[string] `json:"organizationId,required" format:"uuid"`
}
func (r OrganizationInviteGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationInviteGetSummaryParams struct {
InviteID param.Field[string] `json:"inviteId,required" format:"uuid"`
}
func (r OrganizationInviteGetSummaryParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}