-
Notifications
You must be signed in to change notification settings - Fork 0
/
organization.go
executable file
·854 lines (759 loc) · 37 KB
/
organization.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package polar
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/polarsource/polar-go/internal/apijson"
"github.com/polarsource/polar-go/internal/apiquery"
"github.com/polarsource/polar-go/internal/param"
"github.com/polarsource/polar-go/internal/requestconfig"
"github.com/polarsource/polar-go/option"
)
// OrganizationService contains methods and other services that help with
// interacting with the polar 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 [NewOrganizationService] method instead.
type OrganizationService struct {
Options []option.RequestOption
Customers *OrganizationCustomerService
}
// NewOrganizationService 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 NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService) {
r = &OrganizationService{}
r.Options = opts
r.Customers = NewOrganizationCustomerService(opts...)
return
}
// Create an organization.
func (r *OrganizationService) New(ctx context.Context, body OrganizationNewParams, opts ...option.RequestOption) (res *OrganizationNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/organizations/"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get an organization by ID.
func (r *OrganizationService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *OrganizationGetResponse, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("v1/organizations/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update an organization.
func (r *OrganizationService) Update(ctx context.Context, id string, body OrganizationUpdateParams, opts ...option.RequestOption) (res *OrganizationUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("v1/organizations/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// List organizations.
func (r *OrganizationService) List(ctx context.Context, query OrganizationListParams, opts ...option.RequestOption) (res *OrganizationListResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/organizations/"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
type OrganizationNewResponse struct {
// The organization ID.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// If this organizations accepts donations
DonationsEnabled bool `json:"donations_enabled,required"`
// Settings for the organization features
FeatureSettings OrganizationNewResponseFeatureSettings `json:"feature_settings,required,nullable"`
Name string `json:"name,required"`
PledgeBadgeShowAmount bool `json:"pledge_badge_show_amount,required"`
PledgeMinimumAmount int64 `json:"pledge_minimum_amount,required"`
// Settings for the organization profile
ProfileSettings OrganizationNewResponseProfileSettings `json:"profile_settings,required,nullable"`
Slug string `json:"slug,required"`
AvatarURL string `json:"avatar_url,nullable"`
Bio string `json:"bio,nullable"`
Blog string `json:"blog,nullable"`
Company string `json:"company,nullable"`
DefaultUpfrontSplitToContributors int64 `json:"default_upfront_split_to_contributors,nullable"`
Email string `json:"email,nullable"`
Location string `json:"location,nullable"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
TwitterUsername string `json:"twitter_username,nullable"`
JSON organizationNewResponseJSON `json:"-"`
}
// organizationNewResponseJSON contains the JSON metadata for the struct
// [OrganizationNewResponse]
type organizationNewResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
DonationsEnabled apijson.Field
FeatureSettings apijson.Field
Name apijson.Field
PledgeBadgeShowAmount apijson.Field
PledgeMinimumAmount apijson.Field
ProfileSettings apijson.Field
Slug apijson.Field
AvatarURL apijson.Field
Bio apijson.Field
Blog apijson.Field
Company apijson.Field
DefaultUpfrontSplitToContributors apijson.Field
Email apijson.Field
Location apijson.Field
ModifiedAt apijson.Field
TwitterUsername apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationNewResponseJSON) RawJSON() string {
return r.raw
}
// Settings for the organization features
type OrganizationNewResponseFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled bool `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled bool `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled bool `json:"subscriptions_enabled"`
JSON organizationNewResponseFeatureSettingsJSON `json:"-"`
}
// organizationNewResponseFeatureSettingsJSON contains the JSON metadata for the
// struct [OrganizationNewResponseFeatureSettings]
type organizationNewResponseFeatureSettingsJSON struct {
ArticlesEnabled apijson.Field
IssueFundingEnabled apijson.Field
SubscriptionsEnabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationNewResponseFeatureSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationNewResponseFeatureSettingsJSON) RawJSON() string {
return r.raw
}
// Settings for the organization profile
type OrganizationNewResponseProfileSettings struct {
// A description of the organization
Description string `json:"description,nullable"`
// A list of featured organizations
FeaturedOrganizations []string `json:"featured_organizations,nullable" format:"uuid4"`
// A list of featured projects
FeaturedProjects []string `json:"featured_projects,nullable" format:"uuid4"`
// A list of links associated with the organization
Links []string `json:"links,nullable" format:"uri"`
// Subscription promotion settings
Subscribe OrganizationNewResponseProfileSettingsSubscribe `json:"subscribe,nullable"`
JSON organizationNewResponseProfileSettingsJSON `json:"-"`
}
// organizationNewResponseProfileSettingsJSON contains the JSON metadata for the
// struct [OrganizationNewResponseProfileSettings]
type organizationNewResponseProfileSettingsJSON struct {
Description apijson.Field
FeaturedOrganizations apijson.Field
FeaturedProjects apijson.Field
Links apijson.Field
Subscribe apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationNewResponseProfileSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationNewResponseProfileSettingsJSON) RawJSON() string {
return r.raw
}
// Subscription promotion settings
type OrganizationNewResponseProfileSettingsSubscribe struct {
// Include free subscribers in total count
CountFree bool `json:"count_free"`
// Promote email subscription (free)
Promote bool `json:"promote"`
// Show subscription count publicly
ShowCount bool `json:"show_count"`
JSON organizationNewResponseProfileSettingsSubscribeJSON `json:"-"`
}
// organizationNewResponseProfileSettingsSubscribeJSON contains the JSON metadata
// for the struct [OrganizationNewResponseProfileSettingsSubscribe]
type organizationNewResponseProfileSettingsSubscribeJSON struct {
CountFree apijson.Field
Promote apijson.Field
ShowCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationNewResponseProfileSettingsSubscribe) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationNewResponseProfileSettingsSubscribeJSON) RawJSON() string {
return r.raw
}
type OrganizationGetResponse struct {
// The organization ID.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// If this organizations accepts donations
DonationsEnabled bool `json:"donations_enabled,required"`
// Settings for the organization features
FeatureSettings OrganizationGetResponseFeatureSettings `json:"feature_settings,required,nullable"`
Name string `json:"name,required"`
PledgeBadgeShowAmount bool `json:"pledge_badge_show_amount,required"`
PledgeMinimumAmount int64 `json:"pledge_minimum_amount,required"`
// Settings for the organization profile
ProfileSettings OrganizationGetResponseProfileSettings `json:"profile_settings,required,nullable"`
Slug string `json:"slug,required"`
AvatarURL string `json:"avatar_url,nullable"`
Bio string `json:"bio,nullable"`
Blog string `json:"blog,nullable"`
Company string `json:"company,nullable"`
DefaultUpfrontSplitToContributors int64 `json:"default_upfront_split_to_contributors,nullable"`
Email string `json:"email,nullable"`
Location string `json:"location,nullable"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
TwitterUsername string `json:"twitter_username,nullable"`
JSON organizationGetResponseJSON `json:"-"`
}
// organizationGetResponseJSON contains the JSON metadata for the struct
// [OrganizationGetResponse]
type organizationGetResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
DonationsEnabled apijson.Field
FeatureSettings apijson.Field
Name apijson.Field
PledgeBadgeShowAmount apijson.Field
PledgeMinimumAmount apijson.Field
ProfileSettings apijson.Field
Slug apijson.Field
AvatarURL apijson.Field
Bio apijson.Field
Blog apijson.Field
Company apijson.Field
DefaultUpfrontSplitToContributors apijson.Field
Email apijson.Field
Location apijson.Field
ModifiedAt apijson.Field
TwitterUsername apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationGetResponseJSON) RawJSON() string {
return r.raw
}
// Settings for the organization features
type OrganizationGetResponseFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled bool `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled bool `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled bool `json:"subscriptions_enabled"`
JSON organizationGetResponseFeatureSettingsJSON `json:"-"`
}
// organizationGetResponseFeatureSettingsJSON contains the JSON metadata for the
// struct [OrganizationGetResponseFeatureSettings]
type organizationGetResponseFeatureSettingsJSON struct {
ArticlesEnabled apijson.Field
IssueFundingEnabled apijson.Field
SubscriptionsEnabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationGetResponseFeatureSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationGetResponseFeatureSettingsJSON) RawJSON() string {
return r.raw
}
// Settings for the organization profile
type OrganizationGetResponseProfileSettings struct {
// A description of the organization
Description string `json:"description,nullable"`
// A list of featured organizations
FeaturedOrganizations []string `json:"featured_organizations,nullable" format:"uuid4"`
// A list of featured projects
FeaturedProjects []string `json:"featured_projects,nullable" format:"uuid4"`
// A list of links associated with the organization
Links []string `json:"links,nullable" format:"uri"`
// Subscription promotion settings
Subscribe OrganizationGetResponseProfileSettingsSubscribe `json:"subscribe,nullable"`
JSON organizationGetResponseProfileSettingsJSON `json:"-"`
}
// organizationGetResponseProfileSettingsJSON contains the JSON metadata for the
// struct [OrganizationGetResponseProfileSettings]
type organizationGetResponseProfileSettingsJSON struct {
Description apijson.Field
FeaturedOrganizations apijson.Field
FeaturedProjects apijson.Field
Links apijson.Field
Subscribe apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationGetResponseProfileSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationGetResponseProfileSettingsJSON) RawJSON() string {
return r.raw
}
// Subscription promotion settings
type OrganizationGetResponseProfileSettingsSubscribe struct {
// Include free subscribers in total count
CountFree bool `json:"count_free"`
// Promote email subscription (free)
Promote bool `json:"promote"`
// Show subscription count publicly
ShowCount bool `json:"show_count"`
JSON organizationGetResponseProfileSettingsSubscribeJSON `json:"-"`
}
// organizationGetResponseProfileSettingsSubscribeJSON contains the JSON metadata
// for the struct [OrganizationGetResponseProfileSettingsSubscribe]
type organizationGetResponseProfileSettingsSubscribeJSON struct {
CountFree apijson.Field
Promote apijson.Field
ShowCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationGetResponseProfileSettingsSubscribe) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationGetResponseProfileSettingsSubscribeJSON) RawJSON() string {
return r.raw
}
type OrganizationUpdateResponse struct {
// The organization ID.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// If this organizations accepts donations
DonationsEnabled bool `json:"donations_enabled,required"`
// Settings for the organization features
FeatureSettings OrganizationUpdateResponseFeatureSettings `json:"feature_settings,required,nullable"`
Name string `json:"name,required"`
PledgeBadgeShowAmount bool `json:"pledge_badge_show_amount,required"`
PledgeMinimumAmount int64 `json:"pledge_minimum_amount,required"`
// Settings for the organization profile
ProfileSettings OrganizationUpdateResponseProfileSettings `json:"profile_settings,required,nullable"`
Slug string `json:"slug,required"`
AvatarURL string `json:"avatar_url,nullable"`
Bio string `json:"bio,nullable"`
Blog string `json:"blog,nullable"`
Company string `json:"company,nullable"`
DefaultUpfrontSplitToContributors int64 `json:"default_upfront_split_to_contributors,nullable"`
Email string `json:"email,nullable"`
Location string `json:"location,nullable"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
TwitterUsername string `json:"twitter_username,nullable"`
JSON organizationUpdateResponseJSON `json:"-"`
}
// organizationUpdateResponseJSON contains the JSON metadata for the struct
// [OrganizationUpdateResponse]
type organizationUpdateResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
DonationsEnabled apijson.Field
FeatureSettings apijson.Field
Name apijson.Field
PledgeBadgeShowAmount apijson.Field
PledgeMinimumAmount apijson.Field
ProfileSettings apijson.Field
Slug apijson.Field
AvatarURL apijson.Field
Bio apijson.Field
Blog apijson.Field
Company apijson.Field
DefaultUpfrontSplitToContributors apijson.Field
Email apijson.Field
Location apijson.Field
ModifiedAt apijson.Field
TwitterUsername apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationUpdateResponseJSON) RawJSON() string {
return r.raw
}
// Settings for the organization features
type OrganizationUpdateResponseFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled bool `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled bool `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled bool `json:"subscriptions_enabled"`
JSON organizationUpdateResponseFeatureSettingsJSON `json:"-"`
}
// organizationUpdateResponseFeatureSettingsJSON contains the JSON metadata for the
// struct [OrganizationUpdateResponseFeatureSettings]
type organizationUpdateResponseFeatureSettingsJSON struct {
ArticlesEnabled apijson.Field
IssueFundingEnabled apijson.Field
SubscriptionsEnabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationUpdateResponseFeatureSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationUpdateResponseFeatureSettingsJSON) RawJSON() string {
return r.raw
}
// Settings for the organization profile
type OrganizationUpdateResponseProfileSettings struct {
// A description of the organization
Description string `json:"description,nullable"`
// A list of featured organizations
FeaturedOrganizations []string `json:"featured_organizations,nullable" format:"uuid4"`
// A list of featured projects
FeaturedProjects []string `json:"featured_projects,nullable" format:"uuid4"`
// A list of links associated with the organization
Links []string `json:"links,nullable" format:"uri"`
// Subscription promotion settings
Subscribe OrganizationUpdateResponseProfileSettingsSubscribe `json:"subscribe,nullable"`
JSON organizationUpdateResponseProfileSettingsJSON `json:"-"`
}
// organizationUpdateResponseProfileSettingsJSON contains the JSON metadata for the
// struct [OrganizationUpdateResponseProfileSettings]
type organizationUpdateResponseProfileSettingsJSON struct {
Description apijson.Field
FeaturedOrganizations apijson.Field
FeaturedProjects apijson.Field
Links apijson.Field
Subscribe apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationUpdateResponseProfileSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationUpdateResponseProfileSettingsJSON) RawJSON() string {
return r.raw
}
// Subscription promotion settings
type OrganizationUpdateResponseProfileSettingsSubscribe struct {
// Include free subscribers in total count
CountFree bool `json:"count_free"`
// Promote email subscription (free)
Promote bool `json:"promote"`
// Show subscription count publicly
ShowCount bool `json:"show_count"`
JSON organizationUpdateResponseProfileSettingsSubscribeJSON `json:"-"`
}
// organizationUpdateResponseProfileSettingsSubscribeJSON contains the JSON
// metadata for the struct [OrganizationUpdateResponseProfileSettingsSubscribe]
type organizationUpdateResponseProfileSettingsSubscribeJSON struct {
CountFree apijson.Field
Promote apijson.Field
ShowCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationUpdateResponseProfileSettingsSubscribe) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationUpdateResponseProfileSettingsSubscribeJSON) RawJSON() string {
return r.raw
}
type OrganizationListResponse struct {
Pagination OrganizationListResponsePagination `json:"pagination,required"`
Items []OrganizationListResponseItem `json:"items"`
JSON organizationListResponseJSON `json:"-"`
}
// organizationListResponseJSON contains the JSON metadata for the struct
// [OrganizationListResponse]
type organizationListResponseJSON struct {
Pagination apijson.Field
Items apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationListResponsePagination struct {
MaxPage int64 `json:"max_page,required"`
TotalCount int64 `json:"total_count,required"`
JSON organizationListResponsePaginationJSON `json:"-"`
}
// organizationListResponsePaginationJSON contains the JSON metadata for the struct
// [OrganizationListResponsePagination]
type organizationListResponsePaginationJSON struct {
MaxPage apijson.Field
TotalCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponsePagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponsePaginationJSON) RawJSON() string {
return r.raw
}
type OrganizationListResponseItem struct {
// The organization ID.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// If this organizations accepts donations
DonationsEnabled bool `json:"donations_enabled,required"`
// Settings for the organization features
FeatureSettings OrganizationListResponseItemsFeatureSettings `json:"feature_settings,required,nullable"`
Name string `json:"name,required"`
PledgeBadgeShowAmount bool `json:"pledge_badge_show_amount,required"`
PledgeMinimumAmount int64 `json:"pledge_minimum_amount,required"`
// Settings for the organization profile
ProfileSettings OrganizationListResponseItemsProfileSettings `json:"profile_settings,required,nullable"`
Slug string `json:"slug,required"`
AvatarURL string `json:"avatar_url,nullable"`
Bio string `json:"bio,nullable"`
Blog string `json:"blog,nullable"`
Company string `json:"company,nullable"`
DefaultUpfrontSplitToContributors int64 `json:"default_upfront_split_to_contributors,nullable"`
Email string `json:"email,nullable"`
Location string `json:"location,nullable"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
TwitterUsername string `json:"twitter_username,nullable"`
JSON organizationListResponseItemJSON `json:"-"`
}
// organizationListResponseItemJSON contains the JSON metadata for the struct
// [OrganizationListResponseItem]
type organizationListResponseItemJSON struct {
ID apijson.Field
CreatedAt apijson.Field
DonationsEnabled apijson.Field
FeatureSettings apijson.Field
Name apijson.Field
PledgeBadgeShowAmount apijson.Field
PledgeMinimumAmount apijson.Field
ProfileSettings apijson.Field
Slug apijson.Field
AvatarURL apijson.Field
Bio apijson.Field
Blog apijson.Field
Company apijson.Field
DefaultUpfrontSplitToContributors apijson.Field
Email apijson.Field
Location apijson.Field
ModifiedAt apijson.Field
TwitterUsername apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponseItem) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponseItemJSON) RawJSON() string {
return r.raw
}
// Settings for the organization features
type OrganizationListResponseItemsFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled bool `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled bool `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled bool `json:"subscriptions_enabled"`
JSON organizationListResponseItemsFeatureSettingsJSON `json:"-"`
}
// organizationListResponseItemsFeatureSettingsJSON contains the JSON metadata for
// the struct [OrganizationListResponseItemsFeatureSettings]
type organizationListResponseItemsFeatureSettingsJSON struct {
ArticlesEnabled apijson.Field
IssueFundingEnabled apijson.Field
SubscriptionsEnabled apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponseItemsFeatureSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponseItemsFeatureSettingsJSON) RawJSON() string {
return r.raw
}
// Settings for the organization profile
type OrganizationListResponseItemsProfileSettings struct {
// A description of the organization
Description string `json:"description,nullable"`
// A list of featured organizations
FeaturedOrganizations []string `json:"featured_organizations,nullable" format:"uuid4"`
// A list of featured projects
FeaturedProjects []string `json:"featured_projects,nullable" format:"uuid4"`
// A list of links associated with the organization
Links []string `json:"links,nullable" format:"uri"`
// Subscription promotion settings
Subscribe OrganizationListResponseItemsProfileSettingsSubscribe `json:"subscribe,nullable"`
JSON organizationListResponseItemsProfileSettingsJSON `json:"-"`
}
// organizationListResponseItemsProfileSettingsJSON contains the JSON metadata for
// the struct [OrganizationListResponseItemsProfileSettings]
type organizationListResponseItemsProfileSettingsJSON struct {
Description apijson.Field
FeaturedOrganizations apijson.Field
FeaturedProjects apijson.Field
Links apijson.Field
Subscribe apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponseItemsProfileSettings) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponseItemsProfileSettingsJSON) RawJSON() string {
return r.raw
}
// Subscription promotion settings
type OrganizationListResponseItemsProfileSettingsSubscribe struct {
// Include free subscribers in total count
CountFree bool `json:"count_free"`
// Promote email subscription (free)
Promote bool `json:"promote"`
// Show subscription count publicly
ShowCount bool `json:"show_count"`
JSON organizationListResponseItemsProfileSettingsSubscribeJSON `json:"-"`
}
// organizationListResponseItemsProfileSettingsSubscribeJSON contains the JSON
// metadata for the struct [OrganizationListResponseItemsProfileSettingsSubscribe]
type organizationListResponseItemsProfileSettingsSubscribeJSON struct {
CountFree apijson.Field
Promote apijson.Field
ShowCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationListResponseItemsProfileSettingsSubscribe) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationListResponseItemsProfileSettingsSubscribeJSON) RawJSON() string {
return r.raw
}
type OrganizationNewParams struct {
Name param.Field[string] `json:"name,required"`
Slug param.Field[string] `json:"slug,required"`
AvatarURL param.Field[string] `json:"avatar_url" format:"uri"`
DonationsEnabled param.Field[bool] `json:"donations_enabled"`
FeatureSettings param.Field[OrganizationNewParamsFeatureSettings] `json:"feature_settings"`
}
func (r OrganizationNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationNewParamsFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled param.Field[bool] `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled param.Field[bool] `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled param.Field[bool] `json:"subscriptions_enabled"`
}
func (r OrganizationNewParamsFeatureSettings) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationUpdateParams struct {
AvatarURL param.Field[string] `json:"avatar_url" format:"uri"`
BillingEmail param.Field[string] `json:"billing_email"`
DefaultBadgeCustomContent param.Field[string] `json:"default_badge_custom_content"`
DefaultUpfrontSplitToContributors param.Field[int64] `json:"default_upfront_split_to_contributors"`
DonationsEnabled param.Field[bool] `json:"donations_enabled"`
FeatureSettings param.Field[OrganizationUpdateParamsFeatureSettings] `json:"feature_settings"`
Name param.Field[string] `json:"name"`
PerUserMonthlySpendingLimit param.Field[int64] `json:"per_user_monthly_spending_limit"`
PledgeBadgeShowAmount param.Field[bool] `json:"pledge_badge_show_amount"`
PledgeMinimumAmount param.Field[int64] `json:"pledge_minimum_amount"`
ProfileSettings param.Field[OrganizationUpdateParamsProfileSettings] `json:"profile_settings"`
TotalMonthlySpendingLimit param.Field[int64] `json:"total_monthly_spending_limit"`
}
func (r OrganizationUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationUpdateParamsFeatureSettings struct {
// If this organization has articles enabled
ArticlesEnabled param.Field[bool] `json:"articles_enabled"`
// If this organization has issue funding enabled
IssueFundingEnabled param.Field[bool] `json:"issue_funding_enabled"`
// If this organization has subscriptions enabled
SubscriptionsEnabled param.Field[bool] `json:"subscriptions_enabled"`
}
func (r OrganizationUpdateParamsFeatureSettings) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationUpdateParamsProfileSettings struct {
// A description of the organization
Description param.Field[string] `json:"description"`
// A list of featured organizations
FeaturedOrganizations param.Field[[]string] `json:"featured_organizations" format:"uuid4"`
// A list of featured projects
FeaturedProjects param.Field[[]string] `json:"featured_projects" format:"uuid4"`
// A list of links associated with the organization
Links param.Field[[]string] `json:"links" format:"uri"`
// Subscription promotion settings
Subscribe param.Field[OrganizationUpdateParamsProfileSettingsSubscribe] `json:"subscribe"`
}
func (r OrganizationUpdateParamsProfileSettings) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Subscription promotion settings
type OrganizationUpdateParamsProfileSettingsSubscribe struct {
// Include free subscribers in total count
CountFree param.Field[bool] `json:"count_free"`
// Promote email subscription (free)
Promote param.Field[bool] `json:"promote"`
// Show subscription count publicly
ShowCount param.Field[bool] `json:"show_count"`
}
func (r OrganizationUpdateParamsProfileSettingsSubscribe) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationListParams struct {
// Filter by membership. If `true`, only organizations the user is a member of are
// returned. If `false`, only organizations the user is not a member of are
// returned.
IsMember param.Field[bool] `query:"is_member"`
// Size of a page, defaults to 10. Maximum is 100.
Limit param.Field[int64] `query:"limit"`
// Page number, defaults to 1.
Page param.Field[int64] `query:"page"`
// Filter by slug.
Slug param.Field[string] `query:"slug"`
// Sorting criterion. Several criteria can be used simultaneously and will be
// applied in order. Add a minus sign `-` before the criteria name to sort by
// descending order.
Sorting param.Field[[]string] `query:"sorting"`
}
// URLQuery serializes [OrganizationListParams]'s query parameters as `url.Values`.
func (r OrganizationListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}