-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.go
executable file
·660 lines (573 loc) · 23.5 KB
/
order.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package polar
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
"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"
"github.com/tidwall/gjson"
)
// OrderService 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 [NewOrderService] method instead.
type OrderService struct {
Options []option.RequestOption
Invoice *OrderInvoiceService
}
// NewOrderService 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 NewOrderService(opts ...option.RequestOption) (r *OrderService) {
r = &OrderService{}
r.Options = opts
r.Invoice = NewOrderInvoiceService(opts...)
return
}
// Get an order by ID.
func (r *OrderService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *OrderOutput, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("v1/orders/%s", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// List orders.
func (r *OrderService) List(ctx context.Context, query OrderListParams, opts ...option.RequestOption) (res *ListResourceOrder, err error) {
opts = append(r.Options[:], opts...)
path := "v1/orders/"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
type ListResourceOrder struct {
Pagination ListResourceOrderPagination `json:"pagination,required"`
Items []OrderOutput `json:"items"`
JSON listResourceOrderJSON `json:"-"`
}
// listResourceOrderJSON contains the JSON metadata for the struct
// [ListResourceOrder]
type listResourceOrderJSON struct {
Pagination apijson.Field
Items apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ListResourceOrder) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r listResourceOrderJSON) RawJSON() string {
return r.raw
}
type ListResourceOrderPagination struct {
MaxPage int64 `json:"max_page,required"`
TotalCount int64 `json:"total_count,required"`
JSON listResourceOrderPaginationJSON `json:"-"`
}
// listResourceOrderPaginationJSON contains the JSON metadata for the struct
// [ListResourceOrderPagination]
type listResourceOrderPaginationJSON struct {
MaxPage apijson.Field
TotalCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ListResourceOrderPagination) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r listResourceOrderPaginationJSON) RawJSON() string {
return r.raw
}
type OrderOutput struct {
// The ID of the object.
ID string `json:"id,required" format:"uuid4"`
Amount int64 `json:"amount,required"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Currency string `json:"currency,required"`
Product OrderOutputProduct `json:"product,required"`
ProductID string `json:"product_id,required" format:"uuid4"`
// A recurring price for a product, i.e. a subscription.
ProductPrice OrderOutputProductPrice `json:"product_price,required"`
ProductPriceID string `json:"product_price_id,required" format:"uuid4"`
TaxAmount int64 `json:"tax_amount,required"`
User OrderOutputUser `json:"user,required"`
UserID string `json:"user_id,required" format:"uuid4"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
Subscription OrderOutputSubscription `json:"subscription,nullable"`
SubscriptionID string `json:"subscription_id,nullable" format:"uuid4"`
JSON orderOutputJSON `json:"-"`
}
// orderOutputJSON contains the JSON metadata for the struct [OrderOutput]
type orderOutputJSON struct {
ID apijson.Field
Amount apijson.Field
CreatedAt apijson.Field
Currency apijson.Field
Product apijson.Field
ProductID apijson.Field
ProductPrice apijson.Field
ProductPriceID apijson.Field
TaxAmount apijson.Field
User apijson.Field
UserID apijson.Field
ModifiedAt apijson.Field
Subscription apijson.Field
SubscriptionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutput) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputJSON) RawJSON() string {
return r.raw
}
type OrderOutputProduct struct {
// The ID of the product.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Whether the product is archived and no longer available.
IsArchived bool `json:"is_archived,required"`
// Whether the product is a subscription tier.
IsRecurring bool `json:"is_recurring,required"`
// The name of the product.
Name string `json:"name,required"`
// The ID of the organization owning the product.
OrganizationID string `json:"organization_id,required" format:"uuid4"`
// The description of the product.
Description string `json:"description,nullable"`
IsHighlighted bool `json:"is_highlighted,nullable"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
Type OrderOutputProductType `json:"type,nullable"`
JSON orderOutputProductJSON `json:"-"`
}
// orderOutputProductJSON contains the JSON metadata for the struct
// [OrderOutputProduct]
type orderOutputProductJSON struct {
ID apijson.Field
CreatedAt apijson.Field
IsArchived apijson.Field
IsRecurring apijson.Field
Name apijson.Field
OrganizationID apijson.Field
Description apijson.Field
IsHighlighted apijson.Field
ModifiedAt apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutputProduct) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputProductJSON) RawJSON() string {
return r.raw
}
type OrderOutputProductType string
const (
OrderOutputProductTypeFree OrderOutputProductType = "free"
OrderOutputProductTypeIndividual OrderOutputProductType = "individual"
OrderOutputProductTypeBusiness OrderOutputProductType = "business"
)
func (r OrderOutputProductType) IsKnown() bool {
switch r {
case OrderOutputProductTypeFree, OrderOutputProductTypeIndividual, OrderOutputProductTypeBusiness:
return true
}
return false
}
// A recurring price for a product, i.e. a subscription.
type OrderOutputProductPrice struct {
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
// The ID of the price.
ID string `json:"id,required" format:"uuid4"`
// The price in cents.
PriceAmount int64 `json:"price_amount,required"`
// The currency.
PriceCurrency string `json:"price_currency,required"`
// Whether the price is archived and no longer available.
IsArchived bool `json:"is_archived,required"`
// The type of the price.
Type OrderOutputProductPriceType `json:"type,required"`
// The recurring interval of the price, if type is `recurring`.
RecurringInterval OrderOutputProductPriceRecurringInterval `json:"recurring_interval,nullable"`
JSON orderOutputProductPriceJSON `json:"-"`
union OrderOutputProductPriceUnion
}
// orderOutputProductPriceJSON contains the JSON metadata for the struct
// [OrderOutputProductPrice]
type orderOutputProductPriceJSON struct {
CreatedAt apijson.Field
ModifiedAt apijson.Field
ID apijson.Field
PriceAmount apijson.Field
PriceCurrency apijson.Field
IsArchived apijson.Field
Type apijson.Field
RecurringInterval apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r orderOutputProductPriceJSON) RawJSON() string {
return r.raw
}
func (r *OrderOutputProductPrice) UnmarshalJSON(data []byte) (err error) {
*r = OrderOutputProductPrice{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [OrderOutputProductPriceUnion] interface which you can cast to
// the specific types for more type safety.
//
// Possible runtime types of the union are
// [OrderOutputProductPriceProductPriceRecurring],
// [OrderOutputProductPriceProductPriceOneTime].
func (r OrderOutputProductPrice) AsUnion() OrderOutputProductPriceUnion {
return r.union
}
// A recurring price for a product, i.e. a subscription.
//
// Union satisfied by [OrderOutputProductPriceProductPriceRecurring] or
// [OrderOutputProductPriceProductPriceOneTime].
type OrderOutputProductPriceUnion interface {
implementsOrderOutputProductPrice()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*OrderOutputProductPriceUnion)(nil)).Elem(),
"type",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(OrderOutputProductPriceProductPriceRecurring{}),
DiscriminatorValue: "recurring",
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(OrderOutputProductPriceProductPriceOneTime{}),
DiscriminatorValue: "one_time",
},
)
}
// A recurring price for a product, i.e. a subscription.
type OrderOutputProductPriceProductPriceRecurring struct {
// The ID of the price.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Whether the price is archived and no longer available.
IsArchived bool `json:"is_archived,required"`
// The price in cents.
PriceAmount int64 `json:"price_amount,required"`
// The currency.
PriceCurrency string `json:"price_currency,required"`
// The type of the price.
Type OrderOutputProductPriceProductPriceRecurringType `json:"type,required"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
// The recurring interval of the price, if type is `recurring`.
RecurringInterval OrderOutputProductPriceProductPriceRecurringRecurringInterval `json:"recurring_interval,nullable"`
JSON orderOutputProductPriceProductPriceRecurringJSON `json:"-"`
}
// orderOutputProductPriceProductPriceRecurringJSON contains the JSON metadata for
// the struct [OrderOutputProductPriceProductPriceRecurring]
type orderOutputProductPriceProductPriceRecurringJSON struct {
ID apijson.Field
CreatedAt apijson.Field
IsArchived apijson.Field
PriceAmount apijson.Field
PriceCurrency apijson.Field
Type apijson.Field
ModifiedAt apijson.Field
RecurringInterval apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutputProductPriceProductPriceRecurring) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputProductPriceProductPriceRecurringJSON) RawJSON() string {
return r.raw
}
func (r OrderOutputProductPriceProductPriceRecurring) implementsOrderOutputProductPrice() {}
// The type of the price.
type OrderOutputProductPriceProductPriceRecurringType string
const (
OrderOutputProductPriceProductPriceRecurringTypeRecurring OrderOutputProductPriceProductPriceRecurringType = "recurring"
)
func (r OrderOutputProductPriceProductPriceRecurringType) IsKnown() bool {
switch r {
case OrderOutputProductPriceProductPriceRecurringTypeRecurring:
return true
}
return false
}
// The recurring interval of the price, if type is `recurring`.
type OrderOutputProductPriceProductPriceRecurringRecurringInterval string
const (
OrderOutputProductPriceProductPriceRecurringRecurringIntervalMonth OrderOutputProductPriceProductPriceRecurringRecurringInterval = "month"
OrderOutputProductPriceProductPriceRecurringRecurringIntervalYear OrderOutputProductPriceProductPriceRecurringRecurringInterval = "year"
)
func (r OrderOutputProductPriceProductPriceRecurringRecurringInterval) IsKnown() bool {
switch r {
case OrderOutputProductPriceProductPriceRecurringRecurringIntervalMonth, OrderOutputProductPriceProductPriceRecurringRecurringIntervalYear:
return true
}
return false
}
// A one-time price for a product.
type OrderOutputProductPriceProductPriceOneTime struct {
// The ID of the price.
ID string `json:"id,required" format:"uuid4"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Whether the price is archived and no longer available.
IsArchived bool `json:"is_archived,required"`
// The price in cents.
PriceAmount int64 `json:"price_amount,required"`
// The currency.
PriceCurrency string `json:"price_currency,required"`
// The type of the price.
Type OrderOutputProductPriceProductPriceOneTimeType `json:"type,required"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
JSON orderOutputProductPriceProductPriceOneTimeJSON `json:"-"`
}
// orderOutputProductPriceProductPriceOneTimeJSON contains the JSON metadata for
// the struct [OrderOutputProductPriceProductPriceOneTime]
type orderOutputProductPriceProductPriceOneTimeJSON struct {
ID apijson.Field
CreatedAt apijson.Field
IsArchived apijson.Field
PriceAmount apijson.Field
PriceCurrency apijson.Field
Type apijson.Field
ModifiedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutputProductPriceProductPriceOneTime) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputProductPriceProductPriceOneTimeJSON) RawJSON() string {
return r.raw
}
func (r OrderOutputProductPriceProductPriceOneTime) implementsOrderOutputProductPrice() {}
// The type of the price.
type OrderOutputProductPriceProductPriceOneTimeType string
const (
OrderOutputProductPriceProductPriceOneTimeTypeOneTime OrderOutputProductPriceProductPriceOneTimeType = "one_time"
)
func (r OrderOutputProductPriceProductPriceOneTimeType) IsKnown() bool {
switch r {
case OrderOutputProductPriceProductPriceOneTimeTypeOneTime:
return true
}
return false
}
// The type of the price.
type OrderOutputProductPriceType string
const (
OrderOutputProductPriceTypeRecurring OrderOutputProductPriceType = "recurring"
OrderOutputProductPriceTypeOneTime OrderOutputProductPriceType = "one_time"
)
func (r OrderOutputProductPriceType) IsKnown() bool {
switch r {
case OrderOutputProductPriceTypeRecurring, OrderOutputProductPriceTypeOneTime:
return true
}
return false
}
// The recurring interval of the price, if type is `recurring`.
type OrderOutputProductPriceRecurringInterval string
const (
OrderOutputProductPriceRecurringIntervalMonth OrderOutputProductPriceRecurringInterval = "month"
OrderOutputProductPriceRecurringIntervalYear OrderOutputProductPriceRecurringInterval = "year"
)
func (r OrderOutputProductPriceRecurringInterval) IsKnown() bool {
switch r {
case OrderOutputProductPriceRecurringIntervalMonth, OrderOutputProductPriceRecurringIntervalYear:
return true
}
return false
}
type OrderOutputUser struct {
ID string `json:"id,required" format:"uuid4"`
Email string `json:"email,required"`
PublicName string `json:"public_name,required"`
AvatarURL string `json:"avatar_url,nullable"`
GitHubUsername string `json:"github_username,nullable"`
JSON orderOutputUserJSON `json:"-"`
}
// orderOutputUserJSON contains the JSON metadata for the struct [OrderOutputUser]
type orderOutputUserJSON struct {
ID apijson.Field
Email apijson.Field
PublicName apijson.Field
AvatarURL apijson.Field
GitHubUsername apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutputUser) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputUserJSON) RawJSON() string {
return r.raw
}
type OrderOutputSubscription struct {
// The ID of the object.
ID string `json:"id,required" format:"uuid4"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end,required"`
// Creation timestamp of the object.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
CurrentPeriodStart time.Time `json:"current_period_start,required" format:"date-time"`
ProductID string `json:"product_id,required" format:"uuid4"`
Status OrderOutputSubscriptionStatus `json:"status,required"`
UserID string `json:"user_id,required" format:"uuid4"`
CurrentPeriodEnd time.Time `json:"current_period_end,nullable" format:"date-time"`
EndedAt time.Time `json:"ended_at,nullable" format:"date-time"`
// Last modification timestamp of the object.
ModifiedAt time.Time `json:"modified_at,nullable" format:"date-time"`
PriceID string `json:"price_id,nullable" format:"uuid4"`
StartedAt time.Time `json:"started_at,nullable" format:"date-time"`
JSON orderOutputSubscriptionJSON `json:"-"`
}
// orderOutputSubscriptionJSON contains the JSON metadata for the struct
// [OrderOutputSubscription]
type orderOutputSubscriptionJSON struct {
ID apijson.Field
CancelAtPeriodEnd apijson.Field
CreatedAt apijson.Field
CurrentPeriodStart apijson.Field
ProductID apijson.Field
Status apijson.Field
UserID apijson.Field
CurrentPeriodEnd apijson.Field
EndedAt apijson.Field
ModifiedAt apijson.Field
PriceID apijson.Field
StartedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrderOutputSubscription) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r orderOutputSubscriptionJSON) RawJSON() string {
return r.raw
}
type OrderOutputSubscriptionStatus string
const (
OrderOutputSubscriptionStatusIncomplete OrderOutputSubscriptionStatus = "incomplete"
OrderOutputSubscriptionStatusIncompleteExpired OrderOutputSubscriptionStatus = "incomplete_expired"
OrderOutputSubscriptionStatusTrialing OrderOutputSubscriptionStatus = "trialing"
OrderOutputSubscriptionStatusActive OrderOutputSubscriptionStatus = "active"
OrderOutputSubscriptionStatusPastDue OrderOutputSubscriptionStatus = "past_due"
OrderOutputSubscriptionStatusCanceled OrderOutputSubscriptionStatus = "canceled"
OrderOutputSubscriptionStatusUnpaid OrderOutputSubscriptionStatus = "unpaid"
)
func (r OrderOutputSubscriptionStatus) IsKnown() bool {
switch r {
case OrderOutputSubscriptionStatusIncomplete, OrderOutputSubscriptionStatusIncompleteExpired, OrderOutputSubscriptionStatusTrialing, OrderOutputSubscriptionStatusActive, OrderOutputSubscriptionStatusPastDue, OrderOutputSubscriptionStatusCanceled, OrderOutputSubscriptionStatusUnpaid:
return true
}
return false
}
type OrderListParams struct {
// Size of a page, defaults to 10. Maximum is 100.
Limit param.Field[int64] `query:"limit"`
// Filter by organization ID.
OrganizationID param.Field[OrderListParamsOrganizationIDUnion] `query:"organization_id" format:"uuid4"`
// Page number, defaults to 1.
Page param.Field[int64] `query:"page"`
// Filter by product ID.
ProductID param.Field[OrderListParamsProductIDUnion] `query:"product_id" format:"uuid4"`
// Filter by product price type. `recurring` will return orders corresponding to
// subscriptions creations or renewals. `one_time` will return orders corresponding
// to one-time purchases.
ProductPriceType param.Field[OrderListParamsProductPriceTypeUnion] `query:"product_price_type"`
// 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"`
// Filter by customer's user ID.
UserID param.Field[OrderListParamsUserIDUnion] `query:"user_id" format:"uuid4"`
}
// URLQuery serializes [OrderListParams]'s query parameters as `url.Values`.
func (r OrderListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
// Filter by organization ID.
//
// Satisfied by [shared.UnionString], [OrderListParamsOrganizationIDArray].
type OrderListParamsOrganizationIDUnion interface {
ImplementsOrderListParamsOrganizationIDUnion()
}
type OrderListParamsOrganizationIDArray []string
func (r OrderListParamsOrganizationIDArray) ImplementsOrderListParamsOrganizationIDUnion() {}
// Filter by product ID.
//
// Satisfied by [shared.UnionString], [OrderListParamsProductIDArray].
type OrderListParamsProductIDUnion interface {
ImplementsOrderListParamsProductIDUnion()
}
type OrderListParamsProductIDArray []string
func (r OrderListParamsProductIDArray) ImplementsOrderListParamsProductIDUnion() {}
// Filter by product price type. `recurring` will return orders corresponding to
// subscriptions creations or renewals. `one_time` will return orders corresponding
// to one-time purchases.
//
// Satisfied by [OrderListParamsProductPriceTypeProductPriceType],
// [OrderListParamsProductPriceTypeArray].
type OrderListParamsProductPriceTypeUnion interface {
implementsOrderListParamsProductPriceTypeUnion()
}
type OrderListParamsProductPriceTypeProductPriceType string
const (
OrderListParamsProductPriceTypeProductPriceTypeOneTime OrderListParamsProductPriceTypeProductPriceType = "one_time"
OrderListParamsProductPriceTypeProductPriceTypeRecurring OrderListParamsProductPriceTypeProductPriceType = "recurring"
)
func (r OrderListParamsProductPriceTypeProductPriceType) IsKnown() bool {
switch r {
case OrderListParamsProductPriceTypeProductPriceTypeOneTime, OrderListParamsProductPriceTypeProductPriceTypeRecurring:
return true
}
return false
}
func (r OrderListParamsProductPriceTypeProductPriceType) implementsOrderListParamsProductPriceTypeUnion() {
}
type OrderListParamsProductPriceTypeArray []OrderListParamsProductPriceTypeArray
func (r OrderListParamsProductPriceTypeArray) implementsOrderListParamsProductPriceTypeUnion() {}
// Filter by customer's user ID.
//
// Satisfied by [shared.UnionString], [OrderListParamsUserIDArray].
type OrderListParamsUserIDUnion interface {
ImplementsOrderListParamsUserIDUnion()
}
type OrderListParamsUserIDArray []string
func (r OrderListParamsUserIDArray) ImplementsOrderListParamsUserIDUnion() {}