Skip to content

Commit 1c437b5

Browse files
committed
go: Pull in some changes from codegen
1 parent 328490d commit 1c437b5

6 files changed

+125
-66
lines changed

go/backgroundtask.go

+34-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// this file is @generated (with minor manual changes)
12
package svix
23

34
import (
@@ -11,50 +12,67 @@ type BackgroundTask struct {
1112
}
1213

1314
type BackgroundTaskListOptions struct {
15+
// Filter the response based on the status.
16+
Status *BackgroundTaskStatus
17+
// Filter the response based on the type.
18+
Task *BackgroundTaskType
19+
// Limit the number of returned items
20+
Limit *int32
21+
// The iterator returned from a prior invocation
1422
Iterator *string
15-
Limit *int32
16-
Order *Ordering
17-
Status *BackgroundTaskStatus
18-
Task *BackgroundTaskType
23+
// The sorting order of the returned items
24+
Order *Ordering
1925
}
2026

21-
func (a *BackgroundTask) List(
27+
// List background tasks executed in the past 90 days.
28+
func (backgroundTask *BackgroundTask) List(
2229
ctx context.Context,
2330
options *BackgroundTaskListOptions,
2431
) (*ListResponseBackgroundTaskOut, error) {
25-
req := a.api.BackgroundTasksAPI.ListBackgroundTasks(ctx)
32+
req := backgroundTask.api.BackgroundTasksAPI.ListBackgroundTasks(
33+
ctx,
34+
)
35+
2636
if options != nil {
27-
if options.Iterator != nil {
28-
req = req.Iterator(*options.Iterator)
37+
if options.Status != nil {
38+
req = req.Status(*options.Status)
39+
}
40+
if options.Task != nil {
41+
req = req.Task(*options.Task)
2942
}
3043
if options.Limit != nil {
3144
req = req.Limit(*options.Limit)
3245
}
46+
if options.Iterator != nil {
47+
req = req.Iterator(*options.Iterator)
48+
}
3349
if options.Order != nil {
3450
req = req.Order(*options.Order)
3551
}
36-
if options.Status != nil {
37-
req = req.Status(*options.Status)
38-
}
39-
if options.Task != nil {
40-
req = req.Task(*options.Task)
41-
}
4252
}
53+
4354
ret, res, err := req.Execute()
4455
if err != nil {
4556
return nil, wrapError(err, res)
4657
}
58+
4759
return ret, nil
4860
}
4961

50-
func (a *BackgroundTask) Get(
62+
// Get a background task by ID.
63+
func (backgroundTask *BackgroundTask) Get(
5164
ctx context.Context,
5265
taskId string,
5366
) (*BackgroundTaskOut, error) {
54-
req := a.api.BackgroundTasksAPI.GetBackgroundTask(ctx, taskId)
67+
req := backgroundTask.api.BackgroundTasksAPI.GetBackgroundTask(
68+
ctx,
69+
taskId,
70+
)
71+
5572
ret, res, err := req.Execute()
5673
if err != nil {
5774
return nil, wrapError(err, res)
5875
}
76+
5977
return ret, nil
6078
}

go/endpoint.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// this file is @generated (with minor manual changes)
12
package svix
23

34
import (
@@ -444,22 +445,22 @@ func (endpoint *Endpoint) SendExampleWithOptions(
444445
}
445446

446447
// Get basic statistics for the endpoint.
447-
func (e *Endpoint) GetStats(
448+
func (endpoint *Endpoint) GetStats(
448449
ctx context.Context,
449450
appId string,
450451
endpointId string,
451452
) (*EndpointStats, error) {
452-
return e.GetStatsWithOptions(ctx, appId, endpointId, EndpointStatsOptions{})
453+
return endpoint.GetStatsWithOptions(ctx, appId, endpointId, EndpointStatsOptions{})
453454
}
454455

455456
// Get basic statistics for the endpoint.
456-
func (e *Endpoint) GetStatsWithOptions(
457+
func (endpoint *Endpoint) GetStatsWithOptions(
457458
ctx context.Context,
458459
appId string,
459460
endpointId string,
460461
options EndpointStatsOptions,
461462
) (*EndpointStats, error) {
462-
req := e.api.EndpointAPI.V1EndpointGetStats(
463+
req := endpoint.api.EndpointAPI.V1EndpointGetStats(
463464
ctx,
464465
appId,
465466
endpointId,

go/event_type.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// this file is @generated (with some manual changes)
12
package svix
23

34
import (
@@ -23,6 +24,11 @@ type EventTypeListOptions struct {
2324
WithContent *bool
2425
}
2526

27+
type EventTypeDeleteOptions struct {
28+
// By default event types are archived when "deleted". Passing this to `true` deletes them entirely.
29+
Expunge *bool
30+
}
31+
2632
// Return the list of event types.
2733
func (eventType *EventType) List(
2834
ctx context.Context,
@@ -102,19 +108,19 @@ func (eventType *EventType) CreateWithOptions(
102108
return ret, nil
103109
}
104110

105-
func (e *EventType) ImportOpenApi(
111+
func (eventType *EventType) ImportOpenApi(
106112
ctx context.Context,
107113
eventTypeImportOpenApiIn EventTypeImportOpenApiIn,
108114
) (*EventTypeImportOpenApiOut, error) {
109-
return e.ImportOpenApiWithOptions(ctx, eventTypeImportOpenApiIn, nil)
115+
return eventType.ImportOpenApiWithOptions(ctx, eventTypeImportOpenApiIn, nil)
110116
}
111117

112-
func (e *EventType) ImportOpenApiWithOptions(
118+
func (eventType *EventType) ImportOpenApiWithOptions(
113119
ctx context.Context,
114120
eventTypeImportOpenApiIn EventTypeImportOpenApiIn,
115121
options *PostOptions,
116122
) (*EventTypeImportOpenApiOut, error) {
117-
req := e.api.EventTypeAPI.V1EventTypeImportOpenapi(ctx).EventTypeImportOpenApiIn(eventTypeImportOpenApiIn)
123+
req := eventType.api.EventTypeAPI.V1EventTypeImportOpenapi(ctx).EventTypeImportOpenApiIn(eventTypeImportOpenApiIn)
118124
if options != nil && options.IdempotencyKey != nil {
119125
req = req.IdempotencyKey(*options.IdempotencyKey)
120126
}
@@ -175,10 +181,6 @@ func (eventType *EventType) Delete(
175181
return eventType.DeleteWithOptions(ctx, eventTypeName, nil)
176182
}
177183

178-
type EventTypeDeleteOptions struct {
179-
Expunge *bool
180-
}
181-
182184
func (eventType *EventType) DeleteWithOptions(
183185
ctx context.Context,
184186
eventTypeName string,

go/message.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// this file is @generated (with some manual changes)
12
package svix
23

34
import (

go/message_attempt.go

+22-18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// this file is @generated (with manual changes)
12
package svix
23

34
import (
@@ -12,8 +13,11 @@ type MessageAttempt struct {
1213
}
1314

1415
type MessageAttemptListOptions struct {
15-
Iterator *string
16-
Limit *int32
16+
// Limit the number of returned items
17+
Limit *int32
18+
// The iterator returned from a prior invocation
19+
Iterator *string
20+
// Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3)
1721
Status *MessageStatus
1822
EventTypes *[]string
1923
Before *time.Time
@@ -55,38 +59,38 @@ func (messageAttempt *MessageAttempt) ListByEndpoint(
5559
)
5660

5761
if options != nil {
58-
if options.Iterator != nil {
59-
req = req.Iterator(*options.Iterator)
60-
}
6162
if options.Limit != nil {
6263
req = req.Limit(*options.Limit)
6364
}
65+
if options.Iterator != nil {
66+
req = req.Iterator(*options.Iterator)
67+
}
6468
if options.Status != nil {
6569
req = req.Status(*options.Status)
6670
}
67-
if options.EventTypes != nil {
68-
req = req.EventTypes(*options.EventTypes)
71+
if options.StatusCodeClass != nil {
72+
req = req.StatusCodeClass(*options.StatusCodeClass)
73+
}
74+
if options.Channel != nil {
75+
req = req.Channel(*options.Channel)
76+
}
77+
if options.Tag != nil {
78+
req = req.Tag(*options.Tag)
6979
}
7080
if options.Before != nil {
7181
req = req.Before(*options.Before)
7282
}
7383
if options.After != nil {
7484
req = req.After(*options.After)
7585
}
76-
if options.StatusCodeClass != nil {
77-
req.StatusCodeClass(*options.StatusCodeClass)
78-
}
79-
if options.Channel != nil {
80-
req = req.Channel(*options.Channel)
81-
}
8286
if options.WithContent != nil {
8387
req = req.WithContent(*options.WithContent)
8488
}
8589
if options.WithMsg != nil {
8690
req = req.WithMsg(*options.WithMsg)
8791
}
88-
if options.Tag != nil {
89-
req = req.Tag(*options.Tag)
92+
if options.EventTypes != nil {
93+
req = req.EventTypes(*options.EventTypes)
9094
}
9195
}
9296

@@ -268,12 +272,12 @@ func (messageAttempt *MessageAttempt) ListAttemptedDestinations(
268272
) (*ListResponseMessageEndpointOut, error) {
269273
req := messageAttempt.api.MessageAttemptAPI.V1MessageAttemptListAttemptedDestinations(ctx, appId, msgId)
270274
if options != nil {
271-
if options.Iterator != nil {
272-
req = req.Iterator(*options.Iterator)
273-
}
274275
if options.Limit != nil {
275276
req = req.Limit(*options.Limit)
276277
}
278+
if options.Iterator != nil {
279+
req = req.Iterator(*options.Iterator)
280+
}
277281
}
278282
ret, res, err := req.Execute()
279283
if err != nil {

0 commit comments

Comments
 (0)