Skip to content

Commit 5670c9f

Browse files
authored
Update go lib with some new fixes (#1723)
- Pull in new updates from `lib-openapi.json` - Doc comments - New models - Correctly mark nullable types as `*T` Breaking changes: - For all `ListResponse*Out` models, the `Iterator` is now `*string` instead of `string` - `EnvironmentOut.Settings` is now a `*map[string]any` instead of `map[string]any Some breaking changes on environment related models, But this is fine since we don't have the environment as part of our Go lib yet ```json { "file-generated-at": "2025-02-19T20:45:38.376408871+00:00", "git-rev": "98dbc5b090a5c8d72fe50962ee04b46fb9d7db20", "openapi-codegen-version": "0.1.0", "openapi.json-sha256": "33fb5ed57fd9afa4c737cebd0f66244436813844fb00e2a057b06525819af8d7" } ```
1 parent f1c32e1 commit 5670c9f

37 files changed

+291
-60
lines changed

go/message.go

+37
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ type MessageCreateOptions struct {
3737
IdempotencyKey *string
3838
}
3939

40+
type MessageExpungeAllContentsOptions struct {
41+
IdempotencyKey *string
42+
}
43+
4044
type MessageGetOptions struct {
4145
// When `true` message payloads are included in the response.
4246
WithContent *bool
@@ -130,6 +134,39 @@ func (message *Message) Create(
130134

131135
}
132136

137+
// Purge all message content for the application.
138+
//
139+
// Delete all message payloads for the application.
140+
func (message *Message) ExpungeAllContents(
141+
ctx context.Context,
142+
appId string,
143+
o *MessageExpungeAllContentsOptions,
144+
) (*models.ExpungAllContentsOut, error) {
145+
pathMap := map[string]string{
146+
"app_id": appId,
147+
}
148+
headerMap := map[string]string{}
149+
var err error
150+
if o != nil {
151+
serializeParamToMap("idempotency-key", o.IdempotencyKey, headerMap, &err)
152+
if err != nil {
153+
return nil, err
154+
}
155+
}
156+
157+
return executeRequest[any, models.ExpungAllContentsOut](
158+
ctx,
159+
message.client,
160+
"POST",
161+
"/api/v1/app/{app_id}/msg/expunge-all-contents",
162+
pathMap,
163+
nil,
164+
headerMap,
165+
nil,
166+
)
167+
168+
}
169+
133170
// Get a message by its ID or eventID.
134171
func (message *Message) Get(
135172
ctx context.Context,

go/models.go

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Package svix this file is @generated DO NOT EDIT
2+
package svix
3+
4+
import "github.com/svix/svix-webhooks/go/models"
5+
6+
type (
7+
AggregateEventTypesOut = models.AggregateEventTypesOut
8+
AppPortalAccessIn = models.AppPortalAccessIn
9+
AppPortalAccessOut = models.AppPortalAccessOut
10+
AppUsageStatsIn = models.AppUsageStatsIn
11+
AppUsageStatsOut = models.AppUsageStatsOut
12+
ApplicationIn = models.ApplicationIn
13+
ApplicationOut = models.ApplicationOut
14+
ApplicationPatch = models.ApplicationPatch
15+
ApplicationTokenExpireIn = models.ApplicationTokenExpireIn
16+
BackgroundTaskOut = models.BackgroundTaskOut
17+
BackgroundTaskStatus = models.BackgroundTaskStatus
18+
BackgroundTaskType = models.BackgroundTaskType
19+
ConnectorIn = models.ConnectorIn
20+
ConnectorKind = models.ConnectorKind
21+
DashboardAccessOut = models.DashboardAccessOut
22+
EndpointHeadersIn = models.EndpointHeadersIn
23+
EndpointHeadersOut = models.EndpointHeadersOut
24+
EndpointHeadersPatchIn = models.EndpointHeadersPatchIn
25+
EndpointIn = models.EndpointIn
26+
EndpointMessageOut = models.EndpointMessageOut
27+
EndpointOut = models.EndpointOut
28+
EndpointPatch = models.EndpointPatch
29+
EndpointSecretOut = models.EndpointSecretOut
30+
EndpointSecretRotateIn = models.EndpointSecretRotateIn
31+
EndpointStats = models.EndpointStats
32+
EndpointTransformationIn = models.EndpointTransformationIn
33+
EndpointTransformationOut = models.EndpointTransformationOut
34+
EndpointUpdate = models.EndpointUpdate
35+
EnvironmentIn = models.EnvironmentIn
36+
EnvironmentOut = models.EnvironmentOut
37+
EventExampleIn = models.EventExampleIn
38+
EventTypeFromOpenApi = models.EventTypeFromOpenApi
39+
EventTypeImportOpenApiIn = models.EventTypeImportOpenApiIn
40+
EventTypeImportOpenApiOut = models.EventTypeImportOpenApiOut
41+
EventTypeImportOpenApiOutData = models.EventTypeImportOpenApiOutData
42+
EventTypeIn = models.EventTypeIn
43+
EventTypeOut = models.EventTypeOut
44+
EventTypePatch = models.EventTypePatch
45+
EventTypeUpdate = models.EventTypeUpdate
46+
ExpungAllContentsOut = models.ExpungAllContentsOut
47+
IntegrationIn = models.IntegrationIn
48+
IntegrationKeyOut = models.IntegrationKeyOut
49+
IntegrationOut = models.IntegrationOut
50+
IntegrationUpdate = models.IntegrationUpdate
51+
ListResponseApplicationOut = models.ListResponseApplicationOut
52+
ListResponseBackgroundTaskOut = models.ListResponseBackgroundTaskOut
53+
ListResponseEndpointMessageOut = models.ListResponseEndpointMessageOut
54+
ListResponseEndpointOut = models.ListResponseEndpointOut
55+
ListResponseEventTypeOut = models.ListResponseEventTypeOut
56+
ListResponseIntegrationOut = models.ListResponseIntegrationOut
57+
ListResponseMessageAttemptOut = models.ListResponseMessageAttemptOut
58+
ListResponseMessageEndpointOut = models.ListResponseMessageEndpointOut
59+
ListResponseMessageOut = models.ListResponseMessageOut
60+
ListResponseOperationalWebhookEndpointOut = models.ListResponseOperationalWebhookEndpointOut
61+
MessageAttemptOut = models.MessageAttemptOut
62+
MessageAttemptTriggerType = models.MessageAttemptTriggerType
63+
MessageEndpointOut = models.MessageEndpointOut
64+
MessageIn = models.MessageIn
65+
MessageOut = models.MessageOut
66+
MessageStatus = models.MessageStatus
67+
OperationalWebhookEndpointHeadersIn = models.OperationalWebhookEndpointHeadersIn
68+
OperationalWebhookEndpointHeadersOut = models.OperationalWebhookEndpointHeadersOut
69+
OperationalWebhookEndpointIn = models.OperationalWebhookEndpointIn
70+
OperationalWebhookEndpointOut = models.OperationalWebhookEndpointOut
71+
OperationalWebhookEndpointSecretIn = models.OperationalWebhookEndpointSecretIn
72+
OperationalWebhookEndpointSecretOut = models.OperationalWebhookEndpointSecretOut
73+
OperationalWebhookEndpointUpdate = models.OperationalWebhookEndpointUpdate
74+
Ordering = models.Ordering
75+
RecoverIn = models.RecoverIn
76+
RecoverOut = models.RecoverOut
77+
ReplayIn = models.ReplayIn
78+
ReplayOut = models.ReplayOut
79+
StatusCodeClass = models.StatusCodeClass
80+
TemplateOut = models.TemplateOut
81+
)

go/models/aggregate_event_types_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package models
33

44
type AggregateEventTypesOut struct {
5-
Id string `json:"id"`
5+
Id string `json:"id"` // The QueueBackgroundTask's ID.
66
Status BackgroundTaskStatus `json:"status"`
77
Task BackgroundTaskType `json:"task"`
88
}

go/models/app_usage_stats_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package models
33

44
type AppUsageStatsOut struct {
5-
Id string `json:"id"`
5+
Id string `json:"id"` // The QueueBackgroundTask's ID.
66
Status BackgroundTaskStatus `json:"status"`
77
Task BackgroundTaskType `json:"task"`
88
// Any app IDs or UIDs received in the request that weren't found.

go/models/application_out.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import "time"
55

66
type ApplicationOut struct {
77
CreatedAt time.Time `json:"createdAt"`
8-
Id string `json:"id"` // The app's ID
8+
Id string `json:"id"` // The Application's ID.
99
Metadata map[string]string `json:"metadata"`
1010
Name string `json:"name"`
1111
RateLimit *uint16 `json:"rateLimit,omitempty"`
12-
Uid *string `json:"uid,omitempty"` // The app's UID
12+
Uid *string `json:"uid,omitempty"` // The Application's UID.
1313
UpdatedAt time.Time `json:"updatedAt"`
1414
}

go/models/application_patch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type ApplicationPatch struct {
1111
Metadata *map[string]string `json:"metadata,omitempty"`
1212
Name *string `json:"name,omitempty"`
1313
RateLimit utils.Nullable[uint16] `json:"rateLimit"`
14-
Uid utils.Nullable[string] `json:"uid"` // The app's UID
14+
Uid utils.Nullable[string] `json:"uid"` // The Application's UID.
1515
}
1616

1717
func (o ApplicationPatch) MarshalJSON() ([]byte, error) {

go/models/background_task_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package models
33

44
type BackgroundTaskOut struct {
55
Data map[string]any `json:"data"`
6-
Id string `json:"id"`
6+
Id string `json:"id"` // The QueueBackgroundTask's ID.
77
Status BackgroundTaskStatus `json:"status"`
88
Task BackgroundTaskType `json:"task"`
99
}

go/models/background_task_type.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import (
1010
type BackgroundTaskType string
1111

1212
const (
13-
BACKGROUNDTASKTYPE_ENDPOINT_REPLAY BackgroundTaskType = "endpoint.replay"
14-
BACKGROUNDTASKTYPE_ENDPOINT_RECOVER BackgroundTaskType = "endpoint.recover"
15-
BACKGROUNDTASKTYPE_APPLICATION_STATS BackgroundTaskType = "application.stats"
16-
BACKGROUNDTASKTYPE_MESSAGE_BROADCAST BackgroundTaskType = "message.broadcast"
17-
BACKGROUNDTASKTYPE_SDK_GENERATE BackgroundTaskType = "sdk.generate"
18-
BACKGROUNDTASKTYPE_EVENT_TYPE_AGGREGATE BackgroundTaskType = "event-type.aggregate"
13+
BACKGROUNDTASKTYPE_ENDPOINT_REPLAY BackgroundTaskType = "endpoint.replay"
14+
BACKGROUNDTASKTYPE_ENDPOINT_RECOVER BackgroundTaskType = "endpoint.recover"
15+
BACKGROUNDTASKTYPE_APPLICATION_STATS BackgroundTaskType = "application.stats"
16+
BACKGROUNDTASKTYPE_MESSAGE_BROADCAST BackgroundTaskType = "message.broadcast"
17+
BACKGROUNDTASKTYPE_SDK_GENERATE BackgroundTaskType = "sdk.generate"
18+
BACKGROUNDTASKTYPE_EVENT_TYPE_AGGREGATE BackgroundTaskType = "event-type.aggregate"
19+
BACKGROUNDTASKTYPE_APPLICATION_PURGE_CONTENT BackgroundTaskType = "application.purge_content"
1920
)
2021

2122
var allowedBackgroundTaskType = []BackgroundTaskType{
@@ -25,6 +26,7 @@ var allowedBackgroundTaskType = []BackgroundTaskType{
2526
"message.broadcast",
2627
"sdk.generate",
2728
"event-type.aggregate",
29+
"application.purge_content",
2830
}
2931

3032
func (v *BackgroundTaskType) UnmarshalJSON(src []byte) error {

go/models/connector_in.go

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Package svix this file is @generated DO NOT EDIT
2+
package models
3+
4+
type ConnectorIn struct {
5+
Description *string `json:"description,omitempty"`
6+
FeatureFlag *string `json:"featureFlag,omitempty"`
7+
FilterTypes []string `json:"filterTypes,omitempty"`
8+
Instructions *string `json:"instructions,omitempty"`
9+
InstructionsLink *string `json:"instructionsLink,omitempty"`
10+
Kind *ConnectorKind `json:"kind,omitempty"`
11+
Logo string `json:"logo"`
12+
Name string `json:"name"`
13+
Transformation string `json:"transformation"`
14+
}

go/models/connector_kind.go

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Package svix this file is @generated DO NOT EDIT
2+
package models
3+
4+
import (
5+
"encoding/json"
6+
"fmt"
7+
"slices"
8+
)
9+
10+
type ConnectorKind string
11+
12+
const (
13+
CONNECTORKIND_CUSTOM ConnectorKind = "Custom"
14+
CONNECTORKIND_CUSTOMER_IO ConnectorKind = "CustomerIO"
15+
CONNECTORKIND_DISCORD ConnectorKind = "Discord"
16+
CONNECTORKIND_HUBSPOT ConnectorKind = "Hubspot"
17+
CONNECTORKIND_INNGEST ConnectorKind = "Inngest"
18+
CONNECTORKIND_SALESFORCE ConnectorKind = "Salesforce"
19+
CONNECTORKIND_SEGMENT ConnectorKind = "Segment"
20+
CONNECTORKIND_SLACK ConnectorKind = "Slack"
21+
CONNECTORKIND_TEAMS ConnectorKind = "Teams"
22+
CONNECTORKIND_TRIGGER_DEV ConnectorKind = "TriggerDev"
23+
CONNECTORKIND_WINDMILL ConnectorKind = "Windmill"
24+
CONNECTORKIND_ZAPIER ConnectorKind = "Zapier"
25+
)
26+
27+
var allowedConnectorKind = []ConnectorKind{
28+
"Custom",
29+
"CustomerIO",
30+
"Discord",
31+
"Hubspot",
32+
"Inngest",
33+
"Salesforce",
34+
"Segment",
35+
"Slack",
36+
"Teams",
37+
"TriggerDev",
38+
"Windmill",
39+
"Zapier",
40+
}
41+
42+
func (v *ConnectorKind) UnmarshalJSON(src []byte) error {
43+
var value string
44+
err := json.Unmarshal(src, &value)
45+
if err != nil {
46+
return err
47+
}
48+
enumVal := ConnectorKind(value)
49+
if slices.Contains(allowedConnectorKind, enumVal) {
50+
*v = enumVal
51+
return nil
52+
}
53+
return fmt.Errorf("`%+v` is not a valid ConnectorKind", value)
54+
55+
}

go/models/endpoint_message_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type EndpointMessageOut struct {
88
Channels []string `json:"channels,omitempty"` // List of free-form identifiers that endpoints can filter by
99
EventId *string `json:"eventId,omitempty"` // Optional unique identifier for the message
1010
EventType string `json:"eventType"` // The event type's name
11-
Id string `json:"id"` // The msg's ID
11+
Id string `json:"id"` // The Message's ID.
1212
NextAttempt *time.Time `json:"nextAttempt,omitempty"`
1313
Payload map[string]any `json:"payload"`
1414
Status MessageStatus `json:"status"`

go/models/endpoint_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type EndpointOut struct {
99
Description string `json:"description"` // An example endpoint name.
1010
Disabled *bool `json:"disabled,omitempty"`
1111
FilterTypes []string `json:"filterTypes,omitempty"`
12-
Id string `json:"id"` // The ep's ID
12+
Id string `json:"id"` // The Endpoint's ID.
1313
Metadata map[string]string `json:"metadata"`
1414
RateLimit *uint16 `json:"rateLimit,omitempty"`
1515
Uid *string `json:"uid,omitempty"` // Optional unique identifier for the endpoint.

go/models/endpoint_patch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type EndpointPatch struct {
1919
// Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
2020
// It is recommended to not set this and let the server generate the secret.
2121
Secret utils.Nullable[string] `json:"secret"`
22-
Uid utils.Nullable[string] `json:"uid"` // The ep's UID
22+
Uid utils.Nullable[string] `json:"uid"` // The Endpoint's UID.
2323
Url *string `json:"url,omitempty"`
2424
Version *uint16 `json:"version,omitempty"`
2525
}

go/models/environment_in.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package models
33

44
type EnvironmentIn struct {
5-
EventTypes []EventTypeIn `json:"eventTypes,omitempty"`
6-
Settings *map[string]any `json:"settings,omitempty"`
7-
TransformationTemplates []TemplateIn `json:"transformationTemplates,omitempty"`
5+
Connectors []ConnectorIn `json:"connectors,omitempty"`
6+
EventTypes []EventTypeIn `json:"eventTypes,omitempty"`
7+
Settings *map[string]any `json:"settings,omitempty"`
88
}

go/models/environment_out.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ package models
44
import "time"
55

66
type EnvironmentOut struct {
7-
CreatedAt time.Time `json:"createdAt"`
8-
EventTypes []EventTypeOut `json:"eventTypes"`
9-
Settings map[string]any `json:"settings"`
10-
TransformationTemplates []TemplateOut `json:"transformationTemplates"`
11-
Version *int64 `json:"version,omitempty"`
7+
CreatedAt time.Time `json:"createdAt"`
8+
EventTypes []EventTypeOut `json:"eventTypes"`
9+
Settings *map[string]any `json:"settings,omitempty"`
10+
TransformationTemplates []TemplateOut `json:"transformationTemplates"`
11+
Version *int64 `json:"version,omitempty"`
1212
}

go/models/expung_all_contents_out.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Package svix this file is @generated DO NOT EDIT
2+
package models
3+
4+
type ExpungAllContentsOut struct {
5+
Id string `json:"id"` // The QueueBackgroundTask's ID.
6+
Status BackgroundTaskStatus `json:"status"`
7+
Task BackgroundTaskType `json:"task"`
8+
}

go/models/integration_in.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
package models
33

44
type IntegrationIn struct {
5-
Name string `json:"name"`
5+
FeatureFlags []string `json:"featureFlags,omitempty"` // The set of feature flags the integration will have access to.
6+
Name string `json:"name"`
67
}

go/models/integration_out.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ package models
44
import "time"
55

66
type IntegrationOut struct {
7-
CreatedAt time.Time `json:"createdAt"`
8-
Id string `json:"id"` // The integ's ID
9-
Name string `json:"name"`
10-
UpdatedAt time.Time `json:"updatedAt"`
7+
CreatedAt time.Time `json:"createdAt"`
8+
FeatureFlags []string `json:"featureFlags,omitempty"` // The set of feature flags the integration has access to.
9+
Id string `json:"id"` // The Integration's ID.
10+
Name string `json:"name"`
11+
UpdatedAt time.Time `json:"updatedAt"`
1112
}

go/models/integration_update.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
package models
33

44
type IntegrationUpdate struct {
5-
Name string `json:"name"`
5+
FeatureFlags []string `json:"featureFlags,omitempty"` // The set of feature flags the integration will have access to.
6+
Name string `json:"name"`
67
}

go/models/list_response_application_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ package models
44
type ListResponseApplicationOut struct {
55
Data []ApplicationOut `json:"data"`
66
Done bool `json:"done"`
7-
Iterator string `json:"iterator"`
7+
Iterator *string `json:"iterator,omitempty"`
88
PrevIterator *string `json:"prevIterator,omitempty"`
99
}

go/models/list_response_background_task_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ package models
44
type ListResponseBackgroundTaskOut struct {
55
Data []BackgroundTaskOut `json:"data"`
66
Done bool `json:"done"`
7-
Iterator string `json:"iterator"`
7+
Iterator *string `json:"iterator,omitempty"`
88
PrevIterator *string `json:"prevIterator,omitempty"`
99
}

go/models/list_response_endpoint_message_out.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ package models
44
type ListResponseEndpointMessageOut struct {
55
Data []EndpointMessageOut `json:"data"`
66
Done bool `json:"done"`
7-
Iterator string `json:"iterator"`
7+
Iterator *string `json:"iterator,omitempty"`
88
PrevIterator *string `json:"prevIterator,omitempty"`
99
}

0 commit comments

Comments
 (0)