-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontractratecard.go
585 lines (503 loc) · 24.8 KB
/
contractratecard.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package metronome
import (
"context"
"net/http"
"net/url"
"time"
"github.com/Metronome-Industries/metronome-go/internal/apijson"
"github.com/Metronome-Industries/metronome-go/internal/apiquery"
"github.com/Metronome-Industries/metronome-go/internal/param"
"github.com/Metronome-Industries/metronome-go/internal/requestconfig"
"github.com/Metronome-Industries/metronome-go/option"
"github.com/Metronome-Industries/metronome-go/packages/pagination"
"github.com/Metronome-Industries/metronome-go/shared"
)
// ContractRateCardService contains methods and other services that help with
// interacting with the metronome 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 [NewContractRateCardService] method instead.
type ContractRateCardService struct {
Options []option.RequestOption
ProductOrders *ContractRateCardProductOrderService
Rates *ContractRateCardRateService
NamedSchedules *ContractRateCardNamedScheduleService
}
// NewContractRateCardService 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 NewContractRateCardService(opts ...option.RequestOption) (r *ContractRateCardService) {
r = &ContractRateCardService{}
r.Options = opts
r.ProductOrders = NewContractRateCardProductOrderService(opts...)
r.Rates = NewContractRateCardRateService(opts...)
r.NamedSchedules = NewContractRateCardNamedScheduleService(opts...)
return
}
// Create a new rate card
func (r *ContractRateCardService) New(ctx context.Context, body ContractRateCardNewParams, opts ...option.RequestOption) (res *ContractRateCardNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "contract-pricing/rate-cards/create"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get a specific rate card NOTE: Use `/contract-pricing/rate-cards/getRates` to
// retrieve rate card rates.
func (r *ContractRateCardService) Get(ctx context.Context, body ContractRateCardGetParams, opts ...option.RequestOption) (res *ContractRateCardGetResponse, err error) {
opts = append(r.Options[:], opts...)
path := "contract-pricing/rate-cards/get"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Update a rate card
func (r *ContractRateCardService) Update(ctx context.Context, body ContractRateCardUpdateParams, opts ...option.RequestOption) (res *ContractRateCardUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
path := "contract-pricing/rate-cards/update"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// List rate cards NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve
// rate card rates.
func (r *ContractRateCardService) List(ctx context.Context, params ContractRateCardListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ContractRateCardListResponse], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "contract-pricing/rate-cards/list"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// List rate cards NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve
// rate card rates.
func (r *ContractRateCardService) ListAutoPaging(ctx context.Context, params ContractRateCardListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[ContractRateCardListResponse] {
return pagination.NewCursorPageAutoPager(r.List(ctx, params, opts...))
}
// Get all rates for a rate card from starting_at (either in perpetuity or until
// ending_before, if provided)
func (r *ContractRateCardService) GetRateSchedule(ctx context.Context, params ContractRateCardGetRateScheduleParams, opts ...option.RequestOption) (res *ContractRateCardGetRateScheduleResponse, err error) {
opts = append(r.Options[:], opts...)
path := "contract-pricing/rate-cards/getRateSchedule"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
}
type ContractRateCardNewResponse struct {
Data shared.ID `json:"data,required"`
JSON contractRateCardNewResponseJSON `json:"-"`
}
// contractRateCardNewResponseJSON contains the JSON metadata for the struct
// [ContractRateCardNewResponse]
type contractRateCardNewResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardNewResponseJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetResponse struct {
Data ContractRateCardGetResponseData `json:"data,required"`
JSON contractRateCardGetResponseJSON `json:"-"`
}
// contractRateCardGetResponseJSON contains the JSON metadata for the struct
// [ContractRateCardGetResponse]
type contractRateCardGetResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetResponseJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetResponseData struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
CreatedBy string `json:"created_by,required"`
Name string `json:"name,required"`
Aliases []ContractRateCardGetResponseDataAlias `json:"aliases"`
CreditTypeConversions []ContractRateCardGetResponseDataCreditTypeConversion `json:"credit_type_conversions"`
CustomFields map[string]string `json:"custom_fields"`
Description string `json:"description"`
FiatCreditType shared.CreditTypeData `json:"fiat_credit_type"`
JSON contractRateCardGetResponseDataJSON `json:"-"`
}
// contractRateCardGetResponseDataJSON contains the JSON metadata for the struct
// [ContractRateCardGetResponseData]
type contractRateCardGetResponseDataJSON struct {
ID apijson.Field
CreatedAt apijson.Field
CreatedBy apijson.Field
Name apijson.Field
Aliases apijson.Field
CreditTypeConversions apijson.Field
CustomFields apijson.Field
Description apijson.Field
FiatCreditType apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetResponseData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetResponseDataJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetResponseDataAlias struct {
Name string `json:"name,required"`
EndingBefore time.Time `json:"ending_before" format:"date-time"`
StartingAt time.Time `json:"starting_at" format:"date-time"`
JSON contractRateCardGetResponseDataAliasJSON `json:"-"`
}
// contractRateCardGetResponseDataAliasJSON contains the JSON metadata for the
// struct [ContractRateCardGetResponseDataAlias]
type contractRateCardGetResponseDataAliasJSON struct {
Name apijson.Field
EndingBefore apijson.Field
StartingAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetResponseDataAlias) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetResponseDataAliasJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetResponseDataCreditTypeConversion struct {
CustomCreditType shared.CreditTypeData `json:"custom_credit_type,required"`
FiatPerCustomCredit string `json:"fiat_per_custom_credit,required"`
JSON contractRateCardGetResponseDataCreditTypeConversionJSON `json:"-"`
}
// contractRateCardGetResponseDataCreditTypeConversionJSON contains the JSON
// metadata for the struct [ContractRateCardGetResponseDataCreditTypeConversion]
type contractRateCardGetResponseDataCreditTypeConversionJSON struct {
CustomCreditType apijson.Field
FiatPerCustomCredit apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetResponseDataCreditTypeConversion) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetResponseDataCreditTypeConversionJSON) RawJSON() string {
return r.raw
}
type ContractRateCardUpdateResponse struct {
Data shared.ID `json:"data,required"`
JSON contractRateCardUpdateResponseJSON `json:"-"`
}
// contractRateCardUpdateResponseJSON contains the JSON metadata for the struct
// [ContractRateCardUpdateResponse]
type contractRateCardUpdateResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardUpdateResponseJSON) RawJSON() string {
return r.raw
}
type ContractRateCardListResponse struct {
ID string `json:"id,required" format:"uuid"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
CreatedBy string `json:"created_by,required"`
Name string `json:"name,required"`
Aliases []ContractRateCardListResponseAlias `json:"aliases"`
CreditTypeConversions []ContractRateCardListResponseCreditTypeConversion `json:"credit_type_conversions"`
CustomFields map[string]string `json:"custom_fields"`
Description string `json:"description"`
FiatCreditType shared.CreditTypeData `json:"fiat_credit_type"`
JSON contractRateCardListResponseJSON `json:"-"`
}
// contractRateCardListResponseJSON contains the JSON metadata for the struct
// [ContractRateCardListResponse]
type contractRateCardListResponseJSON struct {
ID apijson.Field
CreatedAt apijson.Field
CreatedBy apijson.Field
Name apijson.Field
Aliases apijson.Field
CreditTypeConversions apijson.Field
CustomFields apijson.Field
Description apijson.Field
FiatCreditType apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardListResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardListResponseJSON) RawJSON() string {
return r.raw
}
type ContractRateCardListResponseAlias struct {
Name string `json:"name,required"`
EndingBefore time.Time `json:"ending_before" format:"date-time"`
StartingAt time.Time `json:"starting_at" format:"date-time"`
JSON contractRateCardListResponseAliasJSON `json:"-"`
}
// contractRateCardListResponseAliasJSON contains the JSON metadata for the struct
// [ContractRateCardListResponseAlias]
type contractRateCardListResponseAliasJSON struct {
Name apijson.Field
EndingBefore apijson.Field
StartingAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardListResponseAlias) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardListResponseAliasJSON) RawJSON() string {
return r.raw
}
type ContractRateCardListResponseCreditTypeConversion struct {
CustomCreditType shared.CreditTypeData `json:"custom_credit_type,required"`
FiatPerCustomCredit string `json:"fiat_per_custom_credit,required"`
JSON contractRateCardListResponseCreditTypeConversionJSON `json:"-"`
}
// contractRateCardListResponseCreditTypeConversionJSON contains the JSON metadata
// for the struct [ContractRateCardListResponseCreditTypeConversion]
type contractRateCardListResponseCreditTypeConversionJSON struct {
CustomCreditType apijson.Field
FiatPerCustomCredit apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardListResponseCreditTypeConversion) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardListResponseCreditTypeConversionJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetRateScheduleResponse struct {
Data []ContractRateCardGetRateScheduleResponseData `json:"data,required"`
NextPage string `json:"next_page,nullable"`
JSON contractRateCardGetRateScheduleResponseJSON `json:"-"`
}
// contractRateCardGetRateScheduleResponseJSON contains the JSON metadata for the
// struct [ContractRateCardGetRateScheduleResponse]
type contractRateCardGetRateScheduleResponseJSON struct {
Data apijson.Field
NextPage apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetRateScheduleResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetRateScheduleResponseJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetRateScheduleResponseData struct {
Entitled bool `json:"entitled,required"`
ProductCustomFields map[string]string `json:"product_custom_fields,required"`
ProductID string `json:"product_id,required" format:"uuid"`
ProductName string `json:"product_name,required"`
ProductTags []string `json:"product_tags,required"`
Rate shared.Rate `json:"rate,required"`
StartingAt time.Time `json:"starting_at,required" format:"date-time"`
// A distinct rate on the rate card. You can choose to use this rate rather than
// list rate when consuming a credit or commit.
CommitRate ContractRateCardGetRateScheduleResponseDataCommitRate `json:"commit_rate"`
EndingBefore time.Time `json:"ending_before" format:"date-time"`
PricingGroupValues map[string]string `json:"pricing_group_values"`
JSON contractRateCardGetRateScheduleResponseDataJSON `json:"-"`
}
// contractRateCardGetRateScheduleResponseDataJSON contains the JSON metadata for
// the struct [ContractRateCardGetRateScheduleResponseData]
type contractRateCardGetRateScheduleResponseDataJSON struct {
Entitled apijson.Field
ProductCustomFields apijson.Field
ProductID apijson.Field
ProductName apijson.Field
ProductTags apijson.Field
Rate apijson.Field
StartingAt apijson.Field
CommitRate apijson.Field
EndingBefore apijson.Field
PricingGroupValues apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetRateScheduleResponseData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetRateScheduleResponseDataJSON) RawJSON() string {
return r.raw
}
// A distinct rate on the rate card. You can choose to use this rate rather than
// list rate when consuming a credit or commit.
type ContractRateCardGetRateScheduleResponseDataCommitRate struct {
RateType ContractRateCardGetRateScheduleResponseDataCommitRateRateType `json:"rate_type,required"`
// Commit rate price. For FLAT rate_type, this must be >=0.
Price float64 `json:"price"`
// Only set for TIERED rate_type.
Tiers []shared.Tier `json:"tiers"`
JSON contractRateCardGetRateScheduleResponseDataCommitRateJSON `json:"-"`
}
// contractRateCardGetRateScheduleResponseDataCommitRateJSON contains the JSON
// metadata for the struct [ContractRateCardGetRateScheduleResponseDataCommitRate]
type contractRateCardGetRateScheduleResponseDataCommitRateJSON struct {
RateType apijson.Field
Price apijson.Field
Tiers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ContractRateCardGetRateScheduleResponseDataCommitRate) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r contractRateCardGetRateScheduleResponseDataCommitRateJSON) RawJSON() string {
return r.raw
}
type ContractRateCardGetRateScheduleResponseDataCommitRateRateType string
const (
ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeFlat ContractRateCardGetRateScheduleResponseDataCommitRateRateType = "FLAT"
ContractRateCardGetRateScheduleResponseDataCommitRateRateTypePercentage ContractRateCardGetRateScheduleResponseDataCommitRateRateType = "PERCENTAGE"
ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeSubscription ContractRateCardGetRateScheduleResponseDataCommitRateRateType = "SUBSCRIPTION"
ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeTiered ContractRateCardGetRateScheduleResponseDataCommitRateRateType = "TIERED"
ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeCustom ContractRateCardGetRateScheduleResponseDataCommitRateRateType = "CUSTOM"
)
func (r ContractRateCardGetRateScheduleResponseDataCommitRateRateType) IsKnown() bool {
switch r {
case ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeFlat, ContractRateCardGetRateScheduleResponseDataCommitRateRateTypePercentage, ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeSubscription, ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeTiered, ContractRateCardGetRateScheduleResponseDataCommitRateRateTypeCustom:
return true
}
return false
}
type ContractRateCardNewParams struct {
// Used only in UI/API. It is not exposed to end customers.
Name param.Field[string] `json:"name,required"`
// Reference this alias when creating a contract. If the same alias is assigned to
// multiple rate cards, it will reference the rate card to which it was most
// recently assigned. It is not exposed to end customers.
Aliases param.Field[[]ContractRateCardNewParamsAlias] `json:"aliases"`
// Required when using custom pricing units in rates.
CreditTypeConversions param.Field[[]ContractRateCardNewParamsCreditTypeConversion] `json:"credit_type_conversions"`
CustomFields param.Field[map[string]string] `json:"custom_fields"`
Description param.Field[string] `json:"description"`
// The Metronome ID of the credit type to associate with the rate card, defaults to
// USD (cents) if not passed.
FiatCreditTypeID param.Field[string] `json:"fiat_credit_type_id" format:"uuid"`
}
func (r ContractRateCardNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ContractRateCardNewParamsAlias struct {
Name param.Field[string] `json:"name,required"`
EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
StartingAt param.Field[time.Time] `json:"starting_at" format:"date-time"`
}
func (r ContractRateCardNewParamsAlias) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ContractRateCardNewParamsCreditTypeConversion struct {
CustomCreditTypeID param.Field[string] `json:"custom_credit_type_id,required" format:"uuid"`
FiatPerCustomCredit param.Field[float64] `json:"fiat_per_custom_credit,required"`
}
func (r ContractRateCardNewParamsCreditTypeConversion) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ContractRateCardGetParams struct {
ID shared.IDParam `json:"id,required"`
}
func (r ContractRateCardGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.ID)
}
type ContractRateCardUpdateParams struct {
// ID of the rate card to update
RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
// Reference this alias when creating a contract. If the same alias is assigned to
// multiple rate cards, it will reference the rate card to which it was most
// recently assigned. It is not exposed to end customers.
Aliases param.Field[[]ContractRateCardUpdateParamsAlias] `json:"aliases"`
Description param.Field[string] `json:"description"`
// Used only in UI/API. It is not exposed to end customers.
Name param.Field[string] `json:"name"`
}
func (r ContractRateCardUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ContractRateCardUpdateParamsAlias struct {
Name param.Field[string] `json:"name,required"`
EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
StartingAt param.Field[time.Time] `json:"starting_at" format:"date-time"`
}
func (r ContractRateCardUpdateParamsAlias) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type ContractRateCardListParams struct {
Body interface{} `json:"body,required"`
// Max number of results that should be returned
Limit param.Field[int64] `query:"limit"`
// Cursor that indicates where the next page of results should start.
NextPage param.Field[string] `query:"next_page"`
}
func (r ContractRateCardListParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
}
// URLQuery serializes [ContractRateCardListParams]'s query parameters as
// `url.Values`.
func (r ContractRateCardListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type ContractRateCardGetRateScheduleParams struct {
// ID of the rate card to get the schedule for
RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
// inclusive starting point for the rates schedule
StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
// Max number of results that should be returned
Limit param.Field[int64] `query:"limit"`
// Cursor that indicates where the next page of results should start.
NextPage param.Field[string] `query:"next_page"`
// optional exclusive end date for the rates schedule. When not specified rates
// will show all future schedule segments.
EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
// List of rate selectors, rates matching ANY of the selector will be included in
// the response Passing no selectors will result in all rates being returned.
Selectors param.Field[[]ContractRateCardGetRateScheduleParamsSelector] `json:"selectors"`
}
func (r ContractRateCardGetRateScheduleParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// URLQuery serializes [ContractRateCardGetRateScheduleParams]'s query parameters
// as `url.Values`.
func (r ContractRateCardGetRateScheduleParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type ContractRateCardGetRateScheduleParamsSelector struct {
// List of pricing group key value pairs, rates containing the matching key / value
// pairs will be included in the response.
PartialPricingGroupValues param.Field[map[string]string] `json:"partial_pricing_group_values"`
// List of pricing group key value pairs, rates matching all of the key / value
// pairs will be included in the response.
PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
// Rates matching the product id will be included in the response.
ProductID param.Field[string] `json:"product_id" format:"uuid"`
}
func (r ContractRateCardGetRateScheduleParamsSelector) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}