-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventsubscription.go
470 lines (422 loc) · 32.6 KB
/
eventsubscription.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package lithic
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/lithic-com/lithic-go/internal/apijson"
"github.com/lithic-com/lithic-go/internal/apiquery"
"github.com/lithic-com/lithic-go/internal/pagination"
"github.com/lithic-com/lithic-go/internal/param"
"github.com/lithic-com/lithic-go/internal/requestconfig"
"github.com/lithic-com/lithic-go/option"
)
// EventSubscriptionService contains methods and other services that help with
// interacting with the lithic 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 [NewEventSubscriptionService] method instead.
type EventSubscriptionService struct {
Options []option.RequestOption
}
// NewEventSubscriptionService 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 NewEventSubscriptionService(opts ...option.RequestOption) (r *EventSubscriptionService) {
r = &EventSubscriptionService{}
r.Options = opts
return
}
// Create a new event subscription.
func (r *EventSubscriptionService) New(ctx context.Context, body EventSubscriptionNewParams, opts ...option.RequestOption) (res *EventSubscription, err error) {
opts = append(r.Options[:], opts...)
path := "event_subscriptions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Get an event subscription.
func (r *EventSubscriptionService) Get(ctx context.Context, eventSubscriptionToken string, opts ...option.RequestOption) (res *EventSubscription, err error) {
opts = append(r.Options[:], opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update an event subscription.
func (r *EventSubscriptionService) Update(ctx context.Context, eventSubscriptionToken string, body EventSubscriptionUpdateParams, opts ...option.RequestOption) (res *EventSubscription, err error) {
opts = append(r.Options[:], opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
return
}
// List all the event subscriptions.
func (r *EventSubscriptionService) List(ctx context.Context, query EventSubscriptionListParams, opts ...option.RequestOption) (res *pagination.CursorPage[EventSubscription], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "event_subscriptions"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &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 all the event subscriptions.
func (r *EventSubscriptionService) ListAutoPaging(ctx context.Context, query EventSubscriptionListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[EventSubscription] {
return pagination.NewCursorPageAutoPager(r.List(ctx, query, opts...))
}
// Delete an event subscription.
func (r *EventSubscriptionService) Delete(ctx context.Context, eventSubscriptionToken string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
// List all the message attempts for a given event subscription.
func (r *EventSubscriptionService) ListAttempts(ctx context.Context, eventSubscriptionToken string, query EventSubscriptionListAttemptsParams, opts ...option.RequestOption) (res *pagination.CursorPage[MessageAttempt], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := fmt.Sprintf("event_subscriptions/%s/attempts", eventSubscriptionToken)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &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 all the message attempts for a given event subscription.
func (r *EventSubscriptionService) ListAttemptsAutoPaging(ctx context.Context, eventSubscriptionToken string, query EventSubscriptionListAttemptsParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[MessageAttempt] {
return pagination.NewCursorPageAutoPager(r.ListAttempts(ctx, eventSubscriptionToken, query, opts...))
}
// Resend all failed messages since a given time.
func (r *EventSubscriptionService) Recover(ctx context.Context, eventSubscriptionToken string, body EventSubscriptionRecoverParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s/recover", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return
}
// Replays messages to the endpoint. Only messages that were created after `begin`
// will be sent. Messages that were previously sent to the endpoint are not resent.
// Message will be retried if endpoint responds with a non-2xx status code. See
// [Retry Schedule](https://docs.lithic.com/docs/events-api#retry-schedule) for
// details.
func (r *EventSubscriptionService) ReplayMissing(ctx context.Context, eventSubscriptionToken string, body EventSubscriptionReplayMissingParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s/replay_missing", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return
}
// Get the secret for an event subscription.
func (r *EventSubscriptionService) GetSecret(ctx context.Context, eventSubscriptionToken string, opts ...option.RequestOption) (res *EventSubscriptionGetSecretResponse, err error) {
opts = append(r.Options[:], opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s/secret", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Rotate the secret for an event subscription. The previous secret will be valid
// for the next 24 hours.
func (r *EventSubscriptionService) RotateSecret(ctx context.Context, eventSubscriptionToken string, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("event_subscriptions/%s/secret/rotate", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, nil, opts...)
return
}
// Send an example message for event.
func (r *EventSubscriptionService) SendSimulatedExample(ctx context.Context, eventSubscriptionToken string, body EventSubscriptionSendSimulatedExampleParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if eventSubscriptionToken == "" {
err = errors.New("missing required event_subscription_token parameter")
return
}
path := fmt.Sprintf("simulate/event_subscriptions/%s/send_example", eventSubscriptionToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return
}
type EventSubscriptionGetSecretResponse struct {
// The secret for the event subscription.
Secret string `json:"secret"`
JSON eventSubscriptionGetSecretResponseJSON `json:"-"`
}
// eventSubscriptionGetSecretResponseJSON contains the JSON metadata for the struct
// [EventSubscriptionGetSecretResponse]
type eventSubscriptionGetSecretResponseJSON struct {
Secret apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *EventSubscriptionGetSecretResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r eventSubscriptionGetSecretResponseJSON) RawJSON() string {
return r.raw
}
type EventSubscriptionNewParams struct {
// URL to which event webhooks will be sent. URL must be a valid HTTPS address.
URL param.Field[string] `json:"url,required" format:"uri"`
// Event subscription description.
Description param.Field[string] `json:"description"`
// Whether the event subscription is active (false) or inactive (true).
Disabled param.Field[bool] `json:"disabled"`
// Indicates types of events that will be sent to this subscription. If left blank,
// all types will be sent.
EventTypes param.Field[[]EventSubscriptionNewParamsEventType] `json:"event_types"`
}
func (r EventSubscriptionNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type EventSubscriptionNewParamsEventType string
const (
EventSubscriptionNewParamsEventTypeAccountHolderCreated EventSubscriptionNewParamsEventType = "account_holder.created"
EventSubscriptionNewParamsEventTypeAccountHolderUpdated EventSubscriptionNewParamsEventType = "account_holder.updated"
EventSubscriptionNewParamsEventTypeAccountHolderVerification EventSubscriptionNewParamsEventType = "account_holder.verification"
EventSubscriptionNewParamsEventTypeBalanceUpdated EventSubscriptionNewParamsEventType = "balance.updated"
EventSubscriptionNewParamsEventTypeCardCreated EventSubscriptionNewParamsEventType = "card.created"
EventSubscriptionNewParamsEventTypeCardRenewed EventSubscriptionNewParamsEventType = "card.renewed"
EventSubscriptionNewParamsEventTypeCardShipped EventSubscriptionNewParamsEventType = "card.shipped"
EventSubscriptionNewParamsEventTypeCardTransactionUpdated EventSubscriptionNewParamsEventType = "card_transaction.updated"
EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationApprovalRequest EventSubscriptionNewParamsEventType = "digital_wallet.tokenization_approval_request"
EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationResult EventSubscriptionNewParamsEventType = "digital_wallet.tokenization_result"
EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode EventSubscriptionNewParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code"
EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent EventSubscriptionNewParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code_sent"
EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationUpdated EventSubscriptionNewParamsEventType = "digital_wallet.tokenization_updated"
EventSubscriptionNewParamsEventTypeDisputeUpdated EventSubscriptionNewParamsEventType = "dispute.updated"
EventSubscriptionNewParamsEventTypeDisputeEvidenceUploadFailed EventSubscriptionNewParamsEventType = "dispute_evidence.upload_failed"
EventSubscriptionNewParamsEventTypeExternalBankAccountCreated EventSubscriptionNewParamsEventType = "external_bank_account.created"
EventSubscriptionNewParamsEventTypeExternalBankAccountUpdated EventSubscriptionNewParamsEventType = "external_bank_account.updated"
EventSubscriptionNewParamsEventTypeFinancialAccountCreated EventSubscriptionNewParamsEventType = "financial_account.created"
EventSubscriptionNewParamsEventTypePaymentTransactionCreated EventSubscriptionNewParamsEventType = "payment_transaction.created"
EventSubscriptionNewParamsEventTypePaymentTransactionUpdated EventSubscriptionNewParamsEventType = "payment_transaction.updated"
EventSubscriptionNewParamsEventTypeSettlementReportUpdated EventSubscriptionNewParamsEventType = "settlement_report.updated"
EventSubscriptionNewParamsEventTypeThreeDSAuthenticationCreated EventSubscriptionNewParamsEventType = "three_ds_authentication.created"
EventSubscriptionNewParamsEventTypeTransferTransactionCreated EventSubscriptionNewParamsEventType = "transfer_transaction.created"
)
func (r EventSubscriptionNewParamsEventType) IsKnown() bool {
switch r {
case EventSubscriptionNewParamsEventTypeAccountHolderCreated, EventSubscriptionNewParamsEventTypeAccountHolderUpdated, EventSubscriptionNewParamsEventTypeAccountHolderVerification, EventSubscriptionNewParamsEventTypeBalanceUpdated, EventSubscriptionNewParamsEventTypeCardCreated, EventSubscriptionNewParamsEventTypeCardRenewed, EventSubscriptionNewParamsEventTypeCardShipped, EventSubscriptionNewParamsEventTypeCardTransactionUpdated, EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationApprovalRequest, EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationResult, EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode, EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent, EventSubscriptionNewParamsEventTypeDigitalWalletTokenizationUpdated, EventSubscriptionNewParamsEventTypeDisputeUpdated, EventSubscriptionNewParamsEventTypeDisputeEvidenceUploadFailed, EventSubscriptionNewParamsEventTypeExternalBankAccountCreated, EventSubscriptionNewParamsEventTypeExternalBankAccountUpdated, EventSubscriptionNewParamsEventTypeFinancialAccountCreated, EventSubscriptionNewParamsEventTypePaymentTransactionCreated, EventSubscriptionNewParamsEventTypePaymentTransactionUpdated, EventSubscriptionNewParamsEventTypeSettlementReportUpdated, EventSubscriptionNewParamsEventTypeThreeDSAuthenticationCreated, EventSubscriptionNewParamsEventTypeTransferTransactionCreated:
return true
}
return false
}
type EventSubscriptionUpdateParams struct {
// URL to which event webhooks will be sent. URL must be a valid HTTPS address.
URL param.Field[string] `json:"url,required" format:"uri"`
// Event subscription description.
Description param.Field[string] `json:"description"`
// Whether the event subscription is active (false) or inactive (true).
Disabled param.Field[bool] `json:"disabled"`
// Indicates types of events that will be sent to this subscription. If left blank,
// all types will be sent.
EventTypes param.Field[[]EventSubscriptionUpdateParamsEventType] `json:"event_types"`
}
func (r EventSubscriptionUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type EventSubscriptionUpdateParamsEventType string
const (
EventSubscriptionUpdateParamsEventTypeAccountHolderCreated EventSubscriptionUpdateParamsEventType = "account_holder.created"
EventSubscriptionUpdateParamsEventTypeAccountHolderUpdated EventSubscriptionUpdateParamsEventType = "account_holder.updated"
EventSubscriptionUpdateParamsEventTypeAccountHolderVerification EventSubscriptionUpdateParamsEventType = "account_holder.verification"
EventSubscriptionUpdateParamsEventTypeBalanceUpdated EventSubscriptionUpdateParamsEventType = "balance.updated"
EventSubscriptionUpdateParamsEventTypeCardCreated EventSubscriptionUpdateParamsEventType = "card.created"
EventSubscriptionUpdateParamsEventTypeCardRenewed EventSubscriptionUpdateParamsEventType = "card.renewed"
EventSubscriptionUpdateParamsEventTypeCardShipped EventSubscriptionUpdateParamsEventType = "card.shipped"
EventSubscriptionUpdateParamsEventTypeCardTransactionUpdated EventSubscriptionUpdateParamsEventType = "card_transaction.updated"
EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationApprovalRequest EventSubscriptionUpdateParamsEventType = "digital_wallet.tokenization_approval_request"
EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationResult EventSubscriptionUpdateParamsEventType = "digital_wallet.tokenization_result"
EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode EventSubscriptionUpdateParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code"
EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent EventSubscriptionUpdateParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code_sent"
EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationUpdated EventSubscriptionUpdateParamsEventType = "digital_wallet.tokenization_updated"
EventSubscriptionUpdateParamsEventTypeDisputeUpdated EventSubscriptionUpdateParamsEventType = "dispute.updated"
EventSubscriptionUpdateParamsEventTypeDisputeEvidenceUploadFailed EventSubscriptionUpdateParamsEventType = "dispute_evidence.upload_failed"
EventSubscriptionUpdateParamsEventTypeExternalBankAccountCreated EventSubscriptionUpdateParamsEventType = "external_bank_account.created"
EventSubscriptionUpdateParamsEventTypeExternalBankAccountUpdated EventSubscriptionUpdateParamsEventType = "external_bank_account.updated"
EventSubscriptionUpdateParamsEventTypeFinancialAccountCreated EventSubscriptionUpdateParamsEventType = "financial_account.created"
EventSubscriptionUpdateParamsEventTypePaymentTransactionCreated EventSubscriptionUpdateParamsEventType = "payment_transaction.created"
EventSubscriptionUpdateParamsEventTypePaymentTransactionUpdated EventSubscriptionUpdateParamsEventType = "payment_transaction.updated"
EventSubscriptionUpdateParamsEventTypeSettlementReportUpdated EventSubscriptionUpdateParamsEventType = "settlement_report.updated"
EventSubscriptionUpdateParamsEventTypeThreeDSAuthenticationCreated EventSubscriptionUpdateParamsEventType = "three_ds_authentication.created"
EventSubscriptionUpdateParamsEventTypeTransferTransactionCreated EventSubscriptionUpdateParamsEventType = "transfer_transaction.created"
)
func (r EventSubscriptionUpdateParamsEventType) IsKnown() bool {
switch r {
case EventSubscriptionUpdateParamsEventTypeAccountHolderCreated, EventSubscriptionUpdateParamsEventTypeAccountHolderUpdated, EventSubscriptionUpdateParamsEventTypeAccountHolderVerification, EventSubscriptionUpdateParamsEventTypeBalanceUpdated, EventSubscriptionUpdateParamsEventTypeCardCreated, EventSubscriptionUpdateParamsEventTypeCardRenewed, EventSubscriptionUpdateParamsEventTypeCardShipped, EventSubscriptionUpdateParamsEventTypeCardTransactionUpdated, EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationApprovalRequest, EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationResult, EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode, EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent, EventSubscriptionUpdateParamsEventTypeDigitalWalletTokenizationUpdated, EventSubscriptionUpdateParamsEventTypeDisputeUpdated, EventSubscriptionUpdateParamsEventTypeDisputeEvidenceUploadFailed, EventSubscriptionUpdateParamsEventTypeExternalBankAccountCreated, EventSubscriptionUpdateParamsEventTypeExternalBankAccountUpdated, EventSubscriptionUpdateParamsEventTypeFinancialAccountCreated, EventSubscriptionUpdateParamsEventTypePaymentTransactionCreated, EventSubscriptionUpdateParamsEventTypePaymentTransactionUpdated, EventSubscriptionUpdateParamsEventTypeSettlementReportUpdated, EventSubscriptionUpdateParamsEventTypeThreeDSAuthenticationCreated, EventSubscriptionUpdateParamsEventTypeTransferTransactionCreated:
return true
}
return false
}
type EventSubscriptionListParams struct {
// A cursor representing an item's token before which a page of results should end.
// Used to retrieve the previous page of results before this item.
EndingBefore param.Field[string] `query:"ending_before"`
// Page size (for pagination).
PageSize param.Field[int64] `query:"page_size"`
// A cursor representing an item's token after which a page of results should
// begin. Used to retrieve the next page of results after this item.
StartingAfter param.Field[string] `query:"starting_after"`
}
// URLQuery serializes [EventSubscriptionListParams]'s query parameters as
// `url.Values`.
func (r EventSubscriptionListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type EventSubscriptionListAttemptsParams struct {
// Date string in RFC 3339 format. Only entries created after the specified time
// will be included. UTC time zone.
Begin param.Field[time.Time] `query:"begin" format:"date-time"`
// Date string in RFC 3339 format. Only entries created before the specified time
// will be included. UTC time zone.
End param.Field[time.Time] `query:"end" format:"date-time"`
// A cursor representing an item's token before which a page of results should end.
// Used to retrieve the previous page of results before this item.
EndingBefore param.Field[string] `query:"ending_before"`
// Page size (for pagination).
PageSize param.Field[int64] `query:"page_size"`
// A cursor representing an item's token after which a page of results should
// begin. Used to retrieve the next page of results after this item.
StartingAfter param.Field[string] `query:"starting_after"`
Status param.Field[EventSubscriptionListAttemptsParamsStatus] `query:"status"`
}
// URLQuery serializes [EventSubscriptionListAttemptsParams]'s query parameters as
// `url.Values`.
func (r EventSubscriptionListAttemptsParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type EventSubscriptionListAttemptsParamsStatus string
const (
EventSubscriptionListAttemptsParamsStatusFailed EventSubscriptionListAttemptsParamsStatus = "FAILED"
EventSubscriptionListAttemptsParamsStatusPending EventSubscriptionListAttemptsParamsStatus = "PENDING"
EventSubscriptionListAttemptsParamsStatusSending EventSubscriptionListAttemptsParamsStatus = "SENDING"
EventSubscriptionListAttemptsParamsStatusSuccess EventSubscriptionListAttemptsParamsStatus = "SUCCESS"
)
func (r EventSubscriptionListAttemptsParamsStatus) IsKnown() bool {
switch r {
case EventSubscriptionListAttemptsParamsStatusFailed, EventSubscriptionListAttemptsParamsStatusPending, EventSubscriptionListAttemptsParamsStatusSending, EventSubscriptionListAttemptsParamsStatusSuccess:
return true
}
return false
}
type EventSubscriptionRecoverParams struct {
// Date string in RFC 3339 format. Only entries created after the specified time
// will be included. UTC time zone.
Begin param.Field[time.Time] `query:"begin" format:"date-time"`
// Date string in RFC 3339 format. Only entries created before the specified time
// will be included. UTC time zone.
End param.Field[time.Time] `query:"end" format:"date-time"`
}
// URLQuery serializes [EventSubscriptionRecoverParams]'s query parameters as
// `url.Values`.
func (r EventSubscriptionRecoverParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type EventSubscriptionReplayMissingParams struct {
// Date string in RFC 3339 format. Only entries created after the specified time
// will be included. UTC time zone.
Begin param.Field[time.Time] `query:"begin" format:"date-time"`
// Date string in RFC 3339 format. Only entries created before the specified time
// will be included. UTC time zone.
End param.Field[time.Time] `query:"end" format:"date-time"`
}
// URLQuery serializes [EventSubscriptionReplayMissingParams]'s query parameters as
// `url.Values`.
func (r EventSubscriptionReplayMissingParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type EventSubscriptionSendSimulatedExampleParams struct {
// Event type to send example message for.
EventType param.Field[EventSubscriptionSendSimulatedExampleParamsEventType] `json:"event_type"`
}
func (r EventSubscriptionSendSimulatedExampleParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Event type to send example message for.
type EventSubscriptionSendSimulatedExampleParamsEventType string
const (
EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderCreated EventSubscriptionSendSimulatedExampleParamsEventType = "account_holder.created"
EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "account_holder.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderVerification EventSubscriptionSendSimulatedExampleParamsEventType = "account_holder.verification"
EventSubscriptionSendSimulatedExampleParamsEventTypeBalanceUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "balance.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeCardCreated EventSubscriptionSendSimulatedExampleParamsEventType = "card.created"
EventSubscriptionSendSimulatedExampleParamsEventTypeCardRenewed EventSubscriptionSendSimulatedExampleParamsEventType = "card.renewed"
EventSubscriptionSendSimulatedExampleParamsEventTypeCardShipped EventSubscriptionSendSimulatedExampleParamsEventType = "card.shipped"
EventSubscriptionSendSimulatedExampleParamsEventTypeCardTransactionUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "card_transaction.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationApprovalRequest EventSubscriptionSendSimulatedExampleParamsEventType = "digital_wallet.tokenization_approval_request"
EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationResult EventSubscriptionSendSimulatedExampleParamsEventType = "digital_wallet.tokenization_result"
EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode EventSubscriptionSendSimulatedExampleParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code"
EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent EventSubscriptionSendSimulatedExampleParamsEventType = "digital_wallet.tokenization_two_factor_authentication_code_sent"
EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "digital_wallet.tokenization_updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeDisputeUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "dispute.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeDisputeEvidenceUploadFailed EventSubscriptionSendSimulatedExampleParamsEventType = "dispute_evidence.upload_failed"
EventSubscriptionSendSimulatedExampleParamsEventTypeExternalBankAccountCreated EventSubscriptionSendSimulatedExampleParamsEventType = "external_bank_account.created"
EventSubscriptionSendSimulatedExampleParamsEventTypeExternalBankAccountUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "external_bank_account.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeFinancialAccountCreated EventSubscriptionSendSimulatedExampleParamsEventType = "financial_account.created"
EventSubscriptionSendSimulatedExampleParamsEventTypePaymentTransactionCreated EventSubscriptionSendSimulatedExampleParamsEventType = "payment_transaction.created"
EventSubscriptionSendSimulatedExampleParamsEventTypePaymentTransactionUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "payment_transaction.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeSettlementReportUpdated EventSubscriptionSendSimulatedExampleParamsEventType = "settlement_report.updated"
EventSubscriptionSendSimulatedExampleParamsEventTypeThreeDSAuthenticationCreated EventSubscriptionSendSimulatedExampleParamsEventType = "three_ds_authentication.created"
EventSubscriptionSendSimulatedExampleParamsEventTypeTransferTransactionCreated EventSubscriptionSendSimulatedExampleParamsEventType = "transfer_transaction.created"
)
func (r EventSubscriptionSendSimulatedExampleParamsEventType) IsKnown() bool {
switch r {
case EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderCreated, EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeAccountHolderVerification, EventSubscriptionSendSimulatedExampleParamsEventTypeBalanceUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeCardCreated, EventSubscriptionSendSimulatedExampleParamsEventTypeCardRenewed, EventSubscriptionSendSimulatedExampleParamsEventTypeCardShipped, EventSubscriptionSendSimulatedExampleParamsEventTypeCardTransactionUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationApprovalRequest, EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationResult, EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCode, EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationTwoFactorAuthenticationCodeSent, EventSubscriptionSendSimulatedExampleParamsEventTypeDigitalWalletTokenizationUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeDisputeUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeDisputeEvidenceUploadFailed, EventSubscriptionSendSimulatedExampleParamsEventTypeExternalBankAccountCreated, EventSubscriptionSendSimulatedExampleParamsEventTypeExternalBankAccountUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeFinancialAccountCreated, EventSubscriptionSendSimulatedExampleParamsEventTypePaymentTransactionCreated, EventSubscriptionSendSimulatedExampleParamsEventTypePaymentTransactionUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeSettlementReportUpdated, EventSubscriptionSendSimulatedExampleParamsEventTypeThreeDSAuthenticationCreated, EventSubscriptionSendSimulatedExampleParamsEventTypeTransferTransactionCreated:
return true
}
return false
}