From dbfbc802b205eea43d2b69aa4a3adac07d60ae9d Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Wed, 29 Jan 2025 21:35:06 +0700 Subject: [PATCH 1/2] feat: Generate new SDK with 2025-01-01-next schema --- attempt.go | 64 + attempt/client.go | 123 +- bookmark.go | 266 + bookmark/client.go | 428 +- client/client.go | 7 +- connection.go | 1761 +- connection/client.go | 639 +- core/api_error.go | 42 + core/http.go | 8 + core/request_option.go | 6 +- custom_domain.go | 557 + customdomain/client.go | 81 +- destination.go | 171 +- destination/client.go | 475 +- environments.go | 2 +- event.go | 233 + event/client.go | 279 +- event_bulk_retry.go | 1769 +- eventbulkretry/client.go | 289 +- file_param.go | 41 + ignored_event_bulk_retry.go | 213 +- ignoredeventbulkretry/client.go | 289 +- core/core.go => internal/caller.go | 101 +- core/core_test.go => internal/caller_test.go | 15 +- internal/error_decoder.go | 45 + internal/error_decoder_test.go | 55 + {core => internal}/extra_properties.go | 2 +- {core => internal}/extra_properties_test.go | 2 +- internal/http.go | 48 + {core => internal}/query.go | 2 +- {core => internal}/query_test.go | 2 +- {core => internal}/retrier.go | 3 +- internal/retrier_test.go | 211 + {core => internal}/stringer.go | 2 +- {core => internal}/time.go | 2 +- issue.go | 1452 + issue/client.go | 287 +- issue_trigger.go | 1127 +- issuetrigger/client.go | 455 +- notification.go | 94 + notification/client.go | 30 +- optional.go | 27 - optional_test.go | 55 - request.go | 677 + request/client.go | 397 +- request_bulk_retry.go | 1041 +- requestbulkretry/client.go | 289 +- source.go | 783 +- source/client.go | 478 +- transformation.go | 1033 +- transformation/client.go | 532 +- types.go | 33044 +++++++++++------ 52 files changed, 35851 insertions(+), 14183 deletions(-) create mode 100644 core/api_error.go create mode 100644 core/http.go create mode 100644 custom_domain.go create mode 100644 file_param.go rename core/core.go => internal/caller.go (69%) rename core/core_test.go => internal/caller_test.go (97%) create mode 100644 internal/error_decoder.go create mode 100644 internal/error_decoder_test.go rename {core => internal}/extra_properties.go (99%) rename {core => internal}/extra_properties_test.go (99%) create mode 100644 internal/http.go rename {core => internal}/query.go (99%) rename {core => internal}/query_test.go (99%) rename {core => internal}/retrier.go (98%) create mode 100644 internal/retrier_test.go rename {core => internal}/stringer.go (94%) rename {core => internal}/time.go (99%) delete mode 100644 optional_test.go diff --git a/attempt.go b/attempt.go index 938c465..64a4d0c 100644 --- a/attempt.go +++ b/attempt.go @@ -3,7 +3,9 @@ package api import ( + json "encoding/json" fmt "fmt" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" ) type AttemptListRequest struct { @@ -15,6 +17,68 @@ type AttemptListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +type EventAttemptPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*EventAttempt `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *EventAttemptPaginatedResult) GetPagination() *SeekPagination { + if e == nil { + return nil + } + return e.Pagination +} + +func (e *EventAttemptPaginatedResult) GetCount() *int { + if e == nil { + return nil + } + return e.Count +} + +func (e *EventAttemptPaginatedResult) GetModels() []*EventAttempt { + if e == nil { + return nil + } + return e.Models +} + +func (e *EventAttemptPaginatedResult) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventAttemptPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler EventAttemptPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventAttemptPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventAttemptPaginatedResult) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + type AttemptListRequestDir string const ( diff --git a/attempt/client.go b/attempt/client.go index 237fbef..ccd0784 100644 --- a/attempt/client.go +++ b/attempt/client.go @@ -3,20 +3,17 @@ package attempt import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.EventAttemptPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/attempts" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.EventAttemptPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,51 +93,41 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.EventAttempt, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/attempts/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/attempts/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.EventAttempt if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, ResponseIsOptional: true, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/bookmark.go b/bookmark.go index 15ccb33..82a51ac 100644 --- a/bookmark.go +++ b/bookmark.go @@ -3,8 +3,10 @@ package api import ( + json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -38,6 +40,270 @@ type BookmarkTriggerRequest struct { Target *core.Optional[BookmarkTriggerRequestTarget] `json:"target,omitempty" url:"-"` } +type Bookmark struct { + // ID of the bookmark + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // ID of the associated connection + WebhookId string `json:"webhook_id" url:"webhook_id"` + // ID of the bookmarked event data + EventDataId string `json:"event_data_id" url:"event_data_id"` + // Descriptive name of the bookmark + Label string `json:"label" url:"label"` + // Alternate alias for the bookmark + Alias *string `json:"alias,omitempty" url:"alias,omitempty"` + Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` + // Date the bookmark was last manually triggered + LastUsedAt *time.Time `json:"last_used_at,omitempty" url:"last_used_at,omitempty"` + // Date the bookmark was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the bookmark was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *Bookmark) GetId() string { + if b == nil { + return "" + } + return b.Id +} + +func (b *Bookmark) GetTeamId() string { + if b == nil { + return "" + } + return b.TeamId +} + +func (b *Bookmark) GetWebhookId() string { + if b == nil { + return "" + } + return b.WebhookId +} + +func (b *Bookmark) GetEventDataId() string { + if b == nil { + return "" + } + return b.EventDataId +} + +func (b *Bookmark) GetLabel() string { + if b == nil { + return "" + } + return b.Label +} + +func (b *Bookmark) GetAlias() *string { + if b == nil { + return nil + } + return b.Alias +} + +func (b *Bookmark) GetData() *ShortEventData { + if b == nil { + return nil + } + return b.Data +} + +func (b *Bookmark) GetLastUsedAt() *time.Time { + if b == nil { + return nil + } + return b.LastUsedAt +} + +func (b *Bookmark) GetUpdatedAt() time.Time { + if b == nil { + return time.Time{} + } + return b.UpdatedAt +} + +func (b *Bookmark) GetCreatedAt() time.Time { + if b == nil { + return time.Time{} + } + return b.CreatedAt +} + +func (b *Bookmark) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *Bookmark) UnmarshalJSON(data []byte) error { + type embed Bookmark + var unmarshaler = struct { + embed + LastUsedAt *internal.DateTime `json:"last_used_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*b), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *b = Bookmark(unmarshaler.embed) + b.LastUsedAt = unmarshaler.LastUsedAt.TimePtr() + b.UpdatedAt = unmarshaler.UpdatedAt.Time() + b.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *Bookmark) MarshalJSON() ([]byte, error) { + type embed Bookmark + var marshaler = struct { + embed + LastUsedAt *internal.DateTime `json:"last_used_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*b), + LastUsedAt: internal.NewOptionalDateTime(b.LastUsedAt), + UpdatedAt: internal.NewDateTime(b.UpdatedAt), + CreatedAt: internal.NewDateTime(b.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (b *Bookmark) String() string { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BookmarkPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Bookmark `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BookmarkPaginatedResult) GetPagination() *SeekPagination { + if b == nil { + return nil + } + return b.Pagination +} + +func (b *BookmarkPaginatedResult) GetCount() *int { + if b == nil { + return nil + } + return b.Count +} + +func (b *BookmarkPaginatedResult) GetModels() []*Bookmark { + if b == nil { + return nil + } + return b.Models +} + +func (b *BookmarkPaginatedResult) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BookmarkPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler BookmarkPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BookmarkPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BookmarkPaginatedResult) String() string { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type DeletedBookmarkResponse struct { + // Bookmark ID + Id string `json:"id" url:"id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeletedBookmarkResponse) GetId() string { + if d == nil { + return "" + } + return d.Id +} + +func (d *DeletedBookmarkResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeletedBookmarkResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeletedBookmarkResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeletedBookmarkResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeletedBookmarkResponse) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type EventArray = []*Event + type BookmarkListRequestDir string const ( diff --git a/bookmark/client.go b/bookmark/client.go index eb537d4..230a1cc 100644 --- a/bookmark/client.go +++ b/bookmark/client.go @@ -3,20 +3,17 @@ package bookmark import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.BookmarkPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bookmarks" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BookmarkPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.Bookmark, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bookmarks" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Bookmark if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,50 +144,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Bookmark, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bookmarks/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bookmarks/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Bookmark if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -236,66 +192,52 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Bookmark, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bookmarks/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bookmarks/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Bookmark if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -309,50 +251,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.DeletedBookmarkResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bookmarks/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bookmarks/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.DeletedBookmarkResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -366,50 +298,40 @@ func (c *Client) RetrieveBody( opts ...option.RequestOption, ) (*hookdeckgosdk.RawBody, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bookmarks/%v/raw_body", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bookmarks/%v/raw_body", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RawBody if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -424,66 +346,52 @@ func (c *Client) Trigger( opts ...option.RequestOption, ) (hookdeckgosdk.EventArray, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bookmarks/%v/trigger", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bookmarks/%v/trigger", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response hookdeckgosdk.EventArray if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/client/client.go b/client/client.go index 0a68240..b3ba9be 100644 --- a/client/client.go +++ b/client/client.go @@ -12,6 +12,7 @@ import ( event "github.com/hookdeck/hookdeck-go-sdk/event" eventbulkretry "github.com/hookdeck/hookdeck-go-sdk/eventbulkretry" ignoredeventbulkretry "github.com/hookdeck/hookdeck-go-sdk/ignoredeventbulkretry" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" issue "github.com/hookdeck/hookdeck-go-sdk/issue" issuetrigger "github.com/hookdeck/hookdeck-go-sdk/issuetrigger" notification "github.com/hookdeck/hookdeck-go-sdk/notification" @@ -25,7 +26,7 @@ import ( type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header IssueTrigger *issuetrigger.Client @@ -49,8 +50,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, diff --git a/connection.go b/connection.go index 367f556..7a49a55 100644 --- a/connection.go +++ b/connection.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -49,12 +50,847 @@ type ConnectionListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +type Connection struct { + // ID of the connection + Id string `json:"id" url:"id"` + // Unique name of the connection for this source + Name *string `json:"name,omitempty" url:"name,omitempty"` + // Full name of the connection concatenated from source, connection and desitnation name + FullName *string `json:"full_name,omitempty" url:"full_name,omitempty"` + // Description of the connection + Description *string `json:"description,omitempty" url:"description,omitempty"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + Destination *Destination `json:"destination,omitempty" url:"destination,omitempty"` + Source *Source `json:"source,omitempty" url:"source,omitempty"` + // Array of rules configured on the connection + Rules []*Rule `json:"rules,omitempty" url:"rules,omitempty"` + // Date the connection was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` + // Date the connection was paused + PausedAt *time.Time `json:"paused_at,omitempty" url:"paused_at,omitempty"` + // Date the connection was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the connection was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *Connection) GetId() string { + if c == nil { + return "" + } + return c.Id +} + +func (c *Connection) GetName() *string { + if c == nil { + return nil + } + return c.Name +} + +func (c *Connection) GetFullName() *string { + if c == nil { + return nil + } + return c.FullName +} + +func (c *Connection) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *Connection) GetTeamId() string { + if c == nil { + return "" + } + return c.TeamId +} + +func (c *Connection) GetDestination() *Destination { + if c == nil { + return nil + } + return c.Destination +} + +func (c *Connection) GetSource() *Source { + if c == nil { + return nil + } + return c.Source +} + +func (c *Connection) GetRules() []*Rule { + if c == nil { + return nil + } + return c.Rules +} + +func (c *Connection) GetDisabledAt() *time.Time { + if c == nil { + return nil + } + return c.DisabledAt +} + +func (c *Connection) GetPausedAt() *time.Time { + if c == nil { + return nil + } + return c.PausedAt +} + +func (c *Connection) GetUpdatedAt() time.Time { + if c == nil { + return time.Time{} + } + return c.UpdatedAt +} + +func (c *Connection) GetCreatedAt() time.Time { + if c == nil { + return time.Time{} + } + return c.CreatedAt +} + +func (c *Connection) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *Connection) UnmarshalJSON(data []byte) error { + type embed Connection + var unmarshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + PausedAt *internal.DateTime `json:"paused_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = Connection(unmarshaler.embed) + c.DisabledAt = unmarshaler.DisabledAt.TimePtr() + c.PausedAt = unmarshaler.PausedAt.TimePtr() + c.UpdatedAt = unmarshaler.UpdatedAt.Time() + c.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *Connection) MarshalJSON() ([]byte, error) { + type embed Connection + var marshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + PausedAt *internal.DateTime `json:"paused_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*c), + DisabledAt: internal.NewOptionalDateTime(c.DisabledAt), + PausedAt: internal.NewOptionalDateTime(c.PausedAt), + UpdatedAt: internal.NewDateTime(c.UpdatedAt), + CreatedAt: internal.NewDateTime(c.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (c *Connection) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type ConnectionPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Connection `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ConnectionPaginatedResult) GetPagination() *SeekPagination { + if c == nil { + return nil + } + return c.Pagination +} + +func (c *ConnectionPaginatedResult) GetCount() *int { + if c == nil { + return nil + } + return c.Count +} + +func (c *ConnectionPaginatedResult) GetModels() []*Connection { + if c == nil { + return nil + } + return c.Models +} + +func (c *ConnectionPaginatedResult) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ConnectionPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler ConnectionPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = ConnectionPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ConnectionPaginatedResult) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type DelayRule struct { + // Delay to introduce in MS + Delay int `json:"delay" url:"delay"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DelayRule) GetDelay() int { + if d == nil { + return 0 + } + return d.Delay +} + +func (d *DelayRule) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DelayRule) UnmarshalJSON(data []byte) error { + type unmarshaler DelayRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DelayRule(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DelayRule) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type FilterRule struct { + Headers *FilterRuleProperty `json:"headers,omitempty" url:"headers,omitempty"` + Body *FilterRuleProperty `json:"body,omitempty" url:"body,omitempty"` + Query *FilterRuleProperty `json:"query,omitempty" url:"query,omitempty"` + Path *FilterRuleProperty `json:"path,omitempty" url:"path,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FilterRule) GetHeaders() *FilterRuleProperty { + if f == nil { + return nil + } + return f.Headers +} + +func (f *FilterRule) GetBody() *FilterRuleProperty { + if f == nil { + return nil + } + return f.Body +} + +func (f *FilterRule) GetQuery() *FilterRuleProperty { + if f == nil { + return nil + } + return f.Query +} + +func (f *FilterRule) GetPath() *FilterRuleProperty { + if f == nil { + return nil + } + return f.Path +} + +func (f *FilterRule) GetExtraProperties() map[string]interface{} { + return f.extraProperties +} + +func (f *FilterRule) UnmarshalJSON(data []byte) error { + type unmarshaler FilterRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FilterRule(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FilterRule) String() string { + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +// JSON using our filter syntax to filter on request headers +type FilterRuleProperty struct { + StringOptional *string + DoubleOptional *float64 + BooleanOptional *bool + StringUnknownMapOptional map[string]interface{} + + typ string +} + +func NewFilterRulePropertyFromStringOptional(value *string) *FilterRuleProperty { + return &FilterRuleProperty{typ: "StringOptional", StringOptional: value} +} + +func NewFilterRulePropertyFromDoubleOptional(value *float64) *FilterRuleProperty { + return &FilterRuleProperty{typ: "DoubleOptional", DoubleOptional: value} +} + +func NewFilterRulePropertyFromBooleanOptional(value *bool) *FilterRuleProperty { + return &FilterRuleProperty{typ: "BooleanOptional", BooleanOptional: value} +} + +func NewFilterRulePropertyFromStringUnknownMapOptional(value map[string]interface{}) *FilterRuleProperty { + return &FilterRuleProperty{typ: "StringUnknownMapOptional", StringUnknownMapOptional: value} +} + +func (f *FilterRuleProperty) GetStringOptional() *string { + if f == nil { + return nil + } + return f.StringOptional +} + +func (f *FilterRuleProperty) GetDoubleOptional() *float64 { + if f == nil { + return nil + } + return f.DoubleOptional +} + +func (f *FilterRuleProperty) GetBooleanOptional() *bool { + if f == nil { + return nil + } + return f.BooleanOptional +} + +func (f *FilterRuleProperty) GetStringUnknownMapOptional() map[string]interface{} { + if f == nil { + return nil + } + return f.StringUnknownMapOptional +} + +func (f *FilterRuleProperty) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + f.typ = "StringOptional" + f.StringOptional = valueStringOptional + return nil + } + var valueDoubleOptional *float64 + if err := json.Unmarshal(data, &valueDoubleOptional); err == nil { + f.typ = "DoubleOptional" + f.DoubleOptional = valueDoubleOptional + return nil + } + var valueBooleanOptional *bool + if err := json.Unmarshal(data, &valueBooleanOptional); err == nil { + f.typ = "BooleanOptional" + f.BooleanOptional = valueBooleanOptional + return nil + } + var valueStringUnknownMapOptional map[string]interface{} + if err := json.Unmarshal(data, &valueStringUnknownMapOptional); err == nil { + f.typ = "StringUnknownMapOptional" + f.StringUnknownMapOptional = valueStringUnknownMapOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, f) +} + +func (f FilterRuleProperty) MarshalJSON() ([]byte, error) { + if f.typ == "StringOptional" || f.StringOptional != nil { + return json.Marshal(f.StringOptional) + } + if f.typ == "DoubleOptional" || f.DoubleOptional != nil { + return json.Marshal(f.DoubleOptional) + } + if f.typ == "BooleanOptional" || f.BooleanOptional != nil { + return json.Marshal(f.BooleanOptional) + } + if f.typ == "StringUnknownMapOptional" || f.StringUnknownMapOptional != nil { + return json.Marshal(f.StringUnknownMapOptional) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", f) +} + +type FilterRulePropertyVisitor interface { + VisitStringOptional(*string) error + VisitDoubleOptional(*float64) error + VisitBooleanOptional(*bool) error + VisitStringUnknownMapOptional(map[string]interface{}) error +} + +func (f *FilterRuleProperty) Accept(visitor FilterRulePropertyVisitor) error { + if f.typ == "StringOptional" || f.StringOptional != nil { + return visitor.VisitStringOptional(f.StringOptional) + } + if f.typ == "DoubleOptional" || f.DoubleOptional != nil { + return visitor.VisitDoubleOptional(f.DoubleOptional) + } + if f.typ == "BooleanOptional" || f.BooleanOptional != nil { + return visitor.VisitBooleanOptional(f.BooleanOptional) + } + if f.typ == "StringUnknownMapOptional" || f.StringUnknownMapOptional != nil { + return visitor.VisitStringUnknownMapOptional(f.StringUnknownMapOptional) + } + return fmt.Errorf("type %T does not include a non-empty union type", f) +} + +type RetryRule struct { + Strategy RetryStrategy `json:"strategy" url:"strategy"` + // Time in MS between each retry + Interval *int `json:"interval,omitempty" url:"interval,omitempty"` + // Maximum number of retries to attempt + Count *int `json:"count,omitempty" url:"count,omitempty"` + // HTTP codes to retry on. Accepts: range expressions (e.g., "400-499", ">400"), specific codes (e.g., 404), and exclusions (e.g., "!401"). Example: ["500-599", ">400", 404, "!401"] + ResponseStatusCodes []string `json:"response_status_codes,omitempty" url:"response_status_codes,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RetryRule) GetStrategy() RetryStrategy { + if r == nil { + return "" + } + return r.Strategy +} + +func (r *RetryRule) GetInterval() *int { + if r == nil { + return nil + } + return r.Interval +} + +func (r *RetryRule) GetCount() *int { + if r == nil { + return nil + } + return r.Count +} + +func (r *RetryRule) GetResponseStatusCodes() []string { + if r == nil { + return nil + } + return r.ResponseStatusCodes +} + +func (r *RetryRule) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RetryRule) UnmarshalJSON(data []byte) error { + type unmarshaler RetryRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RetryRule(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RetryRule) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +// Algorithm to use when calculating delay between retries +type RetryStrategy string + +const ( + RetryStrategyLinear RetryStrategy = "linear" + RetryStrategyExponential RetryStrategy = "exponential" +) + +func NewRetryStrategyFromString(s string) (RetryStrategy, error) { + switch s { + case "linear": + return RetryStrategyLinear, nil + case "exponential": + return RetryStrategyExponential, nil + } + var t RetryStrategy + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RetryStrategy) Ptr() *RetryStrategy { + return &r +} + +type Rule struct { + Type string + Retry *RetryRule + Filter *FilterRule + Transform *TransformRule + Delay *DelayRule +} + +func NewRuleFromRetry(value *RetryRule) *Rule { + return &Rule{Type: "retry", Retry: value} +} + +func NewRuleFromFilter(value *FilterRule) *Rule { + return &Rule{Type: "filter", Filter: value} +} + +func NewRuleFromTransform(value *TransformRule) *Rule { + return &Rule{Type: "transform", Transform: value} +} + +func NewRuleFromDelay(value *DelayRule) *Rule { + return &Rule{Type: "delay", Delay: value} +} + +func (r *Rule) GetType() string { + if r == nil { + return "" + } + return r.Type +} + +func (r *Rule) GetRetry() *RetryRule { + if r == nil { + return nil + } + return r.Retry +} + +func (r *Rule) GetFilter() *FilterRule { + if r == nil { + return nil + } + return r.Filter +} + +func (r *Rule) GetTransform() *TransformRule { + if r == nil { + return nil + } + return r.Transform +} + +func (r *Rule) GetDelay() *DelayRule { + if r == nil { + return nil + } + return r.Delay +} + +func (r *Rule) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + r.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", r) + } + switch unmarshaler.Type { + case "retry": + value := new(RetryRule) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + r.Retry = value + case "filter": + value := new(FilterRule) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + r.Filter = value + case "transform": + value := new(TransformRule) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + r.Transform = value + case "delay": + value := new(DelayRule) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + r.Delay = value + } + return nil +} + +func (r Rule) MarshalJSON() ([]byte, error) { + switch r.Type { + default: + return nil, fmt.Errorf("invalid type %s in %T", r.Type, r) + case "retry": + return internal.MarshalJSONWithExtraProperty(r.Retry, "type", "retry") + case "filter": + return internal.MarshalJSONWithExtraProperty(r.Filter, "type", "filter") + case "transform": + return internal.MarshalJSONWithExtraProperty(r.Transform, "type", "transform") + case "delay": + return internal.MarshalJSONWithExtraProperty(r.Delay, "type", "delay") + } +} + +type RuleVisitor interface { + VisitRetry(*RetryRule) error + VisitFilter(*FilterRule) error + VisitTransform(*TransformRule) error + VisitDelay(*DelayRule) error +} + +func (r *Rule) Accept(visitor RuleVisitor) error { + switch r.Type { + default: + return fmt.Errorf("invalid type %s in %T", r.Type, r) + case "retry": + return visitor.VisitRetry(r.Retry) + case "filter": + return visitor.VisitFilter(r.Filter) + case "transform": + return visitor.VisitTransform(r.Transform) + case "delay": + return visitor.VisitDelay(r.Delay) + } +} + +type TransformRule struct { + // ID of the attached transformation object. Optional input, always set once the rule is defined + TransformationId *string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` + // You can optionally define a new transformation while creating a transform rule + Transformation *TransformRuleTransformation `json:"transformation,omitempty" url:"transformation,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformRule) GetTransformationId() *string { + if t == nil { + return nil + } + return t.TransformationId +} + +func (t *TransformRule) GetTransformation() *TransformRuleTransformation { + if t == nil { + return nil + } + return t.Transformation +} + +func (t *TransformRule) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformRule) UnmarshalJSON(data []byte) error { + type unmarshaler TransformRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformRule(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformRule) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// You can optionally define a new transformation while creating a transform rule +type TransformRuleTransformation struct { + // The unique name of the transformation + Name string `json:"name" url:"name"` + // A string representation of your JavaScript (ES6) code to run + Code string `json:"code" url:"code"` + // A key-value object of environment variables to encrypt and expose to your transformation code + Env map[string]*string `json:"env,omitempty" url:"env,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformRuleTransformation) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *TransformRuleTransformation) GetCode() string { + if t == nil { + return "" + } + return t.Code +} + +func (t *TransformRuleTransformation) GetEnv() map[string]*string { + if t == nil { + return nil + } + return t.Env +} + +func (t *TransformRuleTransformation) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformRuleTransformation) UnmarshalJSON(data []byte) error { + type unmarshaler TransformRuleTransformation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformRuleTransformation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformRuleTransformation) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + type ConnectionCountResponse struct { // Count of connections Count float64 `json:"count" url:"count"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionCountResponse) GetCount() float64 { + if c == nil { + return 0 + } + return c.Count } func (c *ConnectionCountResponse) GetExtraProperties() map[string]interface{} { @@ -68,24 +904,22 @@ func (c *ConnectionCountResponse) UnmarshalJSON(data []byte) error { return err } *c = ConnectionCountResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionCountResponse) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) @@ -108,9 +942,89 @@ type ConnectionCreateRequestDestination struct { HttpMethod *DestinationHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty" url:"auth_method,omitempty"` PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + // Type of the destination + Type *ConnectionCreateRequestDestinationType `json:"type,omitempty" url:"type,omitempty"` + Config *DestinationConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionCreateRequestDestination) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *ConnectionCreateRequestDestination) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *ConnectionCreateRequestDestination) GetUrl() *string { + if c == nil { + return nil + } + return c.Url +} + +func (c *ConnectionCreateRequestDestination) GetCliPath() *string { + if c == nil { + return nil + } + return c.CliPath +} + +func (c *ConnectionCreateRequestDestination) GetRateLimit() *int { + if c == nil { + return nil + } + return c.RateLimit +} + +func (c *ConnectionCreateRequestDestination) GetRateLimitPeriod() *ConnectionCreateRequestDestinationRateLimitPeriod { + if c == nil { + return nil + } + return c.RateLimitPeriod +} + +func (c *ConnectionCreateRequestDestination) GetHttpMethod() *DestinationHttpMethod { + if c == nil { + return nil + } + return c.HttpMethod +} + +func (c *ConnectionCreateRequestDestination) GetAuthMethod() *DestinationAuthMethodConfig { + if c == nil { + return nil + } + return c.AuthMethod +} + +func (c *ConnectionCreateRequestDestination) GetPathForwardingDisabled() *bool { + if c == nil { + return nil + } + return c.PathForwardingDisabled +} + +func (c *ConnectionCreateRequestDestination) GetType() *ConnectionCreateRequestDestinationType { + if c == nil { + return nil + } + return c.Type +} + +func (c *ConnectionCreateRequestDestination) GetConfig() *DestinationConfig { + if c == nil { + return nil + } + return c.Config } func (c *ConnectionCreateRequestDestination) GetExtraProperties() map[string]interface{} { @@ -124,29 +1038,82 @@ func (c *ConnectionCreateRequestDestination) UnmarshalJSON(data []byte) error { return err } *c = ConnectionCreateRequestDestination(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionCreateRequestDestination) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) } +// Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. +type ConnectionCreateRequestDestinationRateLimitPeriod string + +const ( + ConnectionCreateRequestDestinationRateLimitPeriodSecond ConnectionCreateRequestDestinationRateLimitPeriod = "second" + ConnectionCreateRequestDestinationRateLimitPeriodMinute ConnectionCreateRequestDestinationRateLimitPeriod = "minute" + ConnectionCreateRequestDestinationRateLimitPeriodHour ConnectionCreateRequestDestinationRateLimitPeriod = "hour" + ConnectionCreateRequestDestinationRateLimitPeriodConcurrent ConnectionCreateRequestDestinationRateLimitPeriod = "concurrent" +) + +func NewConnectionCreateRequestDestinationRateLimitPeriodFromString(s string) (ConnectionCreateRequestDestinationRateLimitPeriod, error) { + switch s { + case "second": + return ConnectionCreateRequestDestinationRateLimitPeriodSecond, nil + case "minute": + return ConnectionCreateRequestDestinationRateLimitPeriodMinute, nil + case "hour": + return ConnectionCreateRequestDestinationRateLimitPeriodHour, nil + case "concurrent": + return ConnectionCreateRequestDestinationRateLimitPeriodConcurrent, nil + } + var t ConnectionCreateRequestDestinationRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionCreateRequestDestinationRateLimitPeriod) Ptr() *ConnectionCreateRequestDestinationRateLimitPeriod { + return &c +} + +// Type of the destination +type ConnectionCreateRequestDestinationType string + +const ( + ConnectionCreateRequestDestinationTypeHttp ConnectionCreateRequestDestinationType = "HTTP" + ConnectionCreateRequestDestinationTypeCli ConnectionCreateRequestDestinationType = "CLI" + ConnectionCreateRequestDestinationTypeMockApi ConnectionCreateRequestDestinationType = "MOCK_API" +) + +func NewConnectionCreateRequestDestinationTypeFromString(s string) (ConnectionCreateRequestDestinationType, error) { + switch s { + case "HTTP": + return ConnectionCreateRequestDestinationTypeHttp, nil + case "CLI": + return ConnectionCreateRequestDestinationTypeCli, nil + case "MOCK_API": + return ConnectionCreateRequestDestinationTypeMockApi, nil + } + var t ConnectionCreateRequestDestinationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionCreateRequestDestinationType) Ptr() *ConnectionCreateRequestDestinationType { + return &c +} + // Source input object type ConnectionCreateRequestSource struct { // A unique name for the source @@ -156,9 +1123,61 @@ type ConnectionCreateRequestSource struct { AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` CustomResponse *SourceCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` Verification *VerificationConfig `json:"verification,omitempty" url:"verification,omitempty"` + // Type of the source + Type *ConnectionCreateRequestSourceType `json:"type,omitempty" url:"type,omitempty"` + Config *SourceTypeConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionCreateRequestSource) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *ConnectionCreateRequestSource) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *ConnectionCreateRequestSource) GetAllowedHttpMethods() *SourceAllowedHttpMethod { + if c == nil { + return nil + } + return c.AllowedHttpMethods +} + +func (c *ConnectionCreateRequestSource) GetCustomResponse() *SourceCustomResponse { + if c == nil { + return nil + } + return c.CustomResponse +} + +func (c *ConnectionCreateRequestSource) GetVerification() *VerificationConfig { + if c == nil { + return nil + } + return c.Verification +} + +func (c *ConnectionCreateRequestSource) GetType() *ConnectionCreateRequestSourceType { + if c == nil { + return nil + } + return c.Type +} + +func (c *ConnectionCreateRequestSource) GetConfig() *SourceTypeConfig { + if c == nil { + return nil + } + return c.Config } func (c *ConnectionCreateRequestSource) GetExtraProperties() map[string]interface{} { @@ -172,35 +1191,270 @@ func (c *ConnectionCreateRequestSource) UnmarshalJSON(data []byte) error { return err } *c = ConnectionCreateRequestSource(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionCreateRequestSource) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) } +// Type of the source +type ConnectionCreateRequestSourceType string + +const ( + ConnectionCreateRequestSourceTypeWebhook ConnectionCreateRequestSourceType = "WEBHOOK" + ConnectionCreateRequestSourceTypeHttp ConnectionCreateRequestSourceType = "HTTP" + ConnectionCreateRequestSourceTypeSanity ConnectionCreateRequestSourceType = "SANITY" + ConnectionCreateRequestSourceTypeBridge ConnectionCreateRequestSourceType = "BRIDGE" + ConnectionCreateRequestSourceTypeCloudsignal ConnectionCreateRequestSourceType = "CLOUDSIGNAL" + ConnectionCreateRequestSourceTypeCourier ConnectionCreateRequestSourceType = "COURIER" + ConnectionCreateRequestSourceTypeFrontapp ConnectionCreateRequestSourceType = "FRONTAPP" + ConnectionCreateRequestSourceTypeZoom ConnectionCreateRequestSourceType = "ZOOM" + ConnectionCreateRequestSourceTypeTwitter ConnectionCreateRequestSourceType = "TWITTER" + ConnectionCreateRequestSourceTypeRecharge ConnectionCreateRequestSourceType = "RECHARGE" + ConnectionCreateRequestSourceTypeStripe ConnectionCreateRequestSourceType = "STRIPE" + ConnectionCreateRequestSourceTypePropertyFinder ConnectionCreateRequestSourceType = "PROPERTY-FINDER" + ConnectionCreateRequestSourceTypeShopify ConnectionCreateRequestSourceType = "SHOPIFY" + ConnectionCreateRequestSourceTypeTwilio ConnectionCreateRequestSourceType = "TWILIO" + ConnectionCreateRequestSourceTypeGithub ConnectionCreateRequestSourceType = "GITHUB" + ConnectionCreateRequestSourceTypePostmark ConnectionCreateRequestSourceType = "POSTMARK" + ConnectionCreateRequestSourceTypeTypeform ConnectionCreateRequestSourceType = "TYPEFORM" + ConnectionCreateRequestSourceTypeXero ConnectionCreateRequestSourceType = "XERO" + ConnectionCreateRequestSourceTypeSvix ConnectionCreateRequestSourceType = "SVIX" + ConnectionCreateRequestSourceTypeAdyen ConnectionCreateRequestSourceType = "ADYEN" + ConnectionCreateRequestSourceTypeAkeneo ConnectionCreateRequestSourceType = "AKENEO" + ConnectionCreateRequestSourceTypeGitlab ConnectionCreateRequestSourceType = "GITLAB" + ConnectionCreateRequestSourceTypeWoocommerce ConnectionCreateRequestSourceType = "WOOCOMMERCE" + ConnectionCreateRequestSourceTypeOura ConnectionCreateRequestSourceType = "OURA" + ConnectionCreateRequestSourceTypeCommercelayer ConnectionCreateRequestSourceType = "COMMERCELAYER" + ConnectionCreateRequestSourceTypeHubspot ConnectionCreateRequestSourceType = "HUBSPOT" + ConnectionCreateRequestSourceTypeMailgun ConnectionCreateRequestSourceType = "MAILGUN" + ConnectionCreateRequestSourceTypePersona ConnectionCreateRequestSourceType = "PERSONA" + ConnectionCreateRequestSourceTypePipedrive ConnectionCreateRequestSourceType = "PIPEDRIVE" + ConnectionCreateRequestSourceTypeSendgrid ConnectionCreateRequestSourceType = "SENDGRID" + ConnectionCreateRequestSourceTypeWorkos ConnectionCreateRequestSourceType = "WORKOS" + ConnectionCreateRequestSourceTypeSynctera ConnectionCreateRequestSourceType = "SYNCTERA" + ConnectionCreateRequestSourceTypeAwsSns ConnectionCreateRequestSourceType = "AWS_SNS" + ConnectionCreateRequestSourceTypeThreeDEye ConnectionCreateRequestSourceType = "THREE_D_EYE" + ConnectionCreateRequestSourceTypeTwitch ConnectionCreateRequestSourceType = "TWITCH" + ConnectionCreateRequestSourceTypeEnode ConnectionCreateRequestSourceType = "ENODE" + ConnectionCreateRequestSourceTypeFavro ConnectionCreateRequestSourceType = "FAVRO" + ConnectionCreateRequestSourceTypeLinear ConnectionCreateRequestSourceType = "LINEAR" + ConnectionCreateRequestSourceTypeShopline ConnectionCreateRequestSourceType = "SHOPLINE" + ConnectionCreateRequestSourceTypeWix ConnectionCreateRequestSourceType = "WIX" + ConnectionCreateRequestSourceTypeNmi ConnectionCreateRequestSourceType = "NMI" + ConnectionCreateRequestSourceTypeOrb ConnectionCreateRequestSourceType = "ORB" + ConnectionCreateRequestSourceTypePylon ConnectionCreateRequestSourceType = "PYLON" + ConnectionCreateRequestSourceTypeRazorpay ConnectionCreateRequestSourceType = "RAZORPAY" + ConnectionCreateRequestSourceTypeRepay ConnectionCreateRequestSourceType = "REPAY" + ConnectionCreateRequestSourceTypeSquare ConnectionCreateRequestSourceType = "SQUARE" + ConnectionCreateRequestSourceTypeSolidgate ConnectionCreateRequestSourceType = "SOLIDGATE" + ConnectionCreateRequestSourceTypeTrello ConnectionCreateRequestSourceType = "TRELLO" + ConnectionCreateRequestSourceTypeEbay ConnectionCreateRequestSourceType = "EBAY" + ConnectionCreateRequestSourceTypeTelnyx ConnectionCreateRequestSourceType = "TELNYX" + ConnectionCreateRequestSourceTypeDiscord ConnectionCreateRequestSourceType = "DISCORD" + ConnectionCreateRequestSourceTypeTokenio ConnectionCreateRequestSourceType = "TOKENIO" + ConnectionCreateRequestSourceTypeFiserv ConnectionCreateRequestSourceType = "FISERV" + ConnectionCreateRequestSourceTypeBondsmith ConnectionCreateRequestSourceType = "BONDSMITH" + ConnectionCreateRequestSourceTypeVercelLogDrains ConnectionCreateRequestSourceType = "VERCEL_LOG_DRAINS" + ConnectionCreateRequestSourceTypeVercel ConnectionCreateRequestSourceType = "VERCEL" + ConnectionCreateRequestSourceTypeTebex ConnectionCreateRequestSourceType = "TEBEX" + ConnectionCreateRequestSourceTypeSlack ConnectionCreateRequestSourceType = "SLACK" + ConnectionCreateRequestSourceTypeMailchimp ConnectionCreateRequestSourceType = "MAILCHIMP" + ConnectionCreateRequestSourceTypePaddle ConnectionCreateRequestSourceType = "PADDLE" + ConnectionCreateRequestSourceTypePaypal ConnectionCreateRequestSourceType = "PAYPAL" + ConnectionCreateRequestSourceTypeTreezor ConnectionCreateRequestSourceType = "TREEZOR" + ConnectionCreateRequestSourceTypePraxis ConnectionCreateRequestSourceType = "PRAXIS" + ConnectionCreateRequestSourceTypeCustomerio ConnectionCreateRequestSourceType = "CUSTOMERIO" + ConnectionCreateRequestSourceTypeFacebook ConnectionCreateRequestSourceType = "FACEBOOK" + ConnectionCreateRequestSourceTypeWhatsapp ConnectionCreateRequestSourceType = "WHATSAPP" + ConnectionCreateRequestSourceTypeReplicate ConnectionCreateRequestSourceType = "REPLICATE" + ConnectionCreateRequestSourceTypeTiktok ConnectionCreateRequestSourceType = "TIKTOK" + ConnectionCreateRequestSourceTypeAirwallex ConnectionCreateRequestSourceType = "AIRWALLEX" + ConnectionCreateRequestSourceTypeZendesk ConnectionCreateRequestSourceType = "ZENDESK" + ConnectionCreateRequestSourceTypeUpollo ConnectionCreateRequestSourceType = "UPOLLO" +) + +func NewConnectionCreateRequestSourceTypeFromString(s string) (ConnectionCreateRequestSourceType, error) { + switch s { + case "WEBHOOK": + return ConnectionCreateRequestSourceTypeWebhook, nil + case "HTTP": + return ConnectionCreateRequestSourceTypeHttp, nil + case "SANITY": + return ConnectionCreateRequestSourceTypeSanity, nil + case "BRIDGE": + return ConnectionCreateRequestSourceTypeBridge, nil + case "CLOUDSIGNAL": + return ConnectionCreateRequestSourceTypeCloudsignal, nil + case "COURIER": + return ConnectionCreateRequestSourceTypeCourier, nil + case "FRONTAPP": + return ConnectionCreateRequestSourceTypeFrontapp, nil + case "ZOOM": + return ConnectionCreateRequestSourceTypeZoom, nil + case "TWITTER": + return ConnectionCreateRequestSourceTypeTwitter, nil + case "RECHARGE": + return ConnectionCreateRequestSourceTypeRecharge, nil + case "STRIPE": + return ConnectionCreateRequestSourceTypeStripe, nil + case "PROPERTY-FINDER": + return ConnectionCreateRequestSourceTypePropertyFinder, nil + case "SHOPIFY": + return ConnectionCreateRequestSourceTypeShopify, nil + case "TWILIO": + return ConnectionCreateRequestSourceTypeTwilio, nil + case "GITHUB": + return ConnectionCreateRequestSourceTypeGithub, nil + case "POSTMARK": + return ConnectionCreateRequestSourceTypePostmark, nil + case "TYPEFORM": + return ConnectionCreateRequestSourceTypeTypeform, nil + case "XERO": + return ConnectionCreateRequestSourceTypeXero, nil + case "SVIX": + return ConnectionCreateRequestSourceTypeSvix, nil + case "ADYEN": + return ConnectionCreateRequestSourceTypeAdyen, nil + case "AKENEO": + return ConnectionCreateRequestSourceTypeAkeneo, nil + case "GITLAB": + return ConnectionCreateRequestSourceTypeGitlab, nil + case "WOOCOMMERCE": + return ConnectionCreateRequestSourceTypeWoocommerce, nil + case "OURA": + return ConnectionCreateRequestSourceTypeOura, nil + case "COMMERCELAYER": + return ConnectionCreateRequestSourceTypeCommercelayer, nil + case "HUBSPOT": + return ConnectionCreateRequestSourceTypeHubspot, nil + case "MAILGUN": + return ConnectionCreateRequestSourceTypeMailgun, nil + case "PERSONA": + return ConnectionCreateRequestSourceTypePersona, nil + case "PIPEDRIVE": + return ConnectionCreateRequestSourceTypePipedrive, nil + case "SENDGRID": + return ConnectionCreateRequestSourceTypeSendgrid, nil + case "WORKOS": + return ConnectionCreateRequestSourceTypeWorkos, nil + case "SYNCTERA": + return ConnectionCreateRequestSourceTypeSynctera, nil + case "AWS_SNS": + return ConnectionCreateRequestSourceTypeAwsSns, nil + case "THREE_D_EYE": + return ConnectionCreateRequestSourceTypeThreeDEye, nil + case "TWITCH": + return ConnectionCreateRequestSourceTypeTwitch, nil + case "ENODE": + return ConnectionCreateRequestSourceTypeEnode, nil + case "FAVRO": + return ConnectionCreateRequestSourceTypeFavro, nil + case "LINEAR": + return ConnectionCreateRequestSourceTypeLinear, nil + case "SHOPLINE": + return ConnectionCreateRequestSourceTypeShopline, nil + case "WIX": + return ConnectionCreateRequestSourceTypeWix, nil + case "NMI": + return ConnectionCreateRequestSourceTypeNmi, nil + case "ORB": + return ConnectionCreateRequestSourceTypeOrb, nil + case "PYLON": + return ConnectionCreateRequestSourceTypePylon, nil + case "RAZORPAY": + return ConnectionCreateRequestSourceTypeRazorpay, nil + case "REPAY": + return ConnectionCreateRequestSourceTypeRepay, nil + case "SQUARE": + return ConnectionCreateRequestSourceTypeSquare, nil + case "SOLIDGATE": + return ConnectionCreateRequestSourceTypeSolidgate, nil + case "TRELLO": + return ConnectionCreateRequestSourceTypeTrello, nil + case "EBAY": + return ConnectionCreateRequestSourceTypeEbay, nil + case "TELNYX": + return ConnectionCreateRequestSourceTypeTelnyx, nil + case "DISCORD": + return ConnectionCreateRequestSourceTypeDiscord, nil + case "TOKENIO": + return ConnectionCreateRequestSourceTypeTokenio, nil + case "FISERV": + return ConnectionCreateRequestSourceTypeFiserv, nil + case "BONDSMITH": + return ConnectionCreateRequestSourceTypeBondsmith, nil + case "VERCEL_LOG_DRAINS": + return ConnectionCreateRequestSourceTypeVercelLogDrains, nil + case "VERCEL": + return ConnectionCreateRequestSourceTypeVercel, nil + case "TEBEX": + return ConnectionCreateRequestSourceTypeTebex, nil + case "SLACK": + return ConnectionCreateRequestSourceTypeSlack, nil + case "MAILCHIMP": + return ConnectionCreateRequestSourceTypeMailchimp, nil + case "PADDLE": + return ConnectionCreateRequestSourceTypePaddle, nil + case "PAYPAL": + return ConnectionCreateRequestSourceTypePaypal, nil + case "TREEZOR": + return ConnectionCreateRequestSourceTypeTreezor, nil + case "PRAXIS": + return ConnectionCreateRequestSourceTypePraxis, nil + case "CUSTOMERIO": + return ConnectionCreateRequestSourceTypeCustomerio, nil + case "FACEBOOK": + return ConnectionCreateRequestSourceTypeFacebook, nil + case "WHATSAPP": + return ConnectionCreateRequestSourceTypeWhatsapp, nil + case "REPLICATE": + return ConnectionCreateRequestSourceTypeReplicate, nil + case "TIKTOK": + return ConnectionCreateRequestSourceTypeTiktok, nil + case "AIRWALLEX": + return ConnectionCreateRequestSourceTypeAirwallex, nil + case "ZENDESK": + return ConnectionCreateRequestSourceTypeZendesk, nil + case "UPOLLO": + return ConnectionCreateRequestSourceTypeUpollo, nil + } + var t ConnectionCreateRequestSourceType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionCreateRequestSourceType) Ptr() *ConnectionCreateRequestSourceType { + return &c +} + type ConnectionDeleteResponse struct { // ID of the connection Id string `json:"id" url:"id"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionDeleteResponse) GetId() string { + if c == nil { + return "" + } + return c.Id } func (c *ConnectionDeleteResponse) GetExtraProperties() map[string]interface{} { @@ -214,24 +1468,22 @@ func (c *ConnectionDeleteResponse) UnmarshalJSON(data []byte) error { return err } *c = ConnectionDeleteResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionDeleteResponse) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) @@ -310,9 +1562,89 @@ type ConnectionUpsertRequestDestination struct { HttpMethod *DestinationHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty" url:"auth_method,omitempty"` PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + // Type of the destination + Type *ConnectionUpsertRequestDestinationType `json:"type,omitempty" url:"type,omitempty"` + Config *DestinationConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionUpsertRequestDestination) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *ConnectionUpsertRequestDestination) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *ConnectionUpsertRequestDestination) GetUrl() *string { + if c == nil { + return nil + } + return c.Url +} + +func (c *ConnectionUpsertRequestDestination) GetCliPath() *string { + if c == nil { + return nil + } + return c.CliPath +} + +func (c *ConnectionUpsertRequestDestination) GetRateLimit() *int { + if c == nil { + return nil + } + return c.RateLimit +} + +func (c *ConnectionUpsertRequestDestination) GetRateLimitPeriod() *ConnectionUpsertRequestDestinationRateLimitPeriod { + if c == nil { + return nil + } + return c.RateLimitPeriod +} + +func (c *ConnectionUpsertRequestDestination) GetHttpMethod() *DestinationHttpMethod { + if c == nil { + return nil + } + return c.HttpMethod +} + +func (c *ConnectionUpsertRequestDestination) GetAuthMethod() *DestinationAuthMethodConfig { + if c == nil { + return nil + } + return c.AuthMethod +} + +func (c *ConnectionUpsertRequestDestination) GetPathForwardingDisabled() *bool { + if c == nil { + return nil + } + return c.PathForwardingDisabled +} + +func (c *ConnectionUpsertRequestDestination) GetType() *ConnectionUpsertRequestDestinationType { + if c == nil { + return nil + } + return c.Type +} + +func (c *ConnectionUpsertRequestDestination) GetConfig() *DestinationConfig { + if c == nil { + return nil + } + return c.Config } func (c *ConnectionUpsertRequestDestination) GetExtraProperties() map[string]interface{} { @@ -326,29 +1658,82 @@ func (c *ConnectionUpsertRequestDestination) UnmarshalJSON(data []byte) error { return err } *c = ConnectionUpsertRequestDestination(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionUpsertRequestDestination) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) } +// Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. +type ConnectionUpsertRequestDestinationRateLimitPeriod string + +const ( + ConnectionUpsertRequestDestinationRateLimitPeriodSecond ConnectionUpsertRequestDestinationRateLimitPeriod = "second" + ConnectionUpsertRequestDestinationRateLimitPeriodMinute ConnectionUpsertRequestDestinationRateLimitPeriod = "minute" + ConnectionUpsertRequestDestinationRateLimitPeriodHour ConnectionUpsertRequestDestinationRateLimitPeriod = "hour" + ConnectionUpsertRequestDestinationRateLimitPeriodConcurrent ConnectionUpsertRequestDestinationRateLimitPeriod = "concurrent" +) + +func NewConnectionUpsertRequestDestinationRateLimitPeriodFromString(s string) (ConnectionUpsertRequestDestinationRateLimitPeriod, error) { + switch s { + case "second": + return ConnectionUpsertRequestDestinationRateLimitPeriodSecond, nil + case "minute": + return ConnectionUpsertRequestDestinationRateLimitPeriodMinute, nil + case "hour": + return ConnectionUpsertRequestDestinationRateLimitPeriodHour, nil + case "concurrent": + return ConnectionUpsertRequestDestinationRateLimitPeriodConcurrent, nil + } + var t ConnectionUpsertRequestDestinationRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionUpsertRequestDestinationRateLimitPeriod) Ptr() *ConnectionUpsertRequestDestinationRateLimitPeriod { + return &c +} + +// Type of the destination +type ConnectionUpsertRequestDestinationType string + +const ( + ConnectionUpsertRequestDestinationTypeHttp ConnectionUpsertRequestDestinationType = "HTTP" + ConnectionUpsertRequestDestinationTypeCli ConnectionUpsertRequestDestinationType = "CLI" + ConnectionUpsertRequestDestinationTypeMockApi ConnectionUpsertRequestDestinationType = "MOCK_API" +) + +func NewConnectionUpsertRequestDestinationTypeFromString(s string) (ConnectionUpsertRequestDestinationType, error) { + switch s { + case "HTTP": + return ConnectionUpsertRequestDestinationTypeHttp, nil + case "CLI": + return ConnectionUpsertRequestDestinationTypeCli, nil + case "MOCK_API": + return ConnectionUpsertRequestDestinationTypeMockApi, nil + } + var t ConnectionUpsertRequestDestinationType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionUpsertRequestDestinationType) Ptr() *ConnectionUpsertRequestDestinationType { + return &c +} + // Source input object type ConnectionUpsertRequestSource struct { // A unique name for the source @@ -358,9 +1743,61 @@ type ConnectionUpsertRequestSource struct { AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` CustomResponse *SourceCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` Verification *VerificationConfig `json:"verification,omitempty" url:"verification,omitempty"` + // Type of the source + Type *ConnectionUpsertRequestSourceType `json:"type,omitempty" url:"type,omitempty"` + Config *SourceTypeConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (c *ConnectionUpsertRequestSource) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *ConnectionUpsertRequestSource) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *ConnectionUpsertRequestSource) GetAllowedHttpMethods() *SourceAllowedHttpMethod { + if c == nil { + return nil + } + return c.AllowedHttpMethods +} + +func (c *ConnectionUpsertRequestSource) GetCustomResponse() *SourceCustomResponse { + if c == nil { + return nil + } + return c.CustomResponse +} + +func (c *ConnectionUpsertRequestSource) GetVerification() *VerificationConfig { + if c == nil { + return nil + } + return c.Verification +} + +func (c *ConnectionUpsertRequestSource) GetType() *ConnectionUpsertRequestSourceType { + if c == nil { + return nil + } + return c.Type +} + +func (c *ConnectionUpsertRequestSource) GetConfig() *SourceTypeConfig { + if c == nil { + return nil + } + return c.Config } func (c *ConnectionUpsertRequestSource) GetExtraProperties() map[string]interface{} { @@ -374,29 +1811,257 @@ func (c *ConnectionUpsertRequestSource) UnmarshalJSON(data []byte) error { return err } *c = ConnectionUpsertRequestSource(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) + c.rawJSON = json.RawMessage(data) return nil } func (c *ConnectionUpsertRequestSource) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(c); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } return fmt.Sprintf("%#v", c) } +// Type of the source +type ConnectionUpsertRequestSourceType string + +const ( + ConnectionUpsertRequestSourceTypeWebhook ConnectionUpsertRequestSourceType = "WEBHOOK" + ConnectionUpsertRequestSourceTypeHttp ConnectionUpsertRequestSourceType = "HTTP" + ConnectionUpsertRequestSourceTypeSanity ConnectionUpsertRequestSourceType = "SANITY" + ConnectionUpsertRequestSourceTypeBridge ConnectionUpsertRequestSourceType = "BRIDGE" + ConnectionUpsertRequestSourceTypeCloudsignal ConnectionUpsertRequestSourceType = "CLOUDSIGNAL" + ConnectionUpsertRequestSourceTypeCourier ConnectionUpsertRequestSourceType = "COURIER" + ConnectionUpsertRequestSourceTypeFrontapp ConnectionUpsertRequestSourceType = "FRONTAPP" + ConnectionUpsertRequestSourceTypeZoom ConnectionUpsertRequestSourceType = "ZOOM" + ConnectionUpsertRequestSourceTypeTwitter ConnectionUpsertRequestSourceType = "TWITTER" + ConnectionUpsertRequestSourceTypeRecharge ConnectionUpsertRequestSourceType = "RECHARGE" + ConnectionUpsertRequestSourceTypeStripe ConnectionUpsertRequestSourceType = "STRIPE" + ConnectionUpsertRequestSourceTypePropertyFinder ConnectionUpsertRequestSourceType = "PROPERTY-FINDER" + ConnectionUpsertRequestSourceTypeShopify ConnectionUpsertRequestSourceType = "SHOPIFY" + ConnectionUpsertRequestSourceTypeTwilio ConnectionUpsertRequestSourceType = "TWILIO" + ConnectionUpsertRequestSourceTypeGithub ConnectionUpsertRequestSourceType = "GITHUB" + ConnectionUpsertRequestSourceTypePostmark ConnectionUpsertRequestSourceType = "POSTMARK" + ConnectionUpsertRequestSourceTypeTypeform ConnectionUpsertRequestSourceType = "TYPEFORM" + ConnectionUpsertRequestSourceTypeXero ConnectionUpsertRequestSourceType = "XERO" + ConnectionUpsertRequestSourceTypeSvix ConnectionUpsertRequestSourceType = "SVIX" + ConnectionUpsertRequestSourceTypeAdyen ConnectionUpsertRequestSourceType = "ADYEN" + ConnectionUpsertRequestSourceTypeAkeneo ConnectionUpsertRequestSourceType = "AKENEO" + ConnectionUpsertRequestSourceTypeGitlab ConnectionUpsertRequestSourceType = "GITLAB" + ConnectionUpsertRequestSourceTypeWoocommerce ConnectionUpsertRequestSourceType = "WOOCOMMERCE" + ConnectionUpsertRequestSourceTypeOura ConnectionUpsertRequestSourceType = "OURA" + ConnectionUpsertRequestSourceTypeCommercelayer ConnectionUpsertRequestSourceType = "COMMERCELAYER" + ConnectionUpsertRequestSourceTypeHubspot ConnectionUpsertRequestSourceType = "HUBSPOT" + ConnectionUpsertRequestSourceTypeMailgun ConnectionUpsertRequestSourceType = "MAILGUN" + ConnectionUpsertRequestSourceTypePersona ConnectionUpsertRequestSourceType = "PERSONA" + ConnectionUpsertRequestSourceTypePipedrive ConnectionUpsertRequestSourceType = "PIPEDRIVE" + ConnectionUpsertRequestSourceTypeSendgrid ConnectionUpsertRequestSourceType = "SENDGRID" + ConnectionUpsertRequestSourceTypeWorkos ConnectionUpsertRequestSourceType = "WORKOS" + ConnectionUpsertRequestSourceTypeSynctera ConnectionUpsertRequestSourceType = "SYNCTERA" + ConnectionUpsertRequestSourceTypeAwsSns ConnectionUpsertRequestSourceType = "AWS_SNS" + ConnectionUpsertRequestSourceTypeThreeDEye ConnectionUpsertRequestSourceType = "THREE_D_EYE" + ConnectionUpsertRequestSourceTypeTwitch ConnectionUpsertRequestSourceType = "TWITCH" + ConnectionUpsertRequestSourceTypeEnode ConnectionUpsertRequestSourceType = "ENODE" + ConnectionUpsertRequestSourceTypeFavro ConnectionUpsertRequestSourceType = "FAVRO" + ConnectionUpsertRequestSourceTypeLinear ConnectionUpsertRequestSourceType = "LINEAR" + ConnectionUpsertRequestSourceTypeShopline ConnectionUpsertRequestSourceType = "SHOPLINE" + ConnectionUpsertRequestSourceTypeWix ConnectionUpsertRequestSourceType = "WIX" + ConnectionUpsertRequestSourceTypeNmi ConnectionUpsertRequestSourceType = "NMI" + ConnectionUpsertRequestSourceTypeOrb ConnectionUpsertRequestSourceType = "ORB" + ConnectionUpsertRequestSourceTypePylon ConnectionUpsertRequestSourceType = "PYLON" + ConnectionUpsertRequestSourceTypeRazorpay ConnectionUpsertRequestSourceType = "RAZORPAY" + ConnectionUpsertRequestSourceTypeRepay ConnectionUpsertRequestSourceType = "REPAY" + ConnectionUpsertRequestSourceTypeSquare ConnectionUpsertRequestSourceType = "SQUARE" + ConnectionUpsertRequestSourceTypeSolidgate ConnectionUpsertRequestSourceType = "SOLIDGATE" + ConnectionUpsertRequestSourceTypeTrello ConnectionUpsertRequestSourceType = "TRELLO" + ConnectionUpsertRequestSourceTypeEbay ConnectionUpsertRequestSourceType = "EBAY" + ConnectionUpsertRequestSourceTypeTelnyx ConnectionUpsertRequestSourceType = "TELNYX" + ConnectionUpsertRequestSourceTypeDiscord ConnectionUpsertRequestSourceType = "DISCORD" + ConnectionUpsertRequestSourceTypeTokenio ConnectionUpsertRequestSourceType = "TOKENIO" + ConnectionUpsertRequestSourceTypeFiserv ConnectionUpsertRequestSourceType = "FISERV" + ConnectionUpsertRequestSourceTypeBondsmith ConnectionUpsertRequestSourceType = "BONDSMITH" + ConnectionUpsertRequestSourceTypeVercelLogDrains ConnectionUpsertRequestSourceType = "VERCEL_LOG_DRAINS" + ConnectionUpsertRequestSourceTypeVercel ConnectionUpsertRequestSourceType = "VERCEL" + ConnectionUpsertRequestSourceTypeTebex ConnectionUpsertRequestSourceType = "TEBEX" + ConnectionUpsertRequestSourceTypeSlack ConnectionUpsertRequestSourceType = "SLACK" + ConnectionUpsertRequestSourceTypeMailchimp ConnectionUpsertRequestSourceType = "MAILCHIMP" + ConnectionUpsertRequestSourceTypePaddle ConnectionUpsertRequestSourceType = "PADDLE" + ConnectionUpsertRequestSourceTypePaypal ConnectionUpsertRequestSourceType = "PAYPAL" + ConnectionUpsertRequestSourceTypeTreezor ConnectionUpsertRequestSourceType = "TREEZOR" + ConnectionUpsertRequestSourceTypePraxis ConnectionUpsertRequestSourceType = "PRAXIS" + ConnectionUpsertRequestSourceTypeCustomerio ConnectionUpsertRequestSourceType = "CUSTOMERIO" + ConnectionUpsertRequestSourceTypeFacebook ConnectionUpsertRequestSourceType = "FACEBOOK" + ConnectionUpsertRequestSourceTypeWhatsapp ConnectionUpsertRequestSourceType = "WHATSAPP" + ConnectionUpsertRequestSourceTypeReplicate ConnectionUpsertRequestSourceType = "REPLICATE" + ConnectionUpsertRequestSourceTypeTiktok ConnectionUpsertRequestSourceType = "TIKTOK" + ConnectionUpsertRequestSourceTypeAirwallex ConnectionUpsertRequestSourceType = "AIRWALLEX" + ConnectionUpsertRequestSourceTypeZendesk ConnectionUpsertRequestSourceType = "ZENDESK" + ConnectionUpsertRequestSourceTypeUpollo ConnectionUpsertRequestSourceType = "UPOLLO" +) + +func NewConnectionUpsertRequestSourceTypeFromString(s string) (ConnectionUpsertRequestSourceType, error) { + switch s { + case "WEBHOOK": + return ConnectionUpsertRequestSourceTypeWebhook, nil + case "HTTP": + return ConnectionUpsertRequestSourceTypeHttp, nil + case "SANITY": + return ConnectionUpsertRequestSourceTypeSanity, nil + case "BRIDGE": + return ConnectionUpsertRequestSourceTypeBridge, nil + case "CLOUDSIGNAL": + return ConnectionUpsertRequestSourceTypeCloudsignal, nil + case "COURIER": + return ConnectionUpsertRequestSourceTypeCourier, nil + case "FRONTAPP": + return ConnectionUpsertRequestSourceTypeFrontapp, nil + case "ZOOM": + return ConnectionUpsertRequestSourceTypeZoom, nil + case "TWITTER": + return ConnectionUpsertRequestSourceTypeTwitter, nil + case "RECHARGE": + return ConnectionUpsertRequestSourceTypeRecharge, nil + case "STRIPE": + return ConnectionUpsertRequestSourceTypeStripe, nil + case "PROPERTY-FINDER": + return ConnectionUpsertRequestSourceTypePropertyFinder, nil + case "SHOPIFY": + return ConnectionUpsertRequestSourceTypeShopify, nil + case "TWILIO": + return ConnectionUpsertRequestSourceTypeTwilio, nil + case "GITHUB": + return ConnectionUpsertRequestSourceTypeGithub, nil + case "POSTMARK": + return ConnectionUpsertRequestSourceTypePostmark, nil + case "TYPEFORM": + return ConnectionUpsertRequestSourceTypeTypeform, nil + case "XERO": + return ConnectionUpsertRequestSourceTypeXero, nil + case "SVIX": + return ConnectionUpsertRequestSourceTypeSvix, nil + case "ADYEN": + return ConnectionUpsertRequestSourceTypeAdyen, nil + case "AKENEO": + return ConnectionUpsertRequestSourceTypeAkeneo, nil + case "GITLAB": + return ConnectionUpsertRequestSourceTypeGitlab, nil + case "WOOCOMMERCE": + return ConnectionUpsertRequestSourceTypeWoocommerce, nil + case "OURA": + return ConnectionUpsertRequestSourceTypeOura, nil + case "COMMERCELAYER": + return ConnectionUpsertRequestSourceTypeCommercelayer, nil + case "HUBSPOT": + return ConnectionUpsertRequestSourceTypeHubspot, nil + case "MAILGUN": + return ConnectionUpsertRequestSourceTypeMailgun, nil + case "PERSONA": + return ConnectionUpsertRequestSourceTypePersona, nil + case "PIPEDRIVE": + return ConnectionUpsertRequestSourceTypePipedrive, nil + case "SENDGRID": + return ConnectionUpsertRequestSourceTypeSendgrid, nil + case "WORKOS": + return ConnectionUpsertRequestSourceTypeWorkos, nil + case "SYNCTERA": + return ConnectionUpsertRequestSourceTypeSynctera, nil + case "AWS_SNS": + return ConnectionUpsertRequestSourceTypeAwsSns, nil + case "THREE_D_EYE": + return ConnectionUpsertRequestSourceTypeThreeDEye, nil + case "TWITCH": + return ConnectionUpsertRequestSourceTypeTwitch, nil + case "ENODE": + return ConnectionUpsertRequestSourceTypeEnode, nil + case "FAVRO": + return ConnectionUpsertRequestSourceTypeFavro, nil + case "LINEAR": + return ConnectionUpsertRequestSourceTypeLinear, nil + case "SHOPLINE": + return ConnectionUpsertRequestSourceTypeShopline, nil + case "WIX": + return ConnectionUpsertRequestSourceTypeWix, nil + case "NMI": + return ConnectionUpsertRequestSourceTypeNmi, nil + case "ORB": + return ConnectionUpsertRequestSourceTypeOrb, nil + case "PYLON": + return ConnectionUpsertRequestSourceTypePylon, nil + case "RAZORPAY": + return ConnectionUpsertRequestSourceTypeRazorpay, nil + case "REPAY": + return ConnectionUpsertRequestSourceTypeRepay, nil + case "SQUARE": + return ConnectionUpsertRequestSourceTypeSquare, nil + case "SOLIDGATE": + return ConnectionUpsertRequestSourceTypeSolidgate, nil + case "TRELLO": + return ConnectionUpsertRequestSourceTypeTrello, nil + case "EBAY": + return ConnectionUpsertRequestSourceTypeEbay, nil + case "TELNYX": + return ConnectionUpsertRequestSourceTypeTelnyx, nil + case "DISCORD": + return ConnectionUpsertRequestSourceTypeDiscord, nil + case "TOKENIO": + return ConnectionUpsertRequestSourceTypeTokenio, nil + case "FISERV": + return ConnectionUpsertRequestSourceTypeFiserv, nil + case "BONDSMITH": + return ConnectionUpsertRequestSourceTypeBondsmith, nil + case "VERCEL_LOG_DRAINS": + return ConnectionUpsertRequestSourceTypeVercelLogDrains, nil + case "VERCEL": + return ConnectionUpsertRequestSourceTypeVercel, nil + case "TEBEX": + return ConnectionUpsertRequestSourceTypeTebex, nil + case "SLACK": + return ConnectionUpsertRequestSourceTypeSlack, nil + case "MAILCHIMP": + return ConnectionUpsertRequestSourceTypeMailchimp, nil + case "PADDLE": + return ConnectionUpsertRequestSourceTypePaddle, nil + case "PAYPAL": + return ConnectionUpsertRequestSourceTypePaypal, nil + case "TREEZOR": + return ConnectionUpsertRequestSourceTypeTreezor, nil + case "PRAXIS": + return ConnectionUpsertRequestSourceTypePraxis, nil + case "CUSTOMERIO": + return ConnectionUpsertRequestSourceTypeCustomerio, nil + case "FACEBOOK": + return ConnectionUpsertRequestSourceTypeFacebook, nil + case "WHATSAPP": + return ConnectionUpsertRequestSourceTypeWhatsapp, nil + case "REPLICATE": + return ConnectionUpsertRequestSourceTypeReplicate, nil + case "TIKTOK": + return ConnectionUpsertRequestSourceTypeTiktok, nil + case "AIRWALLEX": + return ConnectionUpsertRequestSourceTypeAirwallex, nil + case "ZENDESK": + return ConnectionUpsertRequestSourceTypeZendesk, nil + case "UPOLLO": + return ConnectionUpsertRequestSourceTypeUpollo, nil + } + var t ConnectionUpsertRequestSourceType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ConnectionUpsertRequestSourceType) Ptr() *ConnectionUpsertRequestSourceType { + return &c +} + type ConnectionUpdateRequest struct { Name *core.Optional[string] `json:"name,omitempty" url:"-"` // Description for the connection diff --git a/connection/client.go b/connection/client.go index 92204fa..e2bd382 100644 --- a/connection/client.go +++ b/connection/client.go @@ -3,20 +3,17 @@ package connection import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.ConnectionPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/connections" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.ConnectionPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/connections" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,59 +144,44 @@ func (c *Client) Upsert( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/connections" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -244,65 +195,49 @@ func (c *Client) Count( opts ...option.RequestOption, ) (*hookdeckgosdk.ConnectionCountResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/connections/count" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.ConnectionCountResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -316,57 +251,45 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 410: - value := new(hookdeckgosdk.GoneError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 410: func(apiError *core.APIError) error { + return &hookdeckgosdk.GoneError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -381,66 +304,52 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -454,50 +363,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.ConnectionDeleteResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.ConnectionDeleteResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -511,50 +410,40 @@ func (c *Client) Disable( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v/archive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v/archive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -568,50 +457,40 @@ func (c *Client) Enable( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v/unarchive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v/unarchive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -625,50 +504,40 @@ func (c *Client) Pause( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v/pause", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v/pause", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -682,50 +551,40 @@ func (c *Client) Unpause( opts ...option.RequestOption, ) (*hookdeckgosdk.Connection, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/connections/%v/unpause", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/connections/%v/unpause", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Connection if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/core/api_error.go b/core/api_error.go new file mode 100644 index 0000000..dc4190c --- /dev/null +++ b/core/api_error.go @@ -0,0 +1,42 @@ +package core + +import "fmt" + +// APIError is a lightweight wrapper around the standard error +// interface that preserves the status code from the RPC, if any. +type APIError struct { + err error + + StatusCode int `json:"-"` +} + +// NewAPIError constructs a new API error. +func NewAPIError(statusCode int, err error) *APIError { + return &APIError{ + err: err, + StatusCode: statusCode, + } +} + +// Unwrap returns the underlying error. This also makes the error compatible +// with errors.As and errors.Is. +func (a *APIError) Unwrap() error { + if a == nil { + return nil + } + return a.err +} + +// Error returns the API error's message. +func (a *APIError) Error() string { + if a == nil || (a.err == nil && a.StatusCode == 0) { + return "" + } + if a.err == nil { + return fmt.Sprintf("%d", a.StatusCode) + } + if a.StatusCode == 0 { + return a.err.Error() + } + return fmt.Sprintf("%d: %s", a.StatusCode, a.err.Error()) +} diff --git a/core/http.go b/core/http.go new file mode 100644 index 0000000..b553350 --- /dev/null +++ b/core/http.go @@ -0,0 +1,8 @@ +package core + +import "net/http" + +// HTTPClient is an interface for a subset of the *http.Client. +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} diff --git a/core/request_option.go b/core/request_option.go index bab4352..b271a40 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -53,11 +53,7 @@ func (r *RequestOptions) ToHeader() http.Header { } func (r *RequestOptions) cloneHeader() http.Header { - headers := r.HTTPHeader.Clone() - headers.Set("X-Fern-Language", "Go") - headers.Set("X-Fern-SDK-Name", "github.com/hookdeck/hookdeck-go-sdk") - headers.Set("X-Fern-SDK-Version", "v0.7.0") - return headers + return r.HTTPHeader.Clone() } // BaseURLOption implements the RequestOption interface. diff --git a/custom_domain.go b/custom_domain.go new file mode 100644 index 0000000..babb44e --- /dev/null +++ b/custom_domain.go @@ -0,0 +1,557 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" +) + +type AddCustomHostname struct { + // The custom hostname to attach to the project + Hostname string `json:"hostname" url:"hostname"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (a *AddCustomHostname) GetHostname() string { + if a == nil { + return "" + } + return a.Hostname +} + +func (a *AddCustomHostname) GetExtraProperties() map[string]interface{} { + return a.extraProperties +} + +func (a *AddCustomHostname) UnmarshalJSON(data []byte) error { + type unmarshaler AddCustomHostname + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AddCustomHostname(value) + extraProperties, err := internal.ExtractExtraProperties(data, *a) + if err != nil { + return err + } + a.extraProperties = extraProperties + a.rawJSON = json.RawMessage(data) + return nil +} + +func (a *AddCustomHostname) String() string { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type DeleteCustomDomainSchema struct { + // The custom hostname ID + Id string `json:"id" url:"id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeleteCustomDomainSchema) GetId() string { + if d == nil { + return "" + } + return d.Id +} + +func (d *DeleteCustomDomainSchema) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeleteCustomDomainSchema) UnmarshalJSON(data []byte) error { + type unmarshaler DeleteCustomDomainSchema + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeleteCustomDomainSchema(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeleteCustomDomainSchema) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type ListCustomDomainSchema = []*ListCustomDomainSchemaItem + +type ListCustomDomainSchemaItem struct { + Id *string `json:"id,omitempty" url:"id,omitempty"` + Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"` + Status *string `json:"status,omitempty" url:"status,omitempty"` + Ssl *ListCustomDomainSchemaItemSsl `json:"ssl,omitempty" url:"ssl,omitempty"` + VerificationErrors []string `json:"verification_errors,omitempty" url:"verification_errors,omitempty"` + OwnershipVerification *ListCustomDomainSchemaItemOwnershipVerification `json:"ownership_verification,omitempty" url:"ownership_verification,omitempty"` + CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItem) GetId() *string { + if l == nil { + return nil + } + return l.Id +} + +func (l *ListCustomDomainSchemaItem) GetHostname() *string { + if l == nil { + return nil + } + return l.Hostname +} + +func (l *ListCustomDomainSchemaItem) GetStatus() *string { + if l == nil { + return nil + } + return l.Status +} + +func (l *ListCustomDomainSchemaItem) GetSsl() *ListCustomDomainSchemaItemSsl { + if l == nil { + return nil + } + return l.Ssl +} + +func (l *ListCustomDomainSchemaItem) GetVerificationErrors() []string { + if l == nil { + return nil + } + return l.VerificationErrors +} + +func (l *ListCustomDomainSchemaItem) GetOwnershipVerification() *ListCustomDomainSchemaItemOwnershipVerification { + if l == nil { + return nil + } + return l.OwnershipVerification +} + +func (l *ListCustomDomainSchemaItem) GetCreatedAt() *string { + if l == nil { + return nil + } + return l.CreatedAt +} + +func (l *ListCustomDomainSchemaItem) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItem) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItem(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItem) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type ListCustomDomainSchemaItemOwnershipVerification struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + Value *string `json:"value,omitempty" url:"value,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) GetType() *string { + if l == nil { + return nil + } + return l.Type +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) GetName() *string { + if l == nil { + return nil + } + return l.Name +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) GetValue() *string { + if l == nil { + return nil + } + return l.Value +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItemOwnershipVerification + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItemOwnershipVerification(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItemOwnershipVerification) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type ListCustomDomainSchemaItemSsl struct { + Id *string `json:"id,omitempty" url:"id,omitempty"` + Type *string `json:"type,omitempty" url:"type,omitempty"` + Method *string `json:"method,omitempty" url:"method,omitempty"` + Status *string `json:"status,omitempty" url:"status,omitempty"` + TxtName *string `json:"txt_name,omitempty" url:"txt_name,omitempty"` + TxtValue *string `json:"txt_value,omitempty" url:"txt_value,omitempty"` + ValidationRecords []*ListCustomDomainSchemaItemSslValidationRecordsItem `json:"validation_records,omitempty" url:"validation_records,omitempty"` + DcvDelegationRecords []*ListCustomDomainSchemaItemSslDcvDelegationRecordsItem `json:"dcv_delegation_records,omitempty" url:"dcv_delegation_records,omitempty"` + Settings *ListCustomDomainSchemaItemSslSettings `json:"settings,omitempty" url:"settings,omitempty"` + BundleMethod *string `json:"bundle_method,omitempty" url:"bundle_method,omitempty"` + Wildcard *bool `json:"wildcard,omitempty" url:"wildcard,omitempty"` + CertificateAuthority *string `json:"certificate_authority,omitempty" url:"certificate_authority,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItemSsl) GetId() *string { + if l == nil { + return nil + } + return l.Id +} + +func (l *ListCustomDomainSchemaItemSsl) GetType() *string { + if l == nil { + return nil + } + return l.Type +} + +func (l *ListCustomDomainSchemaItemSsl) GetMethod() *string { + if l == nil { + return nil + } + return l.Method +} + +func (l *ListCustomDomainSchemaItemSsl) GetStatus() *string { + if l == nil { + return nil + } + return l.Status +} + +func (l *ListCustomDomainSchemaItemSsl) GetTxtName() *string { + if l == nil { + return nil + } + return l.TxtName +} + +func (l *ListCustomDomainSchemaItemSsl) GetTxtValue() *string { + if l == nil { + return nil + } + return l.TxtValue +} + +func (l *ListCustomDomainSchemaItemSsl) GetValidationRecords() []*ListCustomDomainSchemaItemSslValidationRecordsItem { + if l == nil { + return nil + } + return l.ValidationRecords +} + +func (l *ListCustomDomainSchemaItemSsl) GetDcvDelegationRecords() []*ListCustomDomainSchemaItemSslDcvDelegationRecordsItem { + if l == nil { + return nil + } + return l.DcvDelegationRecords +} + +func (l *ListCustomDomainSchemaItemSsl) GetSettings() *ListCustomDomainSchemaItemSslSettings { + if l == nil { + return nil + } + return l.Settings +} + +func (l *ListCustomDomainSchemaItemSsl) GetBundleMethod() *string { + if l == nil { + return nil + } + return l.BundleMethod +} + +func (l *ListCustomDomainSchemaItemSsl) GetWildcard() *bool { + if l == nil { + return nil + } + return l.Wildcard +} + +func (l *ListCustomDomainSchemaItemSsl) GetCertificateAuthority() *string { + if l == nil { + return nil + } + return l.CertificateAuthority +} + +func (l *ListCustomDomainSchemaItemSsl) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItemSsl) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItemSsl + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItemSsl(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItemSsl) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type ListCustomDomainSchemaItemSslDcvDelegationRecordsItem struct { + Cname *string `json:"cname,omitempty" url:"cname,omitempty"` + CnameTarget *string `json:"cname_target,omitempty" url:"cname_target,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) GetCname() *string { + if l == nil { + return nil + } + return l.Cname +} + +func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) GetCnameTarget() *string { + if l == nil { + return nil + } + return l.CnameTarget +} + +func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItemSslDcvDelegationRecordsItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItemSslDcvDelegationRecordsItem(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type ListCustomDomainSchemaItemSslSettings struct { + MinTlsVersion *string `json:"min_tls_version,omitempty" url:"min_tls_version,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItemSslSettings) GetMinTlsVersion() *string { + if l == nil { + return nil + } + return l.MinTlsVersion +} + +func (l *ListCustomDomainSchemaItemSslSettings) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItemSslSettings) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItemSslSettings + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItemSslSettings(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItemSslSettings) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +type ListCustomDomainSchemaItemSslValidationRecordsItem struct { + Status *string `json:"status,omitempty" url:"status,omitempty"` + TxtName *string `json:"txt_name,omitempty" url:"txt_name,omitempty"` + TxtValue *string `json:"txt_value,omitempty" url:"txt_value,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) GetStatus() *string { + if l == nil { + return nil + } + return l.Status +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) GetTxtName() *string { + if l == nil { + return nil + } + return l.TxtName +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) GetTxtValue() *string { + if l == nil { + return nil + } + return l.TxtValue +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) UnmarshalJSON(data []byte) error { + type unmarshaler ListCustomDomainSchemaItemSslValidationRecordsItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListCustomDomainSchemaItemSslValidationRecordsItem(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} diff --git a/customdomain/client.go b/customdomain/client.go index ff02efd..e62c04f 100644 --- a/customdomain/client.go +++ b/customdomain/client.go @@ -6,13 +6,14 @@ import ( context "context" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -20,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -35,26 +36,25 @@ func (c *Client) List( opts ...option.RequestOption, ) (hookdeckgosdk.ListCustomDomainSchema, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/teams/current/custom_domains" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) var response hookdeckgosdk.ListCustomDomainSchema if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, @@ -72,27 +72,26 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.AddCustomHostname, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/teams/current/custom_domains" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") var response *hookdeckgosdk.AddCustomHostname if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, @@ -111,26 +110,28 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.DeleteCustomDomainSchema, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/teams/current/custom_domains/%v", domainId) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/teams/current/custom_domains/%v", + domainId, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) var response *hookdeckgosdk.DeleteCustomDomainSchema if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, diff --git a/destination.go b/destination.go index 20000bd..7762877 100644 --- a/destination.go +++ b/destination.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -25,6 +26,9 @@ type DestinationCreateRequest struct { HttpMethod *core.Optional[DestinationHttpMethod] `json:"http_method,omitempty" url:"-"` AuthMethod *core.Optional[DestinationAuthMethodConfig] `json:"auth_method,omitempty" url:"-"` PathForwardingDisabled *core.Optional[bool] `json:"path_forwarding_disabled,omitempty" url:"-"` + // Type of the destination + Type *core.Optional[DestinationCreateRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[DestinationConfig] `json:"config,omitempty" url:"-"` } type DestinationListRequest struct { @@ -41,6 +45,68 @@ type DestinationListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +type DestinationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Destination `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DestinationPaginatedResult) GetPagination() *SeekPagination { + if d == nil { + return nil + } + return d.Pagination +} + +func (d *DestinationPaginatedResult) GetCount() *int { + if d == nil { + return nil + } + return d.Count +} + +func (d *DestinationPaginatedResult) GetModels() []*Destination { + if d == nil { + return nil + } + return d.Models +} + +func (d *DestinationPaginatedResult) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DestinationPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DestinationPaginatedResult) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + // Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. type DestinationCreateRequestRateLimitPeriod string @@ -70,12 +136,45 @@ func (d DestinationCreateRequestRateLimitPeriod) Ptr() *DestinationCreateRequest return &d } +// Type of the destination +type DestinationCreateRequestType string + +const ( + DestinationCreateRequestTypeHttp DestinationCreateRequestType = "HTTP" + DestinationCreateRequestTypeCli DestinationCreateRequestType = "CLI" + DestinationCreateRequestTypeMockApi DestinationCreateRequestType = "MOCK_API" +) + +func NewDestinationCreateRequestTypeFromString(s string) (DestinationCreateRequestType, error) { + switch s { + case "HTTP": + return DestinationCreateRequestTypeHttp, nil + case "CLI": + return DestinationCreateRequestTypeCli, nil + case "MOCK_API": + return DestinationCreateRequestTypeMockApi, nil + } + var t DestinationCreateRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationCreateRequestType) Ptr() *DestinationCreateRequestType { + return &d +} + type DestinationDeleteResponse struct { // ID of the destination Id string `json:"id" url:"id"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationDeleteResponse) GetId() string { + if d == nil { + return "" + } + return d.Id } func (d *DestinationDeleteResponse) GetExtraProperties() map[string]interface{} { @@ -89,24 +188,22 @@ func (d *DestinationDeleteResponse) UnmarshalJSON(data []byte) error { return err } *d = DestinationDeleteResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationDeleteResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -182,6 +279,32 @@ func (d DestinationUpdateRequestRateLimitPeriod) Ptr() *DestinationUpdateRequest return &d } +// Type of the destination +type DestinationUpdateRequestType string + +const ( + DestinationUpdateRequestTypeHttp DestinationUpdateRequestType = "HTTP" + DestinationUpdateRequestTypeCli DestinationUpdateRequestType = "CLI" + DestinationUpdateRequestTypeMockApi DestinationUpdateRequestType = "MOCK_API" +) + +func NewDestinationUpdateRequestTypeFromString(s string) (DestinationUpdateRequestType, error) { + switch s { + case "HTTP": + return DestinationUpdateRequestTypeHttp, nil + case "CLI": + return DestinationUpdateRequestTypeCli, nil + case "MOCK_API": + return DestinationUpdateRequestTypeMockApi, nil + } + var t DestinationUpdateRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationUpdateRequestType) Ptr() *DestinationUpdateRequestType { + return &d +} + // Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. type DestinationUpsertRequestRateLimitPeriod string @@ -211,6 +334,32 @@ func (d DestinationUpsertRequestRateLimitPeriod) Ptr() *DestinationUpsertRequest return &d } +// Type of the destination +type DestinationUpsertRequestType string + +const ( + DestinationUpsertRequestTypeHttp DestinationUpsertRequestType = "HTTP" + DestinationUpsertRequestTypeCli DestinationUpsertRequestType = "CLI" + DestinationUpsertRequestTypeMockApi DestinationUpsertRequestType = "MOCK_API" +) + +func NewDestinationUpsertRequestTypeFromString(s string) (DestinationUpsertRequestType, error) { + switch s { + case "HTTP": + return DestinationUpsertRequestTypeHttp, nil + case "CLI": + return DestinationUpsertRequestTypeCli, nil + case "MOCK_API": + return DestinationUpsertRequestTypeMockApi, nil + } + var t DestinationUpsertRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationUpsertRequestType) Ptr() *DestinationUpsertRequestType { + return &d +} + type DestinationUpdateRequest struct { // Name for the destination Name *core.Optional[string] `json:"name,omitempty" url:"-"` @@ -227,6 +376,9 @@ type DestinationUpdateRequest struct { HttpMethod *core.Optional[DestinationHttpMethod] `json:"http_method,omitempty" url:"-"` AuthMethod *core.Optional[DestinationAuthMethodConfig] `json:"auth_method,omitempty" url:"-"` PathForwardingDisabled *core.Optional[bool] `json:"path_forwarding_disabled,omitempty" url:"-"` + // Type of the destination + Type *core.Optional[DestinationUpdateRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[DestinationConfig] `json:"config,omitempty" url:"-"` } type DestinationUpsertRequest struct { @@ -245,4 +397,7 @@ type DestinationUpsertRequest struct { HttpMethod *core.Optional[DestinationHttpMethod] `json:"http_method,omitempty" url:"-"` AuthMethod *core.Optional[DestinationAuthMethodConfig] `json:"auth_method,omitempty" url:"-"` PathForwardingDisabled *core.Optional[bool] `json:"path_forwarding_disabled,omitempty" url:"-"` + // Type of the destination + Type *core.Optional[DestinationUpsertRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[DestinationConfig] `json:"config,omitempty" url:"-"` } diff --git a/destination/client.go b/destination/client.go index 2a86c20..5e0f21b 100644 --- a/destination/client.go +++ b/destination/client.go @@ -3,20 +3,17 @@ package destination import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.DestinationPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/destinations" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.DestinationPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/destinations" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,59 +144,44 @@ func (c *Client) Upsert( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/destinations" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -244,57 +195,45 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/destinations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/destinations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 410: - value := new(hookdeckgosdk.GoneError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 410: func(apiError *core.APIError) error { + return &hookdeckgosdk.GoneError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -309,66 +248,52 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/destinations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/destinations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -382,50 +307,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.DestinationDeleteResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/destinations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/destinations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.DestinationDeleteResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -439,50 +354,40 @@ func (c *Client) Disable( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/destinations/%v/archive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/destinations/%v/archive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -496,50 +401,40 @@ func (c *Client) Enable( opts ...option.RequestOption, ) (*hookdeckgosdk.Destination, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/destinations/%v/unarchive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/destinations/%v/unarchive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Destination if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/environments.go b/environments.go index bf10725..1b3e514 100644 --- a/environments.go +++ b/environments.go @@ -9,5 +9,5 @@ package api var Environments = struct { Default string }{ - Default: "https://api.hookdeck.com/2024-09-01", + Default: "https://api.hookdeck.com/2025-01-01-next", } diff --git a/event.go b/event.go index 4430f2e..3390fe1 100644 --- a/event.go +++ b/event.go @@ -3,7 +3,9 @@ package api import ( + json "encoding/json" fmt "fmt" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -37,6 +39,237 @@ type EventListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +type RetriedEvent struct { + // ID of the event + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // ID of the associated connection + WebhookId string `json:"webhook_id" url:"webhook_id"` + // ID of the associated source + SourceId string `json:"source_id" url:"source_id"` + // ID of the associated destination + DestinationId string `json:"destination_id" url:"destination_id"` + // ID of the event data + EventDataId string `json:"event_data_id" url:"event_data_id"` + // ID of the request that created the event + RequestId string `json:"request_id" url:"request_id"` + // Number of delivery attempts made + Attempts int `json:"attempts" url:"attempts"` + // Date of the most recently attempted retry + LastAttemptAt *time.Time `json:"last_attempt_at,omitempty" url:"last_attempt_at,omitempty"` + // Date of the next scheduled retry + NextAttemptAt *time.Time `json:"next_attempt_at,omitempty" url:"next_attempt_at,omitempty"` + // Event status + ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` + ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` + Status EventStatus `json:"status" url:"status"` + // Date of the latest successful attempt + SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` + // ID of the CLI the event is sent to + CliId *string `json:"cli_id,omitempty" url:"cli_id,omitempty"` + // Date the event was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the event was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RetriedEvent) GetId() string { + if r == nil { + return "" + } + return r.Id +} + +func (r *RetriedEvent) GetTeamId() string { + if r == nil { + return "" + } + return r.TeamId +} + +func (r *RetriedEvent) GetWebhookId() string { + if r == nil { + return "" + } + return r.WebhookId +} + +func (r *RetriedEvent) GetSourceId() string { + if r == nil { + return "" + } + return r.SourceId +} + +func (r *RetriedEvent) GetDestinationId() string { + if r == nil { + return "" + } + return r.DestinationId +} + +func (r *RetriedEvent) GetEventDataId() string { + if r == nil { + return "" + } + return r.EventDataId +} + +func (r *RetriedEvent) GetRequestId() string { + if r == nil { + return "" + } + return r.RequestId +} + +func (r *RetriedEvent) GetAttempts() int { + if r == nil { + return 0 + } + return r.Attempts +} + +func (r *RetriedEvent) GetLastAttemptAt() *time.Time { + if r == nil { + return nil + } + return r.LastAttemptAt +} + +func (r *RetriedEvent) GetNextAttemptAt() *time.Time { + if r == nil { + return nil + } + return r.NextAttemptAt +} + +func (r *RetriedEvent) GetResponseStatus() *int { + if r == nil { + return nil + } + return r.ResponseStatus +} + +func (r *RetriedEvent) GetErrorCode() *AttemptErrorCodes { + if r == nil { + return nil + } + return r.ErrorCode +} + +func (r *RetriedEvent) GetStatus() EventStatus { + if r == nil { + return "" + } + return r.Status +} + +func (r *RetriedEvent) GetSuccessfulAt() *time.Time { + if r == nil { + return nil + } + return r.SuccessfulAt +} + +func (r *RetriedEvent) GetCliId() *string { + if r == nil { + return nil + } + return r.CliId +} + +func (r *RetriedEvent) GetUpdatedAt() time.Time { + if r == nil { + return time.Time{} + } + return r.UpdatedAt +} + +func (r *RetriedEvent) GetCreatedAt() time.Time { + if r == nil { + return time.Time{} + } + return r.CreatedAt +} + +func (r *RetriedEvent) GetData() *ShortEventData { + if r == nil { + return nil + } + return r.Data +} + +func (r *RetriedEvent) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RetriedEvent) UnmarshalJSON(data []byte) error { + type embed RetriedEvent + var unmarshaler = struct { + embed + LastAttemptAt *internal.DateTime `json:"last_attempt_at,omitempty"` + NextAttemptAt *internal.DateTime `json:"next_attempt_at,omitempty"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*r), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *r = RetriedEvent(unmarshaler.embed) + r.LastAttemptAt = unmarshaler.LastAttemptAt.TimePtr() + r.NextAttemptAt = unmarshaler.NextAttemptAt.TimePtr() + r.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() + r.UpdatedAt = unmarshaler.UpdatedAt.Time() + r.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RetriedEvent) MarshalJSON() ([]byte, error) { + type embed RetriedEvent + var marshaler = struct { + embed + LastAttemptAt *internal.DateTime `json:"last_attempt_at,omitempty"` + NextAttemptAt *internal.DateTime `json:"next_attempt_at,omitempty"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*r), + LastAttemptAt: internal.NewOptionalDateTime(r.LastAttemptAt), + NextAttemptAt: internal.NewOptionalDateTime(r.NextAttemptAt), + SuccessfulAt: internal.NewOptionalDateTime(r.SuccessfulAt), + UpdatedAt: internal.NewDateTime(r.UpdatedAt), + CreatedAt: internal.NewDateTime(r.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (r *RetriedEvent) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + // Sort direction type EventListRequestDir string diff --git a/event/client.go b/event/client.go index 66490c1..51800a4 100644 --- a/event/client.go +++ b/event/client.go @@ -3,20 +3,17 @@ package event import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.EventPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/events" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.EventPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,50 +93,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Event, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/events/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/events/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Event if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -169,50 +140,40 @@ func (c *Client) RetrieveBody( opts ...option.RequestOption, ) (*hookdeckgosdk.RawBody, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/events/%v/raw_body", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/events/%v/raw_body", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RawBody if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -226,50 +187,40 @@ func (c *Client) Retry( opts ...option.RequestOption, ) (*hookdeckgosdk.RetriedEvent, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/events/%v/retry", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/events/%v/retry", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RetriedEvent if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -283,50 +234,40 @@ func (c *Client) Mute( opts ...option.RequestOption, ) (*hookdeckgosdk.Event, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/events/%v/mute", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/events/%v/mute", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Event if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/event_bulk_retry.go b/event_bulk_retry.go index dde31cb..6cda5f1 100644 --- a/event_bulk_retry.go +++ b/event_bulk_retry.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -70,43 +71,1752 @@ type EventBulkRetryCreateRequestQuery struct { BulkRetryId *EventBulkRetryCreateRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty" url:"bulk_retry_id,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (e *EventBulkRetryCreateRequestQuery) GetId() *EventBulkRetryCreateRequestQueryId { + if e == nil { + return nil + } + return e.Id +} + +func (e *EventBulkRetryCreateRequestQuery) GetStatus() *EventBulkRetryCreateRequestQueryStatus { + if e == nil { + return nil + } + return e.Status +} + +func (e *EventBulkRetryCreateRequestQuery) GetWebhookId() *EventBulkRetryCreateRequestQueryWebhookId { + if e == nil { + return nil + } + return e.WebhookId +} + +func (e *EventBulkRetryCreateRequestQuery) GetDestinationId() *EventBulkRetryCreateRequestQueryDestinationId { + if e == nil { + return nil + } + return e.DestinationId +} + +func (e *EventBulkRetryCreateRequestQuery) GetSourceId() *EventBulkRetryCreateRequestQuerySourceId { + if e == nil { + return nil + } + return e.SourceId +} + +func (e *EventBulkRetryCreateRequestQuery) GetAttempts() *EventBulkRetryCreateRequestQueryAttempts { + if e == nil { + return nil + } + return e.Attempts +} + +func (e *EventBulkRetryCreateRequestQuery) GetResponseStatus() *EventBulkRetryCreateRequestQueryResponseStatus { + if e == nil { + return nil + } + return e.ResponseStatus +} + +func (e *EventBulkRetryCreateRequestQuery) GetSuccessfulAt() *EventBulkRetryCreateRequestQuerySuccessfulAt { + if e == nil { + return nil + } + return e.SuccessfulAt +} + +func (e *EventBulkRetryCreateRequestQuery) GetCreatedAt() *EventBulkRetryCreateRequestQueryCreatedAt { + if e == nil { + return nil + } + return e.CreatedAt +} + +func (e *EventBulkRetryCreateRequestQuery) GetErrorCode() *EventBulkRetryCreateRequestQueryErrorCode { + if e == nil { + return nil + } + return e.ErrorCode +} + +func (e *EventBulkRetryCreateRequestQuery) GetCliId() *EventBulkRetryCreateRequestQueryCliId { + if e == nil { + return nil + } + return e.CliId +} + +func (e *EventBulkRetryCreateRequestQuery) GetLastAttemptAt() *EventBulkRetryCreateRequestQueryLastAttemptAt { + if e == nil { + return nil + } + return e.LastAttemptAt +} + +func (e *EventBulkRetryCreateRequestQuery) GetSearchTerm() *string { + if e == nil { + return nil + } + return e.SearchTerm +} + +func (e *EventBulkRetryCreateRequestQuery) GetHeaders() *EventBulkRetryCreateRequestQueryHeaders { + if e == nil { + return nil + } + return e.Headers +} + +func (e *EventBulkRetryCreateRequestQuery) GetBody() *EventBulkRetryCreateRequestQueryBody { + if e == nil { + return nil + } + return e.Body +} + +func (e *EventBulkRetryCreateRequestQuery) GetParsedQuery() *EventBulkRetryCreateRequestQueryParsedQuery { + if e == nil { + return nil + } + return e.ParsedQuery +} + +func (e *EventBulkRetryCreateRequestQuery) GetPath() *string { + if e == nil { + return nil + } + return e.Path +} + +func (e *EventBulkRetryCreateRequestQuery) GetCliUserId() *EventBulkRetryCreateRequestQueryCliUserId { + if e == nil { + return nil + } + return e.CliUserId +} + +func (e *EventBulkRetryCreateRequestQuery) GetIssueId() *EventBulkRetryCreateRequestQueryIssueId { + if e == nil { + return nil + } + return e.IssueId +} + +func (e *EventBulkRetryCreateRequestQuery) GetEventDataId() *EventBulkRetryCreateRequestQueryEventDataId { + if e == nil { + return nil + } + return e.EventDataId +} + +func (e *EventBulkRetryCreateRequestQuery) GetBulkRetryId() *EventBulkRetryCreateRequestQueryBulkRetryId { + if e == nil { + return nil + } + return e.BulkRetryId } func (e *EventBulkRetryCreateRequestQuery) GetExtraProperties() map[string]interface{} { return e.extraProperties } -func (e *EventBulkRetryCreateRequestQuery) UnmarshalJSON(data []byte) error { - type unmarshaler EventBulkRetryCreateRequestQuery +func (e *EventBulkRetryCreateRequestQuery) UnmarshalJSON(data []byte) error { + type unmarshaler EventBulkRetryCreateRequestQuery + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventBulkRetryCreateRequestQuery(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventBulkRetryCreateRequestQuery) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Filter by number of attempts +type EventBulkRetryCreateRequestQueryAttempts struct { + Integer int + Operators *Operators + + typ string +} + +func NewEventBulkRetryCreateRequestQueryAttemptsFromInteger(value int) *EventBulkRetryCreateRequestQueryAttempts { + return &EventBulkRetryCreateRequestQueryAttempts{typ: "Integer", Integer: value} +} + +func NewEventBulkRetryCreateRequestQueryAttemptsFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryAttempts { + return &EventBulkRetryCreateRequestQueryAttempts{typ: "Operators", Operators: value} +} + +func (e *EventBulkRetryCreateRequestQueryAttempts) GetInteger() int { + if e == nil { + return 0 + } + return e.Integer +} + +func (e *EventBulkRetryCreateRequestQueryAttempts) GetOperators() *Operators { + if e == nil { + return nil + } + return e.Operators +} + +func (e *EventBulkRetryCreateRequestQueryAttempts) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + e.typ = "Integer" + e.Integer = valueInteger + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + e.typ = "Operators" + e.Operators = valueOperators + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryAttempts) MarshalJSON() ([]byte, error) { + if e.typ == "Integer" || e.Integer != 0 { + return json.Marshal(e.Integer) + } + if e.typ == "Operators" || e.Operators != nil { + return json.Marshal(e.Operators) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryAttemptsVisitor interface { + VisitInteger(int) error + VisitOperators(*Operators) error +} + +func (e *EventBulkRetryCreateRequestQueryAttempts) Accept(visitor EventBulkRetryCreateRequestQueryAttemptsVisitor) error { + if e.typ == "Integer" || e.Integer != 0 { + return visitor.VisitInteger(e.Integer) + } + if e.typ == "Operators" || e.Operators != nil { + return visitor.VisitOperators(e.Operators) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// URL Encoded string of the JSON to match to the data body +type EventBulkRetryCreateRequestQueryBody struct { + String string + EventBulkRetryCreateRequestQueryBodyOne *EventBulkRetryCreateRequestQueryBodyOne + + typ string +} + +func NewEventBulkRetryCreateRequestQueryBodyFromString(value string) *EventBulkRetryCreateRequestQueryBody { + return &EventBulkRetryCreateRequestQueryBody{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryBodyFromEventBulkRetryCreateRequestQueryBodyOne(value *EventBulkRetryCreateRequestQueryBodyOne) *EventBulkRetryCreateRequestQueryBody { + return &EventBulkRetryCreateRequestQueryBody{typ: "EventBulkRetryCreateRequestQueryBodyOne", EventBulkRetryCreateRequestQueryBodyOne: value} +} + +func (e *EventBulkRetryCreateRequestQueryBody) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryBody) GetEventBulkRetryCreateRequestQueryBodyOne() *EventBulkRetryCreateRequestQueryBodyOne { + if e == nil { + return nil + } + return e.EventBulkRetryCreateRequestQueryBodyOne +} + +func (e *EventBulkRetryCreateRequestQueryBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + valueEventBulkRetryCreateRequestQueryBodyOne := new(EventBulkRetryCreateRequestQueryBodyOne) + if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryBodyOne); err == nil { + e.typ = "EventBulkRetryCreateRequestQueryBodyOne" + e.EventBulkRetryCreateRequestQueryBodyOne = valueEventBulkRetryCreateRequestQueryBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryBody) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryBodyOne" || e.EventBulkRetryCreateRequestQueryBodyOne != nil { + return json.Marshal(e.EventBulkRetryCreateRequestQueryBodyOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryBodyVisitor interface { + VisitString(string) error + VisitEventBulkRetryCreateRequestQueryBodyOne(*EventBulkRetryCreateRequestQueryBodyOne) error +} + +func (e *EventBulkRetryCreateRequestQueryBody) Accept(visitor EventBulkRetryCreateRequestQueryBodyVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryBodyOne" || e.EventBulkRetryCreateRequestQueryBodyOne != nil { + return visitor.VisitEventBulkRetryCreateRequestQueryBodyOne(e.EventBulkRetryCreateRequestQueryBodyOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryBodyOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *EventBulkRetryCreateRequestQueryBodyOne) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventBulkRetryCreateRequestQueryBodyOne) UnmarshalJSON(data []byte) error { + type unmarshaler EventBulkRetryCreateRequestQueryBodyOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventBulkRetryCreateRequestQueryBodyOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventBulkRetryCreateRequestQueryBodyOne) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EventBulkRetryCreateRequestQueryBulkRetryId struct { + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryBulkRetryIdFromString(value string) *EventBulkRetryCreateRequestQueryBulkRetryId { + return &EventBulkRetryCreateRequestQueryBulkRetryId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryBulkRetryIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryBulkRetryId { + return &EventBulkRetryCreateRequestQueryBulkRetryId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryBulkRetryId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryBulkRetryId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryBulkRetryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryBulkRetryId) Accept(visitor EventBulkRetryCreateRequestQueryBulkRetryIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by CLI IDs. `?[any]=true` operator for any CLI. +type EventBulkRetryCreateRequestQueryCliId struct { + String string + EventBulkRetryCreateRequestQueryCliIdAll *EventBulkRetryCreateRequestQueryCliIdAll + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryCliIdFromString(value string) *EventBulkRetryCreateRequestQueryCliId { + return &EventBulkRetryCreateRequestQueryCliId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryCliIdFromEventBulkRetryCreateRequestQueryCliIdAll(value *EventBulkRetryCreateRequestQueryCliIdAll) *EventBulkRetryCreateRequestQueryCliId { + return &EventBulkRetryCreateRequestQueryCliId{typ: "EventBulkRetryCreateRequestQueryCliIdAll", EventBulkRetryCreateRequestQueryCliIdAll: value} +} + +func NewEventBulkRetryCreateRequestQueryCliIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryCliId { + return &EventBulkRetryCreateRequestQueryCliId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryCliId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryCliId) GetEventBulkRetryCreateRequestQueryCliIdAll() *EventBulkRetryCreateRequestQueryCliIdAll { + if e == nil { + return nil + } + return e.EventBulkRetryCreateRequestQueryCliIdAll +} + +func (e *EventBulkRetryCreateRequestQueryCliId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryCliId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + valueEventBulkRetryCreateRequestQueryCliIdAll := new(EventBulkRetryCreateRequestQueryCliIdAll) + if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryCliIdAll); err == nil { + e.typ = "EventBulkRetryCreateRequestQueryCliIdAll" + e.EventBulkRetryCreateRequestQueryCliIdAll = valueEventBulkRetryCreateRequestQueryCliIdAll + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryCliId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryCliIdAll" || e.EventBulkRetryCreateRequestQueryCliIdAll != nil { + return json.Marshal(e.EventBulkRetryCreateRequestQueryCliIdAll) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryCliIdVisitor interface { + VisitString(string) error + VisitEventBulkRetryCreateRequestQueryCliIdAll(*EventBulkRetryCreateRequestQueryCliIdAll) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryCliId) Accept(visitor EventBulkRetryCreateRequestQueryCliIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryCliIdAll" || e.EventBulkRetryCreateRequestQueryCliIdAll != nil { + return visitor.VisitEventBulkRetryCreateRequestQueryCliIdAll(e.EventBulkRetryCreateRequestQueryCliIdAll) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryCliIdAll struct { + Any *bool `json:"any,omitempty" url:"any,omitempty"` + All *bool `json:"all,omitempty" url:"all,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *EventBulkRetryCreateRequestQueryCliIdAll) GetAny() *bool { + if e == nil { + return nil + } + return e.Any +} + +func (e *EventBulkRetryCreateRequestQueryCliIdAll) GetAll() *bool { + if e == nil { + return nil + } + return e.All +} + +func (e *EventBulkRetryCreateRequestQueryCliIdAll) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventBulkRetryCreateRequestQueryCliIdAll) UnmarshalJSON(data []byte) error { + type unmarshaler EventBulkRetryCreateRequestQueryCliIdAll + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventBulkRetryCreateRequestQueryCliIdAll(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventBulkRetryCreateRequestQueryCliIdAll) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EventBulkRetryCreateRequestQueryCliUserId struct { + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryCliUserIdFromString(value string) *EventBulkRetryCreateRequestQueryCliUserId { + return &EventBulkRetryCreateRequestQueryCliUserId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryCliUserIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryCliUserId { + return &EventBulkRetryCreateRequestQueryCliUserId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryCliUserId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryCliUserId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryCliUserId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryCliUserId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryCliUserIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryCliUserId) Accept(visitor EventBulkRetryCreateRequestQueryCliUserIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by `created_at` date using a date operator +type EventBulkRetryCreateRequestQueryCreatedAt struct { + DateTime time.Time + Operators *Operators + + typ string +} + +func NewEventBulkRetryCreateRequestQueryCreatedAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQueryCreatedAt { + return &EventBulkRetryCreateRequestQueryCreatedAt{typ: "DateTime", DateTime: value} +} + +func NewEventBulkRetryCreateRequestQueryCreatedAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryCreatedAt { + return &EventBulkRetryCreateRequestQueryCreatedAt{typ: "Operators", Operators: value} +} + +func (e *EventBulkRetryCreateRequestQueryCreatedAt) GetDateTime() time.Time { + if e == nil { + return time.Time{} + } + return e.DateTime +} + +func (e *EventBulkRetryCreateRequestQueryCreatedAt) GetOperators() *Operators { + if e == nil { + return nil + } + return e.Operators +} + +func (e *EventBulkRetryCreateRequestQueryCreatedAt) UnmarshalJSON(data []byte) error { + var valueDateTime *internal.DateTime + if err := json.Unmarshal(data, &valueDateTime); err == nil { + e.typ = "DateTime" + e.DateTime = valueDateTime.Time() + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + e.typ = "Operators" + e.Operators = valueOperators + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryCreatedAt) MarshalJSON() ([]byte, error) { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return json.Marshal(internal.NewDateTime(e.DateTime)) + } + if e.typ == "Operators" || e.Operators != nil { + return json.Marshal(e.Operators) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryCreatedAtVisitor interface { + VisitDateTime(time.Time) error + VisitOperators(*Operators) error +} + +func (e *EventBulkRetryCreateRequestQueryCreatedAt) Accept(visitor EventBulkRetryCreateRequestQueryCreatedAtVisitor) error { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return visitor.VisitDateTime(e.DateTime) + } + if e.typ == "Operators" || e.Operators != nil { + return visitor.VisitOperators(e.Operators) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by destination IDs +type EventBulkRetryCreateRequestQueryDestinationId struct { + // Destination ID + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryDestinationIdFromString(value string) *EventBulkRetryCreateRequestQueryDestinationId { + return &EventBulkRetryCreateRequestQueryDestinationId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryDestinationIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryDestinationId { + return &EventBulkRetryCreateRequestQueryDestinationId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryDestinationId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryDestinationId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryDestinationId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryDestinationId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryDestinationIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryDestinationId) Accept(visitor EventBulkRetryCreateRequestQueryDestinationIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by error code code +type EventBulkRetryCreateRequestQueryErrorCode struct { + AttemptErrorCodes AttemptErrorCodes + AttemptErrorCodesList []AttemptErrorCodes + + typ string +} + +func NewEventBulkRetryCreateRequestQueryErrorCodeFromAttemptErrorCodes(value AttemptErrorCodes) *EventBulkRetryCreateRequestQueryErrorCode { + return &EventBulkRetryCreateRequestQueryErrorCode{typ: "AttemptErrorCodes", AttemptErrorCodes: value} +} + +func NewEventBulkRetryCreateRequestQueryErrorCodeFromAttemptErrorCodesList(value []AttemptErrorCodes) *EventBulkRetryCreateRequestQueryErrorCode { + return &EventBulkRetryCreateRequestQueryErrorCode{typ: "AttemptErrorCodesList", AttemptErrorCodesList: value} +} + +func (e *EventBulkRetryCreateRequestQueryErrorCode) GetAttemptErrorCodes() AttemptErrorCodes { + if e == nil { + return "" + } + return e.AttemptErrorCodes +} + +func (e *EventBulkRetryCreateRequestQueryErrorCode) GetAttemptErrorCodesList() []AttemptErrorCodes { + if e == nil { + return nil + } + return e.AttemptErrorCodesList +} + +func (e *EventBulkRetryCreateRequestQueryErrorCode) UnmarshalJSON(data []byte) error { + var valueAttemptErrorCodes AttemptErrorCodes + if err := json.Unmarshal(data, &valueAttemptErrorCodes); err == nil { + e.typ = "AttemptErrorCodes" + e.AttemptErrorCodes = valueAttemptErrorCodes + return nil + } + var valueAttemptErrorCodesList []AttemptErrorCodes + if err := json.Unmarshal(data, &valueAttemptErrorCodesList); err == nil { + e.typ = "AttemptErrorCodesList" + e.AttemptErrorCodesList = valueAttemptErrorCodesList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryErrorCode) MarshalJSON() ([]byte, error) { + if e.typ == "AttemptErrorCodes" || e.AttemptErrorCodes != "" { + return json.Marshal(e.AttemptErrorCodes) + } + if e.typ == "AttemptErrorCodesList" || e.AttemptErrorCodesList != nil { + return json.Marshal(e.AttemptErrorCodesList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryErrorCodeVisitor interface { + VisitAttemptErrorCodes(AttemptErrorCodes) error + VisitAttemptErrorCodesList([]AttemptErrorCodes) error +} + +func (e *EventBulkRetryCreateRequestQueryErrorCode) Accept(visitor EventBulkRetryCreateRequestQueryErrorCodeVisitor) error { + if e.typ == "AttemptErrorCodes" || e.AttemptErrorCodes != "" { + return visitor.VisitAttemptErrorCodes(e.AttemptErrorCodes) + } + if e.typ == "AttemptErrorCodesList" || e.AttemptErrorCodesList != nil { + return visitor.VisitAttemptErrorCodesList(e.AttemptErrorCodesList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryEventDataId struct { + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryEventDataIdFromString(value string) *EventBulkRetryCreateRequestQueryEventDataId { + return &EventBulkRetryCreateRequestQueryEventDataId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryEventDataIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryEventDataId { + return &EventBulkRetryCreateRequestQueryEventDataId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryEventDataId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryEventDataId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryEventDataId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryEventDataId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryEventDataIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryEventDataId) Accept(visitor EventBulkRetryCreateRequestQueryEventDataIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// URL Encoded string of the JSON to match to the data headers +type EventBulkRetryCreateRequestQueryHeaders struct { + String string + EventBulkRetryCreateRequestQueryHeadersOne *EventBulkRetryCreateRequestQueryHeadersOne + + typ string +} + +func NewEventBulkRetryCreateRequestQueryHeadersFromString(value string) *EventBulkRetryCreateRequestQueryHeaders { + return &EventBulkRetryCreateRequestQueryHeaders{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryHeadersFromEventBulkRetryCreateRequestQueryHeadersOne(value *EventBulkRetryCreateRequestQueryHeadersOne) *EventBulkRetryCreateRequestQueryHeaders { + return &EventBulkRetryCreateRequestQueryHeaders{typ: "EventBulkRetryCreateRequestQueryHeadersOne", EventBulkRetryCreateRequestQueryHeadersOne: value} +} + +func (e *EventBulkRetryCreateRequestQueryHeaders) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryHeaders) GetEventBulkRetryCreateRequestQueryHeadersOne() *EventBulkRetryCreateRequestQueryHeadersOne { + if e == nil { + return nil + } + return e.EventBulkRetryCreateRequestQueryHeadersOne +} + +func (e *EventBulkRetryCreateRequestQueryHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + valueEventBulkRetryCreateRequestQueryHeadersOne := new(EventBulkRetryCreateRequestQueryHeadersOne) + if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryHeadersOne); err == nil { + e.typ = "EventBulkRetryCreateRequestQueryHeadersOne" + e.EventBulkRetryCreateRequestQueryHeadersOne = valueEventBulkRetryCreateRequestQueryHeadersOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryHeaders) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryHeadersOne" || e.EventBulkRetryCreateRequestQueryHeadersOne != nil { + return json.Marshal(e.EventBulkRetryCreateRequestQueryHeadersOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryHeadersVisitor interface { + VisitString(string) error + VisitEventBulkRetryCreateRequestQueryHeadersOne(*EventBulkRetryCreateRequestQueryHeadersOne) error +} + +func (e *EventBulkRetryCreateRequestQueryHeaders) Accept(visitor EventBulkRetryCreateRequestQueryHeadersVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryHeadersOne" || e.EventBulkRetryCreateRequestQueryHeadersOne != nil { + return visitor.VisitEventBulkRetryCreateRequestQueryHeadersOne(e.EventBulkRetryCreateRequestQueryHeadersOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryHeadersOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *EventBulkRetryCreateRequestQueryHeadersOne) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventBulkRetryCreateRequestQueryHeadersOne) UnmarshalJSON(data []byte) error { + type unmarshaler EventBulkRetryCreateRequestQueryHeadersOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EventBulkRetryCreateRequestQueryHeadersOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *EventBulkRetryCreateRequestQueryHeadersOne) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +// Filter by event IDs +type EventBulkRetryCreateRequestQueryId struct { + // Event ID + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryIdFromString(value string) *EventBulkRetryCreateRequestQueryId { + return &EventBulkRetryCreateRequestQueryId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryId { + return &EventBulkRetryCreateRequestQueryId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryId) Accept(visitor EventBulkRetryCreateRequestQueryIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryIssueId struct { + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryIssueIdFromString(value string) *EventBulkRetryCreateRequestQueryIssueId { + return &EventBulkRetryCreateRequestQueryIssueId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryIssueIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryIssueId { + return &EventBulkRetryCreateRequestQueryIssueId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryIssueId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryIssueId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryIssueId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryIssueId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryIssueIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryIssueId) Accept(visitor EventBulkRetryCreateRequestQueryIssueIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by `last_attempt_at` date using a date operator +type EventBulkRetryCreateRequestQueryLastAttemptAt struct { + DateTime time.Time + Operators *Operators + + typ string +} + +func NewEventBulkRetryCreateRequestQueryLastAttemptAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQueryLastAttemptAt { + return &EventBulkRetryCreateRequestQueryLastAttemptAt{typ: "DateTime", DateTime: value} +} + +func NewEventBulkRetryCreateRequestQueryLastAttemptAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryLastAttemptAt { + return &EventBulkRetryCreateRequestQueryLastAttemptAt{typ: "Operators", Operators: value} +} + +func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) GetDateTime() time.Time { + if e == nil { + return time.Time{} + } + return e.DateTime +} + +func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) GetOperators() *Operators { + if e == nil { + return nil + } + return e.Operators +} + +func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) UnmarshalJSON(data []byte) error { + var valueDateTime *internal.DateTime + if err := json.Unmarshal(data, &valueDateTime); err == nil { + e.typ = "DateTime" + e.DateTime = valueDateTime.Time() + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + e.typ = "Operators" + e.Operators = valueOperators + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryLastAttemptAt) MarshalJSON() ([]byte, error) { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return json.Marshal(internal.NewDateTime(e.DateTime)) + } + if e.typ == "Operators" || e.Operators != nil { + return json.Marshal(e.Operators) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryLastAttemptAtVisitor interface { + VisitDateTime(time.Time) error + VisitOperators(*Operators) error +} + +func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) Accept(visitor EventBulkRetryCreateRequestQueryLastAttemptAtVisitor) error { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return visitor.VisitDateTime(e.DateTime) + } + if e.typ == "Operators" || e.Operators != nil { + return visitor.VisitOperators(e.Operators) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) +type EventBulkRetryCreateRequestQueryParsedQuery struct { + String string + EventBulkRetryCreateRequestQueryParsedQueryOne *EventBulkRetryCreateRequestQueryParsedQueryOne + + typ string +} + +func NewEventBulkRetryCreateRequestQueryParsedQueryFromString(value string) *EventBulkRetryCreateRequestQueryParsedQuery { + return &EventBulkRetryCreateRequestQueryParsedQuery{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryParsedQueryFromEventBulkRetryCreateRequestQueryParsedQueryOne(value *EventBulkRetryCreateRequestQueryParsedQueryOne) *EventBulkRetryCreateRequestQueryParsedQuery { + return &EventBulkRetryCreateRequestQueryParsedQuery{typ: "EventBulkRetryCreateRequestQueryParsedQueryOne", EventBulkRetryCreateRequestQueryParsedQueryOne: value} +} + +func (e *EventBulkRetryCreateRequestQueryParsedQuery) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryParsedQuery) GetEventBulkRetryCreateRequestQueryParsedQueryOne() *EventBulkRetryCreateRequestQueryParsedQueryOne { + if e == nil { + return nil + } + return e.EventBulkRetryCreateRequestQueryParsedQueryOne +} + +func (e *EventBulkRetryCreateRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + valueEventBulkRetryCreateRequestQueryParsedQueryOne := new(EventBulkRetryCreateRequestQueryParsedQueryOne) + if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryParsedQueryOne); err == nil { + e.typ = "EventBulkRetryCreateRequestQueryParsedQueryOne" + e.EventBulkRetryCreateRequestQueryParsedQueryOne = valueEventBulkRetryCreateRequestQueryParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryParsedQueryOne" || e.EventBulkRetryCreateRequestQueryParsedQueryOne != nil { + return json.Marshal(e.EventBulkRetryCreateRequestQueryParsedQueryOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryParsedQueryVisitor interface { + VisitString(string) error + VisitEventBulkRetryCreateRequestQueryParsedQueryOne(*EventBulkRetryCreateRequestQueryParsedQueryOne) error +} + +func (e *EventBulkRetryCreateRequestQueryParsedQuery) Accept(visitor EventBulkRetryCreateRequestQueryParsedQueryVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "EventBulkRetryCreateRequestQueryParsedQueryOne" || e.EventBulkRetryCreateRequestQueryParsedQueryOne != nil { + return visitor.VisitEventBulkRetryCreateRequestQueryParsedQueryOne(e.EventBulkRetryCreateRequestQueryParsedQueryOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryParsedQueryOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) UnmarshalJSON(data []byte) error { + type unmarshaler EventBulkRetryCreateRequestQueryParsedQueryOne var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventBulkRetryCreateRequestQuery(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *e = EventBulkRetryCreateRequestQueryParsedQueryOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + e.rawJSON = json.RawMessage(data) return nil } -func (e *EventBulkRetryCreateRequestQuery) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } return fmt.Sprintf("%#v", e) } +// Filter by HTTP response status code +type EventBulkRetryCreateRequestQueryResponseStatus struct { + Integer int + Operators *Operators + IntegerList []int + + typ string +} + +func NewEventBulkRetryCreateRequestQueryResponseStatusFromInteger(value int) *EventBulkRetryCreateRequestQueryResponseStatus { + return &EventBulkRetryCreateRequestQueryResponseStatus{typ: "Integer", Integer: value} +} + +func NewEventBulkRetryCreateRequestQueryResponseStatusFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryResponseStatus { + return &EventBulkRetryCreateRequestQueryResponseStatus{typ: "Operators", Operators: value} +} + +func NewEventBulkRetryCreateRequestQueryResponseStatusFromIntegerList(value []int) *EventBulkRetryCreateRequestQueryResponseStatus { + return &EventBulkRetryCreateRequestQueryResponseStatus{typ: "IntegerList", IntegerList: value} +} + +func (e *EventBulkRetryCreateRequestQueryResponseStatus) GetInteger() int { + if e == nil { + return 0 + } + return e.Integer +} + +func (e *EventBulkRetryCreateRequestQueryResponseStatus) GetOperators() *Operators { + if e == nil { + return nil + } + return e.Operators +} + +func (e *EventBulkRetryCreateRequestQueryResponseStatus) GetIntegerList() []int { + if e == nil { + return nil + } + return e.IntegerList +} + +func (e *EventBulkRetryCreateRequestQueryResponseStatus) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + e.typ = "Integer" + e.Integer = valueInteger + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + e.typ = "Operators" + e.Operators = valueOperators + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + e.typ = "IntegerList" + e.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryResponseStatus) MarshalJSON() ([]byte, error) { + if e.typ == "Integer" || e.Integer != 0 { + return json.Marshal(e.Integer) + } + if e.typ == "Operators" || e.Operators != nil { + return json.Marshal(e.Operators) + } + if e.typ == "IntegerList" || e.IntegerList != nil { + return json.Marshal(e.IntegerList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryResponseStatusVisitor interface { + VisitInteger(int) error + VisitOperators(*Operators) error + VisitIntegerList([]int) error +} + +func (e *EventBulkRetryCreateRequestQueryResponseStatus) Accept(visitor EventBulkRetryCreateRequestQueryResponseStatusVisitor) error { + if e.typ == "Integer" || e.Integer != 0 { + return visitor.VisitInteger(e.Integer) + } + if e.typ == "Operators" || e.Operators != nil { + return visitor.VisitOperators(e.Operators) + } + if e.typ == "IntegerList" || e.IntegerList != nil { + return visitor.VisitIntegerList(e.IntegerList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by source IDs +type EventBulkRetryCreateRequestQuerySourceId struct { + // Source ID + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQuerySourceIdFromString(value string) *EventBulkRetryCreateRequestQuerySourceId { + return &EventBulkRetryCreateRequestQuerySourceId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQuerySourceIdFromStringList(value []string) *EventBulkRetryCreateRequestQuerySourceId { + return &EventBulkRetryCreateRequestQuerySourceId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQuerySourceId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQuerySourceId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQuerySourceId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQuerySourceId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQuerySourceIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQuerySourceId) Accept(visitor EventBulkRetryCreateRequestQuerySourceIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Lifecyle status of the event +type EventBulkRetryCreateRequestQueryStatus struct { + EventStatus EventStatus + EventStatusList []EventStatus + + typ string +} + +func NewEventBulkRetryCreateRequestQueryStatusFromEventStatus(value EventStatus) *EventBulkRetryCreateRequestQueryStatus { + return &EventBulkRetryCreateRequestQueryStatus{typ: "EventStatus", EventStatus: value} +} + +func NewEventBulkRetryCreateRequestQueryStatusFromEventStatusList(value []EventStatus) *EventBulkRetryCreateRequestQueryStatus { + return &EventBulkRetryCreateRequestQueryStatus{typ: "EventStatusList", EventStatusList: value} +} + +func (e *EventBulkRetryCreateRequestQueryStatus) GetEventStatus() EventStatus { + if e == nil { + return "" + } + return e.EventStatus +} + +func (e *EventBulkRetryCreateRequestQueryStatus) GetEventStatusList() []EventStatus { + if e == nil { + return nil + } + return e.EventStatusList +} + +func (e *EventBulkRetryCreateRequestQueryStatus) UnmarshalJSON(data []byte) error { + var valueEventStatus EventStatus + if err := json.Unmarshal(data, &valueEventStatus); err == nil { + e.typ = "EventStatus" + e.EventStatus = valueEventStatus + return nil + } + var valueEventStatusList []EventStatus + if err := json.Unmarshal(data, &valueEventStatusList); err == nil { + e.typ = "EventStatusList" + e.EventStatusList = valueEventStatusList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryStatus) MarshalJSON() ([]byte, error) { + if e.typ == "EventStatus" || e.EventStatus != "" { + return json.Marshal(e.EventStatus) + } + if e.typ == "EventStatusList" || e.EventStatusList != nil { + return json.Marshal(e.EventStatusList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryStatusVisitor interface { + VisitEventStatus(EventStatus) error + VisitEventStatusList([]EventStatus) error +} + +func (e *EventBulkRetryCreateRequestQueryStatus) Accept(visitor EventBulkRetryCreateRequestQueryStatusVisitor) error { + if e.typ == "EventStatus" || e.EventStatus != "" { + return visitor.VisitEventStatus(e.EventStatus) + } + if e.typ == "EventStatusList" || e.EventStatusList != nil { + return visitor.VisitEventStatusList(e.EventStatusList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by `successful_at` date using a date operator +type EventBulkRetryCreateRequestQuerySuccessfulAt struct { + DateTime time.Time + Operators *Operators + + typ string +} + +func NewEventBulkRetryCreateRequestQuerySuccessfulAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQuerySuccessfulAt { + return &EventBulkRetryCreateRequestQuerySuccessfulAt{typ: "DateTime", DateTime: value} +} + +func NewEventBulkRetryCreateRequestQuerySuccessfulAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQuerySuccessfulAt { + return &EventBulkRetryCreateRequestQuerySuccessfulAt{typ: "Operators", Operators: value} +} + +func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) GetDateTime() time.Time { + if e == nil { + return time.Time{} + } + return e.DateTime +} + +func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) GetOperators() *Operators { + if e == nil { + return nil + } + return e.Operators +} + +func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) UnmarshalJSON(data []byte) error { + var valueDateTime *internal.DateTime + if err := json.Unmarshal(data, &valueDateTime); err == nil { + e.typ = "DateTime" + e.DateTime = valueDateTime.Time() + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + e.typ = "Operators" + e.Operators = valueOperators + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQuerySuccessfulAt) MarshalJSON() ([]byte, error) { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return json.Marshal(internal.NewDateTime(e.DateTime)) + } + if e.typ == "Operators" || e.Operators != nil { + return json.Marshal(e.Operators) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQuerySuccessfulAtVisitor interface { + VisitDateTime(time.Time) error + VisitOperators(*Operators) error +} + +func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) Accept(visitor EventBulkRetryCreateRequestQuerySuccessfulAtVisitor) error { + if e.typ == "DateTime" || !e.DateTime.IsZero() { + return visitor.VisitDateTime(e.DateTime) + } + if e.typ == "Operators" || e.Operators != nil { + return visitor.VisitOperators(e.Operators) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + +// Filter by webhook connection IDs +type EventBulkRetryCreateRequestQueryWebhookId struct { + // Webhook ID + String string + StringList []string + + typ string +} + +func NewEventBulkRetryCreateRequestQueryWebhookIdFromString(value string) *EventBulkRetryCreateRequestQueryWebhookId { + return &EventBulkRetryCreateRequestQueryWebhookId{typ: "String", String: value} +} + +func NewEventBulkRetryCreateRequestQueryWebhookIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryWebhookId { + return &EventBulkRetryCreateRequestQueryWebhookId{typ: "StringList", StringList: value} +} + +func (e *EventBulkRetryCreateRequestQueryWebhookId) GetString() string { + if e == nil { + return "" + } + return e.String +} + +func (e *EventBulkRetryCreateRequestQueryWebhookId) GetStringList() []string { + if e == nil { + return nil + } + return e.StringList +} + +func (e *EventBulkRetryCreateRequestQueryWebhookId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + e.typ = "String" + e.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + e.typ = "StringList" + e.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventBulkRetryCreateRequestQueryWebhookId) MarshalJSON() ([]byte, error) { + if e.typ == "String" || e.String != "" { + return json.Marshal(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return json.Marshal(e.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EventBulkRetryCreateRequestQueryWebhookIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (e *EventBulkRetryCreateRequestQueryWebhookId) Accept(visitor EventBulkRetryCreateRequestQueryWebhookIdVisitor) error { + if e.typ == "String" || e.String != "" { + return visitor.VisitString(e.String) + } + if e.typ == "StringList" || e.StringList != nil { + return visitor.VisitStringList(e.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + type EventBulkRetryListRequestDir string const ( @@ -157,7 +1867,28 @@ type EventBulkRetryPlanResponse struct { Progress *float64 `json:"progress,omitempty" url:"progress,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (e *EventBulkRetryPlanResponse) GetEstimatedBatch() *int { + if e == nil { + return nil + } + return e.EstimatedBatch +} + +func (e *EventBulkRetryPlanResponse) GetEstimatedCount() *int { + if e == nil { + return nil + } + return e.EstimatedCount +} + +func (e *EventBulkRetryPlanResponse) GetProgress() *float64 { + if e == nil { + return nil + } + return e.Progress } func (e *EventBulkRetryPlanResponse) GetExtraProperties() map[string]interface{} { @@ -171,24 +1902,22 @@ func (e *EventBulkRetryPlanResponse) UnmarshalJSON(data []byte) error { return err } *e = EventBulkRetryPlanResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + e.rawJSON = json.RawMessage(data) return nil } func (e *EventBulkRetryPlanResponse) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } return fmt.Sprintf("%#v", e) diff --git a/eventbulkretry/client.go b/eventbulkretry/client.go index 7a0b0b4..e957c6f 100644 --- a/eventbulkretry/client.go +++ b/eventbulkretry/client.go @@ -3,20 +3,17 @@ package eventbulkretry import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperationPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/events/retry" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperationPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/events/retry" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -177,57 +143,42 @@ func (c *Client) Plan( opts ...option.RequestOption, ) (*hookdeckgosdk.EventBulkRetryPlanResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/events/retry/plan" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.EventBulkRetryPlanResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -241,50 +192,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/events/retry/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/events/retry/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -298,50 +239,40 @@ func (c *Client) Cancel( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/events/retry/%v/cancel", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/events/retry/%v/cancel", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/file_param.go b/file_param.go new file mode 100644 index 0000000..737abb9 --- /dev/null +++ b/file_param.go @@ -0,0 +1,41 @@ +package api + +import ( + "io" +) + +// FileParam is a file type suitable for multipart/form-data uploads. +type FileParam struct { + io.Reader + filename string + contentType string +} + +// FileParamOption adapts the behavior of the FileParam. No options are +// implemented yet, but this interface allows for future extensibility. +type FileParamOption interface { + apply() +} + +// NewFileParam returns a *FileParam type suitable for multipart/form-data uploads. All file +// upload endpoints accept a simple io.Reader, which is usually created by opening a file +// via os.Open. +// +// However, some endpoints require additional metadata about the file such as a specific +// Content-Type or custom filename. FileParam makes it easier to create the correct type +// signature for these endpoints. +func NewFileParam( + reader io.Reader, + filename string, + contentType string, + opts ...FileParamOption, +) *FileParam { + return &FileParam{ + Reader: reader, + filename: filename, + contentType: contentType, + } +} + +func (f *FileParam) Name() string { return f.filename } +func (f *FileParam) ContentType() string { return f.contentType } diff --git a/ignored_event_bulk_retry.go b/ignored_event_bulk_retry.go index 3affc7e..a857a5a 100644 --- a/ignored_event_bulk_retry.go +++ b/ignored_event_bulk_retry.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -38,7 +39,28 @@ type IgnoredEventBulkRetryCreateRequestQuery struct { TransformationId *string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (i *IgnoredEventBulkRetryCreateRequestQuery) GetCause() *IgnoredEventBulkRetryCreateRequestQueryCause { + if i == nil { + return nil + } + return i.Cause +} + +func (i *IgnoredEventBulkRetryCreateRequestQuery) GetWebhookId() *IgnoredEventBulkRetryCreateRequestQueryWebhookId { + if i == nil { + return nil + } + return i.WebhookId +} + +func (i *IgnoredEventBulkRetryCreateRequestQuery) GetTransformationId() *string { + if i == nil { + return nil + } + return i.TransformationId } func (i *IgnoredEventBulkRetryCreateRequestQuery) GetExtraProperties() map[string]interface{} { @@ -52,29 +74,169 @@ func (i *IgnoredEventBulkRetryCreateRequestQuery) UnmarshalJSON(data []byte) err return err } *i = IgnoredEventBulkRetryCreateRequestQuery(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := internal.ExtractExtraProperties(data, *i) if err != nil { return err } i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + i.rawJSON = json.RawMessage(data) return nil } func (i *IgnoredEventBulkRetryCreateRequestQuery) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(i); err == nil { return value } return fmt.Sprintf("%#v", i) } +// The cause of the ignored event +type IgnoredEventBulkRetryCreateRequestQueryCause struct { + String string + StringList []string + + typ string +} + +func NewIgnoredEventBulkRetryCreateRequestQueryCauseFromString(value string) *IgnoredEventBulkRetryCreateRequestQueryCause { + return &IgnoredEventBulkRetryCreateRequestQueryCause{typ: "String", String: value} +} + +func NewIgnoredEventBulkRetryCreateRequestQueryCauseFromStringList(value []string) *IgnoredEventBulkRetryCreateRequestQueryCause { + return &IgnoredEventBulkRetryCreateRequestQueryCause{typ: "StringList", StringList: value} +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryCause) GetString() string { + if i == nil { + return "" + } + return i.String +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryCause) GetStringList() []string { + if i == nil { + return nil + } + return i.StringList +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryCause) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typ = "String" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typ = "StringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IgnoredEventBulkRetryCreateRequestQueryCause) MarshalJSON() ([]byte, error) { + if i.typ == "String" || i.String != "" { + return json.Marshal(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return json.Marshal(i.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IgnoredEventBulkRetryCreateRequestQueryCauseVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryCause) Accept(visitor IgnoredEventBulkRetryCreateRequestQueryCauseVisitor) error { + if i.typ == "String" || i.String != "" { + return visitor.VisitString(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return visitor.VisitStringList(i.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +// Connection ID of the ignored event +type IgnoredEventBulkRetryCreateRequestQueryWebhookId struct { + String string + StringList []string + + typ string +} + +func NewIgnoredEventBulkRetryCreateRequestQueryWebhookIdFromString(value string) *IgnoredEventBulkRetryCreateRequestQueryWebhookId { + return &IgnoredEventBulkRetryCreateRequestQueryWebhookId{typ: "String", String: value} +} + +func NewIgnoredEventBulkRetryCreateRequestQueryWebhookIdFromStringList(value []string) *IgnoredEventBulkRetryCreateRequestQueryWebhookId { + return &IgnoredEventBulkRetryCreateRequestQueryWebhookId{typ: "StringList", StringList: value} +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) GetString() string { + if i == nil { + return "" + } + return i.String +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) GetStringList() []string { + if i == nil { + return nil + } + return i.StringList +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typ = "String" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typ = "StringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IgnoredEventBulkRetryCreateRequestQueryWebhookId) MarshalJSON() ([]byte, error) { + if i.typ == "String" || i.String != "" { + return json.Marshal(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return json.Marshal(i.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IgnoredEventBulkRetryCreateRequestQueryWebhookIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) Accept(visitor IgnoredEventBulkRetryCreateRequestQueryWebhookIdVisitor) error { + if i.typ == "String" || i.String != "" { + return visitor.VisitString(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return visitor.VisitStringList(i.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + type IgnoredEventBulkRetryListRequestDir string const ( @@ -125,7 +287,28 @@ type IgnoredEventBulkRetryPlanResponse struct { Progress *float64 `json:"progress,omitempty" url:"progress,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (i *IgnoredEventBulkRetryPlanResponse) GetEstimatedBatch() *int { + if i == nil { + return nil + } + return i.EstimatedBatch +} + +func (i *IgnoredEventBulkRetryPlanResponse) GetEstimatedCount() *int { + if i == nil { + return nil + } + return i.EstimatedCount +} + +func (i *IgnoredEventBulkRetryPlanResponse) GetProgress() *float64 { + if i == nil { + return nil + } + return i.Progress } func (i *IgnoredEventBulkRetryPlanResponse) GetExtraProperties() map[string]interface{} { @@ -139,24 +322,22 @@ func (i *IgnoredEventBulkRetryPlanResponse) UnmarshalJSON(data []byte) error { return err } *i = IgnoredEventBulkRetryPlanResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + extraProperties, err := internal.ExtractExtraProperties(data, *i) if err != nil { return err } i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + i.rawJSON = json.RawMessage(data) return nil } func (i *IgnoredEventBulkRetryPlanResponse) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(i); err == nil { return value } return fmt.Sprintf("%#v", i) diff --git a/ignoredeventbulkretry/client.go b/ignoredeventbulkretry/client.go index a02687f..ed795e2 100644 --- a/ignoredeventbulkretry/client.go +++ b/ignoredeventbulkretry/client.go @@ -3,20 +3,17 @@ package ignoredeventbulkretry import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperationPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/ignored-events/retry" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperationPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/ignored-events/retry" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -177,57 +143,42 @@ func (c *Client) Plan( opts ...option.RequestOption, ) (*hookdeckgosdk.IgnoredEventBulkRetryPlanResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/ignored-events/retry/plan" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IgnoredEventBulkRetryPlanResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -241,50 +192,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/ignored-events/retry/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/ignored-events/retry/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -298,50 +239,40 @@ func (c *Client) Cancel( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/ignored-events/retry/%v/cancel", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/ignored-events/retry/%v/cancel", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/core/core.go b/internal/caller.go similarity index 69% rename from core/core.go rename to internal/caller.go index 6b5a8f3..7b1e328 100644 --- a/core/core.go +++ b/internal/caller.go @@ -1,4 +1,4 @@ -package core +package internal import ( "bytes" @@ -7,11 +7,12 @@ import ( "errors" "fmt" "io" - "mime/multipart" "net/http" "net/url" "reflect" "strings" + + "github.com/hookdeck/hookdeck-go-sdk/core" ) const ( @@ -20,105 +21,21 @@ const ( contentTypeHeader = "Content-Type" ) -// HTTPClient is an interface for a subset of the *http.Client. -type HTTPClient interface { - Do(*http.Request) (*http.Response, error) -} - -// EncodeURL encodes the given arguments into the URL, escaping -// values as needed. -func EncodeURL(urlFormat string, args ...interface{}) string { - escapedArgs := make([]interface{}, 0, len(args)) - for _, arg := range args { - escapedArgs = append(escapedArgs, url.PathEscape(fmt.Sprintf("%v", arg))) - } - return fmt.Sprintf(urlFormat, escapedArgs...) -} - -// MergeHeaders merges the given headers together, where the right -// takes precedence over the left. -func MergeHeaders(left, right http.Header) http.Header { - for key, values := range right { - if len(values) > 1 { - left[key] = values - continue - } - if value := right.Get(key); value != "" { - left.Set(key, value) - } - } - return left -} - -// WriteMultipartJSON writes the given value as a JSON part. -// This is used to serialize non-primitive multipart properties -// (i.e. lists, objects, etc). -func WriteMultipartJSON(writer *multipart.Writer, field string, value interface{}) error { - bytes, err := json.Marshal(value) - if err != nil { - return err - } - return writer.WriteField(field, string(bytes)) -} - -// APIError is a lightweight wrapper around the standard error -// interface that preserves the status code from the RPC, if any. -type APIError struct { - err error - - StatusCode int `json:"-"` -} - -// NewAPIError constructs a new API error. -func NewAPIError(statusCode int, err error) *APIError { - return &APIError{ - err: err, - StatusCode: statusCode, - } -} - -// Unwrap returns the underlying error. This also makes the error compatible -// with errors.As and errors.Is. -func (a *APIError) Unwrap() error { - if a == nil { - return nil - } - return a.err -} - -// Error returns the API error's message. -func (a *APIError) Error() string { - if a == nil || (a.err == nil && a.StatusCode == 0) { - return "" - } - if a.err == nil { - return fmt.Sprintf("%d", a.StatusCode) - } - if a.StatusCode == 0 { - return a.err.Error() - } - return fmt.Sprintf("%d: %s", a.StatusCode, a.err.Error()) -} - -// ErrorDecoder decodes *http.Response errors and returns a -// typed API error (e.g. *APIError). -type ErrorDecoder func(statusCode int, body io.Reader) error - // Caller calls APIs and deserializes their response, if any. type Caller struct { - client HTTPClient + client core.HTTPClient retrier *Retrier } // CallerParams represents the parameters used to constrcut a new *Caller. type CallerParams struct { - Client HTTPClient + Client core.HTTPClient MaxAttempts uint } // NewCaller returns a new *Caller backed by the given parameters. func NewCaller(params *CallerParams) *Caller { - var httpClient HTTPClient = http.DefaultClient + var httpClient core.HTTPClient = http.DefaultClient if params.Client != nil { httpClient = params.Client } @@ -140,7 +57,7 @@ type CallParams struct { Headers http.Header BodyProperties map[string]interface{} QueryParameters url.Values - Client HTTPClient + Client core.HTTPClient Request interface{} Response interface{} ResponseIsOptional bool @@ -309,9 +226,9 @@ func decodeError(response *http.Response, errorDecoder ErrorDecoder) error { // The error didn't have a response body, // so all we can do is return an error // with the status code. - return NewAPIError(response.StatusCode, nil) + return core.NewAPIError(response.StatusCode, nil) } - return NewAPIError(response.StatusCode, errors.New(string(bytes))) + return core.NewAPIError(response.StatusCode, errors.New(string(bytes))) } // isNil is used to determine if the request value is equal to nil (i.e. an interface diff --git a/core/core_test.go b/internal/caller_test.go similarity index 97% rename from core/core_test.go rename to internal/caller_test.go index e6eaef3..62c2fbf 100644 --- a/core/core_test.go +++ b/internal/caller_test.go @@ -1,4 +1,4 @@ -package core +package internal import ( "bytes" @@ -13,6 +13,7 @@ import ( "strconv" "testing" + "github.com/hookdeck/hookdeck-go-sdk/core" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -50,7 +51,7 @@ type Response struct { // NotFoundError represents a 404. type NotFoundError struct { - *APIError + *core.APIError Message string `json:"message"` } @@ -98,7 +99,7 @@ func TestCall(t *testing.T) { }, giveErrorDecoder: newTestErrorDecoder(t), wantError: &NotFoundError{ - APIError: NewAPIError( + APIError: core.NewAPIError( http.StatusNotFound, errors.New(`{"message":"ID \"404\" not found"}`), ), @@ -111,7 +112,7 @@ func TestCall(t *testing.T) { "X-API-Status": []string{"fail"}, }, giveRequest: nil, - wantError: NewAPIError( + wantError: core.NewAPIError( http.StatusBadRequest, errors.New("invalid request"), ), @@ -136,7 +137,7 @@ func TestCall(t *testing.T) { giveRequest: &Request{ Id: strconv.Itoa(http.StatusInternalServerError), }, - wantError: NewAPIError( + wantError: core.NewAPIError( http.StatusInternalServerError, errors.New("failed to process request"), ), @@ -324,7 +325,7 @@ func newTestServer(t *testing.T, tc *TestCase) *httptest.Server { switch request.Id { case strconv.Itoa(http.StatusNotFound): notFoundError := &NotFoundError{ - APIError: &APIError{ + APIError: &core.APIError{ StatusCode: http.StatusNotFound, }, Message: fmt.Sprintf("ID %q not found", request.Id), @@ -375,7 +376,7 @@ func newTestErrorDecoder(t *testing.T) func(int, io.Reader) error { require.NoError(t, err) var ( - apiError = NewAPIError(statusCode, errors.New(string(raw))) + apiError = core.NewAPIError(statusCode, errors.New(string(raw))) decoder = json.NewDecoder(bytes.NewReader(raw)) ) if statusCode == http.StatusNotFound { diff --git a/internal/error_decoder.go b/internal/error_decoder.go new file mode 100644 index 0000000..8e23dc5 --- /dev/null +++ b/internal/error_decoder.go @@ -0,0 +1,45 @@ +package internal + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + + "github.com/hookdeck/hookdeck-go-sdk/core" +) + +// ErrorDecoder decodes *http.Response errors and returns a +// typed API error (e.g. *core.APIError). +type ErrorDecoder func(statusCode int, body io.Reader) error + +// ErrorCodes maps HTTP status codes to error constructors. +type ErrorCodes map[int]func(*core.APIError) error + +// NewErrorDecoder returns a new ErrorDecoder backed by the given error codes. +func NewErrorDecoder(errorCodes ErrorCodes) ErrorDecoder { + return func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return fmt.Errorf("failed to read error from response body: %w", err) + } + apiError := core.NewAPIError( + statusCode, + errors.New(string(raw)), + ) + newErrorFunc, ok := errorCodes[statusCode] + if !ok { + // This status code isn't recognized, so we return + // the API error as-is. + return apiError + } + customError := newErrorFunc(apiError) + if err := json.NewDecoder(bytes.NewReader(raw)).Decode(customError); err != nil { + // If we fail to decode the error, we return the + // API error as-is. + return apiError + } + return customError + } +} diff --git a/internal/error_decoder_test.go b/internal/error_decoder_test.go new file mode 100644 index 0000000..2c9eb04 --- /dev/null +++ b/internal/error_decoder_test.go @@ -0,0 +1,55 @@ +package internal + +import ( + "bytes" + "errors" + "net/http" + "testing" + + "github.com/hookdeck/hookdeck-go-sdk/core" + "github.com/stretchr/testify/assert" +) + +func TestErrorDecoder(t *testing.T) { + decoder := NewErrorDecoder( + ErrorCodes{ + http.StatusNotFound: func(apiError *core.APIError) error { + return &NotFoundError{APIError: apiError} + }, + }) + + tests := []struct { + description string + giveStatusCode int + giveBody string + wantError error + }{ + { + description: "unrecognized status code", + giveStatusCode: http.StatusInternalServerError, + giveBody: "Internal Server Error", + wantError: core.NewAPIError(http.StatusInternalServerError, errors.New("Internal Server Error")), + }, + { + description: "not found with valid JSON", + giveStatusCode: http.StatusNotFound, + giveBody: `{"message": "Resource not found"}`, + wantError: &NotFoundError{ + APIError: core.NewAPIError(http.StatusNotFound, errors.New(`{"message": "Resource not found"}`)), + Message: "Resource not found", + }, + }, + { + description: "not found with invalid JSON", + giveStatusCode: http.StatusNotFound, + giveBody: `Resource not found`, + wantError: core.NewAPIError(http.StatusNotFound, errors.New("Resource not found")), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + assert.Equal(t, tt.wantError, decoder(tt.giveStatusCode, bytes.NewReader([]byte(tt.giveBody)))) + }) + } +} diff --git a/core/extra_properties.go b/internal/extra_properties.go similarity index 99% rename from core/extra_properties.go rename to internal/extra_properties.go index a6af3e1..540c3fd 100644 --- a/core/extra_properties.go +++ b/internal/extra_properties.go @@ -1,4 +1,4 @@ -package core +package internal import ( "bytes" diff --git a/core/extra_properties_test.go b/internal/extra_properties_test.go similarity index 99% rename from core/extra_properties_test.go rename to internal/extra_properties_test.go index dc66fcc..aa2510e 100644 --- a/core/extra_properties_test.go +++ b/internal/extra_properties_test.go @@ -1,4 +1,4 @@ -package core +package internal import ( "encoding/json" diff --git a/internal/http.go b/internal/http.go new file mode 100644 index 0000000..768968b --- /dev/null +++ b/internal/http.go @@ -0,0 +1,48 @@ +package internal + +import ( + "fmt" + "net/http" + "net/url" +) + +// HTTPClient is an interface for a subset of the *http.Client. +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// ResolveBaseURL resolves the base URL from the given arguments, +// preferring the first non-empty value. +func ResolveBaseURL(values ...string) string { + for _, value := range values { + if value != "" { + return value + } + } + return "" +} + +// EncodeURL encodes the given arguments into the URL, escaping +// values as needed. +func EncodeURL(urlFormat string, args ...interface{}) string { + escapedArgs := make([]interface{}, 0, len(args)) + for _, arg := range args { + escapedArgs = append(escapedArgs, url.PathEscape(fmt.Sprintf("%v", arg))) + } + return fmt.Sprintf(urlFormat, escapedArgs...) +} + +// MergeHeaders merges the given headers together, where the right +// takes precedence over the left. +func MergeHeaders(left, right http.Header) http.Header { + for key, values := range right { + if len(values) > 1 { + left[key] = values + continue + } + if value := right.Get(key); value != "" { + left.Set(key, value) + } + } + return left +} diff --git a/core/query.go b/internal/query.go similarity index 99% rename from core/query.go rename to internal/query.go index 2670ff7..6129e71 100644 --- a/core/query.go +++ b/internal/query.go @@ -1,4 +1,4 @@ -package core +package internal import ( "encoding/base64" diff --git a/core/query_test.go b/internal/query_test.go similarity index 99% rename from core/query_test.go rename to internal/query_test.go index 5498fa9..2e58cca 100644 --- a/core/query_test.go +++ b/internal/query_test.go @@ -1,4 +1,4 @@ -package core +package internal import ( "testing" diff --git a/core/retrier.go b/internal/retrier.go similarity index 98% rename from core/retrier.go rename to internal/retrier.go index ea24916..6040147 100644 --- a/core/retrier.go +++ b/internal/retrier.go @@ -1,4 +1,4 @@ -package core +package internal import ( "crypto/rand" @@ -130,7 +130,6 @@ func (r *Retrier) run( func (r *Retrier) shouldRetry(response *http.Response) bool { return response.StatusCode == http.StatusTooManyRequests || response.StatusCode == http.StatusRequestTimeout || - response.StatusCode == http.StatusConflict || response.StatusCode >= http.StatusInternalServerError } diff --git a/internal/retrier_test.go b/internal/retrier_test.go new file mode 100644 index 0000000..4ae9335 --- /dev/null +++ b/internal/retrier_test.go @@ -0,0 +1,211 @@ +package internal + +import ( + "context" + "encoding/json" + "io" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/hookdeck/hookdeck-go-sdk/core" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type RetryTestCase struct { + description string + + giveAttempts uint + giveStatusCodes []int + giveResponse *Response + + wantResponse *Response + wantError *core.APIError +} + +func TestRetrier(t *testing.T) { + tests := []*RetryTestCase{ + { + description: "retry request succeeds after multiple failures", + giveAttempts: 3, + giveStatusCodes: []int{ + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusOK, + }, + giveResponse: &Response{ + Id: "1", + }, + wantResponse: &Response{ + Id: "1", + }, + }, + { + description: "retry request fails if MaxAttempts is exceeded", + giveAttempts: 3, + giveStatusCodes: []int{ + http.StatusRequestTimeout, + http.StatusRequestTimeout, + http.StatusRequestTimeout, + http.StatusOK, + }, + wantError: &core.APIError{ + StatusCode: http.StatusRequestTimeout, + }, + }, + { + description: "retry durations increase exponentially and stay within the min and max delay values", + giveAttempts: 4, + giveStatusCodes: []int{ + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusOK, + }, + }, + { + description: "retry does not occur on status code 404", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusNotFound, http.StatusOK}, + wantError: &core.APIError{ + StatusCode: http.StatusNotFound, + }, + }, + { + description: "retries occur on status code 429", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusTooManyRequests, http.StatusOK}, + }, + { + description: "retries occur on status code 408", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, + }, + { + description: "retries occur on status code 500", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + }, + } + + for _, tc := range tests { + t.Run(tc.description, func(t *testing.T) { + var ( + test = tc + server = newTestRetryServer(t, test) + client = server.Client() + ) + + t.Parallel() + + caller := NewCaller( + &CallerParams{ + Client: client, + }, + ) + + var response *Response + err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL, + Method: http.MethodGet, + Request: &Request{}, + Response: &response, + MaxAttempts: test.giveAttempts, + ResponseIsOptional: true, + }, + ) + + if test.wantError != nil { + require.IsType(t, err, &core.APIError{}) + expectedErrorCode := test.wantError.StatusCode + actualErrorCode := err.(*core.APIError).StatusCode + assert.Equal(t, expectedErrorCode, actualErrorCode) + return + } + + require.NoError(t, err) + assert.Equal(t, test.wantResponse, response) + }) + } +} + +// newTestRetryServer returns a new *httptest.Server configured with the +// given test parameters, suitable for testing retries. +func newTestRetryServer(t *testing.T, tc *RetryTestCase) *httptest.Server { + var index int + timestamps := make([]time.Time, 0, len(tc.giveStatusCodes)) + + return httptest.NewServer( + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + timestamps = append(timestamps, time.Now()) + if index > 0 && index < len(expectedRetryDurations) { + // Ensure that the duration between retries increases exponentially, + // and that it is within the minimum and maximum retry delay values. + actualDuration := timestamps[index].Sub(timestamps[index-1]) + expectedDurationMin := expectedRetryDurations[index-1] * 75 / 100 + expectedDurationMax := expectedRetryDurations[index-1] * 125 / 100 + assert.True( + t, + actualDuration >= expectedDurationMin && actualDuration <= expectedDurationMax, + "expected duration to be in range [%v, %v], got %v", + expectedDurationMin, + expectedDurationMax, + actualDuration, + ) + assert.LessOrEqual( + t, + actualDuration, + maxRetryDelay, + "expected duration to be less than the maxRetryDelay (%v), got %v", + maxRetryDelay, + actualDuration, + ) + assert.GreaterOrEqual( + t, + actualDuration, + minRetryDelay, + "expected duration to be greater than the minRetryDelay (%v), got %v", + minRetryDelay, + actualDuration, + ) + } + + request := new(Request) + bytes, err := io.ReadAll(r.Body) + require.NoError(t, err) + require.NoError(t, json.Unmarshal(bytes, request)) + require.LessOrEqual(t, index, len(tc.giveStatusCodes)) + + statusCode := tc.giveStatusCodes[index] + w.WriteHeader(statusCode) + + if tc.giveResponse != nil && statusCode == http.StatusOK { + bytes, err = json.Marshal(tc.giveResponse) + require.NoError(t, err) + _, err = w.Write(bytes) + require.NoError(t, err) + } + + index++ + }, + ), + ) +} + +// expectedRetryDurations holds an array of calculated retry durations, +// where the index of the array should correspond to the retry attempt. +// +// Values are calculated based off of `minRetryDelay + minRetryDelay*i*i`, with +// a max and min value of 5000ms and 500ms respectively. +var expectedRetryDurations = []time.Duration{ + 500 * time.Millisecond, + 1000 * time.Millisecond, + 2500 * time.Millisecond, + 5000 * time.Millisecond, + 5000 * time.Millisecond, +} diff --git a/core/stringer.go b/internal/stringer.go similarity index 94% rename from core/stringer.go rename to internal/stringer.go index 000cf44..3128018 100644 --- a/core/stringer.go +++ b/internal/stringer.go @@ -1,4 +1,4 @@ -package core +package internal import "encoding/json" diff --git a/core/time.go b/internal/time.go similarity index 99% rename from core/time.go rename to internal/time.go index d009ab3..ab0e269 100644 --- a/core/time.go +++ b/internal/time.go @@ -1,4 +1,4 @@ -package core +package internal import ( "encoding/json" diff --git a/issue.go b/issue.go index ee93eec..ffe7678 100644 --- a/issue.go +++ b/issue.go @@ -3,7 +3,9 @@ package api import ( + json "encoding/json" fmt "fmt" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -41,6 +43,1456 @@ type IssueListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +// Delivery issue +type DeliveryIssue struct { + // Issue ID + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + Status IssueStatus `json:"status" url:"status"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at" url:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` + // Deprecated, will always be set to null + LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at" url:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at" url:"created_at"` + AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` + Reference *DeliveryIssueReference `json:"reference,omitempty" url:"reference,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeliveryIssue) GetId() string { + if d == nil { + return "" + } + return d.Id +} + +func (d *DeliveryIssue) GetTeamId() string { + if d == nil { + return "" + } + return d.TeamId +} + +func (d *DeliveryIssue) GetStatus() IssueStatus { + if d == nil { + return "" + } + return d.Status +} + +func (d *DeliveryIssue) GetOpenedAt() time.Time { + if d == nil { + return time.Time{} + } + return d.OpenedAt +} + +func (d *DeliveryIssue) GetFirstSeenAt() time.Time { + if d == nil { + return time.Time{} + } + return d.FirstSeenAt +} + +func (d *DeliveryIssue) GetLastSeenAt() time.Time { + if d == nil { + return time.Time{} + } + return d.LastSeenAt +} + +func (d *DeliveryIssue) GetLastUpdatedBy() *string { + if d == nil { + return nil + } + return d.LastUpdatedBy +} + +func (d *DeliveryIssue) GetDismissedAt() *time.Time { + if d == nil { + return nil + } + return d.DismissedAt +} + +func (d *DeliveryIssue) GetAutoResolvedAt() *time.Time { + if d == nil { + return nil + } + return d.AutoResolvedAt +} + +func (d *DeliveryIssue) GetMergedWith() *string { + if d == nil { + return nil + } + return d.MergedWith +} + +func (d *DeliveryIssue) GetUpdatedAt() string { + if d == nil { + return "" + } + return d.UpdatedAt +} + +func (d *DeliveryIssue) GetCreatedAt() string { + if d == nil { + return "" + } + return d.CreatedAt +} + +func (d *DeliveryIssue) GetAggregationKeys() *DeliveryIssueAggregationKeys { + if d == nil { + return nil + } + return d.AggregationKeys +} + +func (d *DeliveryIssue) GetReference() *DeliveryIssueReference { + if d == nil { + return nil + } + return d.Reference +} + +func (d *DeliveryIssue) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeliveryIssue) UnmarshalJSON(data []byte) error { + type embed DeliveryIssue + var unmarshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*d), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *d = DeliveryIssue(unmarshaler.embed) + d.OpenedAt = unmarshaler.OpenedAt.Time() + d.FirstSeenAt = unmarshaler.FirstSeenAt.Time() + d.LastSeenAt = unmarshaler.LastSeenAt.Time() + d.DismissedAt = unmarshaler.DismissedAt.TimePtr() + d.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeliveryIssue) MarshalJSON() ([]byte, error) { + type embed DeliveryIssue + var marshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*d), + OpenedAt: internal.NewDateTime(d.OpenedAt), + FirstSeenAt: internal.NewDateTime(d.FirstSeenAt), + LastSeenAt: internal.NewDateTime(d.LastSeenAt), + DismissedAt: internal.NewOptionalDateTime(d.DismissedAt), + AutoResolvedAt: internal.NewOptionalDateTime(d.AutoResolvedAt), + } + return json.Marshal(marshaler) +} + +func (d *DeliveryIssue) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Keys used as the aggregation keys a 'delivery' type issue +type DeliveryIssueAggregationKeys struct { + WebhookId []string `json:"webhook_id,omitempty" url:"webhook_id,omitempty"` + ResponseStatus []float64 `json:"response_status,omitempty" url:"response_status,omitempty"` + ErrorCode []AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeliveryIssueAggregationKeys) GetWebhookId() []string { + if d == nil { + return nil + } + return d.WebhookId +} + +func (d *DeliveryIssueAggregationKeys) GetResponseStatus() []float64 { + if d == nil { + return nil + } + return d.ResponseStatus +} + +func (d *DeliveryIssueAggregationKeys) GetErrorCode() []AttemptErrorCodes { + if d == nil { + return nil + } + return d.ErrorCode +} + +func (d *DeliveryIssueAggregationKeys) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeliveryIssueAggregationKeys) UnmarshalJSON(data []byte) error { + type unmarshaler DeliveryIssueAggregationKeys + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeliveryIssueAggregationKeys(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeliveryIssueAggregationKeys) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Delivery issue data +type DeliveryIssueData struct { + TriggerEvent *Event `json:"trigger_event,omitempty" url:"trigger_event,omitempty"` + TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty" url:"trigger_attempt,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeliveryIssueData) GetTriggerEvent() *Event { + if d == nil { + return nil + } + return d.TriggerEvent +} + +func (d *DeliveryIssueData) GetTriggerAttempt() *EventAttempt { + if d == nil { + return nil + } + return d.TriggerAttempt +} + +func (d *DeliveryIssueData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeliveryIssueData) UnmarshalJSON(data []byte) error { + type unmarshaler DeliveryIssueData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeliveryIssueData(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeliveryIssueData) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Reference to the event and attempt an issue is being created for. +type DeliveryIssueReference struct { + EventId string `json:"event_id" url:"event_id"` + AttemptId string `json:"attempt_id" url:"attempt_id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeliveryIssueReference) GetEventId() string { + if d == nil { + return "" + } + return d.EventId +} + +func (d *DeliveryIssueReference) GetAttemptId() string { + if d == nil { + return "" + } + return d.AttemptId +} + +func (d *DeliveryIssueReference) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeliveryIssueReference) UnmarshalJSON(data []byte) error { + type unmarshaler DeliveryIssueReference + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeliveryIssueReference(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeliveryIssueReference) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Delivery issue +type DeliveryIssueWithData struct { + // Issue ID + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + Status IssueStatus `json:"status" url:"status"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at" url:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` + // Deprecated, will always be set to null + LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at" url:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at" url:"created_at"` + AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` + Reference *DeliveryIssueReference `json:"reference,omitempty" url:"reference,omitempty"` + Data *DeliveryIssueData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeliveryIssueWithData) GetId() string { + if d == nil { + return "" + } + return d.Id +} + +func (d *DeliveryIssueWithData) GetTeamId() string { + if d == nil { + return "" + } + return d.TeamId +} + +func (d *DeliveryIssueWithData) GetStatus() IssueStatus { + if d == nil { + return "" + } + return d.Status +} + +func (d *DeliveryIssueWithData) GetOpenedAt() time.Time { + if d == nil { + return time.Time{} + } + return d.OpenedAt +} + +func (d *DeliveryIssueWithData) GetFirstSeenAt() time.Time { + if d == nil { + return time.Time{} + } + return d.FirstSeenAt +} + +func (d *DeliveryIssueWithData) GetLastSeenAt() time.Time { + if d == nil { + return time.Time{} + } + return d.LastSeenAt +} + +func (d *DeliveryIssueWithData) GetLastUpdatedBy() *string { + if d == nil { + return nil + } + return d.LastUpdatedBy +} + +func (d *DeliveryIssueWithData) GetDismissedAt() *time.Time { + if d == nil { + return nil + } + return d.DismissedAt +} + +func (d *DeliveryIssueWithData) GetAutoResolvedAt() *time.Time { + if d == nil { + return nil + } + return d.AutoResolvedAt +} + +func (d *DeliveryIssueWithData) GetMergedWith() *string { + if d == nil { + return nil + } + return d.MergedWith +} + +func (d *DeliveryIssueWithData) GetUpdatedAt() string { + if d == nil { + return "" + } + return d.UpdatedAt +} + +func (d *DeliveryIssueWithData) GetCreatedAt() string { + if d == nil { + return "" + } + return d.CreatedAt +} + +func (d *DeliveryIssueWithData) GetAggregationKeys() *DeliveryIssueAggregationKeys { + if d == nil { + return nil + } + return d.AggregationKeys +} + +func (d *DeliveryIssueWithData) GetReference() *DeliveryIssueReference { + if d == nil { + return nil + } + return d.Reference +} + +func (d *DeliveryIssueWithData) GetData() *DeliveryIssueData { + if d == nil { + return nil + } + return d.Data +} + +func (d *DeliveryIssueWithData) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeliveryIssueWithData) UnmarshalJSON(data []byte) error { + type embed DeliveryIssueWithData + var unmarshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*d), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *d = DeliveryIssueWithData(unmarshaler.embed) + d.OpenedAt = unmarshaler.OpenedAt.Time() + d.FirstSeenAt = unmarshaler.FirstSeenAt.Time() + d.LastSeenAt = unmarshaler.LastSeenAt.Time() + d.DismissedAt = unmarshaler.DismissedAt.TimePtr() + d.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeliveryIssueWithData) MarshalJSON() ([]byte, error) { + type embed DeliveryIssueWithData + var marshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*d), + OpenedAt: internal.NewDateTime(d.OpenedAt), + FirstSeenAt: internal.NewDateTime(d.FirstSeenAt), + LastSeenAt: internal.NewDateTime(d.LastSeenAt), + DismissedAt: internal.NewOptionalDateTime(d.DismissedAt), + AutoResolvedAt: internal.NewOptionalDateTime(d.AutoResolvedAt), + } + return json.Marshal(marshaler) +} + +func (d *DeliveryIssueWithData) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// Issue +type Issue struct { + Type string + Delivery *DeliveryIssue + Transformation *TransformationIssue +} + +func NewIssueFromDelivery(value *DeliveryIssue) *Issue { + return &Issue{Type: "delivery", Delivery: value} +} + +func NewIssueFromTransformation(value *TransformationIssue) *Issue { + return &Issue{Type: "transformation", Transformation: value} +} + +func (i *Issue) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +func (i *Issue) GetDelivery() *DeliveryIssue { + if i == nil { + return nil + } + return i.Delivery +} + +func (i *Issue) GetTransformation() *TransformationIssue { + if i == nil { + return nil + } + return i.Transformation +} + +func (i *Issue) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + i.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", i) + } + switch unmarshaler.Type { + case "delivery": + value := new(DeliveryIssue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.Delivery = value + case "transformation": + value := new(TransformationIssue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.Transformation = value + } + return nil +} + +func (i Issue) MarshalJSON() ([]byte, error) { + switch i.Type { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.Type, i) + case "delivery": + return internal.MarshalJSONWithExtraProperty(i.Delivery, "type", "delivery") + case "transformation": + return internal.MarshalJSONWithExtraProperty(i.Transformation, "type", "transformation") + } +} + +type IssueVisitor interface { + VisitDelivery(*DeliveryIssue) error + VisitTransformation(*TransformationIssue) error +} + +func (i *Issue) Accept(visitor IssueVisitor) error { + switch i.Type { + default: + return fmt.Errorf("invalid type %s in %T", i.Type, i) + case "delivery": + return visitor.VisitDelivery(i.Delivery) + case "transformation": + return visitor.VisitTransformation(i.Transformation) + } +} + +type IssueCount struct { + // Number of issues + Count int `json:"count" url:"count"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueCount) GetCount() int { + if i == nil { + return 0 + } + return i.Count +} + +func (i *IssueCount) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueCount) UnmarshalJSON(data []byte) error { + type unmarshaler IssueCount + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueCount(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueCount) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Issue status +type IssueStatus string + +const ( + IssueStatusOpened IssueStatus = "OPENED" + IssueStatusIgnored IssueStatus = "IGNORED" + IssueStatusAcknowledged IssueStatus = "ACKNOWLEDGED" + IssueStatusResolved IssueStatus = "RESOLVED" +) + +func NewIssueStatusFromString(s string) (IssueStatus, error) { + switch s { + case "OPENED": + return IssueStatusOpened, nil + case "IGNORED": + return IssueStatusIgnored, nil + case "ACKNOWLEDGED": + return IssueStatusAcknowledged, nil + case "RESOLVED": + return IssueStatusResolved, nil + } + var t IssueStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i IssueStatus) Ptr() *IssueStatus { + return &i +} + +type IssueWithData struct { + Type string + Delivery *DeliveryIssueWithData + Transformation *TransformationIssueWithData +} + +func NewIssueWithDataFromDelivery(value *DeliveryIssueWithData) *IssueWithData { + return &IssueWithData{Type: "delivery", Delivery: value} +} + +func NewIssueWithDataFromTransformation(value *TransformationIssueWithData) *IssueWithData { + return &IssueWithData{Type: "transformation", Transformation: value} +} + +func (i *IssueWithData) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +func (i *IssueWithData) GetDelivery() *DeliveryIssueWithData { + if i == nil { + return nil + } + return i.Delivery +} + +func (i *IssueWithData) GetTransformation() *TransformationIssueWithData { + if i == nil { + return nil + } + return i.Transformation +} + +func (i *IssueWithData) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + i.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", i) + } + switch unmarshaler.Type { + case "delivery": + value := new(DeliveryIssueWithData) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.Delivery = value + case "transformation": + value := new(TransformationIssueWithData) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.Transformation = value + } + return nil +} + +func (i IssueWithData) MarshalJSON() ([]byte, error) { + switch i.Type { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.Type, i) + case "delivery": + return internal.MarshalJSONWithExtraProperty(i.Delivery, "type", "delivery") + case "transformation": + return internal.MarshalJSONWithExtraProperty(i.Transformation, "type", "transformation") + } +} + +type IssueWithDataVisitor interface { + VisitDelivery(*DeliveryIssueWithData) error + VisitTransformation(*TransformationIssueWithData) error +} + +func (i *IssueWithData) Accept(visitor IssueWithDataVisitor) error { + switch i.Type { + default: + return fmt.Errorf("invalid type %s in %T", i.Type, i) + case "delivery": + return visitor.VisitDelivery(i.Delivery) + case "transformation": + return visitor.VisitTransformation(i.Transformation) + } +} + +type IssueWithDataPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*IssueWithData `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueWithDataPaginatedResult) GetPagination() *SeekPagination { + if i == nil { + return nil + } + return i.Pagination +} + +func (i *IssueWithDataPaginatedResult) GetCount() *int { + if i == nil { + return nil + } + return i.Count +} + +func (i *IssueWithDataPaginatedResult) GetModels() []*IssueWithData { + if i == nil { + return nil + } + return i.Models +} + +func (i *IssueWithDataPaginatedResult) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueWithDataPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler IssueWithDataPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueWithDataPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueWithDataPaginatedResult) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Transformation issue +type TransformationIssue struct { + // Issue ID + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + Status IssueStatus `json:"status" url:"status"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at" url:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` + // Deprecated, will always be set to null + LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at" url:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at" url:"created_at"` + AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` + Reference *TransformationIssueReference `json:"reference,omitempty" url:"reference,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationIssue) GetId() string { + if t == nil { + return "" + } + return t.Id +} + +func (t *TransformationIssue) GetTeamId() string { + if t == nil { + return "" + } + return t.TeamId +} + +func (t *TransformationIssue) GetStatus() IssueStatus { + if t == nil { + return "" + } + return t.Status +} + +func (t *TransformationIssue) GetOpenedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.OpenedAt +} + +func (t *TransformationIssue) GetFirstSeenAt() time.Time { + if t == nil { + return time.Time{} + } + return t.FirstSeenAt +} + +func (t *TransformationIssue) GetLastSeenAt() time.Time { + if t == nil { + return time.Time{} + } + return t.LastSeenAt +} + +func (t *TransformationIssue) GetLastUpdatedBy() *string { + if t == nil { + return nil + } + return t.LastUpdatedBy +} + +func (t *TransformationIssue) GetDismissedAt() *time.Time { + if t == nil { + return nil + } + return t.DismissedAt +} + +func (t *TransformationIssue) GetAutoResolvedAt() *time.Time { + if t == nil { + return nil + } + return t.AutoResolvedAt +} + +func (t *TransformationIssue) GetMergedWith() *string { + if t == nil { + return nil + } + return t.MergedWith +} + +func (t *TransformationIssue) GetUpdatedAt() string { + if t == nil { + return "" + } + return t.UpdatedAt +} + +func (t *TransformationIssue) GetCreatedAt() string { + if t == nil { + return "" + } + return t.CreatedAt +} + +func (t *TransformationIssue) GetAggregationKeys() *TransformationIssueAggregationKeys { + if t == nil { + return nil + } + return t.AggregationKeys +} + +func (t *TransformationIssue) GetReference() *TransformationIssueReference { + if t == nil { + return nil + } + return t.Reference +} + +func (t *TransformationIssue) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationIssue) UnmarshalJSON(data []byte) error { + type embed TransformationIssue + var unmarshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TransformationIssue(unmarshaler.embed) + t.OpenedAt = unmarshaler.OpenedAt.Time() + t.FirstSeenAt = unmarshaler.FirstSeenAt.Time() + t.LastSeenAt = unmarshaler.LastSeenAt.Time() + t.DismissedAt = unmarshaler.DismissedAt.TimePtr() + t.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationIssue) MarshalJSON() ([]byte, error) { + type embed TransformationIssue + var marshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*t), + OpenedAt: internal.NewDateTime(t.OpenedAt), + FirstSeenAt: internal.NewDateTime(t.FirstSeenAt), + LastSeenAt: internal.NewDateTime(t.LastSeenAt), + DismissedAt: internal.NewOptionalDateTime(t.DismissedAt), + AutoResolvedAt: internal.NewOptionalDateTime(t.AutoResolvedAt), + } + return json.Marshal(marshaler) +} + +func (t *TransformationIssue) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Keys used as the aggregation keys a 'transformation' type issue +type TransformationIssueAggregationKeys struct { + TransformationId []string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` + LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationIssueAggregationKeys) GetTransformationId() []string { + if t == nil { + return nil + } + return t.TransformationId +} + +func (t *TransformationIssueAggregationKeys) GetLogLevel() TransformationExecutionLogLevel { + if t == nil { + return "" + } + return t.LogLevel +} + +func (t *TransformationIssueAggregationKeys) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationIssueAggregationKeys) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationIssueAggregationKeys + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationIssueAggregationKeys(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationIssueAggregationKeys) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Transformation issue data +type TransformationIssueData struct { + TransformationExecution *TransformationExecution `json:"transformation_execution,omitempty" url:"transformation_execution,omitempty"` + TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty" url:"trigger_attempt,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationIssueData) GetTransformationExecution() *TransformationExecution { + if t == nil { + return nil + } + return t.TransformationExecution +} + +func (t *TransformationIssueData) GetTriggerAttempt() *EventAttempt { + if t == nil { + return nil + } + return t.TriggerAttempt +} + +func (t *TransformationIssueData) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationIssueData) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationIssueData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationIssueData(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationIssueData) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Reference to the event request transformation an issue is being created for. +type TransformationIssueReference struct { + TransformationExecutionId string `json:"transformation_execution_id" url:"transformation_execution_id"` + // Deprecated but still found on historical issues + TriggerEventRequestTransformationId *string `json:"trigger_event_request_transformation_id,omitempty" url:"trigger_event_request_transformation_id,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationIssueReference) GetTransformationExecutionId() string { + if t == nil { + return "" + } + return t.TransformationExecutionId +} + +func (t *TransformationIssueReference) GetTriggerEventRequestTransformationId() *string { + if t == nil { + return nil + } + return t.TriggerEventRequestTransformationId +} + +func (t *TransformationIssueReference) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationIssueReference) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationIssueReference + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationIssueReference(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationIssueReference) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Transformation issue +type TransformationIssueWithData struct { + // Issue ID + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + Status IssueStatus `json:"status" url:"status"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at" url:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` + // Deprecated, will always be set to null + LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at" url:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at" url:"created_at"` + AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` + Reference *TransformationIssueReference `json:"reference,omitempty" url:"reference,omitempty"` + Data *TransformationIssueData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationIssueWithData) GetId() string { + if t == nil { + return "" + } + return t.Id +} + +func (t *TransformationIssueWithData) GetTeamId() string { + if t == nil { + return "" + } + return t.TeamId +} + +func (t *TransformationIssueWithData) GetStatus() IssueStatus { + if t == nil { + return "" + } + return t.Status +} + +func (t *TransformationIssueWithData) GetOpenedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.OpenedAt +} + +func (t *TransformationIssueWithData) GetFirstSeenAt() time.Time { + if t == nil { + return time.Time{} + } + return t.FirstSeenAt +} + +func (t *TransformationIssueWithData) GetLastSeenAt() time.Time { + if t == nil { + return time.Time{} + } + return t.LastSeenAt +} + +func (t *TransformationIssueWithData) GetLastUpdatedBy() *string { + if t == nil { + return nil + } + return t.LastUpdatedBy +} + +func (t *TransformationIssueWithData) GetDismissedAt() *time.Time { + if t == nil { + return nil + } + return t.DismissedAt +} + +func (t *TransformationIssueWithData) GetAutoResolvedAt() *time.Time { + if t == nil { + return nil + } + return t.AutoResolvedAt +} + +func (t *TransformationIssueWithData) GetMergedWith() *string { + if t == nil { + return nil + } + return t.MergedWith +} + +func (t *TransformationIssueWithData) GetUpdatedAt() string { + if t == nil { + return "" + } + return t.UpdatedAt +} + +func (t *TransformationIssueWithData) GetCreatedAt() string { + if t == nil { + return "" + } + return t.CreatedAt +} + +func (t *TransformationIssueWithData) GetAggregationKeys() *TransformationIssueAggregationKeys { + if t == nil { + return nil + } + return t.AggregationKeys +} + +func (t *TransformationIssueWithData) GetReference() *TransformationIssueReference { + if t == nil { + return nil + } + return t.Reference +} + +func (t *TransformationIssueWithData) GetData() *TransformationIssueData { + if t == nil { + return nil + } + return t.Data +} + +func (t *TransformationIssueWithData) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationIssueWithData) UnmarshalJSON(data []byte) error { + type embed TransformationIssueWithData + var unmarshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TransformationIssueWithData(unmarshaler.embed) + t.OpenedAt = unmarshaler.OpenedAt.Time() + t.FirstSeenAt = unmarshaler.FirstSeenAt.Time() + t.LastSeenAt = unmarshaler.LastSeenAt.Time() + t.DismissedAt = unmarshaler.DismissedAt.TimePtr() + t.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationIssueWithData) MarshalJSON() ([]byte, error) { + type embed TransformationIssueWithData + var marshaler = struct { + embed + OpenedAt *internal.DateTime `json:"opened_at"` + FirstSeenAt *internal.DateTime `json:"first_seen_at"` + LastSeenAt *internal.DateTime `json:"last_seen_at"` + DismissedAt *internal.DateTime `json:"dismissed_at,omitempty"` + AutoResolvedAt *internal.DateTime `json:"auto_resolved_at,omitempty"` + }{ + embed: embed(*t), + OpenedAt: internal.NewDateTime(t.OpenedAt), + FirstSeenAt: internal.NewDateTime(t.FirstSeenAt), + LastSeenAt: internal.NewDateTime(t.LastSeenAt), + DismissedAt: internal.NewOptionalDateTime(t.DismissedAt), + AutoResolvedAt: internal.NewOptionalDateTime(t.AutoResolvedAt), + } + return json.Marshal(marshaler) +} + +func (t *TransformationIssueWithData) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + type IssueCountRequestDir string const ( diff --git a/issue/client.go b/issue/client.go index 122cf4b..8989081 100644 --- a/issue/client.go +++ b/issue/client.go @@ -3,20 +3,17 @@ package issue import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueWithDataPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/issues" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueWithDataPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,58 +93,44 @@ func (c *Client) Count( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueCount, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/issues/count" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueCount if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -177,50 +144,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueWithData, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issues/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issues/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueWithData if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -235,59 +192,47 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Issue, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issues/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issues/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Issue if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -301,50 +246,40 @@ func (c *Client) Dismiss( opts ...option.RequestOption, ) (*hookdeckgosdk.Issue, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issues/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issues/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Issue if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/issue_trigger.go b/issue_trigger.go index 37b8e17..3b39035 100644 --- a/issue_trigger.go +++ b/issue_trigger.go @@ -5,9 +5,9 @@ package api import ( json "encoding/json" fmt "fmt" - time "time" - core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" + time "time" ) type IssueTriggerCreateRequest struct { @@ -30,38 +30,1051 @@ type IssueTriggerListRequest struct { Prev *string `json:"-" url:"prev,omitempty"` } +type DeletedIssueTriggerResponse struct { + Id string `json:"id" url:"id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeletedIssueTriggerResponse) GetId() string { + if d == nil { + return "" + } + return d.Id +} + +func (d *DeletedIssueTriggerResponse) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DeletedIssueTriggerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler DeletedIssueTriggerResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeletedIssueTriggerResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeletedIssueTriggerResponse) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type IssueTrigger struct { + // ID of the issue trigger + Id string `json:"id" url:"id"` + // ID of the project + TeamId *string `json:"team_id,omitempty" url:"team_id,omitempty"` + // Optional unique name to use as reference when using the API + Name *string `json:"name,omitempty" url:"name,omitempty"` + Type IssueType `json:"type" url:"type"` + Configs *IssueTriggerReference `json:"configs,omitempty" url:"configs,omitempty"` + Channels *IssueTriggerChannels `json:"channels,omitempty" url:"channels,omitempty"` + // ISO timestamp for when the issue trigger was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` + // ISO timestamp for when the issue trigger was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // ISO timestamp for when the issue trigger was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + // ISO timestamp for when the issue trigger was deleted + DeletedAt *time.Time `json:"deleted_at,omitempty" url:"deleted_at,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTrigger) GetId() string { + if i == nil { + return "" + } + return i.Id +} + +func (i *IssueTrigger) GetTeamId() *string { + if i == nil { + return nil + } + return i.TeamId +} + +func (i *IssueTrigger) GetName() *string { + if i == nil { + return nil + } + return i.Name +} + +func (i *IssueTrigger) GetType() IssueType { + if i == nil { + return "" + } + return i.Type +} + +func (i *IssueTrigger) GetConfigs() *IssueTriggerReference { + if i == nil { + return nil + } + return i.Configs +} + +func (i *IssueTrigger) GetChannels() *IssueTriggerChannels { + if i == nil { + return nil + } + return i.Channels +} + +func (i *IssueTrigger) GetDisabledAt() *time.Time { + if i == nil { + return nil + } + return i.DisabledAt +} + +func (i *IssueTrigger) GetUpdatedAt() time.Time { + if i == nil { + return time.Time{} + } + return i.UpdatedAt +} + +func (i *IssueTrigger) GetCreatedAt() time.Time { + if i == nil { + return time.Time{} + } + return i.CreatedAt +} + +func (i *IssueTrigger) GetDeletedAt() *time.Time { + if i == nil { + return nil + } + return i.DeletedAt +} + +func (i *IssueTrigger) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTrigger) UnmarshalJSON(data []byte) error { + type embed IssueTrigger + var unmarshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + DeletedAt *internal.DateTime `json:"deleted_at,omitempty"` + }{ + embed: embed(*i), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *i = IssueTrigger(unmarshaler.embed) + i.DisabledAt = unmarshaler.DisabledAt.TimePtr() + i.UpdatedAt = unmarshaler.UpdatedAt.Time() + i.CreatedAt = unmarshaler.CreatedAt.Time() + i.DeletedAt = unmarshaler.DeletedAt.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTrigger) MarshalJSON() ([]byte, error) { + type embed IssueTrigger + var marshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + DeletedAt *internal.DateTime `json:"deleted_at,omitempty"` + }{ + embed: embed(*i), + DisabledAt: internal.NewOptionalDateTime(i.DisabledAt), + UpdatedAt: internal.NewDateTime(i.UpdatedAt), + CreatedAt: internal.NewDateTime(i.CreatedAt), + DeletedAt: internal.NewOptionalDateTime(i.DeletedAt), + } + return json.Marshal(marshaler) +} + +func (i *IssueTrigger) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Configurations for a 'Backpressure' issue trigger +type IssueTriggerBackpressureConfigs struct { + Delay IssueTriggerBackpressureDelay `json:"delay" url:"delay"` + // A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. + Destinations *IssueTriggerBackpressureConfigsDestinations `json:"destinations,omitempty" url:"destinations,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerBackpressureConfigs) GetDelay() IssueTriggerBackpressureDelay { + if i == nil { + return 0 + } + return i.Delay +} + +func (i *IssueTriggerBackpressureConfigs) GetDestinations() *IssueTriggerBackpressureConfigsDestinations { + if i == nil { + return nil + } + return i.Destinations +} + +func (i *IssueTriggerBackpressureConfigs) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerBackpressureConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerBackpressureConfigs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerBackpressureConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerBackpressureConfigs) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. +type IssueTriggerBackpressureConfigsDestinations struct { + String string + StringList []string + + typ string +} + +func NewIssueTriggerBackpressureConfigsDestinationsFromString(value string) *IssueTriggerBackpressureConfigsDestinations { + return &IssueTriggerBackpressureConfigsDestinations{typ: "String", String: value} +} + +func NewIssueTriggerBackpressureConfigsDestinationsFromStringList(value []string) *IssueTriggerBackpressureConfigsDestinations { + return &IssueTriggerBackpressureConfigsDestinations{typ: "StringList", StringList: value} +} + +func (i *IssueTriggerBackpressureConfigsDestinations) GetString() string { + if i == nil { + return "" + } + return i.String +} + +func (i *IssueTriggerBackpressureConfigsDestinations) GetStringList() []string { + if i == nil { + return nil + } + return i.StringList +} + +func (i *IssueTriggerBackpressureConfigsDestinations) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typ = "String" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typ = "StringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerBackpressureConfigsDestinations) MarshalJSON() ([]byte, error) { + if i.typ == "String" || i.String != "" { + return json.Marshal(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return json.Marshal(i.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IssueTriggerBackpressureConfigsDestinationsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerBackpressureConfigsDestinations) Accept(visitor IssueTriggerBackpressureConfigsDestinationsVisitor) error { + if i.typ == "String" || i.String != "" { + return visitor.VisitString(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return visitor.VisitStringList(i.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +// The minimum delay (backpressure) to open the issue for min of 1 minute (60000) and max of 1 day (86400000) +type IssueTriggerBackpressureDelay = int + +// Notification channels object for the specific channel type +type IssueTriggerChannels struct { + Slack *IssueTriggerSlackChannel `json:"slack,omitempty" url:"slack,omitempty"` + Pagerduty *IssueTriggerIntegrationChannel `json:"pagerduty,omitempty" url:"pagerduty,omitempty"` + Opsgenie *IssueTriggerIntegrationChannel `json:"opsgenie,omitempty" url:"opsgenie,omitempty"` + Email *IssueTriggerEmailChannel `json:"email,omitempty" url:"email,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerChannels) GetSlack() *IssueTriggerSlackChannel { + if i == nil { + return nil + } + return i.Slack +} + +func (i *IssueTriggerChannels) GetPagerduty() *IssueTriggerIntegrationChannel { + if i == nil { + return nil + } + return i.Pagerduty +} + +func (i *IssueTriggerChannels) GetOpsgenie() *IssueTriggerIntegrationChannel { + if i == nil { + return nil + } + return i.Opsgenie +} + +func (i *IssueTriggerChannels) GetEmail() *IssueTriggerEmailChannel { + if i == nil { + return nil + } + return i.Email +} + +func (i *IssueTriggerChannels) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerChannels) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerChannels + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerChannels(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerChannels) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Configurations for a 'delivery' issue trigger +type IssueTriggerDeliveryConfigs struct { + Strategy IssueTriggerStrategy `json:"strategy" url:"strategy"` + // A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. + Connections *IssueTriggerDeliveryConfigsConnections `json:"connections,omitempty" url:"connections,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerDeliveryConfigs) GetStrategy() IssueTriggerStrategy { + if i == nil { + return "" + } + return i.Strategy +} + +func (i *IssueTriggerDeliveryConfigs) GetConnections() *IssueTriggerDeliveryConfigsConnections { + if i == nil { + return nil + } + return i.Connections +} + +func (i *IssueTriggerDeliveryConfigs) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerDeliveryConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerDeliveryConfigs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerDeliveryConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerDeliveryConfigs) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. +type IssueTriggerDeliveryConfigsConnections struct { + String string + StringList []string + + typ string +} + +func NewIssueTriggerDeliveryConfigsConnectionsFromString(value string) *IssueTriggerDeliveryConfigsConnections { + return &IssueTriggerDeliveryConfigsConnections{typ: "String", String: value} +} + +func NewIssueTriggerDeliveryConfigsConnectionsFromStringList(value []string) *IssueTriggerDeliveryConfigsConnections { + return &IssueTriggerDeliveryConfigsConnections{typ: "StringList", StringList: value} +} + +func (i *IssueTriggerDeliveryConfigsConnections) GetString() string { + if i == nil { + return "" + } + return i.String +} + +func (i *IssueTriggerDeliveryConfigsConnections) GetStringList() []string { + if i == nil { + return nil + } + return i.StringList +} + +func (i *IssueTriggerDeliveryConfigsConnections) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typ = "String" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typ = "StringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerDeliveryConfigsConnections) MarshalJSON() ([]byte, error) { + if i.typ == "String" || i.String != "" { + return json.Marshal(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return json.Marshal(i.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IssueTriggerDeliveryConfigsConnectionsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerDeliveryConfigsConnections) Accept(visitor IssueTriggerDeliveryConfigsConnectionsVisitor) error { + if i.typ == "String" || i.String != "" { + return visitor.VisitString(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return visitor.VisitStringList(i.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +// Email channel for an issue trigger +type IssueTriggerEmailChannel struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerEmailChannel) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerEmailChannel) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerEmailChannel + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerEmailChannel(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerEmailChannel) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Integration channel for an issue trigger +type IssueTriggerIntegrationChannel struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerIntegrationChannel) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerIntegrationChannel) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerIntegrationChannel + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerIntegrationChannel(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerIntegrationChannel) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +type IssueTriggerPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*IssueTrigger `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerPaginatedResult) GetPagination() *SeekPagination { + if i == nil { + return nil + } + return i.Pagination +} + +func (i *IssueTriggerPaginatedResult) GetCount() *int { + if i == nil { + return nil + } + return i.Count +} + +func (i *IssueTriggerPaginatedResult) GetModels() []*IssueTrigger { + if i == nil { + return nil + } + return i.Models +} + +func (i *IssueTriggerPaginatedResult) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerPaginatedResult) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// Configuration object for the specific issue type selected +type IssueTriggerReference struct { + IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs + IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs + IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs + + typ string +} + +func NewIssueTriggerReferenceFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typ: "IssueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} +} + +func NewIssueTriggerReferenceFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typ: "IssueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} +} + +func NewIssueTriggerReferenceFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typ: "IssueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (i *IssueTriggerReference) GetIssueTriggerDeliveryConfigs() *IssueTriggerDeliveryConfigs { + if i == nil { + return nil + } + return i.IssueTriggerDeliveryConfigs +} + +func (i *IssueTriggerReference) GetIssueTriggerTransformationConfigs() *IssueTriggerTransformationConfigs { + if i == nil { + return nil + } + return i.IssueTriggerTransformationConfigs +} + +func (i *IssueTriggerReference) GetIssueTriggerBackpressureConfigs() *IssueTriggerBackpressureConfigs { + if i == nil { + return nil + } + return i.IssueTriggerBackpressureConfigs +} + +func (i *IssueTriggerReference) UnmarshalJSON(data []byte) error { + valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + i.typ = "IssueTriggerDeliveryConfigs" + i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs + return nil + } + valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + i.typ = "IssueTriggerTransformationConfigs" + i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs + return nil + } + valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + i.typ = "IssueTriggerBackpressureConfigs" + i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerReference) MarshalJSON() ([]byte, error) { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { + return json.Marshal(i.IssueTriggerDeliveryConfigs) + } + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { + return json.Marshal(i.IssueTriggerTransformationConfigs) + } + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { + return json.Marshal(i.IssueTriggerBackpressureConfigs) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IssueTriggerReferenceVisitor interface { + VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error + VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error + VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +} + +func (i *IssueTriggerReference) Accept(visitor IssueTriggerReferenceVisitor) error { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { + return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) + } + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { + return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) + } + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { + return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +// Slack channel for an issue trigger +type IssueTriggerSlackChannel struct { + // Channel name + ChannelName string `json:"channel_name" url:"channel_name"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerSlackChannel) GetChannelName() string { + if i == nil { + return "" + } + return i.ChannelName +} + +func (i *IssueTriggerSlackChannel) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerSlackChannel) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerSlackChannel + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerSlackChannel(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerSlackChannel) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// The strategy uses to open the issue +type IssueTriggerStrategy string + +const ( + IssueTriggerStrategyFirstAttempt IssueTriggerStrategy = "first_attempt" + IssueTriggerStrategyFinalAttempt IssueTriggerStrategy = "final_attempt" +) + +func NewIssueTriggerStrategyFromString(s string) (IssueTriggerStrategy, error) { + switch s { + case "first_attempt": + return IssueTriggerStrategyFirstAttempt, nil + case "final_attempt": + return IssueTriggerStrategyFinalAttempt, nil + } + var t IssueTriggerStrategy + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i IssueTriggerStrategy) Ptr() *IssueTriggerStrategy { + return &i +} + +// Configurations for a 'Transformation' issue trigger +type IssueTriggerTransformationConfigs struct { + LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` + // A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. + Transformations *IssueTriggerTransformationConfigsTransformations `json:"transformations,omitempty" url:"transformations,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IssueTriggerTransformationConfigs) GetLogLevel() TransformationExecutionLogLevel { + if i == nil { + return "" + } + return i.LogLevel +} + +func (i *IssueTriggerTransformationConfigs) GetTransformations() *IssueTriggerTransformationConfigsTransformations { + if i == nil { + return nil + } + return i.Transformations +} + +func (i *IssueTriggerTransformationConfigs) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IssueTriggerTransformationConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler IssueTriggerTransformationConfigs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IssueTriggerTransformationConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IssueTriggerTransformationConfigs) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +// A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. +type IssueTriggerTransformationConfigsTransformations struct { + String string + StringList []string + + typ string +} + +func NewIssueTriggerTransformationConfigsTransformationsFromString(value string) *IssueTriggerTransformationConfigsTransformations { + return &IssueTriggerTransformationConfigsTransformations{typ: "String", String: value} +} + +func NewIssueTriggerTransformationConfigsTransformationsFromStringList(value []string) *IssueTriggerTransformationConfigsTransformations { + return &IssueTriggerTransformationConfigsTransformations{typ: "StringList", StringList: value} +} + +func (i *IssueTriggerTransformationConfigsTransformations) GetString() string { + if i == nil { + return "" + } + return i.String +} + +func (i *IssueTriggerTransformationConfigsTransformations) GetStringList() []string { + if i == nil { + return nil + } + return i.StringList +} + +func (i *IssueTriggerTransformationConfigsTransformations) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typ = "String" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typ = "StringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerTransformationConfigsTransformations) MarshalJSON() ([]byte, error) { + if i.typ == "String" || i.String != "" { + return json.Marshal(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return json.Marshal(i.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IssueTriggerTransformationConfigsTransformationsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerTransformationConfigsTransformations) Accept(visitor IssueTriggerTransformationConfigsTransformationsVisitor) error { + if i.typ == "String" || i.String != "" { + return visitor.VisitString(i.String) + } + if i.typ == "StringList" || i.StringList != nil { + return visitor.VisitStringList(i.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +// Issue type +type IssueType string + +const ( + IssueTypeDelivery IssueType = "delivery" + IssueTypeTransformation IssueType = "transformation" + IssueTypeBackpressure IssueType = "backpressure" +) + +func NewIssueTypeFromString(s string) (IssueType, error) { + switch s { + case "delivery": + return IssueTypeDelivery, nil + case "transformation": + return IssueTypeTransformation, nil + case "backpressure": + return IssueTypeBackpressure, nil + } + var t IssueType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i IssueType) Ptr() *IssueType { + return &i +} + // Configuration object for the specific issue type selected type IssueTriggerCreateRequestConfigs struct { IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs + + typ string } func NewIssueTriggerCreateRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerCreateRequestConfigs { - return &IssueTriggerCreateRequestConfigs{IssueTriggerDeliveryConfigs: value} + return &IssueTriggerCreateRequestConfigs{typ: "IssueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} } func NewIssueTriggerCreateRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerCreateRequestConfigs { - return &IssueTriggerCreateRequestConfigs{IssueTriggerTransformationConfigs: value} + return &IssueTriggerCreateRequestConfigs{typ: "IssueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} } func NewIssueTriggerCreateRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerCreateRequestConfigs { - return &IssueTriggerCreateRequestConfigs{IssueTriggerBackpressureConfigs: value} + return &IssueTriggerCreateRequestConfigs{typ: "IssueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (i *IssueTriggerCreateRequestConfigs) GetIssueTriggerDeliveryConfigs() *IssueTriggerDeliveryConfigs { + if i == nil { + return nil + } + return i.IssueTriggerDeliveryConfigs +} + +func (i *IssueTriggerCreateRequestConfigs) GetIssueTriggerTransformationConfigs() *IssueTriggerTransformationConfigs { + if i == nil { + return nil + } + return i.IssueTriggerTransformationConfigs +} + +func (i *IssueTriggerCreateRequestConfigs) GetIssueTriggerBackpressureConfigs() *IssueTriggerBackpressureConfigs { + if i == nil { + return nil + } + return i.IssueTriggerBackpressureConfigs } func (i *IssueTriggerCreateRequestConfigs) UnmarshalJSON(data []byte) error { valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + i.typ = "IssueTriggerDeliveryConfigs" i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs return nil } valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + i.typ = "IssueTriggerTransformationConfigs" i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs return nil } valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + i.typ = "IssueTriggerBackpressureConfigs" i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs return nil } @@ -69,13 +1082,13 @@ func (i *IssueTriggerCreateRequestConfigs) UnmarshalJSON(data []byte) error { } func (i IssueTriggerCreateRequestConfigs) MarshalJSON() ([]byte, error) { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return json.Marshal(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return json.Marshal(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return json.Marshal(i.IssueTriggerBackpressureConfigs) } return nil, fmt.Errorf("type %T does not include a non-empty union type", i) @@ -88,13 +1101,13 @@ type IssueTriggerCreateRequestConfigsVisitor interface { } func (i *IssueTriggerCreateRequestConfigs) Accept(visitor IssueTriggerCreateRequestConfigsVisitor) error { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) } return fmt.Errorf("type %T does not include a non-empty union type", i) @@ -149,33 +1162,59 @@ type IssueTriggerUpdateRequestConfigs struct { IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs + + typ string } func NewIssueTriggerUpdateRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerUpdateRequestConfigs { - return &IssueTriggerUpdateRequestConfigs{IssueTriggerDeliveryConfigs: value} + return &IssueTriggerUpdateRequestConfigs{typ: "IssueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} } func NewIssueTriggerUpdateRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerUpdateRequestConfigs { - return &IssueTriggerUpdateRequestConfigs{IssueTriggerTransformationConfigs: value} + return &IssueTriggerUpdateRequestConfigs{typ: "IssueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} } func NewIssueTriggerUpdateRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerUpdateRequestConfigs { - return &IssueTriggerUpdateRequestConfigs{IssueTriggerBackpressureConfigs: value} + return &IssueTriggerUpdateRequestConfigs{typ: "IssueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (i *IssueTriggerUpdateRequestConfigs) GetIssueTriggerDeliveryConfigs() *IssueTriggerDeliveryConfigs { + if i == nil { + return nil + } + return i.IssueTriggerDeliveryConfigs +} + +func (i *IssueTriggerUpdateRequestConfigs) GetIssueTriggerTransformationConfigs() *IssueTriggerTransformationConfigs { + if i == nil { + return nil + } + return i.IssueTriggerTransformationConfigs +} + +func (i *IssueTriggerUpdateRequestConfigs) GetIssueTriggerBackpressureConfigs() *IssueTriggerBackpressureConfigs { + if i == nil { + return nil + } + return i.IssueTriggerBackpressureConfigs } func (i *IssueTriggerUpdateRequestConfigs) UnmarshalJSON(data []byte) error { valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + i.typ = "IssueTriggerDeliveryConfigs" i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs return nil } valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + i.typ = "IssueTriggerTransformationConfigs" i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs return nil } valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + i.typ = "IssueTriggerBackpressureConfigs" i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs return nil } @@ -183,13 +1222,13 @@ func (i *IssueTriggerUpdateRequestConfigs) UnmarshalJSON(data []byte) error { } func (i IssueTriggerUpdateRequestConfigs) MarshalJSON() ([]byte, error) { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return json.Marshal(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return json.Marshal(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return json.Marshal(i.IssueTriggerBackpressureConfigs) } return nil, fmt.Errorf("type %T does not include a non-empty union type", i) @@ -202,13 +1241,13 @@ type IssueTriggerUpdateRequestConfigsVisitor interface { } func (i *IssueTriggerUpdateRequestConfigs) Accept(visitor IssueTriggerUpdateRequestConfigsVisitor) error { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) } return fmt.Errorf("type %T does not include a non-empty union type", i) @@ -219,33 +1258,59 @@ type IssueTriggerUpsertRequestConfigs struct { IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs + + typ string } func NewIssueTriggerUpsertRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerUpsertRequestConfigs { - return &IssueTriggerUpsertRequestConfigs{IssueTriggerDeliveryConfigs: value} + return &IssueTriggerUpsertRequestConfigs{typ: "IssueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} } func NewIssueTriggerUpsertRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerUpsertRequestConfigs { - return &IssueTriggerUpsertRequestConfigs{IssueTriggerTransformationConfigs: value} + return &IssueTriggerUpsertRequestConfigs{typ: "IssueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} } func NewIssueTriggerUpsertRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerUpsertRequestConfigs { - return &IssueTriggerUpsertRequestConfigs{IssueTriggerBackpressureConfigs: value} + return &IssueTriggerUpsertRequestConfigs{typ: "IssueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (i *IssueTriggerUpsertRequestConfigs) GetIssueTriggerDeliveryConfigs() *IssueTriggerDeliveryConfigs { + if i == nil { + return nil + } + return i.IssueTriggerDeliveryConfigs +} + +func (i *IssueTriggerUpsertRequestConfigs) GetIssueTriggerTransformationConfigs() *IssueTriggerTransformationConfigs { + if i == nil { + return nil + } + return i.IssueTriggerTransformationConfigs +} + +func (i *IssueTriggerUpsertRequestConfigs) GetIssueTriggerBackpressureConfigs() *IssueTriggerBackpressureConfigs { + if i == nil { + return nil + } + return i.IssueTriggerBackpressureConfigs } func (i *IssueTriggerUpsertRequestConfigs) UnmarshalJSON(data []byte) error { valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + i.typ = "IssueTriggerDeliveryConfigs" i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs return nil } valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + i.typ = "IssueTriggerTransformationConfigs" i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs return nil } valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + i.typ = "IssueTriggerBackpressureConfigs" i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs return nil } @@ -253,13 +1318,13 @@ func (i *IssueTriggerUpsertRequestConfigs) UnmarshalJSON(data []byte) error { } func (i IssueTriggerUpsertRequestConfigs) MarshalJSON() ([]byte, error) { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return json.Marshal(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return json.Marshal(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return json.Marshal(i.IssueTriggerBackpressureConfigs) } return nil, fmt.Errorf("type %T does not include a non-empty union type", i) @@ -272,13 +1337,13 @@ type IssueTriggerUpsertRequestConfigsVisitor interface { } func (i *IssueTriggerUpsertRequestConfigs) Accept(visitor IssueTriggerUpsertRequestConfigsVisitor) error { - if i.IssueTriggerDeliveryConfigs != nil { + if i.typ == "IssueTriggerDeliveryConfigs" || i.IssueTriggerDeliveryConfigs != nil { return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) } - if i.IssueTriggerTransformationConfigs != nil { + if i.typ == "IssueTriggerTransformationConfigs" || i.IssueTriggerTransformationConfigs != nil { return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) } - if i.IssueTriggerBackpressureConfigs != nil { + if i.typ == "IssueTriggerBackpressureConfigs" || i.IssueTriggerBackpressureConfigs != nil { return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) } return fmt.Errorf("type %T does not include a non-empty union type", i) @@ -308,10 +1373,10 @@ func (i *IssueTriggerUpdateRequest) MarshalJSON() ([]byte, error) { type embed IssueTriggerUpdateRequest var marshaler = struct { embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` }{ embed: embed(*i), - DisabledAt: NewDateTimeFromOptional(i.DisabledAt), + DisabledAt: internal.NewOptionalDateTime(i.DisabledAt), } return json.Marshal(marshaler) } diff --git a/issuetrigger/client.go b/issuetrigger/client.go index 0430388..6d10e5f 100644 --- a/issuetrigger/client.go +++ b/issuetrigger/client.go @@ -3,20 +3,17 @@ package issuetrigger import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTriggerPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/issue-triggers" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTriggerPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/issue-triggers" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,59 +144,44 @@ func (c *Client) Upsert( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/issue-triggers" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -244,50 +195,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issue-triggers/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issue-triggers/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -302,59 +243,47 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issue-triggers/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issue-triggers/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -368,50 +297,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.DeletedIssueTriggerResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issue-triggers/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issue-triggers/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.DeletedIssueTriggerResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -425,50 +344,40 @@ func (c *Client) Disable( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issue-triggers/%v/disable", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issue-triggers/%v/disable", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -482,50 +391,40 @@ func (c *Client) Enable( opts ...option.RequestOption, ) (*hookdeckgosdk.IssueTrigger, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/issue-triggers/%v/enable", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/issue-triggers/%v/enable", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IssueTrigger if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/notification.go b/notification.go index 4e81c39..23e2756 100644 --- a/notification.go +++ b/notification.go @@ -3,9 +3,103 @@ package api import ( + json "encoding/json" + fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" ) +type ToggleWebhookNotifications struct { + Enabled bool `json:"enabled" url:"enabled"` + Topics []TopicsValue `json:"topics,omitempty" url:"topics,omitempty"` + SourceId string `json:"source_id" url:"source_id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *ToggleWebhookNotifications) GetEnabled() bool { + if t == nil { + return false + } + return t.Enabled +} + +func (t *ToggleWebhookNotifications) GetTopics() []TopicsValue { + if t == nil { + return nil + } + return t.Topics +} + +func (t *ToggleWebhookNotifications) GetSourceId() string { + if t == nil { + return "" + } + return t.SourceId +} + +func (t *ToggleWebhookNotifications) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *ToggleWebhookNotifications) UnmarshalJSON(data []byte) error { + type unmarshaler ToggleWebhookNotifications + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = ToggleWebhookNotifications(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *ToggleWebhookNotifications) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Supported topics +type TopicsValue string + +const ( + TopicsValueIssueOpened TopicsValue = "issue.opened" + TopicsValueIssueUpdated TopicsValue = "issue.updated" + TopicsValueDeprecatedAttemptFailed TopicsValue = "deprecated.attempt-failed" + TopicsValueEventSuccessful TopicsValue = "event.successful" +) + +func NewTopicsValueFromString(s string) (TopicsValue, error) { + switch s { + case "issue.opened": + return TopicsValueIssueOpened, nil + case "issue.updated": + return TopicsValueIssueUpdated, nil + case "deprecated.attempt-failed": + return TopicsValueDeprecatedAttemptFailed, nil + case "event.successful": + return TopicsValueEventSuccessful, nil + } + var t TopicsValue + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (t TopicsValue) Ptr() *TopicsValue { + return &t +} + type NotificationUpdateRequest struct { // Enable or disable webhook notifications on the project Enabled *core.Optional[bool] `json:"enabled,omitempty" url:"-"` diff --git a/notification/client.go b/notification/client.go index 602273d..a3c0c90 100644 --- a/notification/client.go +++ b/notification/client.go @@ -6,13 +6,14 @@ import ( context "context" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -20,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -36,27 +37,26 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.ToggleWebhookNotifications, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/notifications/webhooks" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") var response *hookdeckgosdk.ToggleWebhookNotifications if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, diff --git a/optional.go b/optional.go index 9e826e8..f2a7b6e 100644 --- a/optional.go +++ b/optional.go @@ -3,8 +3,6 @@ package api import ( - "time" - core "github.com/hookdeck/hookdeck-go-sdk/core" ) @@ -15,22 +13,6 @@ func Optional[T any](value T) *core.Optional[T] { } } -// NewDateFromOptional returns a new *DateTime from the given optional. -func NewDateFromOptional(optional *core.Optional[time.Time]) *core.Date { - if optional == nil { - return nil - } - return core.NewDate(optional.Value) -} - -// NewDateTimeFromOptional returns a new *DateTime from the given optional. -func NewDateTimeFromOptional(optional *core.Optional[time.Time]) *core.DateTime { - if optional == nil { - return nil - } - return core.NewDateTime(optional.Value) -} - // Null initializes an optional field that will be sent as // an explicit null value. func Null[T any]() *core.Optional[T] { @@ -38,12 +20,3 @@ func Null[T any]() *core.Optional[T] { Null: true, } } - -// OptionalOrNull initializes an optional field, setting the value -// to an explicit null if the value is nil. -func OptionalOrNull[T any](value *T) *core.Optional[T] { - if value == nil { - return Null[T]() - } - return Optional(*value) -} diff --git a/optional_test.go b/optional_test.go deleted file mode 100644 index 56e1644..0000000 --- a/optional_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package api - -import ( - "testing" - - core "github.com/hookdeck/hookdeck-go-sdk/core" - "github.com/stretchr/testify/assert" -) - -func TestOptionalOrNull(t *testing.T) { - t.Run("nil primitive", func(t *testing.T) { - var value *string - optional := OptionalOrNull(value) - assert.Equal(t, &core.Optional[string]{Null: true}, optional) - }) - - t.Run("zero primitive", func(t *testing.T) { - var zero int - optional := OptionalOrNull(&zero) - assert.Equal(t, &core.Optional[int]{Value: zero}, optional) - }) - - t.Run("non-zero primitive", func(t *testing.T) { - value := "test" - optional := OptionalOrNull(&value) - assert.Equal(t, &core.Optional[string]{Value: value}, optional) - }) - - t.Run("nil type", func(t *testing.T) { - type foo struct { - Name string - } - var zero *foo - optional := OptionalOrNull(zero) - assert.Equal(t, &core.Optional[foo]{Null: true}, optional) - }) - - t.Run("zero type", func(t *testing.T) { - type foo struct { - Name string - } - zero := new(foo) - optional := OptionalOrNull(zero) - assert.Equal(t, &core.Optional[foo]{Value: *zero}, optional) - }) - - t.Run("non-zero type", func(t *testing.T) { - type foo struct { - Name string - } - value := &foo{Name: "test"} - optional := OptionalOrNull(value) - assert.Equal(t, &core.Optional[foo]{Value: *value}, optional) - }) -} diff --git a/request.go b/request.go index aee3045..36e5a73 100644 --- a/request.go +++ b/request.go @@ -3,7 +3,9 @@ package api import ( + json "encoding/json" fmt "fmt" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -74,6 +76,681 @@ type RequestRetryRequest struct { WebhookIds []string `json:"webhook_ids,omitempty" url:"-"` } +type FilteredMeta = []FilteredMetaItem + +type FilteredMetaItem string + +const ( + FilteredMetaItemBody FilteredMetaItem = "body" + FilteredMetaItemHeaders FilteredMetaItem = "headers" + FilteredMetaItemPath FilteredMetaItem = "path" + FilteredMetaItemQuery FilteredMetaItem = "query" +) + +func NewFilteredMetaItemFromString(s string) (FilteredMetaItem, error) { + switch s { + case "body": + return FilteredMetaItemBody, nil + case "headers": + return FilteredMetaItemHeaders, nil + case "path": + return FilteredMetaItemPath, nil + case "query": + return FilteredMetaItemQuery, nil + } + var t FilteredMetaItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FilteredMetaItem) Ptr() *FilteredMetaItem { + return &f +} + +type IgnoredEvent struct { + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + WebhookId string `json:"webhook_id" url:"webhook_id"` + Cause IgnoredEventCause `json:"cause" url:"cause"` + RequestId string `json:"request_id" url:"request_id"` + Meta *IgnoredEventMeta `json:"meta,omitempty" url:"meta,omitempty"` + CreatedAt time.Time `json:"created_at" url:"created_at"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IgnoredEvent) GetId() string { + if i == nil { + return "" + } + return i.Id +} + +func (i *IgnoredEvent) GetTeamId() string { + if i == nil { + return "" + } + return i.TeamId +} + +func (i *IgnoredEvent) GetWebhookId() string { + if i == nil { + return "" + } + return i.WebhookId +} + +func (i *IgnoredEvent) GetCause() IgnoredEventCause { + if i == nil { + return "" + } + return i.Cause +} + +func (i *IgnoredEvent) GetRequestId() string { + if i == nil { + return "" + } + return i.RequestId +} + +func (i *IgnoredEvent) GetMeta() *IgnoredEventMeta { + if i == nil { + return nil + } + return i.Meta +} + +func (i *IgnoredEvent) GetCreatedAt() time.Time { + if i == nil { + return time.Time{} + } + return i.CreatedAt +} + +func (i *IgnoredEvent) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IgnoredEvent) UnmarshalJSON(data []byte) error { + type embed IgnoredEvent + var unmarshaler = struct { + embed + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*i), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *i = IgnoredEvent(unmarshaler.embed) + i.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IgnoredEvent) MarshalJSON() ([]byte, error) { + type embed IgnoredEvent + var marshaler = struct { + embed + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*i), + CreatedAt: internal.NewDateTime(i.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (i *IgnoredEvent) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +type IgnoredEventCause string + +const ( + IgnoredEventCauseDisabled IgnoredEventCause = "DISABLED" + IgnoredEventCauseFiltered IgnoredEventCause = "FILTERED" + IgnoredEventCauseTransformationFailed IgnoredEventCause = "TRANSFORMATION_FAILED" + IgnoredEventCauseCliDisconnected IgnoredEventCause = "CLI_DISCONNECTED" +) + +func NewIgnoredEventCauseFromString(s string) (IgnoredEventCause, error) { + switch s { + case "DISABLED": + return IgnoredEventCauseDisabled, nil + case "FILTERED": + return IgnoredEventCauseFiltered, nil + case "TRANSFORMATION_FAILED": + return IgnoredEventCauseTransformationFailed, nil + case "CLI_DISCONNECTED": + return IgnoredEventCauseCliDisconnected, nil + } + var t IgnoredEventCause + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i IgnoredEventCause) Ptr() *IgnoredEventCause { + return &i +} + +type IgnoredEventMeta struct { + FilteredMeta FilteredMeta + TransformationFailedMeta *TransformationFailedMeta + + typ string +} + +func NewIgnoredEventMetaFromFilteredMeta(value FilteredMeta) *IgnoredEventMeta { + return &IgnoredEventMeta{typ: "FilteredMeta", FilteredMeta: value} +} + +func NewIgnoredEventMetaFromTransformationFailedMeta(value *TransformationFailedMeta) *IgnoredEventMeta { + return &IgnoredEventMeta{typ: "TransformationFailedMeta", TransformationFailedMeta: value} +} + +func (i *IgnoredEventMeta) GetFilteredMeta() FilteredMeta { + if i == nil { + return nil + } + return i.FilteredMeta +} + +func (i *IgnoredEventMeta) GetTransformationFailedMeta() *TransformationFailedMeta { + if i == nil { + return nil + } + return i.TransformationFailedMeta +} + +func (i *IgnoredEventMeta) UnmarshalJSON(data []byte) error { + var valueFilteredMeta FilteredMeta + if err := json.Unmarshal(data, &valueFilteredMeta); err == nil { + i.typ = "FilteredMeta" + i.FilteredMeta = valueFilteredMeta + return nil + } + valueTransformationFailedMeta := new(TransformationFailedMeta) + if err := json.Unmarshal(data, &valueTransformationFailedMeta); err == nil { + i.typ = "TransformationFailedMeta" + i.TransformationFailedMeta = valueTransformationFailedMeta + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IgnoredEventMeta) MarshalJSON() ([]byte, error) { + if i.typ == "FilteredMeta" || i.FilteredMeta != nil { + return json.Marshal(i.FilteredMeta) + } + if i.typ == "TransformationFailedMeta" || i.TransformationFailedMeta != nil { + return json.Marshal(i.TransformationFailedMeta) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IgnoredEventMetaVisitor interface { + VisitFilteredMeta(FilteredMeta) error + VisitTransformationFailedMeta(*TransformationFailedMeta) error +} + +func (i *IgnoredEventMeta) Accept(visitor IgnoredEventMetaVisitor) error { + if i.typ == "FilteredMeta" || i.FilteredMeta != nil { + return visitor.VisitFilteredMeta(i.FilteredMeta) + } + if i.typ == "TransformationFailedMeta" || i.TransformationFailedMeta != nil { + return visitor.VisitTransformationFailedMeta(i.TransformationFailedMeta) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) +} + +type IgnoredEventPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*IgnoredEvent `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *IgnoredEventPaginatedResult) GetPagination() *SeekPagination { + if i == nil { + return nil + } + return i.Pagination +} + +func (i *IgnoredEventPaginatedResult) GetCount() *int { + if i == nil { + return nil + } + return i.Count +} + +func (i *IgnoredEventPaginatedResult) GetModels() []*IgnoredEvent { + if i == nil { + return nil + } + return i.Models +} + +func (i *IgnoredEventPaginatedResult) GetExtraProperties() map[string]interface{} { + return i.extraProperties +} + +func (i *IgnoredEventPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler IgnoredEventPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = IgnoredEventPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *IgnoredEventPaginatedResult) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +type Request struct { + // ID of the request + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // Whether or not the request was verified when received + Verified *bool `json:"verified,omitempty" url:"verified,omitempty"` + // ID of the request data + OriginalEventDataId *string `json:"original_event_data_id,omitempty" url:"original_event_data_id,omitempty"` + RejectionCause RequestRejectionCause `json:"rejection_cause" url:"rejection_cause"` + // The priority attributed to the request when received + IngestPriority *RequestIngestPriority `json:"ingest_priority,omitempty" url:"ingest_priority,omitempty"` + // The time the request was originally received + IngestedAt *time.Time `json:"ingested_at,omitempty" url:"ingested_at,omitempty"` + // ID of the associated source + SourceId string `json:"source_id" url:"source_id"` + // The count of events created from this request (CLI events not included) + EventsCount *int `json:"events_count,omitempty" url:"events_count,omitempty"` + // The count of CLI events created from this request + CliEventsCount *int `json:"cli_events_count,omitempty" url:"cli_events_count,omitempty"` + IgnoredCount *int `json:"ignored_count,omitempty" url:"ignored_count,omitempty"` + // Date the event was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the event was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *Request) GetId() string { + if r == nil { + return "" + } + return r.Id +} + +func (r *Request) GetTeamId() string { + if r == nil { + return "" + } + return r.TeamId +} + +func (r *Request) GetVerified() *bool { + if r == nil { + return nil + } + return r.Verified +} + +func (r *Request) GetOriginalEventDataId() *string { + if r == nil { + return nil + } + return r.OriginalEventDataId +} + +func (r *Request) GetRejectionCause() RequestRejectionCause { + if r == nil { + return "" + } + return r.RejectionCause +} + +func (r *Request) GetIngestPriority() *RequestIngestPriority { + if r == nil { + return nil + } + return r.IngestPriority +} + +func (r *Request) GetIngestedAt() *time.Time { + if r == nil { + return nil + } + return r.IngestedAt +} + +func (r *Request) GetSourceId() string { + if r == nil { + return "" + } + return r.SourceId +} + +func (r *Request) GetEventsCount() *int { + if r == nil { + return nil + } + return r.EventsCount +} + +func (r *Request) GetCliEventsCount() *int { + if r == nil { + return nil + } + return r.CliEventsCount +} + +func (r *Request) GetIgnoredCount() *int { + if r == nil { + return nil + } + return r.IgnoredCount +} + +func (r *Request) GetUpdatedAt() time.Time { + if r == nil { + return time.Time{} + } + return r.UpdatedAt +} + +func (r *Request) GetCreatedAt() time.Time { + if r == nil { + return time.Time{} + } + return r.CreatedAt +} + +func (r *Request) GetData() *ShortEventData { + if r == nil { + return nil + } + return r.Data +} + +func (r *Request) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *Request) UnmarshalJSON(data []byte) error { + type embed Request + var unmarshaler = struct { + embed + IngestedAt *internal.DateTime `json:"ingested_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*r), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *r = Request(unmarshaler.embed) + r.IngestedAt = unmarshaler.IngestedAt.TimePtr() + r.UpdatedAt = unmarshaler.UpdatedAt.Time() + r.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *Request) MarshalJSON() ([]byte, error) { + type embed Request + var marshaler = struct { + embed + IngestedAt *internal.DateTime `json:"ingested_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*r), + IngestedAt: internal.NewOptionalDateTime(r.IngestedAt), + UpdatedAt: internal.NewDateTime(r.UpdatedAt), + CreatedAt: internal.NewDateTime(r.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (r *Request) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +// The priority attributed to the request when received +type RequestIngestPriority string + +const ( + RequestIngestPriorityNormal RequestIngestPriority = "NORMAL" + RequestIngestPriorityLow RequestIngestPriority = "LOW" +) + +func NewRequestIngestPriorityFromString(s string) (RequestIngestPriority, error) { + switch s { + case "NORMAL": + return RequestIngestPriorityNormal, nil + case "LOW": + return RequestIngestPriorityLow, nil + } + var t RequestIngestPriority + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RequestIngestPriority) Ptr() *RequestIngestPriority { + return &r +} + +type RequestPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Request `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RequestPaginatedResult) GetPagination() *SeekPagination { + if r == nil { + return nil + } + return r.Pagination +} + +func (r *RequestPaginatedResult) GetCount() *int { + if r == nil { + return nil + } + return r.Count +} + +func (r *RequestPaginatedResult) GetModels() []*Request { + if r == nil { + return nil + } + return r.Models +} + +func (r *RequestPaginatedResult) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RequestPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler RequestPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RequestPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RequestPaginatedResult) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +type RetryRequest struct { + Request *Request `json:"request,omitempty" url:"request,omitempty"` + Events []*Event `json:"events,omitempty" url:"events,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RetryRequest) GetRequest() *Request { + if r == nil { + return nil + } + return r.Request +} + +func (r *RetryRequest) GetEvents() []*Event { + if r == nil { + return nil + } + return r.Events +} + +func (r *RetryRequest) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RetryRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RetryRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RetryRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RetryRequest) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +type TransformationFailedMeta struct { + TransformationId string `json:"transformation_id" url:"transformation_id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationFailedMeta) GetTransformationId() string { + if t == nil { + return "" + } + return t.TransformationId +} + +func (t *TransformationFailedMeta) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationFailedMeta) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationFailedMeta + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationFailedMeta(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationFailedMeta) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + // Sort direction type RequestListEventRequestDir string diff --git a/request/client.go b/request/client.go index dd1c130..97abf0f 100644 --- a/request/client.go +++ b/request/client.go @@ -3,20 +3,17 @@ package request import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.RequestPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/requests" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RequestPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,50 +93,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Request, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/requests/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/requests/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Request if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -169,50 +140,40 @@ func (c *Client) RetrieveBody( opts ...option.RequestOption, ) (*hookdeckgosdk.RawBody, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/requests/%v/raw_body", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/requests/%v/raw_body", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RawBody if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -227,66 +188,52 @@ func (c *Client) Retry( opts ...option.RequestOption, ) (*hookdeckgosdk.RetryRequest, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/requests/%v/retry", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/requests/%v/retry", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RetryRequest if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -301,72 +248,57 @@ func (c *Client) ListEvent( opts ...option.RequestOption, ) (*hookdeckgosdk.EventPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/requests/%v/events", id) - - queryParams, err := core.QueryValues(request) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/requests/%v/events", + id, + ) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.EventPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -381,72 +313,57 @@ func (c *Client) ListIgnoredEvent( opts ...option.RequestOption, ) (*hookdeckgosdk.IgnoredEventPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/requests/%v/ignored_events", id) - - queryParams, err := core.QueryValues(request) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/requests/%v/ignored_events", + id, + ) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.IgnoredEventPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/request_bulk_retry.go b/request_bulk_retry.go index 78bc763..c4b8faa 100644 --- a/request_bulk_retry.go +++ b/request_bulk_retry.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -59,7 +60,105 @@ type RequestBulkRetryCreateRequestQuery struct { BulkRetryId *RequestBulkRetryCreateRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty" url:"bulk_retry_id,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (r *RequestBulkRetryCreateRequestQuery) GetId() *RequestBulkRetryCreateRequestQueryId { + if r == nil { + return nil + } + return r.Id +} + +func (r *RequestBulkRetryCreateRequestQuery) GetStatus() *RequestBulkRetryCreateRequestQueryStatus { + if r == nil { + return nil + } + return r.Status +} + +func (r *RequestBulkRetryCreateRequestQuery) GetRejectionCause() *RequestBulkRetryCreateRequestQueryRejectionCause { + if r == nil { + return nil + } + return r.RejectionCause +} + +func (r *RequestBulkRetryCreateRequestQuery) GetSourceId() *RequestBulkRetryCreateRequestQuerySourceId { + if r == nil { + return nil + } + return r.SourceId +} + +func (r *RequestBulkRetryCreateRequestQuery) GetVerified() *bool { + if r == nil { + return nil + } + return r.Verified +} + +func (r *RequestBulkRetryCreateRequestQuery) GetSearchTerm() *string { + if r == nil { + return nil + } + return r.SearchTerm +} + +func (r *RequestBulkRetryCreateRequestQuery) GetHeaders() *RequestBulkRetryCreateRequestQueryHeaders { + if r == nil { + return nil + } + return r.Headers +} + +func (r *RequestBulkRetryCreateRequestQuery) GetBody() *RequestBulkRetryCreateRequestQueryBody { + if r == nil { + return nil + } + return r.Body +} + +func (r *RequestBulkRetryCreateRequestQuery) GetParsedQuery() *RequestBulkRetryCreateRequestQueryParsedQuery { + if r == nil { + return nil + } + return r.ParsedQuery +} + +func (r *RequestBulkRetryCreateRequestQuery) GetPath() *string { + if r == nil { + return nil + } + return r.Path +} + +func (r *RequestBulkRetryCreateRequestQuery) GetIgnoredCount() *RequestBulkRetryCreateRequestQueryIgnoredCount { + if r == nil { + return nil + } + return r.IgnoredCount +} + +func (r *RequestBulkRetryCreateRequestQuery) GetEventsCount() *RequestBulkRetryCreateRequestQueryEventsCount { + if r == nil { + return nil + } + return r.EventsCount +} + +func (r *RequestBulkRetryCreateRequestQuery) GetIngestedAt() *RequestBulkRetryCreateRequestQueryIngestedAt { + if r == nil { + return nil + } + return r.IngestedAt +} + +func (r *RequestBulkRetryCreateRequestQuery) GetBulkRetryId() *RequestBulkRetryCreateRequestQueryBulkRetryId { + if r == nil { + return nil + } + return r.BulkRetryId } func (r *RequestBulkRetryCreateRequestQuery) GetExtraProperties() map[string]interface{} { @@ -73,29 +172,922 @@ func (r *RequestBulkRetryCreateRequestQuery) UnmarshalJSON(data []byte) error { return err } *r = RequestBulkRetryCreateRequestQuery(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} - extraProperties, err := core.ExtractExtraProperties(data, *r) +func (r *RequestBulkRetryCreateRequestQuery) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +// URL Encoded string of the JSON to match to the data body +type RequestBulkRetryCreateRequestQueryBody struct { + String string + RequestBulkRetryCreateRequestQueryBodyOne *RequestBulkRetryCreateRequestQueryBodyOne + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryBodyFromString(value string) *RequestBulkRetryCreateRequestQueryBody { + return &RequestBulkRetryCreateRequestQueryBody{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQueryBodyFromRequestBulkRetryCreateRequestQueryBodyOne(value *RequestBulkRetryCreateRequestQueryBodyOne) *RequestBulkRetryCreateRequestQueryBody { + return &RequestBulkRetryCreateRequestQueryBody{typ: "RequestBulkRetryCreateRequestQueryBodyOne", RequestBulkRetryCreateRequestQueryBodyOne: value} +} + +func (r *RequestBulkRetryCreateRequestQueryBody) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQueryBody) GetRequestBulkRetryCreateRequestQueryBodyOne() *RequestBulkRetryCreateRequestQueryBodyOne { + if r == nil { + return nil + } + return r.RequestBulkRetryCreateRequestQueryBodyOne +} + +func (r *RequestBulkRetryCreateRequestQueryBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + valueRequestBulkRetryCreateRequestQueryBodyOne := new(RequestBulkRetryCreateRequestQueryBodyOne) + if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryBodyOne); err == nil { + r.typ = "RequestBulkRetryCreateRequestQueryBodyOne" + r.RequestBulkRetryCreateRequestQueryBodyOne = valueRequestBulkRetryCreateRequestQueryBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryBody) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryBodyOne" || r.RequestBulkRetryCreateRequestQueryBodyOne != nil { + return json.Marshal(r.RequestBulkRetryCreateRequestQueryBodyOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryBodyVisitor interface { + VisitString(string) error + VisitRequestBulkRetryCreateRequestQueryBodyOne(*RequestBulkRetryCreateRequestQueryBodyOne) error +} + +func (r *RequestBulkRetryCreateRequestQueryBody) Accept(visitor RequestBulkRetryCreateRequestQueryBodyVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryBodyOne" || r.RequestBulkRetryCreateRequestQueryBodyOne != nil { + return visitor.VisitRequestBulkRetryCreateRequestQueryBodyOne(r.RequestBulkRetryCreateRequestQueryBodyOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryBodyOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RequestBulkRetryCreateRequestQueryBodyOne) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RequestBulkRetryCreateRequestQueryBodyOne) UnmarshalJSON(data []byte) error { + type unmarshaler RequestBulkRetryCreateRequestQueryBodyOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RequestBulkRetryCreateRequestQueryBodyOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) if err != nil { return err } r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RequestBulkRetryCreateRequestQueryBodyOne) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +type RequestBulkRetryCreateRequestQueryBulkRetryId struct { + String string + StringList []string + + typ string +} - r._rawJSON = json.RawMessage(data) +func NewRequestBulkRetryCreateRequestQueryBulkRetryIdFromString(value string) *RequestBulkRetryCreateRequestQueryBulkRetryId { + return &RequestBulkRetryCreateRequestQueryBulkRetryId{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQueryBulkRetryIdFromStringList(value []string) *RequestBulkRetryCreateRequestQueryBulkRetryId { + return &RequestBulkRetryCreateRequestQueryBulkRetryId{typ: "StringList", StringList: value} +} + +func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) GetStringList() []string { + if r == nil { + return nil + } + return r.StringList +} + +func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + r.typ = "StringList" + r.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return json.Marshal(r.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryBulkRetryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) Accept(visitor RequestBulkRetryCreateRequestQueryBulkRetryIdVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return visitor.VisitStringList(r.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// Filter by count of events +type RequestBulkRetryCreateRequestQueryEventsCount struct { + Integer int + Operators *Operators + IntegerList []int + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryEventsCountFromInteger(value int) *RequestBulkRetryCreateRequestQueryEventsCount { + return &RequestBulkRetryCreateRequestQueryEventsCount{typ: "Integer", Integer: value} +} + +func NewRequestBulkRetryCreateRequestQueryEventsCountFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryEventsCount { + return &RequestBulkRetryCreateRequestQueryEventsCount{typ: "Operators", Operators: value} +} + +func NewRequestBulkRetryCreateRequestQueryEventsCountFromIntegerList(value []int) *RequestBulkRetryCreateRequestQueryEventsCount { + return &RequestBulkRetryCreateRequestQueryEventsCount{typ: "IntegerList", IntegerList: value} +} + +func (r *RequestBulkRetryCreateRequestQueryEventsCount) GetInteger() int { + if r == nil { + return 0 + } + return r.Integer +} + +func (r *RequestBulkRetryCreateRequestQueryEventsCount) GetOperators() *Operators { + if r == nil { + return nil + } + return r.Operators +} + +func (r *RequestBulkRetryCreateRequestQueryEventsCount) GetIntegerList() []int { + if r == nil { + return nil + } + return r.IntegerList +} + +func (r *RequestBulkRetryCreateRequestQueryEventsCount) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + r.typ = "Integer" + r.Integer = valueInteger + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + r.typ = "Operators" + r.Operators = valueOperators + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + r.typ = "IntegerList" + r.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryEventsCount) MarshalJSON() ([]byte, error) { + if r.typ == "Integer" || r.Integer != 0 { + return json.Marshal(r.Integer) + } + if r.typ == "Operators" || r.Operators != nil { + return json.Marshal(r.Operators) + } + if r.typ == "IntegerList" || r.IntegerList != nil { + return json.Marshal(r.IntegerList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryEventsCountVisitor interface { + VisitInteger(int) error + VisitOperators(*Operators) error + VisitIntegerList([]int) error +} + +func (r *RequestBulkRetryCreateRequestQueryEventsCount) Accept(visitor RequestBulkRetryCreateRequestQueryEventsCountVisitor) error { + if r.typ == "Integer" || r.Integer != 0 { + return visitor.VisitInteger(r.Integer) + } + if r.typ == "Operators" || r.Operators != nil { + return visitor.VisitOperators(r.Operators) + } + if r.typ == "IntegerList" || r.IntegerList != nil { + return visitor.VisitIntegerList(r.IntegerList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// URL Encoded string of the JSON to match to the data headers +type RequestBulkRetryCreateRequestQueryHeaders struct { + String string + RequestBulkRetryCreateRequestQueryHeadersOne *RequestBulkRetryCreateRequestQueryHeadersOne + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryHeadersFromString(value string) *RequestBulkRetryCreateRequestQueryHeaders { + return &RequestBulkRetryCreateRequestQueryHeaders{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQueryHeadersFromRequestBulkRetryCreateRequestQueryHeadersOne(value *RequestBulkRetryCreateRequestQueryHeadersOne) *RequestBulkRetryCreateRequestQueryHeaders { + return &RequestBulkRetryCreateRequestQueryHeaders{typ: "RequestBulkRetryCreateRequestQueryHeadersOne", RequestBulkRetryCreateRequestQueryHeadersOne: value} +} + +func (r *RequestBulkRetryCreateRequestQueryHeaders) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQueryHeaders) GetRequestBulkRetryCreateRequestQueryHeadersOne() *RequestBulkRetryCreateRequestQueryHeadersOne { + if r == nil { + return nil + } + return r.RequestBulkRetryCreateRequestQueryHeadersOne +} + +func (r *RequestBulkRetryCreateRequestQueryHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + valueRequestBulkRetryCreateRequestQueryHeadersOne := new(RequestBulkRetryCreateRequestQueryHeadersOne) + if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryHeadersOne); err == nil { + r.typ = "RequestBulkRetryCreateRequestQueryHeadersOne" + r.RequestBulkRetryCreateRequestQueryHeadersOne = valueRequestBulkRetryCreateRequestQueryHeadersOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryHeaders) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryHeadersOne" || r.RequestBulkRetryCreateRequestQueryHeadersOne != nil { + return json.Marshal(r.RequestBulkRetryCreateRequestQueryHeadersOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryHeadersVisitor interface { + VisitString(string) error + VisitRequestBulkRetryCreateRequestQueryHeadersOne(*RequestBulkRetryCreateRequestQueryHeadersOne) error +} + +func (r *RequestBulkRetryCreateRequestQueryHeaders) Accept(visitor RequestBulkRetryCreateRequestQueryHeadersVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryHeadersOne" || r.RequestBulkRetryCreateRequestQueryHeadersOne != nil { + return visitor.VisitRequestBulkRetryCreateRequestQueryHeadersOne(r.RequestBulkRetryCreateRequestQueryHeadersOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryHeadersOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RequestBulkRetryCreateRequestQueryHeadersOne) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RequestBulkRetryCreateRequestQueryHeadersOne) UnmarshalJSON(data []byte) error { + type unmarshaler RequestBulkRetryCreateRequestQueryHeadersOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RequestBulkRetryCreateRequestQueryHeadersOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) return nil } -func (r *RequestBulkRetryCreateRequestQuery) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (r *RequestBulkRetryCreateRequestQueryHeadersOne) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +// Filter by requests IDs +type RequestBulkRetryCreateRequestQueryId struct { + // Request ID + String string + StringList []string + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryIdFromString(value string) *RequestBulkRetryCreateRequestQueryId { + return &RequestBulkRetryCreateRequestQueryId{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQueryIdFromStringList(value []string) *RequestBulkRetryCreateRequestQueryId { + return &RequestBulkRetryCreateRequestQueryId{typ: "StringList", StringList: value} +} + +func (r *RequestBulkRetryCreateRequestQueryId) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQueryId) GetStringList() []string { + if r == nil { + return nil + } + return r.StringList +} + +func (r *RequestBulkRetryCreateRequestQueryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + r.typ = "StringList" + r.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryId) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return json.Marshal(r.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (r *RequestBulkRetryCreateRequestQueryId) Accept(visitor RequestBulkRetryCreateRequestQueryIdVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return visitor.VisitStringList(r.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// Filter by count of ignored events +type RequestBulkRetryCreateRequestQueryIgnoredCount struct { + Integer int + Operators *Operators + IntegerList []int + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromInteger(value int) *RequestBulkRetryCreateRequestQueryIgnoredCount { + return &RequestBulkRetryCreateRequestQueryIgnoredCount{typ: "Integer", Integer: value} +} + +func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryIgnoredCount { + return &RequestBulkRetryCreateRequestQueryIgnoredCount{typ: "Operators", Operators: value} +} + +func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromIntegerList(value []int) *RequestBulkRetryCreateRequestQueryIgnoredCount { + return &RequestBulkRetryCreateRequestQueryIgnoredCount{typ: "IntegerList", IntegerList: value} +} + +func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) GetInteger() int { + if r == nil { + return 0 + } + return r.Integer +} + +func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) GetOperators() *Operators { + if r == nil { + return nil + } + return r.Operators +} + +func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) GetIntegerList() []int { + if r == nil { + return nil + } + return r.IntegerList +} + +func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + r.typ = "Integer" + r.Integer = valueInteger + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + r.typ = "Operators" + r.Operators = valueOperators + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + r.typ = "IntegerList" + r.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryIgnoredCount) MarshalJSON() ([]byte, error) { + if r.typ == "Integer" || r.Integer != 0 { + return json.Marshal(r.Integer) + } + if r.typ == "Operators" || r.Operators != nil { + return json.Marshal(r.Operators) + } + if r.typ == "IntegerList" || r.IntegerList != nil { + return json.Marshal(r.IntegerList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryIgnoredCountVisitor interface { + VisitInteger(int) error + VisitOperators(*Operators) error + VisitIntegerList([]int) error +} + +func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) Accept(visitor RequestBulkRetryCreateRequestQueryIgnoredCountVisitor) error { + if r.typ == "Integer" || r.Integer != 0 { + return visitor.VisitInteger(r.Integer) + } + if r.typ == "Operators" || r.Operators != nil { + return visitor.VisitOperators(r.Operators) + } + if r.typ == "IntegerList" || r.IntegerList != nil { + return visitor.VisitIntegerList(r.IntegerList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// Filter by event ingested date +type RequestBulkRetryCreateRequestQueryIngestedAt struct { + DateTime time.Time + Operators *Operators + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryIngestedAtFromDateTime(value time.Time) *RequestBulkRetryCreateRequestQueryIngestedAt { + return &RequestBulkRetryCreateRequestQueryIngestedAt{typ: "DateTime", DateTime: value} +} + +func NewRequestBulkRetryCreateRequestQueryIngestedAtFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryIngestedAt { + return &RequestBulkRetryCreateRequestQueryIngestedAt{typ: "Operators", Operators: value} +} + +func (r *RequestBulkRetryCreateRequestQueryIngestedAt) GetDateTime() time.Time { + if r == nil { + return time.Time{} + } + return r.DateTime +} + +func (r *RequestBulkRetryCreateRequestQueryIngestedAt) GetOperators() *Operators { + if r == nil { + return nil + } + return r.Operators +} + +func (r *RequestBulkRetryCreateRequestQueryIngestedAt) UnmarshalJSON(data []byte) error { + var valueDateTime *internal.DateTime + if err := json.Unmarshal(data, &valueDateTime); err == nil { + r.typ = "DateTime" + r.DateTime = valueDateTime.Time() + return nil + } + valueOperators := new(Operators) + if err := json.Unmarshal(data, &valueOperators); err == nil { + r.typ = "Operators" + r.Operators = valueOperators + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryIngestedAt) MarshalJSON() ([]byte, error) { + if r.typ == "DateTime" || !r.DateTime.IsZero() { + return json.Marshal(internal.NewDateTime(r.DateTime)) + } + if r.typ == "Operators" || r.Operators != nil { + return json.Marshal(r.Operators) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryIngestedAtVisitor interface { + VisitDateTime(time.Time) error + VisitOperators(*Operators) error +} + +func (r *RequestBulkRetryCreateRequestQueryIngestedAt) Accept(visitor RequestBulkRetryCreateRequestQueryIngestedAtVisitor) error { + if r.typ == "DateTime" || !r.DateTime.IsZero() { + return visitor.VisitDateTime(r.DateTime) + } + if r.typ == "Operators" || r.Operators != nil { + return visitor.VisitOperators(r.Operators) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) +type RequestBulkRetryCreateRequestQueryParsedQuery struct { + String string + RequestBulkRetryCreateRequestQueryParsedQueryOne *RequestBulkRetryCreateRequestQueryParsedQueryOne + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryParsedQueryFromString(value string) *RequestBulkRetryCreateRequestQueryParsedQuery { + return &RequestBulkRetryCreateRequestQueryParsedQuery{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQueryParsedQueryFromRequestBulkRetryCreateRequestQueryParsedQueryOne(value *RequestBulkRetryCreateRequestQueryParsedQueryOne) *RequestBulkRetryCreateRequestQueryParsedQuery { + return &RequestBulkRetryCreateRequestQueryParsedQuery{typ: "RequestBulkRetryCreateRequestQueryParsedQueryOne", RequestBulkRetryCreateRequestQueryParsedQueryOne: value} +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQuery) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQuery) GetRequestBulkRetryCreateRequestQueryParsedQueryOne() *RequestBulkRetryCreateRequestQueryParsedQueryOne { + if r == nil { + return nil + } + return r.RequestBulkRetryCreateRequestQueryParsedQueryOne +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + valueRequestBulkRetryCreateRequestQueryParsedQueryOne := new(RequestBulkRetryCreateRequestQueryParsedQueryOne) + if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryParsedQueryOne); err == nil { + r.typ = "RequestBulkRetryCreateRequestQueryParsedQueryOne" + r.RequestBulkRetryCreateRequestQueryParsedQueryOne = valueRequestBulkRetryCreateRequestQueryParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryParsedQueryOne" || r.RequestBulkRetryCreateRequestQueryParsedQueryOne != nil { + return json.Marshal(r.RequestBulkRetryCreateRequestQueryParsedQueryOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryParsedQueryVisitor interface { + VisitString(string) error + VisitRequestBulkRetryCreateRequestQueryParsedQueryOne(*RequestBulkRetryCreateRequestQueryParsedQueryOne) error +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQuery) Accept(visitor RequestBulkRetryCreateRequestQueryParsedQueryVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "RequestBulkRetryCreateRequestQueryParsedQueryOne" || r.RequestBulkRetryCreateRequestQueryParsedQueryOne != nil { + return visitor.VisitRequestBulkRetryCreateRequestQueryParsedQueryOne(r.RequestBulkRetryCreateRequestQueryParsedQueryOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryParsedQueryOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) UnmarshalJSON(data []byte) error { + type unmarshaler RequestBulkRetryCreateRequestQueryParsedQueryOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RequestBulkRetryCreateRequestQueryParsedQueryOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(r); err == nil { return value } return fmt.Sprintf("%#v", r) } +// Filter by rejection cause +type RequestBulkRetryCreateRequestQueryRejectionCause struct { + RequestRejectionCause RequestRejectionCause + RequestRejectionCauseList []RequestRejectionCause + + typ string +} + +func NewRequestBulkRetryCreateRequestQueryRejectionCauseFromRequestRejectionCause(value RequestRejectionCause) *RequestBulkRetryCreateRequestQueryRejectionCause { + return &RequestBulkRetryCreateRequestQueryRejectionCause{typ: "RequestRejectionCause", RequestRejectionCause: value} +} + +func NewRequestBulkRetryCreateRequestQueryRejectionCauseFromRequestRejectionCauseList(value []RequestRejectionCause) *RequestBulkRetryCreateRequestQueryRejectionCause { + return &RequestBulkRetryCreateRequestQueryRejectionCause{typ: "RequestRejectionCauseList", RequestRejectionCauseList: value} +} + +func (r *RequestBulkRetryCreateRequestQueryRejectionCause) GetRequestRejectionCause() RequestRejectionCause { + if r == nil { + return "" + } + return r.RequestRejectionCause +} + +func (r *RequestBulkRetryCreateRequestQueryRejectionCause) GetRequestRejectionCauseList() []RequestRejectionCause { + if r == nil { + return nil + } + return r.RequestRejectionCauseList +} + +func (r *RequestBulkRetryCreateRequestQueryRejectionCause) UnmarshalJSON(data []byte) error { + var valueRequestRejectionCause RequestRejectionCause + if err := json.Unmarshal(data, &valueRequestRejectionCause); err == nil { + r.typ = "RequestRejectionCause" + r.RequestRejectionCause = valueRequestRejectionCause + return nil + } + var valueRequestRejectionCauseList []RequestRejectionCause + if err := json.Unmarshal(data, &valueRequestRejectionCauseList); err == nil { + r.typ = "RequestRejectionCauseList" + r.RequestRejectionCauseList = valueRequestRejectionCauseList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQueryRejectionCause) MarshalJSON() ([]byte, error) { + if r.typ == "RequestRejectionCause" || r.RequestRejectionCause != "" { + return json.Marshal(r.RequestRejectionCause) + } + if r.typ == "RequestRejectionCauseList" || r.RequestRejectionCauseList != nil { + return json.Marshal(r.RequestRejectionCauseList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQueryRejectionCauseVisitor interface { + VisitRequestRejectionCause(RequestRejectionCause) error + VisitRequestRejectionCauseList([]RequestRejectionCause) error +} + +func (r *RequestBulkRetryCreateRequestQueryRejectionCause) Accept(visitor RequestBulkRetryCreateRequestQueryRejectionCauseVisitor) error { + if r.typ == "RequestRejectionCause" || r.RequestRejectionCause != "" { + return visitor.VisitRequestRejectionCause(r.RequestRejectionCause) + } + if r.typ == "RequestRejectionCauseList" || r.RequestRejectionCauseList != nil { + return visitor.VisitRequestRejectionCauseList(r.RequestRejectionCauseList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// Filter by source IDs +type RequestBulkRetryCreateRequestQuerySourceId struct { + // Source ID + String string + StringList []string + + typ string +} + +func NewRequestBulkRetryCreateRequestQuerySourceIdFromString(value string) *RequestBulkRetryCreateRequestQuerySourceId { + return &RequestBulkRetryCreateRequestQuerySourceId{typ: "String", String: value} +} + +func NewRequestBulkRetryCreateRequestQuerySourceIdFromStringList(value []string) *RequestBulkRetryCreateRequestQuerySourceId { + return &RequestBulkRetryCreateRequestQuerySourceId{typ: "StringList", StringList: value} +} + +func (r *RequestBulkRetryCreateRequestQuerySourceId) GetString() string { + if r == nil { + return "" + } + return r.String +} + +func (r *RequestBulkRetryCreateRequestQuerySourceId) GetStringList() []string { + if r == nil { + return nil + } + return r.StringList +} + +func (r *RequestBulkRetryCreateRequestQuerySourceId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + r.typ = "String" + r.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + r.typ = "StringList" + r.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r RequestBulkRetryCreateRequestQuerySourceId) MarshalJSON() ([]byte, error) { + if r.typ == "String" || r.String != "" { + return json.Marshal(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return json.Marshal(r.StringList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +} + +type RequestBulkRetryCreateRequestQuerySourceIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (r *RequestBulkRetryCreateRequestQuerySourceId) Accept(visitor RequestBulkRetryCreateRequestQuerySourceIdVisitor) error { + if r.typ == "String" || r.String != "" { + return visitor.VisitString(r.String) + } + if r.typ == "StringList" || r.StringList != nil { + return visitor.VisitStringList(r.StringList) + } + return fmt.Errorf("type %T does not include a non-empty union type", r) +} + +// Filter by status +type RequestBulkRetryCreateRequestQueryStatus string + +const ( + RequestBulkRetryCreateRequestQueryStatusAccepted RequestBulkRetryCreateRequestQueryStatus = "accepted" + RequestBulkRetryCreateRequestQueryStatusRejected RequestBulkRetryCreateRequestQueryStatus = "rejected" +) + +func NewRequestBulkRetryCreateRequestQueryStatusFromString(s string) (RequestBulkRetryCreateRequestQueryStatus, error) { + switch s { + case "accepted": + return RequestBulkRetryCreateRequestQueryStatusAccepted, nil + case "rejected": + return RequestBulkRetryCreateRequestQueryStatusRejected, nil + } + var t RequestBulkRetryCreateRequestQueryStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RequestBulkRetryCreateRequestQueryStatus) Ptr() *RequestBulkRetryCreateRequestQueryStatus { + return &r +} + type RequestBulkRetryListRequestDir string const ( @@ -146,7 +1138,28 @@ type RequestBulkRetryPlanResponse struct { Progress *float64 `json:"progress,omitempty" url:"progress,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (r *RequestBulkRetryPlanResponse) GetEstimatedBatch() *int { + if r == nil { + return nil + } + return r.EstimatedBatch +} + +func (r *RequestBulkRetryPlanResponse) GetEstimatedCount() *int { + if r == nil { + return nil + } + return r.EstimatedCount +} + +func (r *RequestBulkRetryPlanResponse) GetProgress() *float64 { + if r == nil { + return nil + } + return r.Progress } func (r *RequestBulkRetryPlanResponse) GetExtraProperties() map[string]interface{} { @@ -160,24 +1173,22 @@ func (r *RequestBulkRetryPlanResponse) UnmarshalJSON(data []byte) error { return err } *r = RequestBulkRetryPlanResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *r) + extraProperties, err := internal.ExtractExtraProperties(data, *r) if err != nil { return err } r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + r.rawJSON = json.RawMessage(data) return nil } func (r *RequestBulkRetryPlanResponse) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(r); err == nil { return value } return fmt.Sprintf("%#v", r) diff --git a/requestbulkretry/client.go b/requestbulkretry/client.go index 918f932..ca89995 100644 --- a/requestbulkretry/client.go +++ b/requestbulkretry/client.go @@ -3,20 +3,17 @@ package requestbulkretry import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperationPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/requests/retry" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperationPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/requests/retry" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -177,57 +143,42 @@ func (c *Client) Plan( opts ...option.RequestOption, ) (*hookdeckgosdk.RequestBulkRetryPlanResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/bulk/requests/retry/plan" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.RequestBulkRetryPlanResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -241,50 +192,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/requests/retry/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/requests/retry/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -298,50 +239,40 @@ func (c *Client) Cancel( opts ...option.RequestOption, ) (*hookdeckgosdk.BatchOperation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/bulk/requests/retry/%v/cancel", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/bulk/requests/retry/%v/cancel", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.BatchOperation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/source.go b/source.go index 5c41a77..c513e71 100644 --- a/source.go +++ b/source.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -17,6 +18,9 @@ type SourceCreateRequest struct { AllowedHttpMethods *core.Optional[SourceAllowedHttpMethod] `json:"allowed_http_methods,omitempty" url:"-"` CustomResponse *core.Optional[SourceCustomResponse] `json:"custom_response,omitempty" url:"-"` Verification *core.Optional[VerificationConfig] `json:"verification,omitempty" url:"-"` + // Type of the source + Type *core.Optional[SourceCreateRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[SourceTypeConfig] `json:"config,omitempty" url:"-"` } type SourceListRequest struct { @@ -35,12 +39,311 @@ type SourceRetrieveRequest struct { Include *string `json:"-" url:"include,omitempty"` } +type SourcePaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Source `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourcePaginatedResult) GetPagination() *SeekPagination { + if s == nil { + return nil + } + return s.Pagination +} + +func (s *SourcePaginatedResult) GetCount() *int { + if s == nil { + return nil + } + return s.Count +} + +func (s *SourcePaginatedResult) GetModels() []*Source { + if s == nil { + return nil + } + return s.Models +} + +func (s *SourcePaginatedResult) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourcePaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler SourcePaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourcePaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourcePaginatedResult) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// Type of the source +type SourceCreateRequestType string + +const ( + SourceCreateRequestTypeWebhook SourceCreateRequestType = "WEBHOOK" + SourceCreateRequestTypeHttp SourceCreateRequestType = "HTTP" + SourceCreateRequestTypeSanity SourceCreateRequestType = "SANITY" + SourceCreateRequestTypeBridge SourceCreateRequestType = "BRIDGE" + SourceCreateRequestTypeCloudsignal SourceCreateRequestType = "CLOUDSIGNAL" + SourceCreateRequestTypeCourier SourceCreateRequestType = "COURIER" + SourceCreateRequestTypeFrontapp SourceCreateRequestType = "FRONTAPP" + SourceCreateRequestTypeZoom SourceCreateRequestType = "ZOOM" + SourceCreateRequestTypeTwitter SourceCreateRequestType = "TWITTER" + SourceCreateRequestTypeRecharge SourceCreateRequestType = "RECHARGE" + SourceCreateRequestTypeStripe SourceCreateRequestType = "STRIPE" + SourceCreateRequestTypePropertyFinder SourceCreateRequestType = "PROPERTY-FINDER" + SourceCreateRequestTypeShopify SourceCreateRequestType = "SHOPIFY" + SourceCreateRequestTypeTwilio SourceCreateRequestType = "TWILIO" + SourceCreateRequestTypeGithub SourceCreateRequestType = "GITHUB" + SourceCreateRequestTypePostmark SourceCreateRequestType = "POSTMARK" + SourceCreateRequestTypeTypeform SourceCreateRequestType = "TYPEFORM" + SourceCreateRequestTypeXero SourceCreateRequestType = "XERO" + SourceCreateRequestTypeSvix SourceCreateRequestType = "SVIX" + SourceCreateRequestTypeAdyen SourceCreateRequestType = "ADYEN" + SourceCreateRequestTypeAkeneo SourceCreateRequestType = "AKENEO" + SourceCreateRequestTypeGitlab SourceCreateRequestType = "GITLAB" + SourceCreateRequestTypeWoocommerce SourceCreateRequestType = "WOOCOMMERCE" + SourceCreateRequestTypeOura SourceCreateRequestType = "OURA" + SourceCreateRequestTypeCommercelayer SourceCreateRequestType = "COMMERCELAYER" + SourceCreateRequestTypeHubspot SourceCreateRequestType = "HUBSPOT" + SourceCreateRequestTypeMailgun SourceCreateRequestType = "MAILGUN" + SourceCreateRequestTypePersona SourceCreateRequestType = "PERSONA" + SourceCreateRequestTypePipedrive SourceCreateRequestType = "PIPEDRIVE" + SourceCreateRequestTypeSendgrid SourceCreateRequestType = "SENDGRID" + SourceCreateRequestTypeWorkos SourceCreateRequestType = "WORKOS" + SourceCreateRequestTypeSynctera SourceCreateRequestType = "SYNCTERA" + SourceCreateRequestTypeAwsSns SourceCreateRequestType = "AWS_SNS" + SourceCreateRequestTypeThreeDEye SourceCreateRequestType = "THREE_D_EYE" + SourceCreateRequestTypeTwitch SourceCreateRequestType = "TWITCH" + SourceCreateRequestTypeEnode SourceCreateRequestType = "ENODE" + SourceCreateRequestTypeFavro SourceCreateRequestType = "FAVRO" + SourceCreateRequestTypeLinear SourceCreateRequestType = "LINEAR" + SourceCreateRequestTypeShopline SourceCreateRequestType = "SHOPLINE" + SourceCreateRequestTypeWix SourceCreateRequestType = "WIX" + SourceCreateRequestTypeNmi SourceCreateRequestType = "NMI" + SourceCreateRequestTypeOrb SourceCreateRequestType = "ORB" + SourceCreateRequestTypePylon SourceCreateRequestType = "PYLON" + SourceCreateRequestTypeRazorpay SourceCreateRequestType = "RAZORPAY" + SourceCreateRequestTypeRepay SourceCreateRequestType = "REPAY" + SourceCreateRequestTypeSquare SourceCreateRequestType = "SQUARE" + SourceCreateRequestTypeSolidgate SourceCreateRequestType = "SOLIDGATE" + SourceCreateRequestTypeTrello SourceCreateRequestType = "TRELLO" + SourceCreateRequestTypeEbay SourceCreateRequestType = "EBAY" + SourceCreateRequestTypeTelnyx SourceCreateRequestType = "TELNYX" + SourceCreateRequestTypeDiscord SourceCreateRequestType = "DISCORD" + SourceCreateRequestTypeTokenio SourceCreateRequestType = "TOKENIO" + SourceCreateRequestTypeFiserv SourceCreateRequestType = "FISERV" + SourceCreateRequestTypeBondsmith SourceCreateRequestType = "BONDSMITH" + SourceCreateRequestTypeVercelLogDrains SourceCreateRequestType = "VERCEL_LOG_DRAINS" + SourceCreateRequestTypeVercel SourceCreateRequestType = "VERCEL" + SourceCreateRequestTypeTebex SourceCreateRequestType = "TEBEX" + SourceCreateRequestTypeSlack SourceCreateRequestType = "SLACK" + SourceCreateRequestTypeMailchimp SourceCreateRequestType = "MAILCHIMP" + SourceCreateRequestTypePaddle SourceCreateRequestType = "PADDLE" + SourceCreateRequestTypePaypal SourceCreateRequestType = "PAYPAL" + SourceCreateRequestTypeTreezor SourceCreateRequestType = "TREEZOR" + SourceCreateRequestTypePraxis SourceCreateRequestType = "PRAXIS" + SourceCreateRequestTypeCustomerio SourceCreateRequestType = "CUSTOMERIO" + SourceCreateRequestTypeFacebook SourceCreateRequestType = "FACEBOOK" + SourceCreateRequestTypeWhatsapp SourceCreateRequestType = "WHATSAPP" + SourceCreateRequestTypeReplicate SourceCreateRequestType = "REPLICATE" + SourceCreateRequestTypeTiktok SourceCreateRequestType = "TIKTOK" + SourceCreateRequestTypeAirwallex SourceCreateRequestType = "AIRWALLEX" + SourceCreateRequestTypeZendesk SourceCreateRequestType = "ZENDESK" + SourceCreateRequestTypeUpollo SourceCreateRequestType = "UPOLLO" +) + +func NewSourceCreateRequestTypeFromString(s string) (SourceCreateRequestType, error) { + switch s { + case "WEBHOOK": + return SourceCreateRequestTypeWebhook, nil + case "HTTP": + return SourceCreateRequestTypeHttp, nil + case "SANITY": + return SourceCreateRequestTypeSanity, nil + case "BRIDGE": + return SourceCreateRequestTypeBridge, nil + case "CLOUDSIGNAL": + return SourceCreateRequestTypeCloudsignal, nil + case "COURIER": + return SourceCreateRequestTypeCourier, nil + case "FRONTAPP": + return SourceCreateRequestTypeFrontapp, nil + case "ZOOM": + return SourceCreateRequestTypeZoom, nil + case "TWITTER": + return SourceCreateRequestTypeTwitter, nil + case "RECHARGE": + return SourceCreateRequestTypeRecharge, nil + case "STRIPE": + return SourceCreateRequestTypeStripe, nil + case "PROPERTY-FINDER": + return SourceCreateRequestTypePropertyFinder, nil + case "SHOPIFY": + return SourceCreateRequestTypeShopify, nil + case "TWILIO": + return SourceCreateRequestTypeTwilio, nil + case "GITHUB": + return SourceCreateRequestTypeGithub, nil + case "POSTMARK": + return SourceCreateRequestTypePostmark, nil + case "TYPEFORM": + return SourceCreateRequestTypeTypeform, nil + case "XERO": + return SourceCreateRequestTypeXero, nil + case "SVIX": + return SourceCreateRequestTypeSvix, nil + case "ADYEN": + return SourceCreateRequestTypeAdyen, nil + case "AKENEO": + return SourceCreateRequestTypeAkeneo, nil + case "GITLAB": + return SourceCreateRequestTypeGitlab, nil + case "WOOCOMMERCE": + return SourceCreateRequestTypeWoocommerce, nil + case "OURA": + return SourceCreateRequestTypeOura, nil + case "COMMERCELAYER": + return SourceCreateRequestTypeCommercelayer, nil + case "HUBSPOT": + return SourceCreateRequestTypeHubspot, nil + case "MAILGUN": + return SourceCreateRequestTypeMailgun, nil + case "PERSONA": + return SourceCreateRequestTypePersona, nil + case "PIPEDRIVE": + return SourceCreateRequestTypePipedrive, nil + case "SENDGRID": + return SourceCreateRequestTypeSendgrid, nil + case "WORKOS": + return SourceCreateRequestTypeWorkos, nil + case "SYNCTERA": + return SourceCreateRequestTypeSynctera, nil + case "AWS_SNS": + return SourceCreateRequestTypeAwsSns, nil + case "THREE_D_EYE": + return SourceCreateRequestTypeThreeDEye, nil + case "TWITCH": + return SourceCreateRequestTypeTwitch, nil + case "ENODE": + return SourceCreateRequestTypeEnode, nil + case "FAVRO": + return SourceCreateRequestTypeFavro, nil + case "LINEAR": + return SourceCreateRequestTypeLinear, nil + case "SHOPLINE": + return SourceCreateRequestTypeShopline, nil + case "WIX": + return SourceCreateRequestTypeWix, nil + case "NMI": + return SourceCreateRequestTypeNmi, nil + case "ORB": + return SourceCreateRequestTypeOrb, nil + case "PYLON": + return SourceCreateRequestTypePylon, nil + case "RAZORPAY": + return SourceCreateRequestTypeRazorpay, nil + case "REPAY": + return SourceCreateRequestTypeRepay, nil + case "SQUARE": + return SourceCreateRequestTypeSquare, nil + case "SOLIDGATE": + return SourceCreateRequestTypeSolidgate, nil + case "TRELLO": + return SourceCreateRequestTypeTrello, nil + case "EBAY": + return SourceCreateRequestTypeEbay, nil + case "TELNYX": + return SourceCreateRequestTypeTelnyx, nil + case "DISCORD": + return SourceCreateRequestTypeDiscord, nil + case "TOKENIO": + return SourceCreateRequestTypeTokenio, nil + case "FISERV": + return SourceCreateRequestTypeFiserv, nil + case "BONDSMITH": + return SourceCreateRequestTypeBondsmith, nil + case "VERCEL_LOG_DRAINS": + return SourceCreateRequestTypeVercelLogDrains, nil + case "VERCEL": + return SourceCreateRequestTypeVercel, nil + case "TEBEX": + return SourceCreateRequestTypeTebex, nil + case "SLACK": + return SourceCreateRequestTypeSlack, nil + case "MAILCHIMP": + return SourceCreateRequestTypeMailchimp, nil + case "PADDLE": + return SourceCreateRequestTypePaddle, nil + case "PAYPAL": + return SourceCreateRequestTypePaypal, nil + case "TREEZOR": + return SourceCreateRequestTypeTreezor, nil + case "PRAXIS": + return SourceCreateRequestTypePraxis, nil + case "CUSTOMERIO": + return SourceCreateRequestTypeCustomerio, nil + case "FACEBOOK": + return SourceCreateRequestTypeFacebook, nil + case "WHATSAPP": + return SourceCreateRequestTypeWhatsapp, nil + case "REPLICATE": + return SourceCreateRequestTypeReplicate, nil + case "TIKTOK": + return SourceCreateRequestTypeTiktok, nil + case "AIRWALLEX": + return SourceCreateRequestTypeAirwallex, nil + case "ZENDESK": + return SourceCreateRequestTypeZendesk, nil + case "UPOLLO": + return SourceCreateRequestTypeUpollo, nil + } + var t SourceCreateRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceCreateRequestType) Ptr() *SourceCreateRequestType { + return &s +} + type SourceDeleteResponse struct { // ID of the source Id string `json:"id" url:"id"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (s *SourceDeleteResponse) GetId() string { + if s == nil { + return "" + } + return s.Id } func (s *SourceDeleteResponse) GetExtraProperties() map[string]interface{} { @@ -54,24 +357,22 @@ func (s *SourceDeleteResponse) UnmarshalJSON(data []byte) error { return err } *s = SourceDeleteResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) + s.rawJSON = json.RawMessage(data) return nil } func (s *SourceDeleteResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } return fmt.Sprintf("%#v", s) @@ -118,6 +419,466 @@ func (s SourceListRequestOrderBy) Ptr() *SourceListRequestOrderBy { return &s } +// Type of the source +type SourceUpdateRequestType string + +const ( + SourceUpdateRequestTypeWebhook SourceUpdateRequestType = "WEBHOOK" + SourceUpdateRequestTypeHttp SourceUpdateRequestType = "HTTP" + SourceUpdateRequestTypeSanity SourceUpdateRequestType = "SANITY" + SourceUpdateRequestTypeBridge SourceUpdateRequestType = "BRIDGE" + SourceUpdateRequestTypeCloudsignal SourceUpdateRequestType = "CLOUDSIGNAL" + SourceUpdateRequestTypeCourier SourceUpdateRequestType = "COURIER" + SourceUpdateRequestTypeFrontapp SourceUpdateRequestType = "FRONTAPP" + SourceUpdateRequestTypeZoom SourceUpdateRequestType = "ZOOM" + SourceUpdateRequestTypeTwitter SourceUpdateRequestType = "TWITTER" + SourceUpdateRequestTypeRecharge SourceUpdateRequestType = "RECHARGE" + SourceUpdateRequestTypeStripe SourceUpdateRequestType = "STRIPE" + SourceUpdateRequestTypePropertyFinder SourceUpdateRequestType = "PROPERTY-FINDER" + SourceUpdateRequestTypeShopify SourceUpdateRequestType = "SHOPIFY" + SourceUpdateRequestTypeTwilio SourceUpdateRequestType = "TWILIO" + SourceUpdateRequestTypeGithub SourceUpdateRequestType = "GITHUB" + SourceUpdateRequestTypePostmark SourceUpdateRequestType = "POSTMARK" + SourceUpdateRequestTypeTypeform SourceUpdateRequestType = "TYPEFORM" + SourceUpdateRequestTypeXero SourceUpdateRequestType = "XERO" + SourceUpdateRequestTypeSvix SourceUpdateRequestType = "SVIX" + SourceUpdateRequestTypeAdyen SourceUpdateRequestType = "ADYEN" + SourceUpdateRequestTypeAkeneo SourceUpdateRequestType = "AKENEO" + SourceUpdateRequestTypeGitlab SourceUpdateRequestType = "GITLAB" + SourceUpdateRequestTypeWoocommerce SourceUpdateRequestType = "WOOCOMMERCE" + SourceUpdateRequestTypeOura SourceUpdateRequestType = "OURA" + SourceUpdateRequestTypeCommercelayer SourceUpdateRequestType = "COMMERCELAYER" + SourceUpdateRequestTypeHubspot SourceUpdateRequestType = "HUBSPOT" + SourceUpdateRequestTypeMailgun SourceUpdateRequestType = "MAILGUN" + SourceUpdateRequestTypePersona SourceUpdateRequestType = "PERSONA" + SourceUpdateRequestTypePipedrive SourceUpdateRequestType = "PIPEDRIVE" + SourceUpdateRequestTypeSendgrid SourceUpdateRequestType = "SENDGRID" + SourceUpdateRequestTypeWorkos SourceUpdateRequestType = "WORKOS" + SourceUpdateRequestTypeSynctera SourceUpdateRequestType = "SYNCTERA" + SourceUpdateRequestTypeAwsSns SourceUpdateRequestType = "AWS_SNS" + SourceUpdateRequestTypeThreeDEye SourceUpdateRequestType = "THREE_D_EYE" + SourceUpdateRequestTypeTwitch SourceUpdateRequestType = "TWITCH" + SourceUpdateRequestTypeEnode SourceUpdateRequestType = "ENODE" + SourceUpdateRequestTypeFavro SourceUpdateRequestType = "FAVRO" + SourceUpdateRequestTypeLinear SourceUpdateRequestType = "LINEAR" + SourceUpdateRequestTypeShopline SourceUpdateRequestType = "SHOPLINE" + SourceUpdateRequestTypeWix SourceUpdateRequestType = "WIX" + SourceUpdateRequestTypeNmi SourceUpdateRequestType = "NMI" + SourceUpdateRequestTypeOrb SourceUpdateRequestType = "ORB" + SourceUpdateRequestTypePylon SourceUpdateRequestType = "PYLON" + SourceUpdateRequestTypeRazorpay SourceUpdateRequestType = "RAZORPAY" + SourceUpdateRequestTypeRepay SourceUpdateRequestType = "REPAY" + SourceUpdateRequestTypeSquare SourceUpdateRequestType = "SQUARE" + SourceUpdateRequestTypeSolidgate SourceUpdateRequestType = "SOLIDGATE" + SourceUpdateRequestTypeTrello SourceUpdateRequestType = "TRELLO" + SourceUpdateRequestTypeEbay SourceUpdateRequestType = "EBAY" + SourceUpdateRequestTypeTelnyx SourceUpdateRequestType = "TELNYX" + SourceUpdateRequestTypeDiscord SourceUpdateRequestType = "DISCORD" + SourceUpdateRequestTypeTokenio SourceUpdateRequestType = "TOKENIO" + SourceUpdateRequestTypeFiserv SourceUpdateRequestType = "FISERV" + SourceUpdateRequestTypeBondsmith SourceUpdateRequestType = "BONDSMITH" + SourceUpdateRequestTypeVercelLogDrains SourceUpdateRequestType = "VERCEL_LOG_DRAINS" + SourceUpdateRequestTypeVercel SourceUpdateRequestType = "VERCEL" + SourceUpdateRequestTypeTebex SourceUpdateRequestType = "TEBEX" + SourceUpdateRequestTypeSlack SourceUpdateRequestType = "SLACK" + SourceUpdateRequestTypeMailchimp SourceUpdateRequestType = "MAILCHIMP" + SourceUpdateRequestTypePaddle SourceUpdateRequestType = "PADDLE" + SourceUpdateRequestTypePaypal SourceUpdateRequestType = "PAYPAL" + SourceUpdateRequestTypeTreezor SourceUpdateRequestType = "TREEZOR" + SourceUpdateRequestTypePraxis SourceUpdateRequestType = "PRAXIS" + SourceUpdateRequestTypeCustomerio SourceUpdateRequestType = "CUSTOMERIO" + SourceUpdateRequestTypeFacebook SourceUpdateRequestType = "FACEBOOK" + SourceUpdateRequestTypeWhatsapp SourceUpdateRequestType = "WHATSAPP" + SourceUpdateRequestTypeReplicate SourceUpdateRequestType = "REPLICATE" + SourceUpdateRequestTypeTiktok SourceUpdateRequestType = "TIKTOK" + SourceUpdateRequestTypeAirwallex SourceUpdateRequestType = "AIRWALLEX" + SourceUpdateRequestTypeZendesk SourceUpdateRequestType = "ZENDESK" + SourceUpdateRequestTypeUpollo SourceUpdateRequestType = "UPOLLO" +) + +func NewSourceUpdateRequestTypeFromString(s string) (SourceUpdateRequestType, error) { + switch s { + case "WEBHOOK": + return SourceUpdateRequestTypeWebhook, nil + case "HTTP": + return SourceUpdateRequestTypeHttp, nil + case "SANITY": + return SourceUpdateRequestTypeSanity, nil + case "BRIDGE": + return SourceUpdateRequestTypeBridge, nil + case "CLOUDSIGNAL": + return SourceUpdateRequestTypeCloudsignal, nil + case "COURIER": + return SourceUpdateRequestTypeCourier, nil + case "FRONTAPP": + return SourceUpdateRequestTypeFrontapp, nil + case "ZOOM": + return SourceUpdateRequestTypeZoom, nil + case "TWITTER": + return SourceUpdateRequestTypeTwitter, nil + case "RECHARGE": + return SourceUpdateRequestTypeRecharge, nil + case "STRIPE": + return SourceUpdateRequestTypeStripe, nil + case "PROPERTY-FINDER": + return SourceUpdateRequestTypePropertyFinder, nil + case "SHOPIFY": + return SourceUpdateRequestTypeShopify, nil + case "TWILIO": + return SourceUpdateRequestTypeTwilio, nil + case "GITHUB": + return SourceUpdateRequestTypeGithub, nil + case "POSTMARK": + return SourceUpdateRequestTypePostmark, nil + case "TYPEFORM": + return SourceUpdateRequestTypeTypeform, nil + case "XERO": + return SourceUpdateRequestTypeXero, nil + case "SVIX": + return SourceUpdateRequestTypeSvix, nil + case "ADYEN": + return SourceUpdateRequestTypeAdyen, nil + case "AKENEO": + return SourceUpdateRequestTypeAkeneo, nil + case "GITLAB": + return SourceUpdateRequestTypeGitlab, nil + case "WOOCOMMERCE": + return SourceUpdateRequestTypeWoocommerce, nil + case "OURA": + return SourceUpdateRequestTypeOura, nil + case "COMMERCELAYER": + return SourceUpdateRequestTypeCommercelayer, nil + case "HUBSPOT": + return SourceUpdateRequestTypeHubspot, nil + case "MAILGUN": + return SourceUpdateRequestTypeMailgun, nil + case "PERSONA": + return SourceUpdateRequestTypePersona, nil + case "PIPEDRIVE": + return SourceUpdateRequestTypePipedrive, nil + case "SENDGRID": + return SourceUpdateRequestTypeSendgrid, nil + case "WORKOS": + return SourceUpdateRequestTypeWorkos, nil + case "SYNCTERA": + return SourceUpdateRequestTypeSynctera, nil + case "AWS_SNS": + return SourceUpdateRequestTypeAwsSns, nil + case "THREE_D_EYE": + return SourceUpdateRequestTypeThreeDEye, nil + case "TWITCH": + return SourceUpdateRequestTypeTwitch, nil + case "ENODE": + return SourceUpdateRequestTypeEnode, nil + case "FAVRO": + return SourceUpdateRequestTypeFavro, nil + case "LINEAR": + return SourceUpdateRequestTypeLinear, nil + case "SHOPLINE": + return SourceUpdateRequestTypeShopline, nil + case "WIX": + return SourceUpdateRequestTypeWix, nil + case "NMI": + return SourceUpdateRequestTypeNmi, nil + case "ORB": + return SourceUpdateRequestTypeOrb, nil + case "PYLON": + return SourceUpdateRequestTypePylon, nil + case "RAZORPAY": + return SourceUpdateRequestTypeRazorpay, nil + case "REPAY": + return SourceUpdateRequestTypeRepay, nil + case "SQUARE": + return SourceUpdateRequestTypeSquare, nil + case "SOLIDGATE": + return SourceUpdateRequestTypeSolidgate, nil + case "TRELLO": + return SourceUpdateRequestTypeTrello, nil + case "EBAY": + return SourceUpdateRequestTypeEbay, nil + case "TELNYX": + return SourceUpdateRequestTypeTelnyx, nil + case "DISCORD": + return SourceUpdateRequestTypeDiscord, nil + case "TOKENIO": + return SourceUpdateRequestTypeTokenio, nil + case "FISERV": + return SourceUpdateRequestTypeFiserv, nil + case "BONDSMITH": + return SourceUpdateRequestTypeBondsmith, nil + case "VERCEL_LOG_DRAINS": + return SourceUpdateRequestTypeVercelLogDrains, nil + case "VERCEL": + return SourceUpdateRequestTypeVercel, nil + case "TEBEX": + return SourceUpdateRequestTypeTebex, nil + case "SLACK": + return SourceUpdateRequestTypeSlack, nil + case "MAILCHIMP": + return SourceUpdateRequestTypeMailchimp, nil + case "PADDLE": + return SourceUpdateRequestTypePaddle, nil + case "PAYPAL": + return SourceUpdateRequestTypePaypal, nil + case "TREEZOR": + return SourceUpdateRequestTypeTreezor, nil + case "PRAXIS": + return SourceUpdateRequestTypePraxis, nil + case "CUSTOMERIO": + return SourceUpdateRequestTypeCustomerio, nil + case "FACEBOOK": + return SourceUpdateRequestTypeFacebook, nil + case "WHATSAPP": + return SourceUpdateRequestTypeWhatsapp, nil + case "REPLICATE": + return SourceUpdateRequestTypeReplicate, nil + case "TIKTOK": + return SourceUpdateRequestTypeTiktok, nil + case "AIRWALLEX": + return SourceUpdateRequestTypeAirwallex, nil + case "ZENDESK": + return SourceUpdateRequestTypeZendesk, nil + case "UPOLLO": + return SourceUpdateRequestTypeUpollo, nil + } + var t SourceUpdateRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceUpdateRequestType) Ptr() *SourceUpdateRequestType { + return &s +} + +// Type of the source +type SourceUpsertRequestType string + +const ( + SourceUpsertRequestTypeWebhook SourceUpsertRequestType = "WEBHOOK" + SourceUpsertRequestTypeHttp SourceUpsertRequestType = "HTTP" + SourceUpsertRequestTypeSanity SourceUpsertRequestType = "SANITY" + SourceUpsertRequestTypeBridge SourceUpsertRequestType = "BRIDGE" + SourceUpsertRequestTypeCloudsignal SourceUpsertRequestType = "CLOUDSIGNAL" + SourceUpsertRequestTypeCourier SourceUpsertRequestType = "COURIER" + SourceUpsertRequestTypeFrontapp SourceUpsertRequestType = "FRONTAPP" + SourceUpsertRequestTypeZoom SourceUpsertRequestType = "ZOOM" + SourceUpsertRequestTypeTwitter SourceUpsertRequestType = "TWITTER" + SourceUpsertRequestTypeRecharge SourceUpsertRequestType = "RECHARGE" + SourceUpsertRequestTypeStripe SourceUpsertRequestType = "STRIPE" + SourceUpsertRequestTypePropertyFinder SourceUpsertRequestType = "PROPERTY-FINDER" + SourceUpsertRequestTypeShopify SourceUpsertRequestType = "SHOPIFY" + SourceUpsertRequestTypeTwilio SourceUpsertRequestType = "TWILIO" + SourceUpsertRequestTypeGithub SourceUpsertRequestType = "GITHUB" + SourceUpsertRequestTypePostmark SourceUpsertRequestType = "POSTMARK" + SourceUpsertRequestTypeTypeform SourceUpsertRequestType = "TYPEFORM" + SourceUpsertRequestTypeXero SourceUpsertRequestType = "XERO" + SourceUpsertRequestTypeSvix SourceUpsertRequestType = "SVIX" + SourceUpsertRequestTypeAdyen SourceUpsertRequestType = "ADYEN" + SourceUpsertRequestTypeAkeneo SourceUpsertRequestType = "AKENEO" + SourceUpsertRequestTypeGitlab SourceUpsertRequestType = "GITLAB" + SourceUpsertRequestTypeWoocommerce SourceUpsertRequestType = "WOOCOMMERCE" + SourceUpsertRequestTypeOura SourceUpsertRequestType = "OURA" + SourceUpsertRequestTypeCommercelayer SourceUpsertRequestType = "COMMERCELAYER" + SourceUpsertRequestTypeHubspot SourceUpsertRequestType = "HUBSPOT" + SourceUpsertRequestTypeMailgun SourceUpsertRequestType = "MAILGUN" + SourceUpsertRequestTypePersona SourceUpsertRequestType = "PERSONA" + SourceUpsertRequestTypePipedrive SourceUpsertRequestType = "PIPEDRIVE" + SourceUpsertRequestTypeSendgrid SourceUpsertRequestType = "SENDGRID" + SourceUpsertRequestTypeWorkos SourceUpsertRequestType = "WORKOS" + SourceUpsertRequestTypeSynctera SourceUpsertRequestType = "SYNCTERA" + SourceUpsertRequestTypeAwsSns SourceUpsertRequestType = "AWS_SNS" + SourceUpsertRequestTypeThreeDEye SourceUpsertRequestType = "THREE_D_EYE" + SourceUpsertRequestTypeTwitch SourceUpsertRequestType = "TWITCH" + SourceUpsertRequestTypeEnode SourceUpsertRequestType = "ENODE" + SourceUpsertRequestTypeFavro SourceUpsertRequestType = "FAVRO" + SourceUpsertRequestTypeLinear SourceUpsertRequestType = "LINEAR" + SourceUpsertRequestTypeShopline SourceUpsertRequestType = "SHOPLINE" + SourceUpsertRequestTypeWix SourceUpsertRequestType = "WIX" + SourceUpsertRequestTypeNmi SourceUpsertRequestType = "NMI" + SourceUpsertRequestTypeOrb SourceUpsertRequestType = "ORB" + SourceUpsertRequestTypePylon SourceUpsertRequestType = "PYLON" + SourceUpsertRequestTypeRazorpay SourceUpsertRequestType = "RAZORPAY" + SourceUpsertRequestTypeRepay SourceUpsertRequestType = "REPAY" + SourceUpsertRequestTypeSquare SourceUpsertRequestType = "SQUARE" + SourceUpsertRequestTypeSolidgate SourceUpsertRequestType = "SOLIDGATE" + SourceUpsertRequestTypeTrello SourceUpsertRequestType = "TRELLO" + SourceUpsertRequestTypeEbay SourceUpsertRequestType = "EBAY" + SourceUpsertRequestTypeTelnyx SourceUpsertRequestType = "TELNYX" + SourceUpsertRequestTypeDiscord SourceUpsertRequestType = "DISCORD" + SourceUpsertRequestTypeTokenio SourceUpsertRequestType = "TOKENIO" + SourceUpsertRequestTypeFiserv SourceUpsertRequestType = "FISERV" + SourceUpsertRequestTypeBondsmith SourceUpsertRequestType = "BONDSMITH" + SourceUpsertRequestTypeVercelLogDrains SourceUpsertRequestType = "VERCEL_LOG_DRAINS" + SourceUpsertRequestTypeVercel SourceUpsertRequestType = "VERCEL" + SourceUpsertRequestTypeTebex SourceUpsertRequestType = "TEBEX" + SourceUpsertRequestTypeSlack SourceUpsertRequestType = "SLACK" + SourceUpsertRequestTypeMailchimp SourceUpsertRequestType = "MAILCHIMP" + SourceUpsertRequestTypePaddle SourceUpsertRequestType = "PADDLE" + SourceUpsertRequestTypePaypal SourceUpsertRequestType = "PAYPAL" + SourceUpsertRequestTypeTreezor SourceUpsertRequestType = "TREEZOR" + SourceUpsertRequestTypePraxis SourceUpsertRequestType = "PRAXIS" + SourceUpsertRequestTypeCustomerio SourceUpsertRequestType = "CUSTOMERIO" + SourceUpsertRequestTypeFacebook SourceUpsertRequestType = "FACEBOOK" + SourceUpsertRequestTypeWhatsapp SourceUpsertRequestType = "WHATSAPP" + SourceUpsertRequestTypeReplicate SourceUpsertRequestType = "REPLICATE" + SourceUpsertRequestTypeTiktok SourceUpsertRequestType = "TIKTOK" + SourceUpsertRequestTypeAirwallex SourceUpsertRequestType = "AIRWALLEX" + SourceUpsertRequestTypeZendesk SourceUpsertRequestType = "ZENDESK" + SourceUpsertRequestTypeUpollo SourceUpsertRequestType = "UPOLLO" +) + +func NewSourceUpsertRequestTypeFromString(s string) (SourceUpsertRequestType, error) { + switch s { + case "WEBHOOK": + return SourceUpsertRequestTypeWebhook, nil + case "HTTP": + return SourceUpsertRequestTypeHttp, nil + case "SANITY": + return SourceUpsertRequestTypeSanity, nil + case "BRIDGE": + return SourceUpsertRequestTypeBridge, nil + case "CLOUDSIGNAL": + return SourceUpsertRequestTypeCloudsignal, nil + case "COURIER": + return SourceUpsertRequestTypeCourier, nil + case "FRONTAPP": + return SourceUpsertRequestTypeFrontapp, nil + case "ZOOM": + return SourceUpsertRequestTypeZoom, nil + case "TWITTER": + return SourceUpsertRequestTypeTwitter, nil + case "RECHARGE": + return SourceUpsertRequestTypeRecharge, nil + case "STRIPE": + return SourceUpsertRequestTypeStripe, nil + case "PROPERTY-FINDER": + return SourceUpsertRequestTypePropertyFinder, nil + case "SHOPIFY": + return SourceUpsertRequestTypeShopify, nil + case "TWILIO": + return SourceUpsertRequestTypeTwilio, nil + case "GITHUB": + return SourceUpsertRequestTypeGithub, nil + case "POSTMARK": + return SourceUpsertRequestTypePostmark, nil + case "TYPEFORM": + return SourceUpsertRequestTypeTypeform, nil + case "XERO": + return SourceUpsertRequestTypeXero, nil + case "SVIX": + return SourceUpsertRequestTypeSvix, nil + case "ADYEN": + return SourceUpsertRequestTypeAdyen, nil + case "AKENEO": + return SourceUpsertRequestTypeAkeneo, nil + case "GITLAB": + return SourceUpsertRequestTypeGitlab, nil + case "WOOCOMMERCE": + return SourceUpsertRequestTypeWoocommerce, nil + case "OURA": + return SourceUpsertRequestTypeOura, nil + case "COMMERCELAYER": + return SourceUpsertRequestTypeCommercelayer, nil + case "HUBSPOT": + return SourceUpsertRequestTypeHubspot, nil + case "MAILGUN": + return SourceUpsertRequestTypeMailgun, nil + case "PERSONA": + return SourceUpsertRequestTypePersona, nil + case "PIPEDRIVE": + return SourceUpsertRequestTypePipedrive, nil + case "SENDGRID": + return SourceUpsertRequestTypeSendgrid, nil + case "WORKOS": + return SourceUpsertRequestTypeWorkos, nil + case "SYNCTERA": + return SourceUpsertRequestTypeSynctera, nil + case "AWS_SNS": + return SourceUpsertRequestTypeAwsSns, nil + case "THREE_D_EYE": + return SourceUpsertRequestTypeThreeDEye, nil + case "TWITCH": + return SourceUpsertRequestTypeTwitch, nil + case "ENODE": + return SourceUpsertRequestTypeEnode, nil + case "FAVRO": + return SourceUpsertRequestTypeFavro, nil + case "LINEAR": + return SourceUpsertRequestTypeLinear, nil + case "SHOPLINE": + return SourceUpsertRequestTypeShopline, nil + case "WIX": + return SourceUpsertRequestTypeWix, nil + case "NMI": + return SourceUpsertRequestTypeNmi, nil + case "ORB": + return SourceUpsertRequestTypeOrb, nil + case "PYLON": + return SourceUpsertRequestTypePylon, nil + case "RAZORPAY": + return SourceUpsertRequestTypeRazorpay, nil + case "REPAY": + return SourceUpsertRequestTypeRepay, nil + case "SQUARE": + return SourceUpsertRequestTypeSquare, nil + case "SOLIDGATE": + return SourceUpsertRequestTypeSolidgate, nil + case "TRELLO": + return SourceUpsertRequestTypeTrello, nil + case "EBAY": + return SourceUpsertRequestTypeEbay, nil + case "TELNYX": + return SourceUpsertRequestTypeTelnyx, nil + case "DISCORD": + return SourceUpsertRequestTypeDiscord, nil + case "TOKENIO": + return SourceUpsertRequestTypeTokenio, nil + case "FISERV": + return SourceUpsertRequestTypeFiserv, nil + case "BONDSMITH": + return SourceUpsertRequestTypeBondsmith, nil + case "VERCEL_LOG_DRAINS": + return SourceUpsertRequestTypeVercelLogDrains, nil + case "VERCEL": + return SourceUpsertRequestTypeVercel, nil + case "TEBEX": + return SourceUpsertRequestTypeTebex, nil + case "SLACK": + return SourceUpsertRequestTypeSlack, nil + case "MAILCHIMP": + return SourceUpsertRequestTypeMailchimp, nil + case "PADDLE": + return SourceUpsertRequestTypePaddle, nil + case "PAYPAL": + return SourceUpsertRequestTypePaypal, nil + case "TREEZOR": + return SourceUpsertRequestTypeTreezor, nil + case "PRAXIS": + return SourceUpsertRequestTypePraxis, nil + case "CUSTOMERIO": + return SourceUpsertRequestTypeCustomerio, nil + case "FACEBOOK": + return SourceUpsertRequestTypeFacebook, nil + case "WHATSAPP": + return SourceUpsertRequestTypeWhatsapp, nil + case "REPLICATE": + return SourceUpsertRequestTypeReplicate, nil + case "TIKTOK": + return SourceUpsertRequestTypeTiktok, nil + case "AIRWALLEX": + return SourceUpsertRequestTypeAirwallex, nil + case "ZENDESK": + return SourceUpsertRequestTypeZendesk, nil + case "UPOLLO": + return SourceUpsertRequestTypeUpollo, nil + } + var t SourceUpsertRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceUpsertRequestType) Ptr() *SourceUpsertRequestType { + return &s +} + type SourceUpdateRequest struct { // A unique name for the source Name *core.Optional[string] `json:"name,omitempty" url:"-"` @@ -126,6 +887,9 @@ type SourceUpdateRequest struct { AllowedHttpMethods *core.Optional[SourceAllowedHttpMethod] `json:"allowed_http_methods,omitempty" url:"-"` CustomResponse *core.Optional[SourceCustomResponse] `json:"custom_response,omitempty" url:"-"` Verification *core.Optional[VerificationConfig] `json:"verification,omitempty" url:"-"` + // Type of the source + Type *core.Optional[SourceUpdateRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[SourceTypeConfig] `json:"config,omitempty" url:"-"` } type SourceUpsertRequest struct { @@ -136,4 +900,7 @@ type SourceUpsertRequest struct { AllowedHttpMethods *core.Optional[SourceAllowedHttpMethod] `json:"allowed_http_methods,omitempty" url:"-"` CustomResponse *core.Optional[SourceCustomResponse] `json:"custom_response,omitempty" url:"-"` Verification *core.Optional[VerificationConfig] `json:"verification,omitempty" url:"-"` + // Type of the source + Type *core.Optional[SourceUpsertRequestType] `json:"type,omitempty" url:"-"` + Config *core.Optional[SourceTypeConfig] `json:"config,omitempty" url:"-"` } diff --git a/source/client.go b/source/client.go index 4755f7c..977e91c 100644 --- a/source/client.go +++ b/source/client.go @@ -3,20 +3,17 @@ package source import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.SourcePaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/sources" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.SourcePaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/sources" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,59 +144,44 @@ func (c *Client) Upsert( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/sources" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -245,65 +196,52 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/sources/%v", id) - - queryParams, err := core.QueryValues(request) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sources/%v", + id, + ) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 410: - value := new(hookdeckgosdk.GoneError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 410: func(apiError *core.APIError) error { + return &hookdeckgosdk.GoneError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -318,66 +256,52 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/sources/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sources/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -391,50 +315,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.SourceDeleteResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/sources/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sources/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.SourceDeleteResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -448,50 +362,40 @@ func (c *Client) Disable( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/sources/%v/archive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sources/%v/archive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -505,50 +409,40 @@ func (c *Client) Enable( opts ...option.RequestOption, ) (*hookdeckgosdk.Source, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/sources/%v/unarchive", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sources/%v/unarchive", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Source if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/transformation.go b/transformation.go index c65ad6d..7f17856 100644 --- a/transformation.go +++ b/transformation.go @@ -6,6 +6,7 @@ import ( json "encoding/json" fmt "fmt" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) @@ -54,12 +55,837 @@ type TransformationRunRequest struct { EventId *core.Optional[string] `json:"event_id,omitempty" url:"-"` } +type Transformation struct { + // ID of the transformation + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // A unique, human-friendly name for the transformation + Name string `json:"name" url:"name"` + // JavaScript code to be executed + Code string `json:"code" url:"code"` + EncryptedEnv *string `json:"encrypted_env,omitempty" url:"encrypted_env,omitempty"` + Iv *string `json:"iv,omitempty" url:"iv,omitempty"` + // Key-value environment variables to be passed to the transformation + Env map[string]*string `json:"env,omitempty" url:"env,omitempty"` + // Date the transformation was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the transformation was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *Transformation) GetId() string { + if t == nil { + return "" + } + return t.Id +} + +func (t *Transformation) GetTeamId() string { + if t == nil { + return "" + } + return t.TeamId +} + +func (t *Transformation) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *Transformation) GetCode() string { + if t == nil { + return "" + } + return t.Code +} + +func (t *Transformation) GetEncryptedEnv() *string { + if t == nil { + return nil + } + return t.EncryptedEnv +} + +func (t *Transformation) GetIv() *string { + if t == nil { + return nil + } + return t.Iv +} + +func (t *Transformation) GetEnv() map[string]*string { + if t == nil { + return nil + } + return t.Env +} + +func (t *Transformation) GetUpdatedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.UpdatedAt +} + +func (t *Transformation) GetCreatedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.CreatedAt +} + +func (t *Transformation) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *Transformation) UnmarshalJSON(data []byte) error { + type embed Transformation + var unmarshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = Transformation(unmarshaler.embed) + t.UpdatedAt = unmarshaler.UpdatedAt.Time() + t.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *Transformation) MarshalJSON() ([]byte, error) { + type embed Transformation + var marshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*t), + UpdatedAt: internal.NewDateTime(t.UpdatedAt), + CreatedAt: internal.NewDateTime(t.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (t *Transformation) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutionPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*TransformationExecution `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutionPaginatedResult) GetPagination() *SeekPagination { + if t == nil { + return nil + } + return t.Pagination +} + +func (t *TransformationExecutionPaginatedResult) GetCount() *int { + if t == nil { + return nil + } + return t.Count +} + +func (t *TransformationExecutionPaginatedResult) GetModels() []*TransformationExecution { + if t == nil { + return nil + } + return t.Models +} + +func (t *TransformationExecutionPaginatedResult) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutionPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutionPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutionPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutionPaginatedResult) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutorOutput struct { + RequestId *string `json:"request_id,omitempty" url:"request_id,omitempty"` + TransformationId *string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` + ExecutionId *string `json:"execution_id,omitempty" url:"execution_id,omitempty"` + LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` + Request *TransformationExecutorOutputRequest `json:"request,omitempty" url:"request,omitempty"` + Console []*ConsoleLine `json:"console,omitempty" url:"console,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutorOutput) GetRequestId() *string { + if t == nil { + return nil + } + return t.RequestId +} + +func (t *TransformationExecutorOutput) GetTransformationId() *string { + if t == nil { + return nil + } + return t.TransformationId +} + +func (t *TransformationExecutorOutput) GetExecutionId() *string { + if t == nil { + return nil + } + return t.ExecutionId +} + +func (t *TransformationExecutorOutput) GetLogLevel() TransformationExecutionLogLevel { + if t == nil { + return "" + } + return t.LogLevel +} + +func (t *TransformationExecutorOutput) GetRequest() *TransformationExecutorOutputRequest { + if t == nil { + return nil + } + return t.Request +} + +func (t *TransformationExecutorOutput) GetConsole() []*ConsoleLine { + if t == nil { + return nil + } + return t.Console +} + +func (t *TransformationExecutorOutput) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutorOutput) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutorOutput + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutorOutput(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutorOutput) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutorOutputRequest struct { + Headers *TransformationExecutorOutputRequestHeaders `json:"headers,omitempty" url:"headers,omitempty"` + Path string `json:"path" url:"path"` + Query *TransformationExecutorOutputRequestQuery `json:"query,omitempty" url:"query,omitempty"` + ParsedQuery *TransformationExecutorOutputRequestParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"` + Body *TransformationExecutorOutputRequestBody `json:"body,omitempty" url:"body,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutorOutputRequest) GetHeaders() *TransformationExecutorOutputRequestHeaders { + if t == nil { + return nil + } + return t.Headers +} + +func (t *TransformationExecutorOutputRequest) GetPath() string { + if t == nil { + return "" + } + return t.Path +} + +func (t *TransformationExecutorOutputRequest) GetQuery() *TransformationExecutorOutputRequestQuery { + if t == nil { + return nil + } + return t.Query +} + +func (t *TransformationExecutorOutputRequest) GetParsedQuery() *TransformationExecutorOutputRequestParsedQuery { + if t == nil { + return nil + } + return t.ParsedQuery +} + +func (t *TransformationExecutorOutputRequest) GetBody() *TransformationExecutorOutputRequestBody { + if t == nil { + return nil + } + return t.Body +} + +func (t *TransformationExecutorOutputRequest) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutorOutputRequest) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutorOutputRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutorOutputRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutorOutputRequest) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutorOutputRequestBody struct { + StringOptional *string + TransformationExecutorOutputRequestBodyOne *TransformationExecutorOutputRequestBodyOne + + typ string +} + +func NewTransformationExecutorOutputRequestBodyFromStringOptional(value *string) *TransformationExecutorOutputRequestBody { + return &TransformationExecutorOutputRequestBody{typ: "StringOptional", StringOptional: value} +} + +func NewTransformationExecutorOutputRequestBodyFromTransformationExecutorOutputRequestBodyOne(value *TransformationExecutorOutputRequestBodyOne) *TransformationExecutorOutputRequestBody { + return &TransformationExecutorOutputRequestBody{typ: "TransformationExecutorOutputRequestBodyOne", TransformationExecutorOutputRequestBodyOne: value} +} + +func (t *TransformationExecutorOutputRequestBody) GetStringOptional() *string { + if t == nil { + return nil + } + return t.StringOptional +} + +func (t *TransformationExecutorOutputRequestBody) GetTransformationExecutorOutputRequestBodyOne() *TransformationExecutorOutputRequestBodyOne { + if t == nil { + return nil + } + return t.TransformationExecutorOutputRequestBodyOne +} + +func (t *TransformationExecutorOutputRequestBody) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + t.typ = "StringOptional" + t.StringOptional = valueStringOptional + return nil + } + valueTransformationExecutorOutputRequestBodyOne := new(TransformationExecutorOutputRequestBodyOne) + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestBodyOne); err == nil { + t.typ = "TransformationExecutorOutputRequestBodyOne" + t.TransformationExecutorOutputRequestBodyOne = valueTransformationExecutorOutputRequestBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestBody) MarshalJSON() ([]byte, error) { + if t.typ == "StringOptional" || t.StringOptional != nil { + return json.Marshal(t.StringOptional) + } + if t.typ == "TransformationExecutorOutputRequestBodyOne" || t.TransformationExecutorOutputRequestBodyOne != nil { + return json.Marshal(t.TransformationExecutorOutputRequestBodyOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestBodyVisitor interface { + VisitStringOptional(*string) error + VisitTransformationExecutorOutputRequestBodyOne(*TransformationExecutorOutputRequestBodyOne) error +} + +func (t *TransformationExecutorOutputRequestBody) Accept(visitor TransformationExecutorOutputRequestBodyVisitor) error { + if t.typ == "StringOptional" || t.StringOptional != nil { + return visitor.VisitStringOptional(t.StringOptional) + } + if t.typ == "TransformationExecutorOutputRequestBodyOne" || t.TransformationExecutorOutputRequestBodyOne != nil { + return visitor.VisitTransformationExecutorOutputRequestBodyOne(t.TransformationExecutorOutputRequestBodyOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestBodyOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutorOutputRequestBodyOne) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutorOutputRequestBodyOne) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutorOutputRequestBodyOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutorOutputRequestBodyOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutorOutputRequestBodyOne) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutorOutputRequestHeaders struct { + String string + StringUnknownMap map[string]interface{} + + typ string +} + +func NewTransformationExecutorOutputRequestHeadersFromString(value string) *TransformationExecutorOutputRequestHeaders { + return &TransformationExecutorOutputRequestHeaders{typ: "String", String: value} +} + +func NewTransformationExecutorOutputRequestHeadersFromStringUnknownMap(value map[string]interface{}) *TransformationExecutorOutputRequestHeaders { + return &TransformationExecutorOutputRequestHeaders{typ: "StringUnknownMap", StringUnknownMap: value} +} + +func (t *TransformationExecutorOutputRequestHeaders) GetString() string { + if t == nil { + return "" + } + return t.String +} + +func (t *TransformationExecutorOutputRequestHeaders) GetStringUnknownMap() map[string]interface{} { + if t == nil { + return nil + } + return t.StringUnknownMap +} + +func (t *TransformationExecutorOutputRequestHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typ = "String" + t.String = valueString + return nil + } + var valueStringUnknownMap map[string]interface{} + if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { + t.typ = "StringUnknownMap" + t.StringUnknownMap = valueStringUnknownMap + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestHeaders) MarshalJSON() ([]byte, error) { + if t.typ == "String" || t.String != "" { + return json.Marshal(t.String) + } + if t.typ == "StringUnknownMap" || t.StringUnknownMap != nil { + return json.Marshal(t.StringUnknownMap) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestHeadersVisitor interface { + VisitString(string) error + VisitStringUnknownMap(map[string]interface{}) error +} + +func (t *TransformationExecutorOutputRequestHeaders) Accept(visitor TransformationExecutorOutputRequestHeadersVisitor) error { + if t.typ == "String" || t.String != "" { + return visitor.VisitString(t.String) + } + if t.typ == "StringUnknownMap" || t.StringUnknownMap != nil { + return visitor.VisitStringUnknownMap(t.StringUnknownMap) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestParsedQuery struct { + StringOptional *string + TransformationExecutorOutputRequestParsedQueryOne *TransformationExecutorOutputRequestParsedQueryOne + + typ string +} + +func NewTransformationExecutorOutputRequestParsedQueryFromStringOptional(value *string) *TransformationExecutorOutputRequestParsedQuery { + return &TransformationExecutorOutputRequestParsedQuery{typ: "StringOptional", StringOptional: value} +} + +func NewTransformationExecutorOutputRequestParsedQueryFromTransformationExecutorOutputRequestParsedQueryOne(value *TransformationExecutorOutputRequestParsedQueryOne) *TransformationExecutorOutputRequestParsedQuery { + return &TransformationExecutorOutputRequestParsedQuery{typ: "TransformationExecutorOutputRequestParsedQueryOne", TransformationExecutorOutputRequestParsedQueryOne: value} +} + +func (t *TransformationExecutorOutputRequestParsedQuery) GetStringOptional() *string { + if t == nil { + return nil + } + return t.StringOptional +} + +func (t *TransformationExecutorOutputRequestParsedQuery) GetTransformationExecutorOutputRequestParsedQueryOne() *TransformationExecutorOutputRequestParsedQueryOne { + if t == nil { + return nil + } + return t.TransformationExecutorOutputRequestParsedQueryOne +} + +func (t *TransformationExecutorOutputRequestParsedQuery) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + t.typ = "StringOptional" + t.StringOptional = valueStringOptional + return nil + } + valueTransformationExecutorOutputRequestParsedQueryOne := new(TransformationExecutorOutputRequestParsedQueryOne) + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestParsedQueryOne); err == nil { + t.typ = "TransformationExecutorOutputRequestParsedQueryOne" + t.TransformationExecutorOutputRequestParsedQueryOne = valueTransformationExecutorOutputRequestParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestParsedQuery) MarshalJSON() ([]byte, error) { + if t.typ == "StringOptional" || t.StringOptional != nil { + return json.Marshal(t.StringOptional) + } + if t.typ == "TransformationExecutorOutputRequestParsedQueryOne" || t.TransformationExecutorOutputRequestParsedQueryOne != nil { + return json.Marshal(t.TransformationExecutorOutputRequestParsedQueryOne) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestParsedQueryVisitor interface { + VisitStringOptional(*string) error + VisitTransformationExecutorOutputRequestParsedQueryOne(*TransformationExecutorOutputRequestParsedQueryOne) error +} + +func (t *TransformationExecutorOutputRequestParsedQuery) Accept(visitor TransformationExecutorOutputRequestParsedQueryVisitor) error { + if t.typ == "StringOptional" || t.StringOptional != nil { + return visitor.VisitStringOptional(t.StringOptional) + } + if t.typ == "TransformationExecutorOutputRequestParsedQueryOne" || t.TransformationExecutorOutputRequestParsedQueryOne != nil { + return visitor.VisitTransformationExecutorOutputRequestParsedQueryOne(t.TransformationExecutorOutputRequestParsedQueryOne) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestParsedQueryOne struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutorOutputRequestParsedQueryOne) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutorOutputRequestParsedQueryOne) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutorOutputRequestParsedQueryOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutorOutputRequestParsedQueryOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutorOutputRequestParsedQueryOne) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationExecutorOutputRequestQuery struct { + TransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero + String string + + typ string +} + +func NewTransformationExecutorOutputRequestQueryFromTransformationExecutorOutputRequestQueryZeroOptional(value *TransformationExecutorOutputRequestQueryZero) *TransformationExecutorOutputRequestQuery { + return &TransformationExecutorOutputRequestQuery{typ: "TransformationExecutorOutputRequestQueryZeroOptional", TransformationExecutorOutputRequestQueryZeroOptional: value} +} + +func NewTransformationExecutorOutputRequestQueryFromString(value string) *TransformationExecutorOutputRequestQuery { + return &TransformationExecutorOutputRequestQuery{typ: "String", String: value} +} + +func (t *TransformationExecutorOutputRequestQuery) GetTransformationExecutorOutputRequestQueryZeroOptional() *TransformationExecutorOutputRequestQueryZero { + if t == nil { + return nil + } + return t.TransformationExecutorOutputRequestQueryZeroOptional +} + +func (t *TransformationExecutorOutputRequestQuery) GetString() string { + if t == nil { + return "" + } + return t.String +} + +func (t *TransformationExecutorOutputRequestQuery) UnmarshalJSON(data []byte) error { + var valueTransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestQueryZeroOptional); err == nil { + t.typ = "TransformationExecutorOutputRequestQueryZeroOptional" + t.TransformationExecutorOutputRequestQueryZeroOptional = valueTransformationExecutorOutputRequestQueryZeroOptional + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typ = "String" + t.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestQuery) MarshalJSON() ([]byte, error) { + if t.typ == "TransformationExecutorOutputRequestQueryZeroOptional" || t.TransformationExecutorOutputRequestQueryZeroOptional != nil { + return json.Marshal(t.TransformationExecutorOutputRequestQueryZeroOptional) + } + if t.typ == "String" || t.String != "" { + return json.Marshal(t.String) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestQueryVisitor interface { + VisitTransformationExecutorOutputRequestQueryZeroOptional(*TransformationExecutorOutputRequestQueryZero) error + VisitString(string) error +} + +func (t *TransformationExecutorOutputRequestQuery) Accept(visitor TransformationExecutorOutputRequestQueryVisitor) error { + if t.typ == "TransformationExecutorOutputRequestQueryZeroOptional" || t.TransformationExecutorOutputRequestQueryZeroOptional != nil { + return visitor.VisitTransformationExecutorOutputRequestQueryZeroOptional(t.TransformationExecutorOutputRequestQueryZeroOptional) + } + if t.typ == "String" || t.String != "" { + return visitor.VisitString(t.String) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationExecutorOutputRequestQueryZero struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecutorOutputRequestQueryZero) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationExecutorOutputRequestQueryZero) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationExecutorOutputRequestQueryZero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationExecutorOutputRequestQueryZero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationExecutorOutputRequestQueryZero) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TransformationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Transformation `json:"models,omitempty" url:"models,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationPaginatedResult) GetPagination() *SeekPagination { + if t == nil { + return nil + } + return t.Pagination +} + +func (t *TransformationPaginatedResult) GetCount() *int { + if t == nil { + return nil + } + return t.Count +} + +func (t *TransformationPaginatedResult) GetModels() []*Transformation { + if t == nil { + return nil + } + return t.Models +} + +func (t *TransformationPaginatedResult) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationPaginatedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationPaginatedResult) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + type TransformationDeleteResponse struct { // ID of the Transformation Id string `json:"id" url:"id"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (t *TransformationDeleteResponse) GetId() string { + if t == nil { + return "" + } + return t.Id } func (t *TransformationDeleteResponse) GetExtraProperties() map[string]interface{} { @@ -73,24 +899,22 @@ func (t *TransformationDeleteResponse) UnmarshalJSON(data []byte) error { return err } *t = TransformationDeleteResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + t.rawJSON = json.RawMessage(data) return nil } func (t *TransformationDeleteResponse) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } return fmt.Sprintf("%#v", t) @@ -223,7 +1047,42 @@ type TransformationRunRequestRequest struct { ParsedQuery *TransformationRunRequestRequestParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (t *TransformationRunRequestRequest) GetHeaders() map[string]string { + if t == nil { + return nil + } + return t.Headers +} + +func (t *TransformationRunRequestRequest) GetBody() *TransformationRunRequestRequestBody { + if t == nil { + return nil + } + return t.Body +} + +func (t *TransformationRunRequestRequest) GetPath() *string { + if t == nil { + return nil + } + return t.Path +} + +func (t *TransformationRunRequestRequest) GetQuery() *string { + if t == nil { + return nil + } + return t.Query +} + +func (t *TransformationRunRequestRequest) GetParsedQuery() *TransformationRunRequestRequestParsedQuery { + if t == nil { + return nil + } + return t.ParsedQuery } func (t *TransformationRunRequestRequest) GetExtraProperties() map[string]interface{} { @@ -237,24 +1096,168 @@ func (t *TransformationRunRequestRequest) UnmarshalJSON(data []byte) error { return err } *t = TransformationRunRequestRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationRunRequestRequest) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// Body of the request +type TransformationRunRequestRequestBody struct { + TransformationRunRequestRequestBodyZero *TransformationRunRequestRequestBodyZero + String string - extraProperties, err := core.ExtractExtraProperties(data, *t) + typ string +} + +func NewTransformationRunRequestRequestBodyFromTransformationRunRequestRequestBodyZero(value *TransformationRunRequestRequestBodyZero) *TransformationRunRequestRequestBody { + return &TransformationRunRequestRequestBody{typ: "TransformationRunRequestRequestBodyZero", TransformationRunRequestRequestBodyZero: value} +} + +func NewTransformationRunRequestRequestBodyFromString(value string) *TransformationRunRequestRequestBody { + return &TransformationRunRequestRequestBody{typ: "String", String: value} +} + +func (t *TransformationRunRequestRequestBody) GetTransformationRunRequestRequestBodyZero() *TransformationRunRequestRequestBodyZero { + if t == nil { + return nil + } + return t.TransformationRunRequestRequestBodyZero +} + +func (t *TransformationRunRequestRequestBody) GetString() string { + if t == nil { + return "" + } + return t.String +} + +func (t *TransformationRunRequestRequestBody) UnmarshalJSON(data []byte) error { + valueTransformationRunRequestRequestBodyZero := new(TransformationRunRequestRequestBodyZero) + if err := json.Unmarshal(data, &valueTransformationRunRequestRequestBodyZero); err == nil { + t.typ = "TransformationRunRequestRequestBodyZero" + t.TransformationRunRequestRequestBodyZero = valueTransformationRunRequestRequestBodyZero + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typ = "String" + t.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationRunRequestRequestBody) MarshalJSON() ([]byte, error) { + if t.typ == "TransformationRunRequestRequestBodyZero" || t.TransformationRunRequestRequestBodyZero != nil { + return json.Marshal(t.TransformationRunRequestRequestBodyZero) + } + if t.typ == "String" || t.String != "" { + return json.Marshal(t.String) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationRunRequestRequestBodyVisitor interface { + VisitTransformationRunRequestRequestBodyZero(*TransformationRunRequestRequestBodyZero) error + VisitString(string) error +} + +func (t *TransformationRunRequestRequestBody) Accept(visitor TransformationRunRequestRequestBodyVisitor) error { + if t.typ == "TransformationRunRequestRequestBodyZero" || t.TransformationRunRequestRequestBodyZero != nil { + return visitor.VisitTransformationRunRequestRequestBodyZero(t.TransformationRunRequestRequestBodyZero) + } + if t.typ == "String" || t.String != "" { + return visitor.VisitString(t.String) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TransformationRunRequestRequestBodyZero struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationRunRequestRequestBodyZero) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationRunRequestRequestBodyZero) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationRunRequestRequestBodyZero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationRunRequestRequestBodyZero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TransformationRunRequestRequestBodyZero) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} - t._rawJSON = json.RawMessage(data) +// JSON representation of the query params +type TransformationRunRequestRequestParsedQuery struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationRunRequestRequestParsedQuery) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TransformationRunRequestRequestParsedQuery) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationRunRequestRequestParsedQuery + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationRunRequestRequestParsedQuery(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationRunRequestRequest) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (t *TransformationRunRequestRequestParsedQuery) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } return fmt.Sprintf("%#v", t) diff --git a/transformation/client.go b/transformation/client.go index 7693817..decd271 100644 --- a/transformation/client.go +++ b/transformation/client.go @@ -3,20 +3,17 @@ package transformation import ( - bytes "bytes" context "context" - json "encoding/json" - errors "errors" hookdeckgosdk "github.com/hookdeck/hookdeck-go-sdk" core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" option "github.com/hookdeck/hookdeck-go-sdk/option" - io "io" http "net/http" ) type Client struct { baseURL string - caller *core.Caller + caller *internal.Caller header http.Header } @@ -24,8 +21,8 @@ func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) return &Client{ baseURL: options.BaseURL, - caller: core.NewCaller( - &core.CallerParams{ + caller: internal.NewCaller( + &internal.CallerParams{ Client: options.HTTPClient, MaxAttempts: options.MaxAttempts, }, @@ -40,65 +37,49 @@ func (c *Client) List( opts ...option.RequestOption, ) (*hookdeckgosdk.TransformationPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/transformations" - - queryParams, err := core.QueryValues(request) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.TransformationPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -112,59 +93,44 @@ func (c *Client) Create( opts ...option.RequestOption, ) (*hookdeckgosdk.Transformation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/transformations" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Transformation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPost, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -178,59 +144,44 @@ func (c *Client) Upsert( opts ...option.RequestOption, ) (*hookdeckgosdk.Transformation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/transformations" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Transformation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -244,50 +195,40 @@ func (c *Client) Retrieve( opts ...option.RequestOption, ) (*hookdeckgosdk.Transformation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/transformations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/transformations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Transformation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -302,66 +243,52 @@ func (c *Client) Update( opts ...option.RequestOption, ) (*hookdeckgosdk.Transformation, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/transformations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/transformations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.Transformation if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -375,50 +302,40 @@ func (c *Client) Delete( opts ...option.RequestOption, ) (*hookdeckgosdk.TransformationDeleteResponse, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/transformations/%v", id) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/transformations/%v", + id, + ) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.TransformationDeleteResponse if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodDelete, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -432,59 +349,44 @@ func (c *Client) Run( opts ...option.RequestOption, ) (*hookdeckgosdk.TransformationExecutorOutput, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) endpointURL := baseURL + "/transformations/run" - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) headers.Set("Content-Type", "application/json") - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.TransformationExecutorOutput if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodPut, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Request: request, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -499,65 +401,52 @@ func (c *Client) ListExecution( opts ...option.RequestOption, ) (*hookdeckgosdk.TransformationExecutionPaginatedResult, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL(baseURL+"/transformations/%v/executions", id) - - queryParams, err := core.QueryValues(request) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( + baseURL+"/transformations/%v/executions", + id, + ) + queryParams, err := internal.QueryValues(request) if err != nil { return nil, err } if len(queryParams) > 0 { endpointURL += "?" + queryParams.Encode() } - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(hookdeckgosdk.BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 400: func(apiError *core.APIError) error { + return &hookdeckgosdk.BadRequestError{ + APIError: apiError, } - return value - case 422: - value := new(hookdeckgosdk.UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + }, + 422: func(apiError *core.APIError) error { + return &hookdeckgosdk.UnprocessableEntityError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.TransformationExecutionPaginatedResult if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err @@ -572,54 +461,41 @@ func (c *Client) RetrieveExecution( opts ...option.RequestOption, ) (*hookdeckgosdk.TransformationExecution, error) { options := core.NewRequestOptions(opts...) - - baseURL := "https://api.hookdeck.com/2024-09-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - if options.BaseURL != "" { - baseURL = options.BaseURL - } - endpointURL := core.EncodeURL( + baseURL := internal.ResolveBaseURL( + options.BaseURL, + c.baseURL, + "https://api.hookdeck.com/2025-01-01-next", + ) + endpointURL := internal.EncodeURL( baseURL+"/transformations/%v/executions/%v", id, executionId, ) - - headers := core.MergeHeaders(c.header.Clone(), options.ToHeader()) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(hookdeckgosdk.NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return apiError + headers := internal.MergeHeaders( + c.header.Clone(), + options.ToHeader(), + ) + errorCodes := internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &hookdeckgosdk.NotFoundError{ + APIError: apiError, } - return value - } - return apiError + }, } var response *hookdeckgosdk.TransformationExecution if err := c.caller.Call( ctx, - &core.CallParams{ + &internal.CallParams{ URL: endpointURL, Method: http.MethodGet, - MaxAttempts: options.MaxAttempts, Headers: headers, + MaxAttempts: options.MaxAttempts, BodyProperties: options.BodyProperties, QueryParameters: options.QueryParameters, Client: options.HTTPClient, Response: &response, - ErrorDecoder: errorDecoder, + ErrorDecoder: internal.NewErrorDecoder(errorCodes), }, ); err != nil { return nil, err diff --git a/types.go b/types.go index 5076e1a..b82aac5 100644 --- a/types.go +++ b/types.go @@ -5,64 +5,50 @@ package api import ( json "encoding/json" fmt "fmt" - core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" time "time" ) -type AddCustomHostname struct { - // The custom hostname to attach to the project - Hostname string `json:"hostname" url:"hostname"` +// Error response model +type ApiErrorResponse struct { + // Error code + Code string `json:"code" url:"code"` + // Status code + Status float64 `json:"status" url:"status"` + // Error description + Message string `json:"message" url:"message"` + Data *ApiErrorResponseData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (a *AddCustomHostname) GetExtraProperties() map[string]interface{} { - return a.extraProperties + rawJSON json.RawMessage } -func (a *AddCustomHostname) UnmarshalJSON(data []byte) error { - type unmarshaler AddCustomHostname - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (a *ApiErrorResponse) GetCode() string { + if a == nil { + return "" } - *a = AddCustomHostname(value) + return a.Code +} - extraProperties, err := core.ExtractExtraProperties(data, *a) - if err != nil { - return err +func (a *ApiErrorResponse) GetStatus() float64 { + if a == nil { + return 0 } - a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) - return nil + return a.Status } -func (a *AddCustomHostname) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(a); err == nil { - return value +func (a *ApiErrorResponse) GetMessage() string { + if a == nil { + return "" } - return fmt.Sprintf("%#v", a) + return a.Message } -// Error response model -type ApiErrorResponse struct { - // Error code - Code string `json:"code" url:"code"` - // Status code - Status float64 `json:"status" url:"status"` - // Error description - Message string `json:"message" url:"message"` - Data *ApiErrorResponseData `json:"data,omitempty" url:"data,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (a *ApiErrorResponse) GetData() *ApiErrorResponseData { + if a == nil { + return nil + } + return a.Data } func (a *ApiErrorResponse) GetExtraProperties() map[string]interface{} { @@ -76,24 +62,22 @@ func (a *ApiErrorResponse) UnmarshalJSON(data []byte) error { return err } *a = ApiErrorResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *ApiErrorResponse) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -101,7 +85,7 @@ func (a *ApiErrorResponse) String() string { type ApiErrorResponseData struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } func (a *ApiErrorResponseData) GetExtraProperties() map[string]interface{} { @@ -115,24 +99,22 @@ func (a *ApiErrorResponseData) UnmarshalJSON(data []byte) error { return err } *a = ApiErrorResponseData(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *ApiErrorResponseData) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -143,7 +125,21 @@ type ApiKeyIntegrationConfigs struct { ApiKey string `json:"api_key" url:"api_key"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *ApiKeyIntegrationConfigs) GetHeaderKey() string { + if a == nil { + return "" + } + return a.HeaderKey +} + +func (a *ApiKeyIntegrationConfigs) GetApiKey() string { + if a == nil { + return "" + } + return a.ApiKey } func (a *ApiKeyIntegrationConfigs) GetExtraProperties() map[string]interface{} { @@ -157,24 +153,22 @@ func (a *ApiKeyIntegrationConfigs) UnmarshalJSON(data []byte) error { return err } *a = ApiKeyIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *ApiKeyIntegrationConfigs) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -184,7 +178,14 @@ type AttachedIntegrationToSource struct { Success bool `json:"success" url:"success"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AttachedIntegrationToSource) GetSuccess() bool { + if a == nil { + return false + } + return a.Success } func (a *AttachedIntegrationToSource) GetExtraProperties() map[string]interface{} { @@ -198,24 +199,22 @@ func (a *AttachedIntegrationToSource) UnmarshalJSON(data []byte) error { return err } *a = AttachedIntegrationToSource(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AttachedIntegrationToSource) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -364,7 +363,14 @@ type AuthApiKey struct { Config *DestinationAuthMethodApiKeyConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthApiKey) GetConfig() *DestinationAuthMethodApiKeyConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthApiKey) GetExtraProperties() map[string]interface{} { @@ -378,24 +384,22 @@ func (a *AuthApiKey) UnmarshalJSON(data []byte) error { return err } *a = AuthApiKey(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthApiKey) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -406,7 +410,14 @@ type AuthAwsSignature struct { Config *DestinationAuthMethodAwsSignatureConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthAwsSignature) GetConfig() *DestinationAuthMethodAwsSignatureConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthAwsSignature) GetExtraProperties() map[string]interface{} { @@ -420,24 +431,22 @@ func (a *AuthAwsSignature) UnmarshalJSON(data []byte) error { return err } *a = AuthAwsSignature(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthAwsSignature) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -448,7 +457,14 @@ type AuthBasicAuth struct { Config *DestinationAuthMethodBasicAuthConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthBasicAuth) GetConfig() *DestinationAuthMethodBasicAuthConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthBasicAuth) GetExtraProperties() map[string]interface{} { @@ -462,24 +478,22 @@ func (a *AuthBasicAuth) UnmarshalJSON(data []byte) error { return err } *a = AuthBasicAuth(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthBasicAuth) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -490,7 +504,14 @@ type AuthBearerToken struct { Config *DestinationAuthMethodBearerTokenConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthBearerToken) GetConfig() *DestinationAuthMethodBearerTokenConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthBearerToken) GetExtraProperties() map[string]interface{} { @@ -504,24 +525,22 @@ func (a *AuthBearerToken) UnmarshalJSON(data []byte) error { return err } *a = AuthBearerToken(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthBearerToken) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -532,7 +551,14 @@ type AuthCustomSignature struct { Config *DestinationAuthMethodCustomSignatureConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthCustomSignature) GetConfig() *DestinationAuthMethodCustomSignatureConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthCustomSignature) GetExtraProperties() map[string]interface{} { @@ -546,24 +572,22 @@ func (a *AuthCustomSignature) UnmarshalJSON(data []byte) error { return err } *a = AuthCustomSignature(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthCustomSignature) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -574,7 +598,14 @@ type AuthHookdeckSignature struct { Config *DestinationAuthMethodSignatureConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthHookdeckSignature) GetConfig() *DestinationAuthMethodSignatureConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthHookdeckSignature) GetExtraProperties() map[string]interface{} { @@ -588,24 +619,22 @@ func (a *AuthHookdeckSignature) UnmarshalJSON(data []byte) error { return err } *a = AuthHookdeckSignature(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthHookdeckSignature) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -616,7 +645,14 @@ type AuthOAuth2AuthorizationCode struct { Config *DestinationAuthMethodOAuth2AuthorizationCodeConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthOAuth2AuthorizationCode) GetConfig() *DestinationAuthMethodOAuth2AuthorizationCodeConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthOAuth2AuthorizationCode) GetExtraProperties() map[string]interface{} { @@ -630,24 +666,22 @@ func (a *AuthOAuth2AuthorizationCode) UnmarshalJSON(data []byte) error { return err } *a = AuthOAuth2AuthorizationCode(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthOAuth2AuthorizationCode) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -658,7 +692,14 @@ type AuthOAuth2ClientCredentials struct { Config *DestinationAuthMethodOAuth2ClientCredentialsConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (a *AuthOAuth2ClientCredentials) GetConfig() *DestinationAuthMethodOAuth2ClientCredentialsConfig { + if a == nil { + return nil + } + return a.Config } func (a *AuthOAuth2ClientCredentials) GetExtraProperties() map[string]interface{} { @@ -672,24 +713,22 @@ func (a *AuthOAuth2ClientCredentials) UnmarshalJSON(data []byte) error { return err } *a = AuthOAuth2ClientCredentials(value) - - extraProperties, err := core.ExtractExtraProperties(data, *a) + extraProperties, err := internal.ExtractExtraProperties(data, *a) if err != nil { return err } a.extraProperties = extraProperties - - a._rawJSON = json.RawMessage(data) + a.rawJSON = json.RawMessage(data) return nil } func (a *AuthOAuth2ClientCredentials) String() string { - if len(a._rawJSON) > 0 { - if value, err := core.StringifyJSON(a._rawJSON); err == nil { + if len(a.rawJSON) > 0 { + if value, err := internal.StringifyJSON(a.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(a); err == nil { + if value, err := internal.StringifyJSON(a); err == nil { return value } return fmt.Sprintf("%#v", a) @@ -700,7 +739,21 @@ type BasicAuthIntegrationConfigs struct { Password string `json:"password" url:"password"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (b *BasicAuthIntegrationConfigs) GetUsername() string { + if b == nil { + return "" + } + return b.Username +} + +func (b *BasicAuthIntegrationConfigs) GetPassword() string { + if b == nil { + return "" + } + return b.Password } func (b *BasicAuthIntegrationConfigs) GetExtraProperties() map[string]interface{} { @@ -714,24 +767,22 @@ func (b *BasicAuthIntegrationConfigs) UnmarshalJSON(data []byte) error { return err } *b = BasicAuthIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *b) + extraProperties, err := internal.ExtractExtraProperties(data, *b) if err != nil { return err } b.extraProperties = extraProperties - - b._rawJSON = json.RawMessage(data) + b.rawJSON = json.RawMessage(data) return nil } func (b *BasicAuthIntegrationConfigs) String() string { - if len(b._rawJSON) > 0 { - if value, err := core.StringifyJSON(b._rawJSON); err == nil { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(b); err == nil { + if value, err := internal.StringifyJSON(b); err == nil { return value } return fmt.Sprintf("%#v", b) @@ -769,7 +820,112 @@ type BatchOperation struct { Number *float64 `json:"number,omitempty" url:"number,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (b *BatchOperation) GetId() string { + if b == nil { + return "" + } + return b.Id +} + +func (b *BatchOperation) GetTeamId() string { + if b == nil { + return "" + } + return b.TeamId +} + +func (b *BatchOperation) GetQuery() *BatchOperationQuery { + if b == nil { + return nil + } + return b.Query +} + +func (b *BatchOperation) GetCreatedAt() time.Time { + if b == nil { + return time.Time{} + } + return b.CreatedAt +} + +func (b *BatchOperation) GetUpdatedAt() time.Time { + if b == nil { + return time.Time{} + } + return b.UpdatedAt +} + +func (b *BatchOperation) GetCancelledAt() *time.Time { + if b == nil { + return nil + } + return b.CancelledAt +} + +func (b *BatchOperation) GetCompletedAt() *time.Time { + if b == nil { + return nil + } + return b.CompletedAt +} + +func (b *BatchOperation) GetEstimatedBatch() *int { + if b == nil { + return nil + } + return b.EstimatedBatch +} + +func (b *BatchOperation) GetEstimatedCount() *int { + if b == nil { + return nil + } + return b.EstimatedCount +} + +func (b *BatchOperation) GetProcessedBatch() *int { + if b == nil { + return nil + } + return b.ProcessedBatch +} + +func (b *BatchOperation) GetCompletedCount() *int { + if b == nil { + return nil + } + return b.CompletedCount +} + +func (b *BatchOperation) GetInProgress() bool { + if b == nil { + return false + } + return b.InProgress +} + +func (b *BatchOperation) GetProgress() *float64 { + if b == nil { + return nil + } + return b.Progress +} + +func (b *BatchOperation) GetFailedCount() *int { + if b == nil { + return nil + } + return b.FailedCount +} + +func (b *BatchOperation) GetNumber() *float64 { + if b == nil { + return nil + } + return b.Number } func (b *BatchOperation) GetExtraProperties() map[string]interface{} { @@ -780,10 +936,10 @@ func (b *BatchOperation) UnmarshalJSON(data []byte) error { type embed BatchOperation var unmarshaler = struct { embed - CreatedAt *core.DateTime `json:"created_at"` - UpdatedAt *core.DateTime `json:"updated_at"` - CancelledAt *core.DateTime `json:"cancelled_at,omitempty"` - CompletedAt *core.DateTime `json:"completed_at,omitempty"` + CreatedAt *internal.DateTime `json:"created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CancelledAt *internal.DateTime `json:"cancelled_at,omitempty"` + CompletedAt *internal.DateTime `json:"completed_at,omitempty"` }{ embed: embed(*b), } @@ -795,14 +951,12 @@ func (b *BatchOperation) UnmarshalJSON(data []byte) error { b.UpdatedAt = unmarshaler.UpdatedAt.Time() b.CancelledAt = unmarshaler.CancelledAt.TimePtr() b.CompletedAt = unmarshaler.CompletedAt.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *b) + extraProperties, err := internal.ExtractExtraProperties(data, *b) if err != nil { return err } b.extraProperties = extraProperties - - b._rawJSON = json.RawMessage(data) + b.rawJSON = json.RawMessage(data) return nil } @@ -810,27 +964,27 @@ func (b *BatchOperation) MarshalJSON() ([]byte, error) { type embed BatchOperation var marshaler = struct { embed - CreatedAt *core.DateTime `json:"created_at"` - UpdatedAt *core.DateTime `json:"updated_at"` - CancelledAt *core.DateTime `json:"cancelled_at,omitempty"` - CompletedAt *core.DateTime `json:"completed_at,omitempty"` + CreatedAt *internal.DateTime `json:"created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CancelledAt *internal.DateTime `json:"cancelled_at,omitempty"` + CompletedAt *internal.DateTime `json:"completed_at,omitempty"` }{ embed: embed(*b), - CreatedAt: core.NewDateTime(b.CreatedAt), - UpdatedAt: core.NewDateTime(b.UpdatedAt), - CancelledAt: core.NewOptionalDateTime(b.CancelledAt), - CompletedAt: core.NewOptionalDateTime(b.CompletedAt), + CreatedAt: internal.NewDateTime(b.CreatedAt), + UpdatedAt: internal.NewDateTime(b.UpdatedAt), + CancelledAt: internal.NewOptionalDateTime(b.CancelledAt), + CompletedAt: internal.NewOptionalDateTime(b.CompletedAt), } return json.Marshal(marshaler) } func (b *BatchOperation) String() string { - if len(b._rawJSON) > 0 { - if value, err := core.StringifyJSON(b._rawJSON); err == nil { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(b); err == nil { + if value, err := internal.StringifyJSON(b); err == nil { return value } return fmt.Sprintf("%#v", b) @@ -842,7 +996,28 @@ type BatchOperationPaginatedResult struct { Models []*BatchOperation `json:"models,omitempty" url:"models,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (b *BatchOperationPaginatedResult) GetPagination() *SeekPagination { + if b == nil { + return nil + } + return b.Pagination +} + +func (b *BatchOperationPaginatedResult) GetCount() *int { + if b == nil { + return nil + } + return b.Count +} + +func (b *BatchOperationPaginatedResult) GetModels() []*BatchOperation { + if b == nil { + return nil + } + return b.Models } func (b *BatchOperationPaginatedResult) GetExtraProperties() map[string]interface{} { @@ -856,24 +1031,22 @@ func (b *BatchOperationPaginatedResult) UnmarshalJSON(data []byte) error { return err } *b = BatchOperationPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *b) + extraProperties, err := internal.ExtractExtraProperties(data, *b) if err != nil { return err } b.extraProperties = extraProperties - - b._rawJSON = json.RawMessage(data) + b.rawJSON = json.RawMessage(data) return nil } func (b *BatchOperationPaginatedResult) String() string { - if len(b._rawJSON) > 0 { - if value, err := core.StringifyJSON(b._rawJSON); err == nil { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(b); err == nil { + if value, err := internal.StringifyJSON(b); err == nil { return value } return fmt.Sprintf("%#v", b) @@ -883,24 +1056,42 @@ func (b *BatchOperationPaginatedResult) String() string { type BatchOperationQuery struct { StringUnknownMap map[string]interface{} StringOptional *string + + typ string } func NewBatchOperationQueryFromStringUnknownMap(value map[string]interface{}) *BatchOperationQuery { - return &BatchOperationQuery{StringUnknownMap: value} + return &BatchOperationQuery{typ: "StringUnknownMap", StringUnknownMap: value} } func NewBatchOperationQueryFromStringOptional(value *string) *BatchOperationQuery { - return &BatchOperationQuery{StringOptional: value} + return &BatchOperationQuery{typ: "StringOptional", StringOptional: value} +} + +func (b *BatchOperationQuery) GetStringUnknownMap() map[string]interface{} { + if b == nil { + return nil + } + return b.StringUnknownMap +} + +func (b *BatchOperationQuery) GetStringOptional() *string { + if b == nil { + return nil + } + return b.StringOptional } func (b *BatchOperationQuery) UnmarshalJSON(data []byte) error { var valueStringUnknownMap map[string]interface{} if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { + b.typ = "StringUnknownMap" b.StringUnknownMap = valueStringUnknownMap return nil } var valueStringOptional *string if err := json.Unmarshal(data, &valueStringOptional); err == nil { + b.typ = "StringOptional" b.StringOptional = valueStringOptional return nil } @@ -908,10 +1099,10 @@ func (b *BatchOperationQuery) UnmarshalJSON(data []byte) error { } func (b BatchOperationQuery) MarshalJSON() ([]byte, error) { - if b.StringUnknownMap != nil { + if b.typ == "StringUnknownMap" || b.StringUnknownMap != nil { return json.Marshal(b.StringUnknownMap) } - if b.StringOptional != nil { + if b.typ == "StringOptional" || b.StringOptional != nil { return json.Marshal(b.StringOptional) } return nil, fmt.Errorf("type %T does not include a non-empty union type", b) @@ -923,318 +1114,67 @@ type BatchOperationQueryVisitor interface { } func (b *BatchOperationQuery) Accept(visitor BatchOperationQueryVisitor) error { - if b.StringUnknownMap != nil { + if b.typ == "StringUnknownMap" || b.StringUnknownMap != nil { return visitor.VisitStringUnknownMap(b.StringUnknownMap) } - if b.StringOptional != nil { + if b.typ == "StringOptional" || b.StringOptional != nil { return visitor.VisitStringOptional(b.StringOptional) } return fmt.Errorf("type %T does not include a non-empty union type", b) } -type Bookmark struct { - // ID of the bookmark - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // ID of the associated connection - WebhookId string `json:"webhook_id" url:"webhook_id"` - // ID of the bookmarked event data - EventDataId string `json:"event_data_id" url:"event_data_id"` - // Descriptive name of the bookmark - Label string `json:"label" url:"label"` - // Alternate alias for the bookmark - Alias *string `json:"alias,omitempty" url:"alias,omitempty"` - Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` - // Date the bookmark was last manually triggered - LastUsedAt *time.Time `json:"last_used_at,omitempty" url:"last_used_at,omitempty"` - // Date the bookmark was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the bookmark was created - CreatedAt time.Time `json:"created_at" url:"created_at"` +type ConsoleLine struct { + Type ConsoleLineType `json:"type" url:"type"` + Message string `json:"message" url:"message"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (b *Bookmark) GetExtraProperties() map[string]interface{} { - return b.extraProperties -} - -func (b *Bookmark) UnmarshalJSON(data []byte) error { - type embed Bookmark - var unmarshaler = struct { - embed - LastUsedAt *core.DateTime `json:"last_used_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*b), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *b = Bookmark(unmarshaler.embed) - b.LastUsedAt = unmarshaler.LastUsedAt.TimePtr() - b.UpdatedAt = unmarshaler.UpdatedAt.Time() - b.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *b) - if err != nil { - return err - } - b.extraProperties = extraProperties - - b._rawJSON = json.RawMessage(data) - return nil + rawJSON json.RawMessage } -func (b *Bookmark) MarshalJSON() ([]byte, error) { - type embed Bookmark - var marshaler = struct { - embed - LastUsedAt *core.DateTime `json:"last_used_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*b), - LastUsedAt: core.NewOptionalDateTime(b.LastUsedAt), - UpdatedAt: core.NewDateTime(b.UpdatedAt), - CreatedAt: core.NewDateTime(b.CreatedAt), +func (c *ConsoleLine) GetType() ConsoleLineType { + if c == nil { + return "" } - return json.Marshal(marshaler) + return c.Type } -func (b *Bookmark) String() string { - if len(b._rawJSON) > 0 { - if value, err := core.StringifyJSON(b._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(b); err == nil { - return value +func (c *ConsoleLine) GetMessage() string { + if c == nil { + return "" } - return fmt.Sprintf("%#v", b) -} - -type BookmarkPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Bookmark `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return c.Message } -func (b *BookmarkPaginatedResult) GetExtraProperties() map[string]interface{} { - return b.extraProperties +func (c *ConsoleLine) GetExtraProperties() map[string]interface{} { + return c.extraProperties } -func (b *BookmarkPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler BookmarkPaginatedResult +func (c *ConsoleLine) UnmarshalJSON(data []byte) error { + type unmarshaler ConsoleLine var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *b = BookmarkPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *b) + *c = ConsoleLine(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err } - b.extraProperties = extraProperties - - b._rawJSON = json.RawMessage(data) + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) return nil } -func (b *BookmarkPaginatedResult) String() string { - if len(b._rawJSON) > 0 { - if value, err := core.StringifyJSON(b._rawJSON); err == nil { +func (c *ConsoleLine) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(b); err == nil { + if value, err := internal.StringifyJSON(c); err == nil { return value } - return fmt.Sprintf("%#v", b) -} - -type Connection struct { - // ID of the connection - Id string `json:"id" url:"id"` - // Unique name of the connection for this source - Name *string `json:"name,omitempty" url:"name,omitempty"` - // Full name of the connection concatenated from source, connection and desitnation name - FullName *string `json:"full_name,omitempty" url:"full_name,omitempty"` - // Description of the connection - Description *string `json:"description,omitempty" url:"description,omitempty"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - Destination *Destination `json:"destination,omitempty" url:"destination,omitempty"` - Source *Source `json:"source,omitempty" url:"source,omitempty"` - // Array of rules configured on the connection - Rules []*Rule `json:"rules,omitempty" url:"rules,omitempty"` - // Date the connection was disabled - DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` - // Date the connection was paused - PausedAt *time.Time `json:"paused_at,omitempty" url:"paused_at,omitempty"` - // Date the connection was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the connection was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *Connection) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *Connection) UnmarshalJSON(data []byte) error { - type embed Connection - var unmarshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - PausedAt *core.DateTime `json:"paused_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*c), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *c = Connection(unmarshaler.embed) - c.DisabledAt = unmarshaler.DisabledAt.TimePtr() - c.PausedAt = unmarshaler.PausedAt.TimePtr() - c.UpdatedAt = unmarshaler.UpdatedAt.Time() - c.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *Connection) MarshalJSON() ([]byte, error) { - type embed Connection - var marshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - PausedAt *core.DateTime `json:"paused_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*c), - DisabledAt: core.NewOptionalDateTime(c.DisabledAt), - PausedAt: core.NewOptionalDateTime(c.PausedAt), - UpdatedAt: core.NewDateTime(c.UpdatedAt), - CreatedAt: core.NewDateTime(c.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (c *Connection) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - -type ConnectionPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Connection `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *ConnectionPaginatedResult) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *ConnectionPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler ConnectionPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = ConnectionPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *ConnectionPaginatedResult) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - -type ConsoleLine struct { - Type ConsoleLineType `json:"type" url:"type"` - Message string `json:"message" url:"message"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (c *ConsoleLine) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *ConsoleLine) UnmarshalJSON(data []byte) error { - type unmarshaler ConsoleLine - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = ConsoleLine(value) - - extraProperties, err := core.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - - c._rawJSON = json.RawMessage(data) - return nil -} - -func (c *ConsoleLine) String() string { - if len(c._rawJSON) > 0 { - if value, err := core.StringifyJSON(c._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) + return fmt.Sprintf("%#v", c) } type ConsoleLineType string @@ -1268,643 +1208,280 @@ func (c ConsoleLineType) Ptr() *ConsoleLineType { return &c } -type DelayRule struct { - // Delay to introduce in MS - Delay int `json:"delay" url:"delay"` +type DeletedIntegration struct { + Id string `json:"id" url:"id"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DelayRule) GetExtraProperties() map[string]interface{} { - return d.extraProperties + rawJSON json.RawMessage } -func (d *DelayRule) UnmarshalJSON(data []byte) error { - type unmarshaler DelayRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DelayRule(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DelayRule) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value +func (d *DeletedIntegration) GetId() string { + if d == nil { + return "" } - return fmt.Sprintf("%#v", d) -} - -type DeleteCustomDomainSchema struct { - // The custom hostname ID - Id string `json:"id" url:"id"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return d.Id } -func (d *DeleteCustomDomainSchema) GetExtraProperties() map[string]interface{} { +func (d *DeletedIntegration) GetExtraProperties() map[string]interface{} { return d.extraProperties } -func (d *DeleteCustomDomainSchema) UnmarshalJSON(data []byte) error { - type unmarshaler DeleteCustomDomainSchema +func (d *DeletedIntegration) UnmarshalJSON(data []byte) error { + type unmarshaler DeletedIntegration var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *d = DeleteCustomDomainSchema(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + *d = DeletedIntegration(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } -func (d *DeleteCustomDomainSchema) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (d *DeletedIntegration) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) } -type DeletedBookmarkResponse struct { - // Bookmark ID +// Associated [Destination](#destination-object) object +type Destination struct { + // ID of the destination Id string `json:"id" url:"id"` + // A unique, human-friendly name for the destination + Name string `json:"name" url:"name"` + // Description of the destination + Description *string `json:"description,omitempty" url:"description,omitempty"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + // HTTP endpoint of the destination + Url *string `json:"url,omitempty" url:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty" url:"cli_path,omitempty"` + // Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. + RateLimit *int `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty" url:"auth_method,omitempty"` + // Date the destination was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` + // Date the destination was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the destination was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + // Type of the destination + Type *string `json:"type,omitempty" url:"type,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (d *DeletedBookmarkResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (d *Destination) GetId() string { + if d == nil { + return "" + } + return d.Id } -func (d *DeletedBookmarkResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeletedBookmarkResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (d *Destination) GetName() string { + if d == nil { + return "" } - *d = DeletedBookmarkResponse(value) + return d.Name +} - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func (d *Destination) GetDescription() *string { + if d == nil { + return nil } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + return d.Description } -func (d *DeletedBookmarkResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value +func (d *Destination) GetTeamId() string { + if d == nil { + return "" } - return fmt.Sprintf("%#v", d) + return d.TeamId } -type DeletedIntegration struct { - Id string `json:"id" url:"id"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *Destination) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (d *DeletedIntegration) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (d *Destination) GetUrl() *string { + if d == nil { + return nil + } + return d.Url } -func (d *DeletedIntegration) UnmarshalJSON(data []byte) error { - type unmarshaler DeletedIntegration - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (d *Destination) GetCliPath() *string { + if d == nil { + return nil } - *d = DeletedIntegration(value) + return d.CliPath +} - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func (d *Destination) GetRateLimit() *int { + if d == nil { + return nil } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + return d.RateLimit } -func (d *DeletedIntegration) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value +func (d *Destination) GetRateLimitPeriod() *DestinationRateLimitPeriod { + if d == nil { + return nil } - return fmt.Sprintf("%#v", d) + return d.RateLimitPeriod } -type DeletedIssueTriggerResponse struct { - Id string `json:"id" url:"id"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *Destination) GetHttpMethod() *DestinationHttpMethod { + if d == nil { + return nil + } + return d.HttpMethod } -func (d *DeletedIssueTriggerResponse) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (d *Destination) GetAuthMethod() *DestinationAuthMethodConfig { + if d == nil { + return nil + } + return d.AuthMethod } -func (d *DeletedIssueTriggerResponse) UnmarshalJSON(data []byte) error { - type unmarshaler DeletedIssueTriggerResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (d *Destination) GetDisabledAt() *time.Time { + if d == nil { + return nil } - *d = DeletedIssueTriggerResponse(value) + return d.DisabledAt +} - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func (d *Destination) GetUpdatedAt() time.Time { + if d == nil { + return time.Time{} } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + return d.UpdatedAt } -func (d *DeletedIssueTriggerResponse) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } +func (d *Destination) GetCreatedAt() time.Time { + if d == nil { + return time.Time{} } - if value, err := core.StringifyJSON(d); err == nil { - return value + return d.CreatedAt +} + +func (d *Destination) GetType() *string { + if d == nil { + return nil } - return fmt.Sprintf("%#v", d) + return d.Type } -// Delivery issue -type DeliveryIssue struct { - // Issue ID - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - Status IssueStatus `json:"status" url:"status"` - // ISO timestamp for when the issue was last opened - OpenedAt time.Time `json:"opened_at" url:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` - // Deprecated, will always be set to null - LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` - AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at" url:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at" url:"created_at"` - AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` - Reference *DeliveryIssueReference `json:"reference,omitempty" url:"reference,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DeliveryIssue) GetExtraProperties() map[string]interface{} { +func (d *Destination) GetExtraProperties() map[string]interface{} { return d.extraProperties } -func (d *DeliveryIssue) UnmarshalJSON(data []byte) error { - type embed DeliveryIssue +func (d *Destination) UnmarshalJSON(data []byte) error { + type embed Destination var unmarshaler = struct { embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ embed: embed(*d), } if err := json.Unmarshal(data, &unmarshaler); err != nil { return err } - *d = DeliveryIssue(unmarshaler.embed) - d.OpenedAt = unmarshaler.OpenedAt.Time() - d.FirstSeenAt = unmarshaler.FirstSeenAt.Time() - d.LastSeenAt = unmarshaler.LastSeenAt.Time() - d.DismissedAt = unmarshaler.DismissedAt.TimePtr() - d.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *d) + *d = Destination(unmarshaler.embed) + d.DisabledAt = unmarshaler.DisabledAt.TimePtr() + d.UpdatedAt = unmarshaler.UpdatedAt.Time() + d.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } -func (d *DeliveryIssue) MarshalJSON() ([]byte, error) { - type embed DeliveryIssue +func (d *Destination) MarshalJSON() ([]byte, error) { + type embed Destination var marshaler = struct { embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*d), - OpenedAt: core.NewDateTime(d.OpenedAt), - FirstSeenAt: core.NewDateTime(d.FirstSeenAt), - LastSeenAt: core.NewDateTime(d.LastSeenAt), - DismissedAt: core.NewOptionalDateTime(d.DismissedAt), - AutoResolvedAt: core.NewOptionalDateTime(d.AutoResolvedAt), + embed: embed(*d), + DisabledAt: internal.NewOptionalDateTime(d.DisabledAt), + UpdatedAt: internal.NewDateTime(d.UpdatedAt), + CreatedAt: internal.NewDateTime(d.CreatedAt), } return json.Marshal(marshaler) } -func (d *DeliveryIssue) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { +func (d *Destination) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) } -// Keys used as the aggregation keys a 'delivery' type issue -type DeliveryIssueAggregationKeys struct { - WebhookId []string `json:"webhook_id,omitempty" url:"webhook_id,omitempty"` - ResponseStatus []float64 `json:"response_status,omitempty" url:"response_status,omitempty"` - ErrorCode []AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DeliveryIssueAggregationKeys) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} - -func (d *DeliveryIssueAggregationKeys) UnmarshalJSON(data []byte) error { - type unmarshaler DeliveryIssueAggregationKeys - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeliveryIssueAggregationKeys(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DeliveryIssueAggregationKeys) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) -} - -// Delivery issue data -type DeliveryIssueData struct { - TriggerEvent *Event `json:"trigger_event,omitempty" url:"trigger_event,omitempty"` - TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty" url:"trigger_attempt,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DeliveryIssueData) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} - -func (d *DeliveryIssueData) UnmarshalJSON(data []byte) error { - type unmarshaler DeliveryIssueData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeliveryIssueData(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DeliveryIssueData) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) -} - -// Reference to the event and attempt an issue is being created for. -type DeliveryIssueReference struct { - EventId string `json:"event_id" url:"event_id"` - AttemptId string `json:"attempt_id" url:"attempt_id"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DeliveryIssueReference) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} - -func (d *DeliveryIssueReference) UnmarshalJSON(data []byte) error { - type unmarshaler DeliveryIssueReference - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeliveryIssueReference(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DeliveryIssueReference) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) -} - -// Delivery issue -type DeliveryIssueWithData struct { - // Issue ID - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - Status IssueStatus `json:"status" url:"status"` - // ISO timestamp for when the issue was last opened - OpenedAt time.Time `json:"opened_at" url:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` - // Deprecated, will always be set to null - LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` - AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at" url:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at" url:"created_at"` - AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` - Reference *DeliveryIssueReference `json:"reference,omitempty" url:"reference,omitempty"` - Data *DeliveryIssueData `json:"data,omitempty" url:"data,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DeliveryIssueWithData) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} - -func (d *DeliveryIssueWithData) UnmarshalJSON(data []byte) error { - type embed DeliveryIssueWithData - var unmarshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*d), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *d = DeliveryIssueWithData(unmarshaler.embed) - d.OpenedAt = unmarshaler.OpenedAt.Time() - d.FirstSeenAt = unmarshaler.FirstSeenAt.Time() - d.LastSeenAt = unmarshaler.LastSeenAt.Time() - d.DismissedAt = unmarshaler.DismissedAt.TimePtr() - d.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DeliveryIssueWithData) MarshalJSON() ([]byte, error) { - type embed DeliveryIssueWithData - var marshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*d), - OpenedAt: core.NewDateTime(d.OpenedAt), - FirstSeenAt: core.NewDateTime(d.FirstSeenAt), - LastSeenAt: core.NewDateTime(d.LastSeenAt), - DismissedAt: core.NewOptionalDateTime(d.DismissedAt), - AutoResolvedAt: core.NewOptionalDateTime(d.AutoResolvedAt), - } - return json.Marshal(marshaler) -} - -func (d *DeliveryIssueWithData) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) -} - -// Associated [Destination](#destination-object) object -type Destination struct { - // ID of the destination - Id string `json:"id" url:"id"` - // A unique, human-friendly name for the destination - Name string `json:"name" url:"name"` - // Description of the destination - Description *string `json:"description,omitempty" url:"description,omitempty"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` - // HTTP endpoint of the destination - Url *string `json:"url,omitempty" url:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty" url:"cli_path,omitempty"` - // Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. - RateLimit *int `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` - RateLimitPeriod *DestinationRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` - HttpMethod *DestinationHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` - AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty" url:"auth_method,omitempty"` - // Date the destination was disabled - DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` - // Date the destination was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the destination was created - CreatedAt time.Time `json:"created_at" url:"created_at"` +// API key config for the destination's auth method +type DestinationAuthMethodApiKeyConfig struct { + // Key for the API key auth + Key string `json:"key" url:"key"` + // API key for the API key auth + ApiKey string `json:"api_key" url:"api_key"` + // Whether the API key should be sent as a header or a query parameter + To *DestinationAuthMethodApiKeyConfigTo `json:"to,omitempty" url:"to,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *Destination) GetExtraProperties() map[string]interface{} { - return d.extraProperties + rawJSON json.RawMessage } -func (d *Destination) UnmarshalJSON(data []byte) error { - type embed Destination - var unmarshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*d), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *d = Destination(unmarshaler.embed) - d.DisabledAt = unmarshaler.DisabledAt.TimePtr() - d.UpdatedAt = unmarshaler.UpdatedAt.Time() - d.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func (d *DestinationAuthMethodApiKeyConfig) GetKey() string { + if d == nil { + return "" } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil + return d.Key } -func (d *Destination) MarshalJSON() ([]byte, error) { - type embed Destination - var marshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*d), - DisabledAt: core.NewOptionalDateTime(d.DisabledAt), - UpdatedAt: core.NewDateTime(d.UpdatedAt), - CreatedAt: core.NewDateTime(d.CreatedAt), +func (d *DestinationAuthMethodApiKeyConfig) GetApiKey() string { + if d == nil { + return "" } - return json.Marshal(marshaler) + return d.ApiKey } -func (d *Destination) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value +func (d *DestinationAuthMethodApiKeyConfig) GetTo() *DestinationAuthMethodApiKeyConfigTo { + if d == nil { + return nil } - return fmt.Sprintf("%#v", d) -} - -// API key config for the destination's auth method -type DestinationAuthMethodApiKeyConfig struct { - // Key for the API key auth - Key string `json:"key" url:"key"` - // API key for the API key auth - ApiKey string `json:"api_key" url:"api_key"` - // Whether the API key should be sent as a header or a query parameter - To *DestinationAuthMethodApiKeyConfigTo `json:"to,omitempty" url:"to,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return d.To } func (d *DestinationAuthMethodApiKeyConfig) GetExtraProperties() map[string]interface{} { @@ -1918,24 +1495,22 @@ func (d *DestinationAuthMethodApiKeyConfig) UnmarshalJSON(data []byte) error { return err } *d = DestinationAuthMethodApiKeyConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodApiKeyConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -1976,7 +1551,35 @@ type DestinationAuthMethodAwsSignatureConfig struct { Service *string `json:"service,omitempty" url:"service,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodAwsSignatureConfig) GetAccessKeyId() string { + if d == nil { + return "" + } + return d.AccessKeyId +} + +func (d *DestinationAuthMethodAwsSignatureConfig) GetSecretAccessKey() string { + if d == nil { + return "" + } + return d.SecretAccessKey +} + +func (d *DestinationAuthMethodAwsSignatureConfig) GetRegion() *string { + if d == nil { + return nil + } + return d.Region +} + +func (d *DestinationAuthMethodAwsSignatureConfig) GetService() *string { + if d == nil { + return nil + } + return d.Service } func (d *DestinationAuthMethodAwsSignatureConfig) GetExtraProperties() map[string]interface{} { @@ -1990,24 +1593,22 @@ func (d *DestinationAuthMethodAwsSignatureConfig) UnmarshalJSON(data []byte) err return err } *d = DestinationAuthMethodAwsSignatureConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodAwsSignatureConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2021,7 +1622,21 @@ type DestinationAuthMethodBasicAuthConfig struct { Password string `json:"password" url:"password"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodBasicAuthConfig) GetUsername() string { + if d == nil { + return "" + } + return d.Username +} + +func (d *DestinationAuthMethodBasicAuthConfig) GetPassword() string { + if d == nil { + return "" + } + return d.Password } func (d *DestinationAuthMethodBasicAuthConfig) GetExtraProperties() map[string]interface{} { @@ -2035,24 +1650,22 @@ func (d *DestinationAuthMethodBasicAuthConfig) UnmarshalJSON(data []byte) error return err } *d = DestinationAuthMethodBasicAuthConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodBasicAuthConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2064,7 +1677,14 @@ type DestinationAuthMethodBearerTokenConfig struct { Token string `json:"token" url:"token"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodBearerTokenConfig) GetToken() string { + if d == nil { + return "" + } + return d.Token } func (d *DestinationAuthMethodBearerTokenConfig) GetExtraProperties() map[string]interface{} { @@ -2078,24 +1698,22 @@ func (d *DestinationAuthMethodBearerTokenConfig) UnmarshalJSON(data []byte) erro return err } *d = DestinationAuthMethodBearerTokenConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodBearerTokenConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2146,24 +1764,87 @@ func NewDestinationAuthMethodConfigFromAwsSignature(value *AuthAwsSignature) *De return &DestinationAuthMethodConfig{Type: "AWS_SIGNATURE", AwsSignature: value} } -func (d *DestinationAuthMethodConfig) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` +func (d *DestinationAuthMethodConfig) GetType() string { + if d == nil { + return "" } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err + return d.Type +} + +func (d *DestinationAuthMethodConfig) GetHookdeckSignature() *AuthHookdeckSignature { + if d == nil { + return nil } - d.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", d) + return d.HookdeckSignature +} + +func (d *DestinationAuthMethodConfig) GetBasicAuth() *AuthBasicAuth { + if d == nil { + return nil } - switch unmarshaler.Type { - case "HOOKDECK_SIGNATURE": - value := new(AuthHookdeckSignature) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - d.HookdeckSignature = value + return d.BasicAuth +} + +func (d *DestinationAuthMethodConfig) GetApiKey() *AuthApiKey { + if d == nil { + return nil + } + return d.ApiKey +} + +func (d *DestinationAuthMethodConfig) GetBearerToken() *AuthBearerToken { + if d == nil { + return nil + } + return d.BearerToken +} + +func (d *DestinationAuthMethodConfig) GetOauth2ClientCredentials() *AuthOAuth2ClientCredentials { + if d == nil { + return nil + } + return d.Oauth2ClientCredentials +} + +func (d *DestinationAuthMethodConfig) GetOauth2AuthorizationCode() *AuthOAuth2AuthorizationCode { + if d == nil { + return nil + } + return d.Oauth2AuthorizationCode +} + +func (d *DestinationAuthMethodConfig) GetCustomSignature() *AuthCustomSignature { + if d == nil { + return nil + } + return d.CustomSignature +} + +func (d *DestinationAuthMethodConfig) GetAwsSignature() *AuthAwsSignature { + if d == nil { + return nil + } + return d.AwsSignature +} + +func (d *DestinationAuthMethodConfig) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + d.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", d) + } + switch unmarshaler.Type { + case "HOOKDECK_SIGNATURE": + value := new(AuthHookdeckSignature) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.HookdeckSignature = value case "BASIC_AUTH": value := new(AuthBasicAuth) if err := json.Unmarshal(data, &value); err != nil { @@ -2215,21 +1896,21 @@ func (d DestinationAuthMethodConfig) MarshalJSON() ([]byte, error) { default: return nil, fmt.Errorf("invalid type %s in %T", d.Type, d) case "HOOKDECK_SIGNATURE": - return core.MarshalJSONWithExtraProperty(d.HookdeckSignature, "type", "HOOKDECK_SIGNATURE") + return internal.MarshalJSONWithExtraProperty(d.HookdeckSignature, "type", "HOOKDECK_SIGNATURE") case "BASIC_AUTH": - return core.MarshalJSONWithExtraProperty(d.BasicAuth, "type", "BASIC_AUTH") + return internal.MarshalJSONWithExtraProperty(d.BasicAuth, "type", "BASIC_AUTH") case "API_KEY": - return core.MarshalJSONWithExtraProperty(d.ApiKey, "type", "API_KEY") + return internal.MarshalJSONWithExtraProperty(d.ApiKey, "type", "API_KEY") case "BEARER_TOKEN": - return core.MarshalJSONWithExtraProperty(d.BearerToken, "type", "BEARER_TOKEN") + return internal.MarshalJSONWithExtraProperty(d.BearerToken, "type", "BEARER_TOKEN") case "OAUTH2_CLIENT_CREDENTIALS": - return core.MarshalJSONWithExtraProperty(d.Oauth2ClientCredentials, "type", "OAUTH2_CLIENT_CREDENTIALS") + return internal.MarshalJSONWithExtraProperty(d.Oauth2ClientCredentials, "type", "OAUTH2_CLIENT_CREDENTIALS") case "OAUTH2_AUTHORIZATION_CODE": - return core.MarshalJSONWithExtraProperty(d.Oauth2AuthorizationCode, "type", "OAUTH2_AUTHORIZATION_CODE") + return internal.MarshalJSONWithExtraProperty(d.Oauth2AuthorizationCode, "type", "OAUTH2_AUTHORIZATION_CODE") case "CUSTOM_SIGNATURE": - return core.MarshalJSONWithExtraProperty(d.CustomSignature, "type", "CUSTOM_SIGNATURE") + return internal.MarshalJSONWithExtraProperty(d.CustomSignature, "type", "CUSTOM_SIGNATURE") case "AWS_SIGNATURE": - return core.MarshalJSONWithExtraProperty(d.AwsSignature, "type", "AWS_SIGNATURE") + return internal.MarshalJSONWithExtraProperty(d.AwsSignature, "type", "AWS_SIGNATURE") } } @@ -2275,7 +1956,21 @@ type DestinationAuthMethodCustomSignatureConfig struct { SigningSecret *string `json:"signing_secret,omitempty" url:"signing_secret,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodCustomSignatureConfig) GetKey() string { + if d == nil { + return "" + } + return d.Key +} + +func (d *DestinationAuthMethodCustomSignatureConfig) GetSigningSecret() *string { + if d == nil { + return nil + } + return d.SigningSecret } func (d *DestinationAuthMethodCustomSignatureConfig) GetExtraProperties() map[string]interface{} { @@ -2289,24 +1984,22 @@ func (d *DestinationAuthMethodCustomSignatureConfig) UnmarshalJSON(data []byte) return err } *d = DestinationAuthMethodCustomSignatureConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodCustomSignatureConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2326,7 +2019,42 @@ type DestinationAuthMethodOAuth2AuthorizationCodeConfig struct { AuthServer string `json:"auth_server" url:"auth_server"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetClientId() string { + if d == nil { + return "" + } + return d.ClientId +} + +func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetClientSecret() string { + if d == nil { + return "" + } + return d.ClientSecret +} + +func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetRefreshToken() string { + if d == nil { + return "" + } + return d.RefreshToken +} + +func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetScope() *string { + if d == nil { + return nil + } + return d.Scope +} + +func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetAuthServer() string { + if d == nil { + return "" + } + return d.AuthServer } func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) GetExtraProperties() map[string]interface{} { @@ -2340,24 +2068,22 @@ func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) UnmarshalJSON(data return err } *d = DestinationAuthMethodOAuth2AuthorizationCodeConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodOAuth2AuthorizationCodeConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2377,7 +2103,42 @@ type DestinationAuthMethodOAuth2ClientCredentialsConfig struct { AuthenticationType *DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType `json:"authentication_type,omitempty" url:"authentication_type,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetClientId() string { + if d == nil { + return "" + } + return d.ClientId +} + +func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetClientSecret() string { + if d == nil { + return "" + } + return d.ClientSecret +} + +func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetScope() *string { + if d == nil { + return nil + } + return d.Scope +} + +func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetAuthServer() string { + if d == nil { + return "" + } + return d.AuthServer +} + +func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetAuthenticationType() *DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType { + if d == nil { + return nil + } + return d.AuthenticationType } func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) GetExtraProperties() map[string]interface{} { @@ -2391,24 +2152,22 @@ func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) UnmarshalJSON(data return err } *d = DestinationAuthMethodOAuth2ClientCredentialsConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodOAuth2ClientCredentialsConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) @@ -2443,7 +2202,7 @@ func (d DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType) Pt // Empty config for the destination's auth method type DestinationAuthMethodSignatureConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } func (d *DestinationAuthMethodSignatureConfig) GetExtraProperties() map[string]interface{} { @@ -2457,29 +2216,298 @@ func (d *DestinationAuthMethodSignatureConfig) UnmarshalJSON(data []byte) error return err } *d = DestinationAuthMethodSignatureConfig(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) + d.rawJSON = json.RawMessage(data) return nil } func (d *DestinationAuthMethodSignatureConfig) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(d); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } return fmt.Sprintf("%#v", d) } +// Configuration object for the destination type +type DestinationConfig struct { + DestinationTypeConfigCustomSha256HmacSignature *DestinationTypeConfigCustomSha256HmacSignature + DestinationTypeConfigBasicAuth *DestinationTypeConfigBasicAuth + DestinationTypeConfigApiKey *DestinationTypeConfigApiKey + DestinationTypeConfigBearerToken *DestinationTypeConfigBearerToken + DestinationTypeConfigOAuth2ClientCredentials *DestinationTypeConfigOAuth2ClientCredentials + DestinationTypeConfigOAuth2AuthorizationCode *DestinationTypeConfigOAuth2AuthorizationCode + DestinationTypeConfigAwsSignature *DestinationTypeConfigAwsSignature + DestinationTypeConfigHttp *DestinationTypeConfigHttp + DestinationTypeConfigCli *DestinationTypeConfigCli + DestinationTypeConfigMockApi *DestinationTypeConfigMockApi + + typ string +} + +func NewDestinationConfigFromDestinationTypeConfigCustomSha256HmacSignature(value *DestinationTypeConfigCustomSha256HmacSignature) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigCustomSha256HmacSignature", DestinationTypeConfigCustomSha256HmacSignature: value} +} + +func NewDestinationConfigFromDestinationTypeConfigBasicAuth(value *DestinationTypeConfigBasicAuth) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigBasicAuth", DestinationTypeConfigBasicAuth: value} +} + +func NewDestinationConfigFromDestinationTypeConfigApiKey(value *DestinationTypeConfigApiKey) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigApiKey", DestinationTypeConfigApiKey: value} +} + +func NewDestinationConfigFromDestinationTypeConfigBearerToken(value *DestinationTypeConfigBearerToken) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigBearerToken", DestinationTypeConfigBearerToken: value} +} + +func NewDestinationConfigFromDestinationTypeConfigOAuth2ClientCredentials(value *DestinationTypeConfigOAuth2ClientCredentials) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigOAuth2ClientCredentials", DestinationTypeConfigOAuth2ClientCredentials: value} +} + +func NewDestinationConfigFromDestinationTypeConfigOAuth2AuthorizationCode(value *DestinationTypeConfigOAuth2AuthorizationCode) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigOAuth2AuthorizationCode", DestinationTypeConfigOAuth2AuthorizationCode: value} +} + +func NewDestinationConfigFromDestinationTypeConfigAwsSignature(value *DestinationTypeConfigAwsSignature) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigAwsSignature", DestinationTypeConfigAwsSignature: value} +} + +func NewDestinationConfigFromDestinationTypeConfigHttp(value *DestinationTypeConfigHttp) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigHttp", DestinationTypeConfigHttp: value} +} + +func NewDestinationConfigFromDestinationTypeConfigCli(value *DestinationTypeConfigCli) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigCli", DestinationTypeConfigCli: value} +} + +func NewDestinationConfigFromDestinationTypeConfigMockApi(value *DestinationTypeConfigMockApi) *DestinationConfig { + return &DestinationConfig{typ: "DestinationTypeConfigMockApi", DestinationTypeConfigMockApi: value} +} + +func (d *DestinationConfig) GetDestinationTypeConfigCustomSha256HmacSignature() *DestinationTypeConfigCustomSha256HmacSignature { + if d == nil { + return nil + } + return d.DestinationTypeConfigCustomSha256HmacSignature +} + +func (d *DestinationConfig) GetDestinationTypeConfigBasicAuth() *DestinationTypeConfigBasicAuth { + if d == nil { + return nil + } + return d.DestinationTypeConfigBasicAuth +} + +func (d *DestinationConfig) GetDestinationTypeConfigApiKey() *DestinationTypeConfigApiKey { + if d == nil { + return nil + } + return d.DestinationTypeConfigApiKey +} + +func (d *DestinationConfig) GetDestinationTypeConfigBearerToken() *DestinationTypeConfigBearerToken { + if d == nil { + return nil + } + return d.DestinationTypeConfigBearerToken +} + +func (d *DestinationConfig) GetDestinationTypeConfigOAuth2ClientCredentials() *DestinationTypeConfigOAuth2ClientCredentials { + if d == nil { + return nil + } + return d.DestinationTypeConfigOAuth2ClientCredentials +} + +func (d *DestinationConfig) GetDestinationTypeConfigOAuth2AuthorizationCode() *DestinationTypeConfigOAuth2AuthorizationCode { + if d == nil { + return nil + } + return d.DestinationTypeConfigOAuth2AuthorizationCode +} + +func (d *DestinationConfig) GetDestinationTypeConfigAwsSignature() *DestinationTypeConfigAwsSignature { + if d == nil { + return nil + } + return d.DestinationTypeConfigAwsSignature +} + +func (d *DestinationConfig) GetDestinationTypeConfigHttp() *DestinationTypeConfigHttp { + if d == nil { + return nil + } + return d.DestinationTypeConfigHttp +} + +func (d *DestinationConfig) GetDestinationTypeConfigCli() *DestinationTypeConfigCli { + if d == nil { + return nil + } + return d.DestinationTypeConfigCli +} + +func (d *DestinationConfig) GetDestinationTypeConfigMockApi() *DestinationTypeConfigMockApi { + if d == nil { + return nil + } + return d.DestinationTypeConfigMockApi +} + +func (d *DestinationConfig) UnmarshalJSON(data []byte) error { + valueDestinationTypeConfigCustomSha256HmacSignature := new(DestinationTypeConfigCustomSha256HmacSignature) + if err := json.Unmarshal(data, &valueDestinationTypeConfigCustomSha256HmacSignature); err == nil { + d.typ = "DestinationTypeConfigCustomSha256HmacSignature" + d.DestinationTypeConfigCustomSha256HmacSignature = valueDestinationTypeConfigCustomSha256HmacSignature + return nil + } + valueDestinationTypeConfigBasicAuth := new(DestinationTypeConfigBasicAuth) + if err := json.Unmarshal(data, &valueDestinationTypeConfigBasicAuth); err == nil { + d.typ = "DestinationTypeConfigBasicAuth" + d.DestinationTypeConfigBasicAuth = valueDestinationTypeConfigBasicAuth + return nil + } + valueDestinationTypeConfigApiKey := new(DestinationTypeConfigApiKey) + if err := json.Unmarshal(data, &valueDestinationTypeConfigApiKey); err == nil { + d.typ = "DestinationTypeConfigApiKey" + d.DestinationTypeConfigApiKey = valueDestinationTypeConfigApiKey + return nil + } + valueDestinationTypeConfigBearerToken := new(DestinationTypeConfigBearerToken) + if err := json.Unmarshal(data, &valueDestinationTypeConfigBearerToken); err == nil { + d.typ = "DestinationTypeConfigBearerToken" + d.DestinationTypeConfigBearerToken = valueDestinationTypeConfigBearerToken + return nil + } + valueDestinationTypeConfigOAuth2ClientCredentials := new(DestinationTypeConfigOAuth2ClientCredentials) + if err := json.Unmarshal(data, &valueDestinationTypeConfigOAuth2ClientCredentials); err == nil { + d.typ = "DestinationTypeConfigOAuth2ClientCredentials" + d.DestinationTypeConfigOAuth2ClientCredentials = valueDestinationTypeConfigOAuth2ClientCredentials + return nil + } + valueDestinationTypeConfigOAuth2AuthorizationCode := new(DestinationTypeConfigOAuth2AuthorizationCode) + if err := json.Unmarshal(data, &valueDestinationTypeConfigOAuth2AuthorizationCode); err == nil { + d.typ = "DestinationTypeConfigOAuth2AuthorizationCode" + d.DestinationTypeConfigOAuth2AuthorizationCode = valueDestinationTypeConfigOAuth2AuthorizationCode + return nil + } + valueDestinationTypeConfigAwsSignature := new(DestinationTypeConfigAwsSignature) + if err := json.Unmarshal(data, &valueDestinationTypeConfigAwsSignature); err == nil { + d.typ = "DestinationTypeConfigAwsSignature" + d.DestinationTypeConfigAwsSignature = valueDestinationTypeConfigAwsSignature + return nil + } + valueDestinationTypeConfigHttp := new(DestinationTypeConfigHttp) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttp); err == nil { + d.typ = "DestinationTypeConfigHttp" + d.DestinationTypeConfigHttp = valueDestinationTypeConfigHttp + return nil + } + valueDestinationTypeConfigCli := new(DestinationTypeConfigCli) + if err := json.Unmarshal(data, &valueDestinationTypeConfigCli); err == nil { + d.typ = "DestinationTypeConfigCli" + d.DestinationTypeConfigCli = valueDestinationTypeConfigCli + return nil + } + valueDestinationTypeConfigMockApi := new(DestinationTypeConfigMockApi) + if err := json.Unmarshal(data, &valueDestinationTypeConfigMockApi); err == nil { + d.typ = "DestinationTypeConfigMockApi" + d.DestinationTypeConfigMockApi = valueDestinationTypeConfigMockApi + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) +} + +func (d DestinationConfig) MarshalJSON() ([]byte, error) { + if d.typ == "DestinationTypeConfigCustomSha256HmacSignature" || d.DestinationTypeConfigCustomSha256HmacSignature != nil { + return json.Marshal(d.DestinationTypeConfigCustomSha256HmacSignature) + } + if d.typ == "DestinationTypeConfigBasicAuth" || d.DestinationTypeConfigBasicAuth != nil { + return json.Marshal(d.DestinationTypeConfigBasicAuth) + } + if d.typ == "DestinationTypeConfigApiKey" || d.DestinationTypeConfigApiKey != nil { + return json.Marshal(d.DestinationTypeConfigApiKey) + } + if d.typ == "DestinationTypeConfigBearerToken" || d.DestinationTypeConfigBearerToken != nil { + return json.Marshal(d.DestinationTypeConfigBearerToken) + } + if d.typ == "DestinationTypeConfigOAuth2ClientCredentials" || d.DestinationTypeConfigOAuth2ClientCredentials != nil { + return json.Marshal(d.DestinationTypeConfigOAuth2ClientCredentials) + } + if d.typ == "DestinationTypeConfigOAuth2AuthorizationCode" || d.DestinationTypeConfigOAuth2AuthorizationCode != nil { + return json.Marshal(d.DestinationTypeConfigOAuth2AuthorizationCode) + } + if d.typ == "DestinationTypeConfigAwsSignature" || d.DestinationTypeConfigAwsSignature != nil { + return json.Marshal(d.DestinationTypeConfigAwsSignature) + } + if d.typ == "DestinationTypeConfigHttp" || d.DestinationTypeConfigHttp != nil { + return json.Marshal(d.DestinationTypeConfigHttp) + } + if d.typ == "DestinationTypeConfigCli" || d.DestinationTypeConfigCli != nil { + return json.Marshal(d.DestinationTypeConfigCli) + } + if d.typ == "DestinationTypeConfigMockApi" || d.DestinationTypeConfigMockApi != nil { + return json.Marshal(d.DestinationTypeConfigMockApi) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", d) +} + +type DestinationConfigVisitor interface { + VisitDestinationTypeConfigCustomSha256HmacSignature(*DestinationTypeConfigCustomSha256HmacSignature) error + VisitDestinationTypeConfigBasicAuth(*DestinationTypeConfigBasicAuth) error + VisitDestinationTypeConfigApiKey(*DestinationTypeConfigApiKey) error + VisitDestinationTypeConfigBearerToken(*DestinationTypeConfigBearerToken) error + VisitDestinationTypeConfigOAuth2ClientCredentials(*DestinationTypeConfigOAuth2ClientCredentials) error + VisitDestinationTypeConfigOAuth2AuthorizationCode(*DestinationTypeConfigOAuth2AuthorizationCode) error + VisitDestinationTypeConfigAwsSignature(*DestinationTypeConfigAwsSignature) error + VisitDestinationTypeConfigHttp(*DestinationTypeConfigHttp) error + VisitDestinationTypeConfigCli(*DestinationTypeConfigCli) error + VisitDestinationTypeConfigMockApi(*DestinationTypeConfigMockApi) error +} + +func (d *DestinationConfig) Accept(visitor DestinationConfigVisitor) error { + if d.typ == "DestinationTypeConfigCustomSha256HmacSignature" || d.DestinationTypeConfigCustomSha256HmacSignature != nil { + return visitor.VisitDestinationTypeConfigCustomSha256HmacSignature(d.DestinationTypeConfigCustomSha256HmacSignature) + } + if d.typ == "DestinationTypeConfigBasicAuth" || d.DestinationTypeConfigBasicAuth != nil { + return visitor.VisitDestinationTypeConfigBasicAuth(d.DestinationTypeConfigBasicAuth) + } + if d.typ == "DestinationTypeConfigApiKey" || d.DestinationTypeConfigApiKey != nil { + return visitor.VisitDestinationTypeConfigApiKey(d.DestinationTypeConfigApiKey) + } + if d.typ == "DestinationTypeConfigBearerToken" || d.DestinationTypeConfigBearerToken != nil { + return visitor.VisitDestinationTypeConfigBearerToken(d.DestinationTypeConfigBearerToken) + } + if d.typ == "DestinationTypeConfigOAuth2ClientCredentials" || d.DestinationTypeConfigOAuth2ClientCredentials != nil { + return visitor.VisitDestinationTypeConfigOAuth2ClientCredentials(d.DestinationTypeConfigOAuth2ClientCredentials) + } + if d.typ == "DestinationTypeConfigOAuth2AuthorizationCode" || d.DestinationTypeConfigOAuth2AuthorizationCode != nil { + return visitor.VisitDestinationTypeConfigOAuth2AuthorizationCode(d.DestinationTypeConfigOAuth2AuthorizationCode) + } + if d.typ == "DestinationTypeConfigAwsSignature" || d.DestinationTypeConfigAwsSignature != nil { + return visitor.VisitDestinationTypeConfigAwsSignature(d.DestinationTypeConfigAwsSignature) + } + if d.typ == "DestinationTypeConfigHttp" || d.DestinationTypeConfigHttp != nil { + return visitor.VisitDestinationTypeConfigHttp(d.DestinationTypeConfigHttp) + } + if d.typ == "DestinationTypeConfigCli" || d.DestinationTypeConfigCli != nil { + return visitor.VisitDestinationTypeConfigCli(d.DestinationTypeConfigCli) + } + if d.typ == "DestinationTypeConfigMockApi" || d.DestinationTypeConfigMockApi != nil { + return visitor.VisitDestinationTypeConfigMockApi(d.DestinationTypeConfigMockApi) + } + return fmt.Errorf("type %T does not include a non-empty union type", d) +} + // HTTP method used on requests sent to the destination, overrides the method used on requests sent to the source. type DestinationHttpMethod string @@ -2512,49 +2540,6 @@ func (d DestinationHttpMethod) Ptr() *DestinationHttpMethod { return &d } -type DestinationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Destination `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (d *DestinationPaginatedResult) GetExtraProperties() map[string]interface{} { - return d.extraProperties -} - -func (d *DestinationPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler DestinationPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DestinationPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err - } - d.extraProperties = extraProperties - - d._rawJSON = json.RawMessage(data) - return nil -} - -func (d *DestinationPaginatedResult) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value - } - return fmt.Sprintf("%#v", d) -} - // Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. type DestinationRateLimitPeriod string @@ -2584,14067 +2569,25660 @@ func (d DestinationRateLimitPeriod) Ptr() *DestinationRateLimitPeriod { return &d } -type DetachedIntegrationFromSource struct { +// The type config for API Key. Requires type to be `API_KEY`. +type DestinationTypeConfigApiKey struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigApiKeyRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigApiKeyHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigApiKeyAuth `json:"auth,omitempty" url:"auth,omitempty"` + extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (d *DetachedIntegrationFromSource) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (d *DestinationTypeConfigApiKey) GetUrl() *string { + if d == nil { + return nil + } + return d.Url } -func (d *DetachedIntegrationFromSource) UnmarshalJSON(data []byte) error { - type unmarshaler DetachedIntegrationFromSource - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (d *DestinationTypeConfigApiKey) GetRateLimit() *float64 { + if d == nil { + return nil } - *d = DetachedIntegrationFromSource(value) + return d.RateLimit +} - extraProperties, err := core.ExtractExtraProperties(data, *d) - if err != nil { - return err +func (d *DestinationTypeConfigApiKey) GetRateLimitPeriod() *DestinationTypeConfigApiKeyRateLimitPeriod { + if d == nil { + return nil } - d.extraProperties = extraProperties + return d.RateLimitPeriod +} - d._rawJSON = json.RawMessage(data) - return nil +func (d *DestinationTypeConfigApiKey) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (d *DetachedIntegrationFromSource) String() string { - if len(d._rawJSON) > 0 { - if value, err := core.StringifyJSON(d._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(d); err == nil { - return value +func (d *DestinationTypeConfigApiKey) GetHttpMethod() *DestinationTypeConfigApiKeyHttpMethod { + if d == nil { + return nil } - return fmt.Sprintf("%#v", d) + return d.HttpMethod } -type Event struct { - // ID of the event - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // ID of the associated connection - WebhookId string `json:"webhook_id" url:"webhook_id"` - // ID of the associated source - SourceId string `json:"source_id" url:"source_id"` - // ID of the associated destination - DestinationId string `json:"destination_id" url:"destination_id"` - // ID of the event data - EventDataId string `json:"event_data_id" url:"event_data_id"` - // ID of the request that created the event - RequestId string `json:"request_id" url:"request_id"` - // Number of delivery attempts made - Attempts int `json:"attempts" url:"attempts"` - // Date of the most recently attempted retry - LastAttemptAt *time.Time `json:"last_attempt_at,omitempty" url:"last_attempt_at,omitempty"` - // Date of the next scheduled retry - NextAttemptAt *time.Time `json:"next_attempt_at,omitempty" url:"next_attempt_at,omitempty"` - // Event status - ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` - ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` - Status EventStatus `json:"status" url:"status"` - // Date of the latest successful attempt - SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` - // ID of the CLI the event is sent to - CliId *string `json:"cli_id,omitempty" url:"cli_id,omitempty"` - // Date the event was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the event was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigApiKey) GetAuth() *DestinationTypeConfigApiKeyAuth { + if d == nil { + return nil + } + return d.Auth } -func (e *Event) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (d *DestinationTypeConfigApiKey) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (e *Event) UnmarshalJSON(data []byte) error { - type embed Event - var unmarshaler = struct { - embed - LastAttemptAt *core.DateTime `json:"last_attempt_at,omitempty"` - NextAttemptAt *core.DateTime `json:"next_attempt_at,omitempty"` - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*e), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (d *DestinationTypeConfigApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigApiKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *e = Event(unmarshaler.embed) - e.LastAttemptAt = unmarshaler.LastAttemptAt.TimePtr() - e.NextAttemptAt = unmarshaler.NextAttemptAt.TimePtr() - e.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() - e.UpdatedAt = unmarshaler.UpdatedAt.Time() - e.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *d = DestinationTypeConfigApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (e *Event) MarshalJSON() ([]byte, error) { - type embed Event - var marshaler = struct { - embed - LastAttemptAt *core.DateTime `json:"last_attempt_at,omitempty"` - NextAttemptAt *core.DateTime `json:"next_attempt_at,omitempty"` - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*e), - LastAttemptAt: core.NewOptionalDateTime(e.LastAttemptAt), - NextAttemptAt: core.NewOptionalDateTime(e.NextAttemptAt), - SuccessfulAt: core.NewOptionalDateTime(e.SuccessfulAt), - UpdatedAt: core.NewDateTime(e.UpdatedAt), - CreatedAt: core.NewDateTime(e.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (e *Event) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (d *DestinationTypeConfigApiKey) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", d) } -type EventArray = []*Event - -type EventAttempt struct { - // Attempt ID - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // Event ID - EventId string `json:"event_id" url:"event_id"` - // Destination ID - DestinationId string `json:"destination_id" url:"destination_id"` - // Attempt's HTTP response code - ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` - // Sequential number of attempts (up to and including this one) made for the associated event - AttemptNumber *int `json:"attempt_number,omitempty" url:"attempt_number,omitempty"` - Trigger *AttemptTrigger `json:"trigger,omitempty" url:"trigger,omitempty"` - ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` - Body *EventAttemptBody `json:"body,omitempty" url:"body,omitempty"` - // URL of the destination where delivery was attempted - RequestedUrl *string `json:"requested_url,omitempty" url:"requested_url,omitempty"` - // HTTP method used to deliver the attempt - HttpMethod *EventAttemptHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` - // ID of associated bulk retry - BulkRetryId *string `json:"bulk_retry_id,omitempty" url:"bulk_retry_id,omitempty"` - Status AttemptStatus `json:"status" url:"status"` - // Date the attempt was successful - SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` - // Date the attempt was delivered - DeliveredAt *time.Time `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` - // Date the destination responded to this attempt - RespondedAt *time.Time `json:"responded_at,omitempty" url:"responded_at,omitempty"` - // Time elapsed between attempt initiation and final delivery (in ms) - DeliveryLatency *int `json:"delivery_latency,omitempty" url:"delivery_latency,omitempty"` - // Time elapsed between attempt initiation and a response from the destination (in ms) - ResponseLatency *int `json:"response_latency,omitempty" url:"response_latency,omitempty"` - // Date the attempt was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the attempt was created - CreatedAt time.Time `json:"created_at" url:"created_at"` +type DestinationTypeConfigApiKeyAuth struct { + Key string `json:"key" url:"key"` + ApiKey string `json:"api_key" url:"api_key"` + To DestinationTypeConfigApiKeyAuthTo `json:"to" url:"to"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (e *EventAttempt) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (d *DestinationTypeConfigApiKeyAuth) GetKey() string { + if d == nil { + return "" + } + return d.Key } -func (e *EventAttempt) UnmarshalJSON(data []byte) error { - type embed EventAttempt - var unmarshaler = struct { - embed - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - DeliveredAt *core.DateTime `json:"delivered_at,omitempty"` - RespondedAt *core.DateTime `json:"responded_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*e), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err +func (d *DestinationTypeConfigApiKeyAuth) GetApiKey() string { + if d == nil { + return "" } - *e = EventAttempt(unmarshaler.embed) - e.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() - e.DeliveredAt = unmarshaler.DeliveredAt.TimePtr() - e.RespondedAt = unmarshaler.RespondedAt.TimePtr() - e.UpdatedAt = unmarshaler.UpdatedAt.Time() - e.CreatedAt = unmarshaler.CreatedAt.Time() + return d.ApiKey +} - extraProperties, err := core.ExtractExtraProperties(data, *e) - if err != nil { - return err +func (d *DestinationTypeConfigApiKeyAuth) GetTo() DestinationTypeConfigApiKeyAuthTo { + if d == nil { + return "" } - e.extraProperties = extraProperties + return d.To +} - e._rawJSON = json.RawMessage(data) - return nil +func (d *DestinationTypeConfigApiKeyAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (e *EventAttempt) MarshalJSON() ([]byte, error) { - type embed EventAttempt - var marshaler = struct { - embed - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - DeliveredAt *core.DateTime `json:"delivered_at,omitempty"` - RespondedAt *core.DateTime `json:"responded_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*e), - SuccessfulAt: core.NewOptionalDateTime(e.SuccessfulAt), - DeliveredAt: core.NewOptionalDateTime(e.DeliveredAt), - RespondedAt: core.NewOptionalDateTime(e.RespondedAt), - UpdatedAt: core.NewDateTime(e.UpdatedAt), - CreatedAt: core.NewDateTime(e.CreatedAt), +func (d *DestinationTypeConfigApiKeyAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigApiKeyAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - return json.Marshal(marshaler) + *d = DestinationTypeConfigApiKeyAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil } -func (e *EventAttempt) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (d *DestinationTypeConfigApiKeyAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", d) } -type EventAttemptBody struct { - // Response body from the destination - EventAttemptBodyZeroOptional *EventAttemptBodyZero - // Response body from the destination - StringOptional *string +type DestinationTypeConfigApiKeyAuthTo string + +const ( + DestinationTypeConfigApiKeyAuthToHeader DestinationTypeConfigApiKeyAuthTo = "header" + DestinationTypeConfigApiKeyAuthToQuery DestinationTypeConfigApiKeyAuthTo = "query" +) + +func NewDestinationTypeConfigApiKeyAuthToFromString(s string) (DestinationTypeConfigApiKeyAuthTo, error) { + switch s { + case "header": + return DestinationTypeConfigApiKeyAuthToHeader, nil + case "query": + return DestinationTypeConfigApiKeyAuthToQuery, nil + } + var t DestinationTypeConfigApiKeyAuthTo + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func NewEventAttemptBodyFromEventAttemptBodyZeroOptional(value *EventAttemptBodyZero) *EventAttemptBody { - return &EventAttemptBody{EventAttemptBodyZeroOptional: value} +func (d DestinationTypeConfigApiKeyAuthTo) Ptr() *DestinationTypeConfigApiKeyAuthTo { + return &d } -func NewEventAttemptBodyFromStringOptional(value *string) *EventAttemptBody { - return &EventAttemptBody{StringOptional: value} +type DestinationTypeConfigApiKeyHttpMethod string + +const ( + DestinationTypeConfigApiKeyHttpMethodGet DestinationTypeConfigApiKeyHttpMethod = "GET" + DestinationTypeConfigApiKeyHttpMethodPost DestinationTypeConfigApiKeyHttpMethod = "POST" + DestinationTypeConfigApiKeyHttpMethodPut DestinationTypeConfigApiKeyHttpMethod = "PUT" + DestinationTypeConfigApiKeyHttpMethodPatch DestinationTypeConfigApiKeyHttpMethod = "PATCH" + DestinationTypeConfigApiKeyHttpMethodDelete DestinationTypeConfigApiKeyHttpMethod = "DELETE" +) + +func NewDestinationTypeConfigApiKeyHttpMethodFromString(s string) (DestinationTypeConfigApiKeyHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigApiKeyHttpMethodGet, nil + case "POST": + return DestinationTypeConfigApiKeyHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigApiKeyHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigApiKeyHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigApiKeyHttpMethodDelete, nil + } + var t DestinationTypeConfigApiKeyHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e *EventAttemptBody) UnmarshalJSON(data []byte) error { - var valueEventAttemptBodyZeroOptional *EventAttemptBodyZero - if err := json.Unmarshal(data, &valueEventAttemptBodyZeroOptional); err == nil { - e.EventAttemptBodyZeroOptional = valueEventAttemptBodyZeroOptional - return nil +func (d DestinationTypeConfigApiKeyHttpMethod) Ptr() *DestinationTypeConfigApiKeyHttpMethod { + return &d +} + +type DestinationTypeConfigApiKeyRateLimitPeriod string + +const ( + DestinationTypeConfigApiKeyRateLimitPeriodSecond DestinationTypeConfigApiKeyRateLimitPeriod = "second" + DestinationTypeConfigApiKeyRateLimitPeriodMinute DestinationTypeConfigApiKeyRateLimitPeriod = "minute" + DestinationTypeConfigApiKeyRateLimitPeriodHour DestinationTypeConfigApiKeyRateLimitPeriod = "hour" + DestinationTypeConfigApiKeyRateLimitPeriodConcurrent DestinationTypeConfigApiKeyRateLimitPeriod = "concurrent" +) + +func NewDestinationTypeConfigApiKeyRateLimitPeriodFromString(s string) (DestinationTypeConfigApiKeyRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigApiKeyRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigApiKeyRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigApiKeyRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigApiKeyRateLimitPeriodConcurrent, nil } - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - e.StringOptional = valueStringOptional + var t DestinationTypeConfigApiKeyRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationTypeConfigApiKeyRateLimitPeriod) Ptr() *DestinationTypeConfigApiKeyRateLimitPeriod { + return &d +} + +// The type config for AWS Signature. Requires type to be `AWS_SIGNATURE`. +type DestinationTypeConfigAwsSignature struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigAwsSignatureRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigAwsSignatureHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigAwsSignatureAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DestinationTypeConfigAwsSignature) GetUrl() *string { + if d == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + return d.Url } -func (e EventAttemptBody) MarshalJSON() ([]byte, error) { - if e.EventAttemptBodyZeroOptional != nil { - return json.Marshal(e.EventAttemptBodyZeroOptional) - } - if e.StringOptional != nil { - return json.Marshal(e.StringOptional) +func (d *DestinationTypeConfigAwsSignature) GetRateLimit() *float64 { + if d == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return d.RateLimit } -type EventAttemptBodyVisitor interface { - VisitEventAttemptBodyZeroOptional(*EventAttemptBodyZero) error - VisitStringOptional(*string) error +func (d *DestinationTypeConfigAwsSignature) GetRateLimitPeriod() *DestinationTypeConfigAwsSignatureRateLimitPeriod { + if d == nil { + return nil + } + return d.RateLimitPeriod } -func (e *EventAttemptBody) Accept(visitor EventAttemptBodyVisitor) error { - if e.EventAttemptBodyZeroOptional != nil { - return visitor.VisitEventAttemptBodyZeroOptional(e.EventAttemptBodyZeroOptional) +func (d *DestinationTypeConfigAwsSignature) GetPathForwardingDisabled() *bool { + if d == nil { + return nil } - if e.StringOptional != nil { - return visitor.VisitStringOptional(e.StringOptional) + return d.PathForwardingDisabled +} + +func (d *DestinationTypeConfigAwsSignature) GetHttpMethod() *DestinationTypeConfigAwsSignatureHttpMethod { + if d == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", e) + return d.HttpMethod } -// Response body from the destination -type EventAttemptBodyZero struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigAwsSignature) GetAuth() *DestinationTypeConfigAwsSignatureAuth { + if d == nil { + return nil + } + return d.Auth } -func (e *EventAttemptBodyZero) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (d *DestinationTypeConfigAwsSignature) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (e *EventAttemptBodyZero) UnmarshalJSON(data []byte) error { - type unmarshaler EventAttemptBodyZero +func (d *DestinationTypeConfigAwsSignature) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigAwsSignature var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventAttemptBodyZero(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *d = DestinationTypeConfigAwsSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (e *EventAttemptBodyZero) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (d *DestinationTypeConfigAwsSignature) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", d) } -// HTTP method used to deliver the attempt -type EventAttemptHttpMethod string +type DestinationTypeConfigAwsSignatureAuth struct { + AccessKeyId string `json:"access_key_id" url:"access_key_id"` + SecretAccessKey string `json:"secret_access_key" url:"secret_access_key"` + Region string `json:"region" url:"region"` + Service string `json:"service" url:"service"` -const ( - EventAttemptHttpMethodGet EventAttemptHttpMethod = "GET" - EventAttemptHttpMethodPost EventAttemptHttpMethod = "POST" - EventAttemptHttpMethodPut EventAttemptHttpMethod = "PUT" - EventAttemptHttpMethodPatch EventAttemptHttpMethod = "PATCH" - EventAttemptHttpMethodDelete EventAttemptHttpMethod = "DELETE" -) + extraProperties map[string]interface{} + rawJSON json.RawMessage +} -func NewEventAttemptHttpMethodFromString(s string) (EventAttemptHttpMethod, error) { - switch s { - case "GET": - return EventAttemptHttpMethodGet, nil - case "POST": - return EventAttemptHttpMethodPost, nil - case "PUT": - return EventAttemptHttpMethodPut, nil - case "PATCH": - return EventAttemptHttpMethodPatch, nil - case "DELETE": - return EventAttemptHttpMethodDelete, nil +func (d *DestinationTypeConfigAwsSignatureAuth) GetAccessKeyId() string { + if d == nil { + return "" } - var t EventAttemptHttpMethod - return "", fmt.Errorf("%s is not a valid %T", s, t) + return d.AccessKeyId } -func (e EventAttemptHttpMethod) Ptr() *EventAttemptHttpMethod { - return &e +func (d *DestinationTypeConfigAwsSignatureAuth) GetSecretAccessKey() string { + if d == nil { + return "" + } + return d.SecretAccessKey } -type EventAttemptPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*EventAttempt `json:"models,omitempty" url:"models,omitempty"` +func (d *DestinationTypeConfigAwsSignatureAuth) GetRegion() string { + if d == nil { + return "" + } + return d.Region +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigAwsSignatureAuth) GetService() string { + if d == nil { + return "" + } + return d.Service } -func (e *EventAttemptPaginatedResult) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (d *DestinationTypeConfigAwsSignatureAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (e *EventAttemptPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler EventAttemptPaginatedResult +func (d *DestinationTypeConfigAwsSignatureAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigAwsSignatureAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventAttemptPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *d = DestinationTypeConfigAwsSignatureAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (e *EventAttemptPaginatedResult) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (d *DestinationTypeConfigAwsSignatureAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", e) -} - -type EventPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Event `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return fmt.Sprintf("%#v", d) } -func (e *EventPaginatedResult) GetExtraProperties() map[string]interface{} { - return e.extraProperties -} +type DestinationTypeConfigAwsSignatureHttpMethod string -func (e *EventPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler EventPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *e = EventPaginatedResult(value) +const ( + DestinationTypeConfigAwsSignatureHttpMethodGet DestinationTypeConfigAwsSignatureHttpMethod = "GET" + DestinationTypeConfigAwsSignatureHttpMethodPost DestinationTypeConfigAwsSignatureHttpMethod = "POST" + DestinationTypeConfigAwsSignatureHttpMethodPut DestinationTypeConfigAwsSignatureHttpMethod = "PUT" + DestinationTypeConfigAwsSignatureHttpMethodPatch DestinationTypeConfigAwsSignatureHttpMethod = "PATCH" + DestinationTypeConfigAwsSignatureHttpMethodDelete DestinationTypeConfigAwsSignatureHttpMethod = "DELETE" +) - extraProperties, err := core.ExtractExtraProperties(data, *e) - if err != nil { - return err +func NewDestinationTypeConfigAwsSignatureHttpMethodFromString(s string) (DestinationTypeConfigAwsSignatureHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigAwsSignatureHttpMethodGet, nil + case "POST": + return DestinationTypeConfigAwsSignatureHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigAwsSignatureHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigAwsSignatureHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigAwsSignatureHttpMethodDelete, nil } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) - return nil + var t DestinationTypeConfigAwsSignatureHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e *EventPaginatedResult) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(e); err == nil { - return value - } - return fmt.Sprintf("%#v", e) +func (d DestinationTypeConfigAwsSignatureHttpMethod) Ptr() *DestinationTypeConfigAwsSignatureHttpMethod { + return &d } -type EventStatus string +type DestinationTypeConfigAwsSignatureRateLimitPeriod string const ( - EventStatusScheduled EventStatus = "SCHEDULED" - EventStatusQueued EventStatus = "QUEUED" - EventStatusHold EventStatus = "HOLD" - EventStatusSuccessful EventStatus = "SUCCESSFUL" - EventStatusFailed EventStatus = "FAILED" + DestinationTypeConfigAwsSignatureRateLimitPeriodSecond DestinationTypeConfigAwsSignatureRateLimitPeriod = "second" + DestinationTypeConfigAwsSignatureRateLimitPeriodMinute DestinationTypeConfigAwsSignatureRateLimitPeriod = "minute" + DestinationTypeConfigAwsSignatureRateLimitPeriodHour DestinationTypeConfigAwsSignatureRateLimitPeriod = "hour" + DestinationTypeConfigAwsSignatureRateLimitPeriodConcurrent DestinationTypeConfigAwsSignatureRateLimitPeriod = "concurrent" ) -func NewEventStatusFromString(s string) (EventStatus, error) { +func NewDestinationTypeConfigAwsSignatureRateLimitPeriodFromString(s string) (DestinationTypeConfigAwsSignatureRateLimitPeriod, error) { switch s { - case "SCHEDULED": - return EventStatusScheduled, nil - case "QUEUED": - return EventStatusQueued, nil - case "HOLD": - return EventStatusHold, nil - case "SUCCESSFUL": - return EventStatusSuccessful, nil - case "FAILED": - return EventStatusFailed, nil + case "second": + return DestinationTypeConfigAwsSignatureRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigAwsSignatureRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigAwsSignatureRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigAwsSignatureRateLimitPeriodConcurrent, nil } - var t EventStatus + var t DestinationTypeConfigAwsSignatureRateLimitPeriod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (e EventStatus) Ptr() *EventStatus { - return &e +func (d DestinationTypeConfigAwsSignatureRateLimitPeriod) Ptr() *DestinationTypeConfigAwsSignatureRateLimitPeriod { + return &d } -type FilterRule struct { - Headers *FilterRuleProperty `json:"headers,omitempty" url:"headers,omitempty"` - Body *FilterRuleProperty `json:"body,omitempty" url:"body,omitempty"` - Query *FilterRuleProperty `json:"query,omitempty" url:"query,omitempty"` - Path *FilterRuleProperty `json:"path,omitempty" url:"path,omitempty"` +// The type config for Basic Auth. Requires type to be `BASIC_AUTH`. +type DestinationTypeConfigBasicAuth struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigBasicAuthRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigBasicAuthHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigBasicAuthAuth `json:"auth,omitempty" url:"auth,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (d *DestinationTypeConfigBasicAuth) GetUrl() *string { + if d == nil { + return nil + } + return d.Url +} + +func (d *DestinationTypeConfigBasicAuth) GetRateLimit() *float64 { + if d == nil { + return nil + } + return d.RateLimit +} + +func (d *DestinationTypeConfigBasicAuth) GetRateLimitPeriod() *DestinationTypeConfigBasicAuthRateLimitPeriod { + if d == nil { + return nil + } + return d.RateLimitPeriod +} + +func (d *DestinationTypeConfigBasicAuth) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled +} + +func (d *DestinationTypeConfigBasicAuth) GetHttpMethod() *DestinationTypeConfigBasicAuthHttpMethod { + if d == nil { + return nil + } + return d.HttpMethod +} + +func (d *DestinationTypeConfigBasicAuth) GetAuth() *DestinationTypeConfigBasicAuthAuth { + if d == nil { + return nil + } + return d.Auth } -func (f *FilterRule) GetExtraProperties() map[string]interface{} { - return f.extraProperties +func (d *DestinationTypeConfigBasicAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (f *FilterRule) UnmarshalJSON(data []byte) error { - type unmarshaler FilterRule +func (d *DestinationTypeConfigBasicAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigBasicAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *f = FilterRule(value) - - extraProperties, err := core.ExtractExtraProperties(data, *f) + *d = DestinationTypeConfigBasicAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - f.extraProperties = extraProperties - - f._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (f *FilterRule) String() string { - if len(f._rawJSON) > 0 { - if value, err := core.StringifyJSON(f._rawJSON); err == nil { +func (d *DestinationTypeConfigBasicAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(f); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", f) + return fmt.Sprintf("%#v", d) } -// JSON using our filter syntax to filter on request headers -type FilterRuleProperty struct { - StringOptional *string - DoubleOptional *float64 - BooleanOptional *bool - StringUnknownMapOptional map[string]interface{} -} +type DestinationTypeConfigBasicAuthAuth struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` -func NewFilterRulePropertyFromStringOptional(value *string) *FilterRuleProperty { - return &FilterRuleProperty{StringOptional: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewFilterRulePropertyFromDoubleOptional(value *float64) *FilterRuleProperty { - return &FilterRuleProperty{DoubleOptional: value} +func (d *DestinationTypeConfigBasicAuthAuth) GetUsername() *string { + if d == nil { + return nil + } + return d.Username } -func NewFilterRulePropertyFromBooleanOptional(value *bool) *FilterRuleProperty { - return &FilterRuleProperty{BooleanOptional: value} +func (d *DestinationTypeConfigBasicAuthAuth) GetPassword() *string { + if d == nil { + return nil + } + return d.Password } -func NewFilterRulePropertyFromStringUnknownMapOptional(value map[string]interface{}) *FilterRuleProperty { - return &FilterRuleProperty{StringUnknownMapOptional: value} +func (d *DestinationTypeConfigBasicAuthAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (f *FilterRuleProperty) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - f.StringOptional = valueStringOptional - return nil - } - var valueDoubleOptional *float64 - if err := json.Unmarshal(data, &valueDoubleOptional); err == nil { - f.DoubleOptional = valueDoubleOptional - return nil - } - var valueBooleanOptional *bool - if err := json.Unmarshal(data, &valueBooleanOptional); err == nil { - f.BooleanOptional = valueBooleanOptional - return nil +func (d *DestinationTypeConfigBasicAuthAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigBasicAuthAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueStringUnknownMapOptional map[string]interface{} - if err := json.Unmarshal(data, &valueStringUnknownMapOptional); err == nil { - f.StringUnknownMapOptional = valueStringUnknownMapOptional - return nil + *d = DestinationTypeConfigBasicAuthAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, f) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil } -func (f FilterRuleProperty) MarshalJSON() ([]byte, error) { - if f.StringOptional != nil { - return json.Marshal(f.StringOptional) - } - if f.DoubleOptional != nil { - return json.Marshal(f.DoubleOptional) - } - if f.BooleanOptional != nil { - return json.Marshal(f.BooleanOptional) +func (d *DestinationTypeConfigBasicAuthAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } } - if f.StringUnknownMapOptional != nil { - return json.Marshal(f.StringUnknownMapOptional) + if value, err := internal.StringifyJSON(d); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", f) + return fmt.Sprintf("%#v", d) } -type FilterRulePropertyVisitor interface { - VisitStringOptional(*string) error - VisitDoubleOptional(*float64) error - VisitBooleanOptional(*bool) error - VisitStringUnknownMapOptional(map[string]interface{}) error -} +type DestinationTypeConfigBasicAuthHttpMethod string -func (f *FilterRuleProperty) Accept(visitor FilterRulePropertyVisitor) error { - if f.StringOptional != nil { - return visitor.VisitStringOptional(f.StringOptional) - } - if f.DoubleOptional != nil { - return visitor.VisitDoubleOptional(f.DoubleOptional) - } - if f.BooleanOptional != nil { - return visitor.VisitBooleanOptional(f.BooleanOptional) - } - if f.StringUnknownMapOptional != nil { - return visitor.VisitStringUnknownMapOptional(f.StringUnknownMapOptional) +const ( + DestinationTypeConfigBasicAuthHttpMethodGet DestinationTypeConfigBasicAuthHttpMethod = "GET" + DestinationTypeConfigBasicAuthHttpMethodPost DestinationTypeConfigBasicAuthHttpMethod = "POST" + DestinationTypeConfigBasicAuthHttpMethodPut DestinationTypeConfigBasicAuthHttpMethod = "PUT" + DestinationTypeConfigBasicAuthHttpMethodPatch DestinationTypeConfigBasicAuthHttpMethod = "PATCH" + DestinationTypeConfigBasicAuthHttpMethodDelete DestinationTypeConfigBasicAuthHttpMethod = "DELETE" +) + +func NewDestinationTypeConfigBasicAuthHttpMethodFromString(s string) (DestinationTypeConfigBasicAuthHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigBasicAuthHttpMethodGet, nil + case "POST": + return DestinationTypeConfigBasicAuthHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigBasicAuthHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigBasicAuthHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigBasicAuthHttpMethodDelete, nil } - return fmt.Errorf("type %T does not include a non-empty union type", f) + var t DestinationTypeConfigBasicAuthHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -type FilteredMeta = []FilteredMetaItem +func (d DestinationTypeConfigBasicAuthHttpMethod) Ptr() *DestinationTypeConfigBasicAuthHttpMethod { + return &d +} -type FilteredMetaItem string +type DestinationTypeConfigBasicAuthRateLimitPeriod string const ( - FilteredMetaItemBody FilteredMetaItem = "body" - FilteredMetaItemHeaders FilteredMetaItem = "headers" - FilteredMetaItemPath FilteredMetaItem = "path" - FilteredMetaItemQuery FilteredMetaItem = "query" + DestinationTypeConfigBasicAuthRateLimitPeriodSecond DestinationTypeConfigBasicAuthRateLimitPeriod = "second" + DestinationTypeConfigBasicAuthRateLimitPeriodMinute DestinationTypeConfigBasicAuthRateLimitPeriod = "minute" + DestinationTypeConfigBasicAuthRateLimitPeriodHour DestinationTypeConfigBasicAuthRateLimitPeriod = "hour" + DestinationTypeConfigBasicAuthRateLimitPeriodConcurrent DestinationTypeConfigBasicAuthRateLimitPeriod = "concurrent" ) -func NewFilteredMetaItemFromString(s string) (FilteredMetaItem, error) { +func NewDestinationTypeConfigBasicAuthRateLimitPeriodFromString(s string) (DestinationTypeConfigBasicAuthRateLimitPeriod, error) { switch s { - case "body": - return FilteredMetaItemBody, nil - case "headers": - return FilteredMetaItemHeaders, nil - case "path": - return FilteredMetaItemPath, nil - case "query": - return FilteredMetaItemQuery, nil + case "second": + return DestinationTypeConfigBasicAuthRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigBasicAuthRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigBasicAuthRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigBasicAuthRateLimitPeriodConcurrent, nil } - var t FilteredMetaItem + var t DestinationTypeConfigBasicAuthRateLimitPeriod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (f FilteredMetaItem) Ptr() *FilteredMetaItem { - return &f +func (d DestinationTypeConfigBasicAuthRateLimitPeriod) Ptr() *DestinationTypeConfigBasicAuthRateLimitPeriod { + return &d } -type HandledApiKeyIntegrationConfigs struct { - ApiKey string `json:"api_key" url:"api_key"` +// The type config for Bearer Token. Requires type to be `BEARER_TOKEN`. +type DestinationTypeConfigBearerToken struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigBearerTokenRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigBearerTokenHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigBearerTokenAuth `json:"auth,omitempty" url:"auth,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (h *HandledApiKeyIntegrationConfigs) GetExtraProperties() map[string]interface{} { - return h.extraProperties +func (d *DestinationTypeConfigBearerToken) GetUrl() *string { + if d == nil { + return nil + } + return d.Url } -func (h *HandledApiKeyIntegrationConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler HandledApiKeyIntegrationConfigs +func (d *DestinationTypeConfigBearerToken) GetRateLimit() *float64 { + if d == nil { + return nil + } + return d.RateLimit +} + +func (d *DestinationTypeConfigBearerToken) GetRateLimitPeriod() *DestinationTypeConfigBearerTokenRateLimitPeriod { + if d == nil { + return nil + } + return d.RateLimitPeriod +} + +func (d *DestinationTypeConfigBearerToken) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled +} + +func (d *DestinationTypeConfigBearerToken) GetHttpMethod() *DestinationTypeConfigBearerTokenHttpMethod { + if d == nil { + return nil + } + return d.HttpMethod +} + +func (d *DestinationTypeConfigBearerToken) GetAuth() *DestinationTypeConfigBearerTokenAuth { + if d == nil { + return nil + } + return d.Auth +} + +func (d *DestinationTypeConfigBearerToken) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigBearerToken) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigBearerToken var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *h = HandledApiKeyIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *h) + *d = DestinationTypeConfigBearerToken(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - h.extraProperties = extraProperties - - h._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (h *HandledApiKeyIntegrationConfigs) String() string { - if len(h._rawJSON) > 0 { - if value, err := core.StringifyJSON(h._rawJSON); err == nil { +func (d *DestinationTypeConfigBearerToken) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(h); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", h) + return fmt.Sprintf("%#v", d) } -type HandledHmacConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type DestinationTypeConfigBearerTokenAuth struct { + Token string `json:"token" url:"token"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (h *HandledHmacConfigs) GetExtraProperties() map[string]interface{} { - return h.extraProperties +func (d *DestinationTypeConfigBearerTokenAuth) GetToken() string { + if d == nil { + return "" + } + return d.Token } -func (h *HandledHmacConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler HandledHmacConfigs +func (d *DestinationTypeConfigBearerTokenAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigBearerTokenAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigBearerTokenAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *h = HandledHmacConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *h) + *d = DestinationTypeConfigBearerTokenAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - h.extraProperties = extraProperties - - h._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (h *HandledHmacConfigs) String() string { - if len(h._rawJSON) > 0 { - if value, err := core.StringifyJSON(h._rawJSON); err == nil { +func (d *DestinationTypeConfigBearerTokenAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(h); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", h) + return fmt.Sprintf("%#v", d) } -type HmacAlgorithms string +type DestinationTypeConfigBearerTokenHttpMethod string const ( - HmacAlgorithmsMd5 HmacAlgorithms = "md5" - HmacAlgorithmsSha1 HmacAlgorithms = "sha1" - HmacAlgorithmsSha256 HmacAlgorithms = "sha256" - HmacAlgorithmsSha512 HmacAlgorithms = "sha512" + DestinationTypeConfigBearerTokenHttpMethodGet DestinationTypeConfigBearerTokenHttpMethod = "GET" + DestinationTypeConfigBearerTokenHttpMethodPost DestinationTypeConfigBearerTokenHttpMethod = "POST" + DestinationTypeConfigBearerTokenHttpMethodPut DestinationTypeConfigBearerTokenHttpMethod = "PUT" + DestinationTypeConfigBearerTokenHttpMethodPatch DestinationTypeConfigBearerTokenHttpMethod = "PATCH" + DestinationTypeConfigBearerTokenHttpMethodDelete DestinationTypeConfigBearerTokenHttpMethod = "DELETE" ) -func NewHmacAlgorithmsFromString(s string) (HmacAlgorithms, error) { +func NewDestinationTypeConfigBearerTokenHttpMethodFromString(s string) (DestinationTypeConfigBearerTokenHttpMethod, error) { switch s { - case "md5": - return HmacAlgorithmsMd5, nil - case "sha1": - return HmacAlgorithmsSha1, nil - case "sha256": - return HmacAlgorithmsSha256, nil - case "sha512": - return HmacAlgorithmsSha512, nil + case "GET": + return DestinationTypeConfigBearerTokenHttpMethodGet, nil + case "POST": + return DestinationTypeConfigBearerTokenHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigBearerTokenHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigBearerTokenHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigBearerTokenHttpMethodDelete, nil } - var t HmacAlgorithms + var t DestinationTypeConfigBearerTokenHttpMethod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (h HmacAlgorithms) Ptr() *HmacAlgorithms { - return &h +func (d DestinationTypeConfigBearerTokenHttpMethod) Ptr() *DestinationTypeConfigBearerTokenHttpMethod { + return &d } -type HmacIntegrationConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - Algorithm HmacAlgorithms `json:"algorithm" url:"algorithm"` - HeaderKey string `json:"header_key" url:"header_key"` - Encoding HmacIntegrationConfigsEncoding `json:"encoding" url:"encoding"` +type DestinationTypeConfigBearerTokenRateLimitPeriod string + +const ( + DestinationTypeConfigBearerTokenRateLimitPeriodSecond DestinationTypeConfigBearerTokenRateLimitPeriod = "second" + DestinationTypeConfigBearerTokenRateLimitPeriodMinute DestinationTypeConfigBearerTokenRateLimitPeriod = "minute" + DestinationTypeConfigBearerTokenRateLimitPeriodHour DestinationTypeConfigBearerTokenRateLimitPeriod = "hour" + DestinationTypeConfigBearerTokenRateLimitPeriodConcurrent DestinationTypeConfigBearerTokenRateLimitPeriod = "concurrent" +) + +func NewDestinationTypeConfigBearerTokenRateLimitPeriodFromString(s string) (DestinationTypeConfigBearerTokenRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigBearerTokenRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigBearerTokenRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigBearerTokenRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigBearerTokenRateLimitPeriodConcurrent, nil + } + var t DestinationTypeConfigBearerTokenRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationTypeConfigBearerTokenRateLimitPeriod) Ptr() *DestinationTypeConfigBearerTokenRateLimitPeriod { + return &d +} + +// The type config for CLI. Requires type to be `CLI`. +type DestinationTypeConfigCli struct { + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigCliHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigCliAuth `json:"auth,omitempty" url:"auth,omitempty"` + Configs *DestinationTypeConfigCliConfigs `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (h *HmacIntegrationConfigs) GetExtraProperties() map[string]interface{} { - return h.extraProperties +func (d *DestinationTypeConfigCli) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (h *HmacIntegrationConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler HmacIntegrationConfigs +func (d *DestinationTypeConfigCli) GetHttpMethod() *DestinationTypeConfigCliHttpMethod { + if d == nil { + return nil + } + return d.HttpMethod +} + +func (d *DestinationTypeConfigCli) GetAuth() *DestinationTypeConfigCliAuth { + if d == nil { + return nil + } + return d.Auth +} + +func (d *DestinationTypeConfigCli) GetConfigs() *DestinationTypeConfigCliConfigs { + if d == nil { + return nil + } + return d.Configs +} + +func (d *DestinationTypeConfigCli) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigCli) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigCli var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *h = HmacIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *h) + *d = DestinationTypeConfigCli(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - h.extraProperties = extraProperties - - h._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (h *HmacIntegrationConfigs) String() string { - if len(h._rawJSON) > 0 { - if value, err := core.StringifyJSON(h._rawJSON); err == nil { +func (d *DestinationTypeConfigCli) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(h); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", h) + return fmt.Sprintf("%#v", d) } -type HmacIntegrationConfigsEncoding string +type DestinationTypeConfigCliAuth struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} -const ( - HmacIntegrationConfigsEncodingBase64 HmacIntegrationConfigsEncoding = "base64" - HmacIntegrationConfigsEncodingHex HmacIntegrationConfigsEncoding = "hex" -) +func (d *DestinationTypeConfigCliAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} -func NewHmacIntegrationConfigsEncodingFromString(s string) (HmacIntegrationConfigsEncoding, error) { - switch s { - case "base64": - return HmacIntegrationConfigsEncodingBase64, nil - case "hex": - return HmacIntegrationConfigsEncodingHex, nil +func (d *DestinationTypeConfigCliAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigCliAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var t HmacIntegrationConfigsEncoding - return "", fmt.Errorf("%s is not a valid %T", s, t) + *d = DestinationTypeConfigCliAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil } -func (h HmacIntegrationConfigsEncoding) Ptr() *HmacIntegrationConfigsEncoding { - return &h +func (d *DestinationTypeConfigCliAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) } -type IgnoredEvent struct { - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - WebhookId string `json:"webhook_id" url:"webhook_id"` - Cause IgnoredEventCause `json:"cause" url:"cause"` - RequestId string `json:"request_id" url:"request_id"` - Meta *IgnoredEventMeta `json:"meta,omitempty" url:"meta,omitempty"` - CreatedAt time.Time `json:"created_at" url:"created_at"` - +type DestinationTypeConfigCliConfigs struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IgnoredEvent) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigCliConfigs) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IgnoredEvent) UnmarshalJSON(data []byte) error { - type embed IgnoredEvent - var unmarshaler = struct { - embed - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*i), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (d *DestinationTypeConfigCliConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigCliConfigs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IgnoredEvent(unmarshaler.embed) - i.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigCliConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IgnoredEvent) MarshalJSON() ([]byte, error) { - type embed IgnoredEvent - var marshaler = struct { - embed - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*i), - CreatedAt: core.NewDateTime(i.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (i *IgnoredEvent) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigCliConfigs) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type IgnoredEventCause string +type DestinationTypeConfigCliHttpMethod string const ( - IgnoredEventCauseDisabled IgnoredEventCause = "DISABLED" - IgnoredEventCauseFiltered IgnoredEventCause = "FILTERED" - IgnoredEventCauseTransformationFailed IgnoredEventCause = "TRANSFORMATION_FAILED" - IgnoredEventCauseCliDisconnected IgnoredEventCause = "CLI_DISCONNECTED" + DestinationTypeConfigCliHttpMethodGet DestinationTypeConfigCliHttpMethod = "GET" + DestinationTypeConfigCliHttpMethodPost DestinationTypeConfigCliHttpMethod = "POST" + DestinationTypeConfigCliHttpMethodPut DestinationTypeConfigCliHttpMethod = "PUT" + DestinationTypeConfigCliHttpMethodPatch DestinationTypeConfigCliHttpMethod = "PATCH" + DestinationTypeConfigCliHttpMethodDelete DestinationTypeConfigCliHttpMethod = "DELETE" ) -func NewIgnoredEventCauseFromString(s string) (IgnoredEventCause, error) { +func NewDestinationTypeConfigCliHttpMethodFromString(s string) (DestinationTypeConfigCliHttpMethod, error) { switch s { - case "DISABLED": - return IgnoredEventCauseDisabled, nil - case "FILTERED": - return IgnoredEventCauseFiltered, nil - case "TRANSFORMATION_FAILED": - return IgnoredEventCauseTransformationFailed, nil - case "CLI_DISCONNECTED": - return IgnoredEventCauseCliDisconnected, nil - } - var t IgnoredEventCause + case "GET": + return DestinationTypeConfigCliHttpMethodGet, nil + case "POST": + return DestinationTypeConfigCliHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigCliHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigCliHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigCliHttpMethodDelete, nil + } + var t DestinationTypeConfigCliHttpMethod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i IgnoredEventCause) Ptr() *IgnoredEventCause { - return &i -} - -type IgnoredEventMeta struct { - FilteredMeta FilteredMeta - TransformationFailedMeta *TransformationFailedMeta +func (d DestinationTypeConfigCliHttpMethod) Ptr() *DestinationTypeConfigCliHttpMethod { + return &d } -func NewIgnoredEventMetaFromFilteredMeta(value FilteredMeta) *IgnoredEventMeta { - return &IgnoredEventMeta{FilteredMeta: value} -} +// The type config for Custom SHA-256 HMAC Signature. Requires type to be `CUSTOM_SIGNATURE`. +type DestinationTypeConfigCustomSha256HmacSignature struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigCustomSha256HmacSignatureHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigCustomSha256HmacSignatureAuth `json:"auth,omitempty" url:"auth,omitempty"` -func NewIgnoredEventMetaFromTransformationFailedMeta(value *TransformationFailedMeta) *IgnoredEventMeta { - return &IgnoredEventMeta{TransformationFailedMeta: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IgnoredEventMeta) UnmarshalJSON(data []byte) error { - var valueFilteredMeta FilteredMeta - if err := json.Unmarshal(data, &valueFilteredMeta); err == nil { - i.FilteredMeta = valueFilteredMeta +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetUrl() *string { + if d == nil { return nil } - valueTransformationFailedMeta := new(TransformationFailedMeta) - if err := json.Unmarshal(data, &valueTransformationFailedMeta); err == nil { - i.TransformationFailedMeta = valueTransformationFailedMeta + return d.Url +} + +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetRateLimit() *float64 { + if d == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + return d.RateLimit } -func (i IgnoredEventMeta) MarshalJSON() ([]byte, error) { - if i.FilteredMeta != nil { - return json.Marshal(i.FilteredMeta) - } - if i.TransformationFailedMeta != nil { - return json.Marshal(i.TransformationFailedMeta) +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetRateLimitPeriod() *DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod { + if d == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return d.RateLimitPeriod } -type IgnoredEventMetaVisitor interface { - VisitFilteredMeta(FilteredMeta) error - VisitTransformationFailedMeta(*TransformationFailedMeta) error +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (i *IgnoredEventMeta) Accept(visitor IgnoredEventMetaVisitor) error { - if i.FilteredMeta != nil { - return visitor.VisitFilteredMeta(i.FilteredMeta) - } - if i.TransformationFailedMeta != nil { - return visitor.VisitTransformationFailedMeta(i.TransformationFailedMeta) +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetHttpMethod() *DestinationTypeConfigCustomSha256HmacSignatureHttpMethod { + if d == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", i) + return d.HttpMethod } -type IgnoredEventPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*IgnoredEvent `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetAuth() *DestinationTypeConfigCustomSha256HmacSignatureAuth { + if d == nil { + return nil + } + return d.Auth } -func (i *IgnoredEventPaginatedResult) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigCustomSha256HmacSignature) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IgnoredEventPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler IgnoredEventPaginatedResult +func (d *DestinationTypeConfigCustomSha256HmacSignature) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigCustomSha256HmacSignature var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IgnoredEventPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigCustomSha256HmacSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IgnoredEventPaginatedResult) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigCustomSha256HmacSignature) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type Integration struct { - // ID of the integration - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // Label of the integration - Label string `json:"label" url:"label"` - Provider IntegrationProvider `json:"provider" url:"provider"` - // List of features to enable (see features list below) - Features []IntegrationFeature `json:"features,omitempty" url:"features,omitempty"` - // Decrypted Key/Value object of the associated configuration for that provider - Configs *IntegrationConfigs `json:"configs,omitempty" url:"configs,omitempty"` - // List of source IDs the integration is attached to - Sources []string `json:"sources,omitempty" url:"sources,omitempty"` - // Date the integration was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the integration was created - CreatedAt time.Time `json:"created_at" url:"created_at"` +type DestinationTypeConfigCustomSha256HmacSignatureAuth struct { + Key string `json:"key" url:"key"` + SigningSecret string `json:"signing_secret" url:"signing_secret"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *Integration) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigCustomSha256HmacSignatureAuth) GetKey() string { + if d == nil { + return "" + } + return d.Key } -func (i *Integration) UnmarshalJSON(data []byte) error { - type embed Integration - var unmarshaler = struct { - embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*i), +func (d *DestinationTypeConfigCustomSha256HmacSignatureAuth) GetSigningSecret() string { + if d == nil { + return "" } - if err := json.Unmarshal(data, &unmarshaler); err != nil { + return d.SigningSecret +} + +func (d *DestinationTypeConfigCustomSha256HmacSignatureAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigCustomSha256HmacSignatureAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigCustomSha256HmacSignatureAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *i = Integration(unmarshaler.embed) - i.UpdatedAt = unmarshaler.UpdatedAt.Time() - i.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigCustomSha256HmacSignatureAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *Integration) MarshalJSON() ([]byte, error) { - type embed Integration - var marshaler = struct { - embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*i), - UpdatedAt: core.NewDateTime(i.UpdatedAt), - CreatedAt: core.NewDateTime(i.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (i *Integration) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigCustomSha256HmacSignatureAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// Decrypted Key/Value object of the associated configuration for that provider -type IntegrationConfigs struct { - HmacIntegrationConfigs *HmacIntegrationConfigs - ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs - HandledApiKeyIntegrationConfigs *HandledApiKeyIntegrationConfigs - HandledHmacConfigs *HandledHmacConfigs - BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs - ShopifyIntegrationConfigs *ShopifyIntegrationConfigs - VercelLogDrainsIntegrationConfigs *VercelLogDrainsIntegrationConfigs - IntegrationConfigsSeven *IntegrationConfigsSeven -} - -func NewIntegrationConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{HmacIntegrationConfigs: value} + return fmt.Sprintf("%#v", d) } -func NewIntegrationConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{ApiKeyIntegrationConfigs: value} -} +type DestinationTypeConfigCustomSha256HmacSignatureHttpMethod string -func NewIntegrationConfigsFromHandledApiKeyIntegrationConfigs(value *HandledApiKeyIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{HandledApiKeyIntegrationConfigs: value} -} +const ( + DestinationTypeConfigCustomSha256HmacSignatureHttpMethodGet DestinationTypeConfigCustomSha256HmacSignatureHttpMethod = "GET" + DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPost DestinationTypeConfigCustomSha256HmacSignatureHttpMethod = "POST" + DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPut DestinationTypeConfigCustomSha256HmacSignatureHttpMethod = "PUT" + DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPatch DestinationTypeConfigCustomSha256HmacSignatureHttpMethod = "PATCH" + DestinationTypeConfigCustomSha256HmacSignatureHttpMethodDelete DestinationTypeConfigCustomSha256HmacSignatureHttpMethod = "DELETE" +) -func NewIntegrationConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *IntegrationConfigs { - return &IntegrationConfigs{HandledHmacConfigs: value} +func NewDestinationTypeConfigCustomSha256HmacSignatureHttpMethodFromString(s string) (DestinationTypeConfigCustomSha256HmacSignatureHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigCustomSha256HmacSignatureHttpMethodGet, nil + case "POST": + return DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigCustomSha256HmacSignatureHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigCustomSha256HmacSignatureHttpMethodDelete, nil + } + var t DestinationTypeConfigCustomSha256HmacSignatureHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func NewIntegrationConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{BasicAuthIntegrationConfigs: value} +func (d DestinationTypeConfigCustomSha256HmacSignatureHttpMethod) Ptr() *DestinationTypeConfigCustomSha256HmacSignatureHttpMethod { + return &d } -func NewIntegrationConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{ShopifyIntegrationConfigs: value} -} +type DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod string -func NewIntegrationConfigsFromVercelLogDrainsIntegrationConfigs(value *VercelLogDrainsIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{VercelLogDrainsIntegrationConfigs: value} -} +const ( + DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodSecond DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod = "second" + DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodMinute DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod = "minute" + DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodHour DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod = "hour" + DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodConcurrent DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod = "concurrent" +) -func NewIntegrationConfigsFromIntegrationConfigsSeven(value *IntegrationConfigsSeven) *IntegrationConfigs { - return &IntegrationConfigs{IntegrationConfigsSeven: value} +func NewDestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodFromString(s string) (DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriodConcurrent, nil + } + var t DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i *IntegrationConfigs) UnmarshalJSON(data []byte) error { - valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) - if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { - i.HmacIntegrationConfigs = valueHmacIntegrationConfigs +func (d DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod) Ptr() *DestinationTypeConfigCustomSha256HmacSignatureRateLimitPeriod { + return &d +} + +// The type config for HTTP. Requires type to be `HTTP`. +type DestinationTypeConfigHttp struct { + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigHttpRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigHttpHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Configs *DestinationTypeConfigHttpConfigs `json:"configs,omitempty" url:"configs,omitempty"` + Type *DestinationTypeConfigHttpType `json:"type,omitempty" url:"type,omitempty"` + Auth *DestinationTypeConfigHttpAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DestinationTypeConfigHttp) GetUrl() *string { + if d == nil { return nil } - valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) - if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { - i.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs + return d.Url +} + +func (d *DestinationTypeConfigHttp) GetRateLimit() *float64 { + if d == nil { return nil } - valueHandledApiKeyIntegrationConfigs := new(HandledApiKeyIntegrationConfigs) - if err := json.Unmarshal(data, &valueHandledApiKeyIntegrationConfigs); err == nil { - i.HandledApiKeyIntegrationConfigs = valueHandledApiKeyIntegrationConfigs + return d.RateLimit +} + +func (d *DestinationTypeConfigHttp) GetRateLimitPeriod() *DestinationTypeConfigHttpRateLimitPeriod { + if d == nil { return nil } - valueHandledHmacConfigs := new(HandledHmacConfigs) - if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { - i.HandledHmacConfigs = valueHandledHmacConfigs + return d.RateLimitPeriod +} + +func (d *DestinationTypeConfigHttp) GetPathForwardingDisabled() *bool { + if d == nil { return nil } - valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) - if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { - i.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs + return d.PathForwardingDisabled +} + +func (d *DestinationTypeConfigHttp) GetHttpMethod() *DestinationTypeConfigHttpHttpMethod { + if d == nil { return nil } - valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) - if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { - i.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs + return d.HttpMethod +} + +func (d *DestinationTypeConfigHttp) GetConfigs() *DestinationTypeConfigHttpConfigs { + if d == nil { return nil } - valueVercelLogDrainsIntegrationConfigs := new(VercelLogDrainsIntegrationConfigs) - if err := json.Unmarshal(data, &valueVercelLogDrainsIntegrationConfigs); err == nil { - i.VercelLogDrainsIntegrationConfigs = valueVercelLogDrainsIntegrationConfigs + return d.Configs +} + +func (d *DestinationTypeConfigHttp) GetType() *DestinationTypeConfigHttpType { + if d == nil { return nil } - valueIntegrationConfigsSeven := new(IntegrationConfigsSeven) - if err := json.Unmarshal(data, &valueIntegrationConfigsSeven); err == nil { - i.IntegrationConfigsSeven = valueIntegrationConfigsSeven + return d.Type +} + +func (d *DestinationTypeConfigHttp) GetAuth() *DestinationTypeConfigHttpAuth { + if d == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + return d.Auth } -func (i IntegrationConfigs) MarshalJSON() ([]byte, error) { - if i.HmacIntegrationConfigs != nil { - return json.Marshal(i.HmacIntegrationConfigs) +func (d *DestinationTypeConfigHttp) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigHttp) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if i.ApiKeyIntegrationConfigs != nil { - return json.Marshal(i.ApiKeyIntegrationConfigs) + *d = DestinationTypeConfigHttp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err } - if i.HandledApiKeyIntegrationConfigs != nil { - return json.Marshal(i.HandledApiKeyIntegrationConfigs) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DestinationTypeConfigHttp) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } } - if i.HandledHmacConfigs != nil { - return json.Marshal(i.HandledHmacConfigs) + if value, err := internal.StringifyJSON(d); err == nil { + return value } - if i.BasicAuthIntegrationConfigs != nil { - return json.Marshal(i.BasicAuthIntegrationConfigs) + return fmt.Sprintf("%#v", d) +} + +type DestinationTypeConfigHttpAuth struct { + DestinationTypeConfigHttpAuthZero *DestinationTypeConfigHttpAuthZero + DestinationTypeConfigHttpAuthSigningSecret *DestinationTypeConfigHttpAuthSigningSecret + DestinationTypeConfigHttpAuthPassword *DestinationTypeConfigHttpAuthPassword + DestinationTypeConfigHttpAuthApiKey *DestinationTypeConfigHttpAuthApiKey + DestinationTypeConfigHttpAuthToken *DestinationTypeConfigHttpAuthToken + DestinationTypeConfigHttpAuthAuthenticationType *DestinationTypeConfigHttpAuthAuthenticationType + DestinationTypeConfigHttpAuthRefreshToken *DestinationTypeConfigHttpAuthRefreshToken + DestinationTypeConfigHttpAuthAccessKeyId *DestinationTypeConfigHttpAuthAccessKeyId + + typ string +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthZero(value *DestinationTypeConfigHttpAuthZero) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthZero", DestinationTypeConfigHttpAuthZero: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthSigningSecret(value *DestinationTypeConfigHttpAuthSigningSecret) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthSigningSecret", DestinationTypeConfigHttpAuthSigningSecret: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthPassword(value *DestinationTypeConfigHttpAuthPassword) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthPassword", DestinationTypeConfigHttpAuthPassword: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthApiKey(value *DestinationTypeConfigHttpAuthApiKey) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthApiKey", DestinationTypeConfigHttpAuthApiKey: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthToken(value *DestinationTypeConfigHttpAuthToken) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthToken", DestinationTypeConfigHttpAuthToken: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthAuthenticationType(value *DestinationTypeConfigHttpAuthAuthenticationType) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthAuthenticationType", DestinationTypeConfigHttpAuthAuthenticationType: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthRefreshToken(value *DestinationTypeConfigHttpAuthRefreshToken) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthRefreshToken", DestinationTypeConfigHttpAuthRefreshToken: value} +} + +func NewDestinationTypeConfigHttpAuthFromDestinationTypeConfigHttpAuthAccessKeyId(value *DestinationTypeConfigHttpAuthAccessKeyId) *DestinationTypeConfigHttpAuth { + return &DestinationTypeConfigHttpAuth{typ: "DestinationTypeConfigHttpAuthAccessKeyId", DestinationTypeConfigHttpAuthAccessKeyId: value} +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthZero() *DestinationTypeConfigHttpAuthZero { + if d == nil { + return nil } - if i.ShopifyIntegrationConfigs != nil { - return json.Marshal(i.ShopifyIntegrationConfigs) + return d.DestinationTypeConfigHttpAuthZero +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthSigningSecret() *DestinationTypeConfigHttpAuthSigningSecret { + if d == nil { + return nil } - if i.VercelLogDrainsIntegrationConfigs != nil { - return json.Marshal(i.VercelLogDrainsIntegrationConfigs) + return d.DestinationTypeConfigHttpAuthSigningSecret +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthPassword() *DestinationTypeConfigHttpAuthPassword { + if d == nil { + return nil } - if i.IntegrationConfigsSeven != nil { - return json.Marshal(i.IntegrationConfigsSeven) + return d.DestinationTypeConfigHttpAuthPassword +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthApiKey() *DestinationTypeConfigHttpAuthApiKey { + if d == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return d.DestinationTypeConfigHttpAuthApiKey } -type IntegrationConfigsVisitor interface { - VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error - VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error - VisitHandledApiKeyIntegrationConfigs(*HandledApiKeyIntegrationConfigs) error - VisitHandledHmacConfigs(*HandledHmacConfigs) error - VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error - VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error - VisitVercelLogDrainsIntegrationConfigs(*VercelLogDrainsIntegrationConfigs) error - VisitIntegrationConfigsSeven(*IntegrationConfigsSeven) error +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthToken() *DestinationTypeConfigHttpAuthToken { + if d == nil { + return nil + } + return d.DestinationTypeConfigHttpAuthToken } -func (i *IntegrationConfigs) Accept(visitor IntegrationConfigsVisitor) error { - if i.HmacIntegrationConfigs != nil { - return visitor.VisitHmacIntegrationConfigs(i.HmacIntegrationConfigs) +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthAuthenticationType() *DestinationTypeConfigHttpAuthAuthenticationType { + if d == nil { + return nil } - if i.ApiKeyIntegrationConfigs != nil { - return visitor.VisitApiKeyIntegrationConfigs(i.ApiKeyIntegrationConfigs) + return d.DestinationTypeConfigHttpAuthAuthenticationType +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthRefreshToken() *DestinationTypeConfigHttpAuthRefreshToken { + if d == nil { + return nil } - if i.HandledApiKeyIntegrationConfigs != nil { - return visitor.VisitHandledApiKeyIntegrationConfigs(i.HandledApiKeyIntegrationConfigs) + return d.DestinationTypeConfigHttpAuthRefreshToken +} + +func (d *DestinationTypeConfigHttpAuth) GetDestinationTypeConfigHttpAuthAccessKeyId() *DestinationTypeConfigHttpAuthAccessKeyId { + if d == nil { + return nil } - if i.HandledHmacConfigs != nil { - return visitor.VisitHandledHmacConfigs(i.HandledHmacConfigs) + return d.DestinationTypeConfigHttpAuthAccessKeyId +} + +func (d *DestinationTypeConfigHttpAuth) UnmarshalJSON(data []byte) error { + valueDestinationTypeConfigHttpAuthZero := new(DestinationTypeConfigHttpAuthZero) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthZero); err == nil { + d.typ = "DestinationTypeConfigHttpAuthZero" + d.DestinationTypeConfigHttpAuthZero = valueDestinationTypeConfigHttpAuthZero + return nil } - if i.BasicAuthIntegrationConfigs != nil { - return visitor.VisitBasicAuthIntegrationConfigs(i.BasicAuthIntegrationConfigs) + valueDestinationTypeConfigHttpAuthSigningSecret := new(DestinationTypeConfigHttpAuthSigningSecret) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthSigningSecret); err == nil { + d.typ = "DestinationTypeConfigHttpAuthSigningSecret" + d.DestinationTypeConfigHttpAuthSigningSecret = valueDestinationTypeConfigHttpAuthSigningSecret + return nil } - if i.ShopifyIntegrationConfigs != nil { - return visitor.VisitShopifyIntegrationConfigs(i.ShopifyIntegrationConfigs) + valueDestinationTypeConfigHttpAuthPassword := new(DestinationTypeConfigHttpAuthPassword) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthPassword); err == nil { + d.typ = "DestinationTypeConfigHttpAuthPassword" + d.DestinationTypeConfigHttpAuthPassword = valueDestinationTypeConfigHttpAuthPassword + return nil } - if i.VercelLogDrainsIntegrationConfigs != nil { - return visitor.VisitVercelLogDrainsIntegrationConfigs(i.VercelLogDrainsIntegrationConfigs) + valueDestinationTypeConfigHttpAuthApiKey := new(DestinationTypeConfigHttpAuthApiKey) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthApiKey); err == nil { + d.typ = "DestinationTypeConfigHttpAuthApiKey" + d.DestinationTypeConfigHttpAuthApiKey = valueDestinationTypeConfigHttpAuthApiKey + return nil } - if i.IntegrationConfigsSeven != nil { - return visitor.VisitIntegrationConfigsSeven(i.IntegrationConfigsSeven) + valueDestinationTypeConfigHttpAuthToken := new(DestinationTypeConfigHttpAuthToken) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthToken); err == nil { + d.typ = "DestinationTypeConfigHttpAuthToken" + d.DestinationTypeConfigHttpAuthToken = valueDestinationTypeConfigHttpAuthToken + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", i) + valueDestinationTypeConfigHttpAuthAuthenticationType := new(DestinationTypeConfigHttpAuthAuthenticationType) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthAuthenticationType); err == nil { + d.typ = "DestinationTypeConfigHttpAuthAuthenticationType" + d.DestinationTypeConfigHttpAuthAuthenticationType = valueDestinationTypeConfigHttpAuthAuthenticationType + return nil + } + valueDestinationTypeConfigHttpAuthRefreshToken := new(DestinationTypeConfigHttpAuthRefreshToken) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthRefreshToken); err == nil { + d.typ = "DestinationTypeConfigHttpAuthRefreshToken" + d.DestinationTypeConfigHttpAuthRefreshToken = valueDestinationTypeConfigHttpAuthRefreshToken + return nil + } + valueDestinationTypeConfigHttpAuthAccessKeyId := new(DestinationTypeConfigHttpAuthAccessKeyId) + if err := json.Unmarshal(data, &valueDestinationTypeConfigHttpAuthAccessKeyId); err == nil { + d.typ = "DestinationTypeConfigHttpAuthAccessKeyId" + d.DestinationTypeConfigHttpAuthAccessKeyId = valueDestinationTypeConfigHttpAuthAccessKeyId + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) } -type IntegrationConfigsSeven struct { +func (d DestinationTypeConfigHttpAuth) MarshalJSON() ([]byte, error) { + if d.typ == "DestinationTypeConfigHttpAuthZero" || d.DestinationTypeConfigHttpAuthZero != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthZero) + } + if d.typ == "DestinationTypeConfigHttpAuthSigningSecret" || d.DestinationTypeConfigHttpAuthSigningSecret != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthSigningSecret) + } + if d.typ == "DestinationTypeConfigHttpAuthPassword" || d.DestinationTypeConfigHttpAuthPassword != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthPassword) + } + if d.typ == "DestinationTypeConfigHttpAuthApiKey" || d.DestinationTypeConfigHttpAuthApiKey != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthApiKey) + } + if d.typ == "DestinationTypeConfigHttpAuthToken" || d.DestinationTypeConfigHttpAuthToken != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthToken) + } + if d.typ == "DestinationTypeConfigHttpAuthAuthenticationType" || d.DestinationTypeConfigHttpAuthAuthenticationType != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthAuthenticationType) + } + if d.typ == "DestinationTypeConfigHttpAuthRefreshToken" || d.DestinationTypeConfigHttpAuthRefreshToken != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthRefreshToken) + } + if d.typ == "DestinationTypeConfigHttpAuthAccessKeyId" || d.DestinationTypeConfigHttpAuthAccessKeyId != nil { + return json.Marshal(d.DestinationTypeConfigHttpAuthAccessKeyId) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", d) +} + +type DestinationTypeConfigHttpAuthVisitor interface { + VisitDestinationTypeConfigHttpAuthZero(*DestinationTypeConfigHttpAuthZero) error + VisitDestinationTypeConfigHttpAuthSigningSecret(*DestinationTypeConfigHttpAuthSigningSecret) error + VisitDestinationTypeConfigHttpAuthPassword(*DestinationTypeConfigHttpAuthPassword) error + VisitDestinationTypeConfigHttpAuthApiKey(*DestinationTypeConfigHttpAuthApiKey) error + VisitDestinationTypeConfigHttpAuthToken(*DestinationTypeConfigHttpAuthToken) error + VisitDestinationTypeConfigHttpAuthAuthenticationType(*DestinationTypeConfigHttpAuthAuthenticationType) error + VisitDestinationTypeConfigHttpAuthRefreshToken(*DestinationTypeConfigHttpAuthRefreshToken) error + VisitDestinationTypeConfigHttpAuthAccessKeyId(*DestinationTypeConfigHttpAuthAccessKeyId) error +} + +func (d *DestinationTypeConfigHttpAuth) Accept(visitor DestinationTypeConfigHttpAuthVisitor) error { + if d.typ == "DestinationTypeConfigHttpAuthZero" || d.DestinationTypeConfigHttpAuthZero != nil { + return visitor.VisitDestinationTypeConfigHttpAuthZero(d.DestinationTypeConfigHttpAuthZero) + } + if d.typ == "DestinationTypeConfigHttpAuthSigningSecret" || d.DestinationTypeConfigHttpAuthSigningSecret != nil { + return visitor.VisitDestinationTypeConfigHttpAuthSigningSecret(d.DestinationTypeConfigHttpAuthSigningSecret) + } + if d.typ == "DestinationTypeConfigHttpAuthPassword" || d.DestinationTypeConfigHttpAuthPassword != nil { + return visitor.VisitDestinationTypeConfigHttpAuthPassword(d.DestinationTypeConfigHttpAuthPassword) + } + if d.typ == "DestinationTypeConfigHttpAuthApiKey" || d.DestinationTypeConfigHttpAuthApiKey != nil { + return visitor.VisitDestinationTypeConfigHttpAuthApiKey(d.DestinationTypeConfigHttpAuthApiKey) + } + if d.typ == "DestinationTypeConfigHttpAuthToken" || d.DestinationTypeConfigHttpAuthToken != nil { + return visitor.VisitDestinationTypeConfigHttpAuthToken(d.DestinationTypeConfigHttpAuthToken) + } + if d.typ == "DestinationTypeConfigHttpAuthAuthenticationType" || d.DestinationTypeConfigHttpAuthAuthenticationType != nil { + return visitor.VisitDestinationTypeConfigHttpAuthAuthenticationType(d.DestinationTypeConfigHttpAuthAuthenticationType) + } + if d.typ == "DestinationTypeConfigHttpAuthRefreshToken" || d.DestinationTypeConfigHttpAuthRefreshToken != nil { + return visitor.VisitDestinationTypeConfigHttpAuthRefreshToken(d.DestinationTypeConfigHttpAuthRefreshToken) + } + if d.typ == "DestinationTypeConfigHttpAuthAccessKeyId" || d.DestinationTypeConfigHttpAuthAccessKeyId != nil { + return visitor.VisitDestinationTypeConfigHttpAuthAccessKeyId(d.DestinationTypeConfigHttpAuthAccessKeyId) + } + return fmt.Errorf("type %T does not include a non-empty union type", d) +} + +type DestinationTypeConfigHttpAuthAccessKeyId struct { + AccessKeyId string `json:"access_key_id" url:"access_key_id"` + SecretAccessKey string `json:"secret_access_key" url:"secret_access_key"` + Region string `json:"region" url:"region"` + Service string `json:"service" url:"service"` + extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IntegrationConfigsSeven) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthAccessKeyId) GetAccessKeyId() string { + if d == nil { + return "" + } + return d.AccessKeyId } -func (i *IntegrationConfigsSeven) UnmarshalJSON(data []byte) error { - type unmarshaler IntegrationConfigsSeven +func (d *DestinationTypeConfigHttpAuthAccessKeyId) GetSecretAccessKey() string { + if d == nil { + return "" + } + return d.SecretAccessKey +} + +func (d *DestinationTypeConfigHttpAuthAccessKeyId) GetRegion() string { + if d == nil { + return "" + } + return d.Region +} + +func (d *DestinationTypeConfigHttpAuthAccessKeyId) GetService() string { + if d == nil { + return "" + } + return d.Service +} + +func (d *DestinationTypeConfigHttpAuthAccessKeyId) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigHttpAuthAccessKeyId) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthAccessKeyId var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IntegrationConfigsSeven(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthAccessKeyId(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IntegrationConfigsSeven) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthAccessKeyId) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type IntegrationFeature string +type DestinationTypeConfigHttpAuthApiKey struct { + Key string `json:"key" url:"key"` + ApiKey string `json:"api_key" url:"api_key"` + To DestinationTypeConfigHttpAuthApiKeyTo `json:"to" url:"to"` -const ( - IntegrationFeatureVerification IntegrationFeature = "VERIFICATION" - IntegrationFeatureHandshake IntegrationFeature = "HANDSHAKE" -) + extraProperties map[string]interface{} + rawJSON json.RawMessage +} -func NewIntegrationFeatureFromString(s string) (IntegrationFeature, error) { - switch s { - case "VERIFICATION": - return IntegrationFeatureVerification, nil - case "HANDSHAKE": - return IntegrationFeatureHandshake, nil +func (d *DestinationTypeConfigHttpAuthApiKey) GetKey() string { + if d == nil { + return "" } - var t IntegrationFeature - return "", fmt.Errorf("%s is not a valid %T", s, t) + return d.Key } -func (i IntegrationFeature) Ptr() *IntegrationFeature { - return &i +func (d *DestinationTypeConfigHttpAuthApiKey) GetApiKey() string { + if d == nil { + return "" + } + return d.ApiKey } -type IntegrationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Integration `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigHttpAuthApiKey) GetTo() DestinationTypeConfigHttpAuthApiKeyTo { + if d == nil { + return "" + } + return d.To } -func (i *IntegrationPaginatedResult) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthApiKey) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IntegrationPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler IntegrationPaginatedResult +func (d *DestinationTypeConfigHttpAuthApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthApiKey var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IntegrationPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IntegrationPaginatedResult) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthApiKey) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type IntegrationProvider string +type DestinationTypeConfigHttpAuthApiKeyTo string const ( - IntegrationProviderHmac IntegrationProvider = "HMAC" - IntegrationProviderBasicAuth IntegrationProvider = "BASIC_AUTH" - IntegrationProviderApiKey IntegrationProvider = "API_KEY" - IntegrationProviderBridge IntegrationProvider = "BRIDGE" - IntegrationProviderCloudsignal IntegrationProvider = "CLOUDSIGNAL" - IntegrationProviderCourier IntegrationProvider = "COURIER" - IntegrationProviderFrontapp IntegrationProvider = "FRONTAPP" - IntegrationProviderTwitter IntegrationProvider = "TWITTER" - IntegrationProviderStripe IntegrationProvider = "STRIPE" - IntegrationProviderRecharge IntegrationProvider = "RECHARGE" - IntegrationProviderTwilio IntegrationProvider = "TWILIO" - IntegrationProviderGithub IntegrationProvider = "GITHUB" - IntegrationProviderShopify IntegrationProvider = "SHOPIFY" - IntegrationProviderPostmark IntegrationProvider = "POSTMARK" - IntegrationProviderTypeform IntegrationProvider = "TYPEFORM" - IntegrationProviderXero IntegrationProvider = "XERO" - IntegrationProviderSvix IntegrationProvider = "SVIX" - IntegrationProviderZoom IntegrationProvider = "ZOOM" - IntegrationProviderAkeneo IntegrationProvider = "AKENEO" - IntegrationProviderAdyen IntegrationProvider = "ADYEN" - IntegrationProviderGitlab IntegrationProvider = "GITLAB" - IntegrationProviderPropertyFinder IntegrationProvider = "PROPERTY-FINDER" - IntegrationProviderWoocommerce IntegrationProvider = "WOOCOMMERCE" - IntegrationProviderOura IntegrationProvider = "OURA" - IntegrationProviderCommercelayer IntegrationProvider = "COMMERCELAYER" - IntegrationProviderHubspot IntegrationProvider = "HUBSPOT" - IntegrationProviderMailgun IntegrationProvider = "MAILGUN" - IntegrationProviderPersona IntegrationProvider = "PERSONA" - IntegrationProviderPipedrive IntegrationProvider = "PIPEDRIVE" - IntegrationProviderSendgrid IntegrationProvider = "SENDGRID" - IntegrationProviderWorkos IntegrationProvider = "WORKOS" - IntegrationProviderSynctera IntegrationProvider = "SYNCTERA" - IntegrationProviderAwsSns IntegrationProvider = "AWS_SNS" - IntegrationProviderThreeDEye IntegrationProvider = "THREE_D_EYE" - IntegrationProviderTwitch IntegrationProvider = "TWITCH" - IntegrationProviderEnode IntegrationProvider = "ENODE" - IntegrationProviderFavro IntegrationProvider = "FAVRO" - IntegrationProviderLinear IntegrationProvider = "LINEAR" - IntegrationProviderShopline IntegrationProvider = "SHOPLINE" - IntegrationProviderWix IntegrationProvider = "WIX" - IntegrationProviderNmi IntegrationProvider = "NMI" - IntegrationProviderOrb IntegrationProvider = "ORB" - IntegrationProviderPylon IntegrationProvider = "PYLON" - IntegrationProviderRepay IntegrationProvider = "REPAY" - IntegrationProviderSquare IntegrationProvider = "SQUARE" - IntegrationProviderSolidgate IntegrationProvider = "SOLIDGATE" - IntegrationProviderTrello IntegrationProvider = "TRELLO" - IntegrationProviderSanity IntegrationProvider = "SANITY" - IntegrationProviderEbay IntegrationProvider = "EBAY" - IntegrationProviderTelnyx IntegrationProvider = "TELNYX" - IntegrationProviderDiscord IntegrationProvider = "DISCORD" - IntegrationProviderTokenio IntegrationProvider = "TOKENIO" - IntegrationProviderFiserv IntegrationProvider = "FISERV" - IntegrationProviderBondsmith IntegrationProvider = "BONDSMITH" - IntegrationProviderVercelLogDrains IntegrationProvider = "VERCEL_LOG_DRAINS" - IntegrationProviderVercel IntegrationProvider = "VERCEL" - IntegrationProviderTebex IntegrationProvider = "TEBEX" - IntegrationProviderSlack IntegrationProvider = "SLACK" - IntegrationProviderRazorpay IntegrationProvider = "RAZORPAY" - IntegrationProviderMailchimp IntegrationProvider = "MAILCHIMP" - IntegrationProviderPaddle IntegrationProvider = "PADDLE" - IntegrationProviderPaypal IntegrationProvider = "PAYPAL" - IntegrationProviderTreezor IntegrationProvider = "TREEZOR" - IntegrationProviderPraxis IntegrationProvider = "PRAXIS" + DestinationTypeConfigHttpAuthApiKeyToHeader DestinationTypeConfigHttpAuthApiKeyTo = "header" + DestinationTypeConfigHttpAuthApiKeyToQuery DestinationTypeConfigHttpAuthApiKeyTo = "query" ) -func NewIntegrationProviderFromString(s string) (IntegrationProvider, error) { +func NewDestinationTypeConfigHttpAuthApiKeyToFromString(s string) (DestinationTypeConfigHttpAuthApiKeyTo, error) { switch s { - case "HMAC": - return IntegrationProviderHmac, nil - case "BASIC_AUTH": - return IntegrationProviderBasicAuth, nil - case "API_KEY": - return IntegrationProviderApiKey, nil - case "BRIDGE": - return IntegrationProviderBridge, nil - case "CLOUDSIGNAL": - return IntegrationProviderCloudsignal, nil - case "COURIER": - return IntegrationProviderCourier, nil - case "FRONTAPP": - return IntegrationProviderFrontapp, nil - case "TWITTER": - return IntegrationProviderTwitter, nil - case "STRIPE": - return IntegrationProviderStripe, nil - case "RECHARGE": - return IntegrationProviderRecharge, nil - case "TWILIO": - return IntegrationProviderTwilio, nil - case "GITHUB": - return IntegrationProviderGithub, nil - case "SHOPIFY": - return IntegrationProviderShopify, nil - case "POSTMARK": - return IntegrationProviderPostmark, nil - case "TYPEFORM": - return IntegrationProviderTypeform, nil - case "XERO": - return IntegrationProviderXero, nil - case "SVIX": - return IntegrationProviderSvix, nil - case "ZOOM": - return IntegrationProviderZoom, nil - case "AKENEO": - return IntegrationProviderAkeneo, nil - case "ADYEN": - return IntegrationProviderAdyen, nil - case "GITLAB": - return IntegrationProviderGitlab, nil - case "PROPERTY-FINDER": - return IntegrationProviderPropertyFinder, nil - case "WOOCOMMERCE": - return IntegrationProviderWoocommerce, nil - case "OURA": - return IntegrationProviderOura, nil - case "COMMERCELAYER": - return IntegrationProviderCommercelayer, nil - case "HUBSPOT": - return IntegrationProviderHubspot, nil - case "MAILGUN": - return IntegrationProviderMailgun, nil - case "PERSONA": - return IntegrationProviderPersona, nil - case "PIPEDRIVE": - return IntegrationProviderPipedrive, nil - case "SENDGRID": - return IntegrationProviderSendgrid, nil - case "WORKOS": - return IntegrationProviderWorkos, nil - case "SYNCTERA": - return IntegrationProviderSynctera, nil - case "AWS_SNS": - return IntegrationProviderAwsSns, nil - case "THREE_D_EYE": - return IntegrationProviderThreeDEye, nil - case "TWITCH": - return IntegrationProviderTwitch, nil - case "ENODE": - return IntegrationProviderEnode, nil - case "FAVRO": - return IntegrationProviderFavro, nil - case "LINEAR": - return IntegrationProviderLinear, nil - case "SHOPLINE": - return IntegrationProviderShopline, nil - case "WIX": - return IntegrationProviderWix, nil - case "NMI": - return IntegrationProviderNmi, nil - case "ORB": - return IntegrationProviderOrb, nil - case "PYLON": - return IntegrationProviderPylon, nil - case "REPAY": - return IntegrationProviderRepay, nil - case "SQUARE": - return IntegrationProviderSquare, nil - case "SOLIDGATE": - return IntegrationProviderSolidgate, nil - case "TRELLO": - return IntegrationProviderTrello, nil - case "SANITY": - return IntegrationProviderSanity, nil - case "EBAY": - return IntegrationProviderEbay, nil - case "TELNYX": - return IntegrationProviderTelnyx, nil - case "DISCORD": - return IntegrationProviderDiscord, nil - case "TOKENIO": - return IntegrationProviderTokenio, nil - case "FISERV": - return IntegrationProviderFiserv, nil - case "BONDSMITH": - return IntegrationProviderBondsmith, nil - case "VERCEL_LOG_DRAINS": - return IntegrationProviderVercelLogDrains, nil - case "VERCEL": - return IntegrationProviderVercel, nil - case "TEBEX": - return IntegrationProviderTebex, nil - case "SLACK": - return IntegrationProviderSlack, nil - case "RAZORPAY": - return IntegrationProviderRazorpay, nil - case "MAILCHIMP": - return IntegrationProviderMailchimp, nil - case "PADDLE": - return IntegrationProviderPaddle, nil - case "PAYPAL": - return IntegrationProviderPaypal, nil - case "TREEZOR": - return IntegrationProviderTreezor, nil - case "PRAXIS": - return IntegrationProviderPraxis, nil + case "header": + return DestinationTypeConfigHttpAuthApiKeyToHeader, nil + case "query": + return DestinationTypeConfigHttpAuthApiKeyToQuery, nil } - var t IntegrationProvider + var t DestinationTypeConfigHttpAuthApiKeyTo return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i IntegrationProvider) Ptr() *IntegrationProvider { - return &i -} - -// Issue -type Issue struct { - Type string - Delivery *DeliveryIssue - Transformation *TransformationIssue +func (d DestinationTypeConfigHttpAuthApiKeyTo) Ptr() *DestinationTypeConfigHttpAuthApiKeyTo { + return &d } -func NewIssueFromDelivery(value *DeliveryIssue) *Issue { - return &Issue{Type: "delivery", Delivery: value} -} +type DestinationTypeConfigHttpAuthAuthenticationType struct { + AuthServer string `json:"auth_server" url:"auth_server"` + ClientId string `json:"client_id" url:"client_id"` + ClientSecret string `json:"client_secret" url:"client_secret"` + Scope string `json:"scope" url:"scope"` + AuthenticationType DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType `json:"authentication_type" url:"authentication_type"` -func NewIssueFromTransformation(value *TransformationIssue) *Issue { - return &Issue{Type: "transformation", Transformation: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *Issue) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - i.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", i) - } - switch unmarshaler.Type { - case "delivery": - value := new(DeliveryIssue) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - i.Delivery = value - case "transformation": - value := new(TransformationIssue) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - i.Transformation = value +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetAuthServer() string { + if d == nil { + return "" } - return nil + return d.AuthServer } -func (i Issue) MarshalJSON() ([]byte, error) { - switch i.Type { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.Type, i) - case "delivery": - return core.MarshalJSONWithExtraProperty(i.Delivery, "type", "delivery") - case "transformation": - return core.MarshalJSONWithExtraProperty(i.Transformation, "type", "transformation") +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetClientId() string { + if d == nil { + return "" } + return d.ClientId } -type IssueVisitor interface { - VisitDelivery(*DeliveryIssue) error - VisitTransformation(*TransformationIssue) error +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetClientSecret() string { + if d == nil { + return "" + } + return d.ClientSecret } -func (i *Issue) Accept(visitor IssueVisitor) error { - switch i.Type { - default: - return fmt.Errorf("invalid type %s in %T", i.Type, i) - case "delivery": - return visitor.VisitDelivery(i.Delivery) - case "transformation": - return visitor.VisitTransformation(i.Transformation) +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetScope() string { + if d == nil { + return "" } + return d.Scope } -type IssueCount struct { - // Number of issues - Count int `json:"count" url:"count"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetAuthenticationType() DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType { + if d == nil { + return "" + } + return d.AuthenticationType } -func (i *IssueCount) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthAuthenticationType) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueCount) UnmarshalJSON(data []byte) error { - type unmarshaler IssueCount +func (d *DestinationTypeConfigHttpAuthAuthenticationType) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthAuthenticationType var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueCount(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthAuthenticationType(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueCount) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthAuthenticationType) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// Issue status -type IssueStatus string +type DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType string const ( - IssueStatusOpened IssueStatus = "OPENED" - IssueStatusIgnored IssueStatus = "IGNORED" - IssueStatusAcknowledged IssueStatus = "ACKNOWLEDGED" - IssueStatusResolved IssueStatus = "RESOLVED" + DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeBasic DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType = "basic" + DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeBearer DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType = "bearer" + DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeXWwwFormUrlencoded DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType = "x-www-form-urlencoded" ) -func NewIssueStatusFromString(s string) (IssueStatus, error) { +func NewDestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeFromString(s string) (DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType, error) { switch s { - case "OPENED": - return IssueStatusOpened, nil - case "IGNORED": - return IssueStatusIgnored, nil - case "ACKNOWLEDGED": - return IssueStatusAcknowledged, nil - case "RESOLVED": - return IssueStatusResolved, nil - } - var t IssueStatus + case "basic": + return DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeBasic, nil + case "bearer": + return DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeBearer, nil + case "x-www-form-urlencoded": + return DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationTypeXWwwFormUrlencoded, nil + } + var t DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i IssueStatus) Ptr() *IssueStatus { - return &i +func (d DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType) Ptr() *DestinationTypeConfigHttpAuthAuthenticationTypeAuthenticationType { + return &d } -type IssueTrigger struct { - // ID of the issue trigger - Id string `json:"id" url:"id"` - // ID of the project - TeamId *string `json:"team_id,omitempty" url:"team_id,omitempty"` - // Optional unique name to use as reference when using the API - Name *string `json:"name,omitempty" url:"name,omitempty"` - Type IssueType `json:"type" url:"type"` - Configs *IssueTriggerReference `json:"configs,omitempty" url:"configs,omitempty"` - Channels *IssueTriggerChannels `json:"channels,omitempty" url:"channels,omitempty"` - // ISO timestamp for when the issue trigger was disabled - DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` - // ISO timestamp for when the issue trigger was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // ISO timestamp for when the issue trigger was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - // ISO timestamp for when the issue trigger was deleted - DeletedAt *time.Time `json:"deleted_at,omitempty" url:"deleted_at,omitempty"` +type DestinationTypeConfigHttpAuthPassword struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTrigger) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthPassword) GetUsername() *string { + if d == nil { + return nil + } + return d.Username } -func (i *IssueTrigger) UnmarshalJSON(data []byte) error { - type embed IssueTrigger - var unmarshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - DeletedAt *core.DateTime `json:"deleted_at,omitempty"` - }{ - embed: embed(*i), +func (d *DestinationTypeConfigHttpAuthPassword) GetPassword() *string { + if d == nil { + return nil } - if err := json.Unmarshal(data, &unmarshaler); err != nil { + return d.Password +} + +func (d *DestinationTypeConfigHttpAuthPassword) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigHttpAuthPassword) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthPassword + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTrigger(unmarshaler.embed) - i.DisabledAt = unmarshaler.DisabledAt.TimePtr() - i.UpdatedAt = unmarshaler.UpdatedAt.Time() - i.CreatedAt = unmarshaler.CreatedAt.Time() - i.DeletedAt = unmarshaler.DeletedAt.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthPassword(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTrigger) MarshalJSON() ([]byte, error) { - type embed IssueTrigger - var marshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - DeletedAt *core.DateTime `json:"deleted_at,omitempty"` - }{ - embed: embed(*i), - DisabledAt: core.NewOptionalDateTime(i.DisabledAt), - UpdatedAt: core.NewDateTime(i.UpdatedAt), - CreatedAt: core.NewDateTime(i.CreatedAt), - DeletedAt: core.NewOptionalDateTime(i.DeletedAt), - } - return json.Marshal(marshaler) -} - -func (i *IssueTrigger) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthPassword) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// Configurations for a 'Backpressure' issue trigger -type IssueTriggerBackpressureConfigs struct { - Delay IssueTriggerBackpressureDelay `json:"delay" url:"delay"` - // A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. - Destinations *IssueTriggerBackpressureConfigsDestinations `json:"destinations,omitempty" url:"destinations,omitempty"` +type DestinationTypeConfigHttpAuthRefreshToken struct { + AuthServer string `json:"auth_server" url:"auth_server"` + ClientId string `json:"client_id" url:"client_id"` + ClientSecret string `json:"client_secret" url:"client_secret"` + RefreshToken string `json:"refresh_token" url:"refresh_token"` + Scope string `json:"scope" url:"scope"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTriggerBackpressureConfigs) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetAuthServer() string { + if d == nil { + return "" + } + return d.AuthServer +} + +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetClientId() string { + if d == nil { + return "" + } + return d.ClientId +} + +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetClientSecret() string { + if d == nil { + return "" + } + return d.ClientSecret +} + +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetRefreshToken() string { + if d == nil { + return "" + } + return d.RefreshToken +} + +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetScope() string { + if d == nil { + return "" + } + return d.Scope +} + +func (d *DestinationTypeConfigHttpAuthRefreshToken) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerBackpressureConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerBackpressureConfigs +func (d *DestinationTypeConfigHttpAuthRefreshToken) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthRefreshToken var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerBackpressureConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthRefreshToken(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerBackpressureConfigs) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthRefreshToken) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. -type IssueTriggerBackpressureConfigsDestinations struct { - String string - StringList []string +type DestinationTypeConfigHttpAuthSigningSecret struct { + Key string `json:"key" url:"key"` + SigningSecret string `json:"signing_secret" url:"signing_secret"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewIssueTriggerBackpressureConfigsDestinationsFromString(value string) *IssueTriggerBackpressureConfigsDestinations { - return &IssueTriggerBackpressureConfigsDestinations{String: value} +func (d *DestinationTypeConfigHttpAuthSigningSecret) GetKey() string { + if d == nil { + return "" + } + return d.Key } -func NewIssueTriggerBackpressureConfigsDestinationsFromStringList(value []string) *IssueTriggerBackpressureConfigsDestinations { - return &IssueTriggerBackpressureConfigsDestinations{StringList: value} +func (d *DestinationTypeConfigHttpAuthSigningSecret) GetSigningSecret() string { + if d == nil { + return "" + } + return d.SigningSecret } -func (i *IssueTriggerBackpressureConfigsDestinations) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.String = valueString - return nil +func (d *DestinationTypeConfigHttpAuthSigningSecret) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DestinationTypeConfigHttpAuthSigningSecret) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthSigningSecret + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.StringList = valueStringList - return nil + *d = DestinationTypeConfigHttpAuthSigningSecret(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil } -func (i IssueTriggerBackpressureConfigsDestinations) MarshalJSON() ([]byte, error) { - if i.String != "" { - return json.Marshal(i.String) +func (d *DestinationTypeConfigHttpAuthSigningSecret) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } } - if i.StringList != nil { - return json.Marshal(i.StringList) + if value, err := internal.StringifyJSON(d); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return fmt.Sprintf("%#v", d) } -type IssueTriggerBackpressureConfigsDestinationsVisitor interface { - VisitString(string) error - VisitStringList([]string) error +type DestinationTypeConfigHttpAuthToken struct { + Token string `json:"token" url:"token"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IssueTriggerBackpressureConfigsDestinations) Accept(visitor IssueTriggerBackpressureConfigsDestinationsVisitor) error { - if i.String != "" { - return visitor.VisitString(i.String) - } - if i.StringList != nil { - return visitor.VisitStringList(i.StringList) +func (d *DestinationTypeConfigHttpAuthToken) GetToken() string { + if d == nil { + return "" } - return fmt.Errorf("type %T does not include a non-empty union type", i) + return d.Token +} + +func (d *DestinationTypeConfigHttpAuthToken) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -// The minimum delay (backpressure) to open the issue for min of 1 minute (60000) and max of 1 day (86400000) -type IssueTriggerBackpressureDelay = int +func (d *DestinationTypeConfigHttpAuthToken) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthToken + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DestinationTypeConfigHttpAuthToken(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} -// Notification channels object for the specific channel type -type IssueTriggerChannels struct { - Slack *IssueTriggerSlackChannel `json:"slack,omitempty" url:"slack,omitempty"` - Opsgenie *IssueTriggerIntegrationChannel `json:"opsgenie,omitempty" url:"opsgenie,omitempty"` - Email *IssueTriggerEmailChannel `json:"email,omitempty" url:"email,omitempty"` +func (d *DestinationTypeConfigHttpAuthToken) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} +type DestinationTypeConfigHttpAuthZero struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTriggerChannels) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpAuthZero) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerChannels) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerChannels +func (d *DestinationTypeConfigHttpAuthZero) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpAuthZero var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerChannels(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpAuthZero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerChannels) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpAuthZero) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// Configurations for a 'delivery' issue trigger -type IssueTriggerDeliveryConfigs struct { - Strategy IssueTriggerStrategy `json:"strategy" url:"strategy"` - // A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. - Connections *IssueTriggerDeliveryConfigsConnections `json:"connections,omitempty" url:"connections,omitempty"` - +type DestinationTypeConfigHttpConfigs struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTriggerDeliveryConfigs) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigHttpConfigs) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerDeliveryConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerDeliveryConfigs +func (d *DestinationTypeConfigHttpConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigHttpConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerDeliveryConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigHttpConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerDeliveryConfigs) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigHttpConfigs) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. -type IssueTriggerDeliveryConfigsConnections struct { - String string - StringList []string +type DestinationTypeConfigHttpHttpMethod string + +const ( + DestinationTypeConfigHttpHttpMethodGet DestinationTypeConfigHttpHttpMethod = "GET" + DestinationTypeConfigHttpHttpMethodPost DestinationTypeConfigHttpHttpMethod = "POST" + DestinationTypeConfigHttpHttpMethodPut DestinationTypeConfigHttpHttpMethod = "PUT" + DestinationTypeConfigHttpHttpMethodPatch DestinationTypeConfigHttpHttpMethod = "PATCH" + DestinationTypeConfigHttpHttpMethodDelete DestinationTypeConfigHttpHttpMethod = "DELETE" +) + +func NewDestinationTypeConfigHttpHttpMethodFromString(s string) (DestinationTypeConfigHttpHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigHttpHttpMethodGet, nil + case "POST": + return DestinationTypeConfigHttpHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigHttpHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigHttpHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigHttpHttpMethodDelete, nil + } + var t DestinationTypeConfigHttpHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationTypeConfigHttpHttpMethod) Ptr() *DestinationTypeConfigHttpHttpMethod { + return &d +} + +type DestinationTypeConfigHttpRateLimitPeriod string + +const ( + DestinationTypeConfigHttpRateLimitPeriodSecond DestinationTypeConfigHttpRateLimitPeriod = "second" + DestinationTypeConfigHttpRateLimitPeriodMinute DestinationTypeConfigHttpRateLimitPeriod = "minute" + DestinationTypeConfigHttpRateLimitPeriodHour DestinationTypeConfigHttpRateLimitPeriod = "hour" + DestinationTypeConfigHttpRateLimitPeriodConcurrent DestinationTypeConfigHttpRateLimitPeriod = "concurrent" +) + +func NewDestinationTypeConfigHttpRateLimitPeriodFromString(s string) (DestinationTypeConfigHttpRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigHttpRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigHttpRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigHttpRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigHttpRateLimitPeriodConcurrent, nil + } + var t DestinationTypeConfigHttpRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DestinationTypeConfigHttpRateLimitPeriod) Ptr() *DestinationTypeConfigHttpRateLimitPeriod { + return &d +} + +type DestinationTypeConfigHttpType string + +const ( + DestinationTypeConfigHttpTypeHookdeckSignature DestinationTypeConfigHttpType = "HOOKDECK_SIGNATURE" + DestinationTypeConfigHttpTypeCustomSignature DestinationTypeConfigHttpType = "CUSTOM_SIGNATURE" + DestinationTypeConfigHttpTypeBasicAuth DestinationTypeConfigHttpType = "BASIC_AUTH" + DestinationTypeConfigHttpTypeApiKey DestinationTypeConfigHttpType = "API_KEY" + DestinationTypeConfigHttpTypeBearerToken DestinationTypeConfigHttpType = "BEARER_TOKEN" + DestinationTypeConfigHttpTypeOauth2ClientCredentials DestinationTypeConfigHttpType = "OAUTH2_CLIENT_CREDENTIALS" + DestinationTypeConfigHttpTypeOauth2AuthorizationCode DestinationTypeConfigHttpType = "OAUTH2_AUTHORIZATION_CODE" + DestinationTypeConfigHttpTypeAwsSignature DestinationTypeConfigHttpType = "AWS_SIGNATURE" +) + +func NewDestinationTypeConfigHttpTypeFromString(s string) (DestinationTypeConfigHttpType, error) { + switch s { + case "HOOKDECK_SIGNATURE": + return DestinationTypeConfigHttpTypeHookdeckSignature, nil + case "CUSTOM_SIGNATURE": + return DestinationTypeConfigHttpTypeCustomSignature, nil + case "BASIC_AUTH": + return DestinationTypeConfigHttpTypeBasicAuth, nil + case "API_KEY": + return DestinationTypeConfigHttpTypeApiKey, nil + case "BEARER_TOKEN": + return DestinationTypeConfigHttpTypeBearerToken, nil + case "OAUTH2_CLIENT_CREDENTIALS": + return DestinationTypeConfigHttpTypeOauth2ClientCredentials, nil + case "OAUTH2_AUTHORIZATION_CODE": + return DestinationTypeConfigHttpTypeOauth2AuthorizationCode, nil + case "AWS_SIGNATURE": + return DestinationTypeConfigHttpTypeAwsSignature, nil + } + var t DestinationTypeConfigHttpType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func NewIssueTriggerDeliveryConfigsConnectionsFromString(value string) *IssueTriggerDeliveryConfigsConnections { - return &IssueTriggerDeliveryConfigsConnections{String: value} +func (d DestinationTypeConfigHttpType) Ptr() *DestinationTypeConfigHttpType { + return &d } -func NewIssueTriggerDeliveryConfigsConnectionsFromStringList(value []string) *IssueTriggerDeliveryConfigsConnections { - return &IssueTriggerDeliveryConfigsConnections{StringList: value} +// The type config for Mock API. Requires type to be `MOCK_API`. +type DestinationTypeConfigMockApi struct { + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigMockApiRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigMockApiHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigMockApiAuth `json:"auth,omitempty" url:"auth,omitempty"` + Configs *DestinationTypeConfigMockApiConfigs `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IssueTriggerDeliveryConfigsConnections) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.String = valueString +func (d *DestinationTypeConfigMockApi) GetRateLimit() *float64 { + if d == nil { return nil } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.StringList = valueStringList + return d.RateLimit +} + +func (d *DestinationTypeConfigMockApi) GetRateLimitPeriod() *DestinationTypeConfigMockApiRateLimitPeriod { + if d == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + return d.RateLimitPeriod } -func (i IssueTriggerDeliveryConfigsConnections) MarshalJSON() ([]byte, error) { - if i.String != "" { - return json.Marshal(i.String) - } - if i.StringList != nil { - return json.Marshal(i.StringList) +func (d *DestinationTypeConfigMockApi) GetPathForwardingDisabled() *bool { + if d == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return d.PathForwardingDisabled } -type IssueTriggerDeliveryConfigsConnectionsVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (d *DestinationTypeConfigMockApi) GetHttpMethod() *DestinationTypeConfigMockApiHttpMethod { + if d == nil { + return nil + } + return d.HttpMethod } -func (i *IssueTriggerDeliveryConfigsConnections) Accept(visitor IssueTriggerDeliveryConfigsConnectionsVisitor) error { - if i.String != "" { - return visitor.VisitString(i.String) - } - if i.StringList != nil { - return visitor.VisitStringList(i.StringList) +func (d *DestinationTypeConfigMockApi) GetAuth() *DestinationTypeConfigMockApiAuth { + if d == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", i) + return d.Auth } -// Email channel for an issue trigger -type IssueTriggerEmailChannel struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigMockApi) GetConfigs() *DestinationTypeConfigMockApiConfigs { + if d == nil { + return nil + } + return d.Configs } -func (i *IssueTriggerEmailChannel) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigMockApi) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerEmailChannel) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerEmailChannel +func (d *DestinationTypeConfigMockApi) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigMockApi var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerEmailChannel(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigMockApi(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerEmailChannel) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigMockApi) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// Integration channel for an issue trigger -type IssueTriggerIntegrationChannel struct { +type DestinationTypeConfigMockApiAuth struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTriggerIntegrationChannel) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigMockApiAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerIntegrationChannel) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerIntegrationChannel +func (d *DestinationTypeConfigMockApiAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigMockApiAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerIntegrationChannel(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigMockApiAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerIntegrationChannel) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigMockApiAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type IssueTriggerPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*IssueTrigger `json:"models,omitempty" url:"models,omitempty"` - +type DestinationTypeConfigMockApiConfigs struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (i *IssueTriggerPaginatedResult) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigMockApiConfigs) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerPaginatedResult +func (d *DestinationTypeConfigMockApiConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigMockApiConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigMockApiConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerPaginatedResult) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigMockApiConfigs) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) +} + +type DestinationTypeConfigMockApiHttpMethod string + +const ( + DestinationTypeConfigMockApiHttpMethodGet DestinationTypeConfigMockApiHttpMethod = "GET" + DestinationTypeConfigMockApiHttpMethodPost DestinationTypeConfigMockApiHttpMethod = "POST" + DestinationTypeConfigMockApiHttpMethodPut DestinationTypeConfigMockApiHttpMethod = "PUT" + DestinationTypeConfigMockApiHttpMethodPatch DestinationTypeConfigMockApiHttpMethod = "PATCH" + DestinationTypeConfigMockApiHttpMethodDelete DestinationTypeConfigMockApiHttpMethod = "DELETE" +) + +func NewDestinationTypeConfigMockApiHttpMethodFromString(s string) (DestinationTypeConfigMockApiHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigMockApiHttpMethodGet, nil + case "POST": + return DestinationTypeConfigMockApiHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigMockApiHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigMockApiHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigMockApiHttpMethodDelete, nil + } + var t DestinationTypeConfigMockApiHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -// Configuration object for the specific issue type selected -type IssueTriggerReference struct { - IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs - IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs - IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs +func (d DestinationTypeConfigMockApiHttpMethod) Ptr() *DestinationTypeConfigMockApiHttpMethod { + return &d } -func NewIssueTriggerReferenceFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerReference { - return &IssueTriggerReference{IssueTriggerDeliveryConfigs: value} +type DestinationTypeConfigMockApiRateLimitPeriod string + +const ( + DestinationTypeConfigMockApiRateLimitPeriodSecond DestinationTypeConfigMockApiRateLimitPeriod = "second" + DestinationTypeConfigMockApiRateLimitPeriodMinute DestinationTypeConfigMockApiRateLimitPeriod = "minute" + DestinationTypeConfigMockApiRateLimitPeriodHour DestinationTypeConfigMockApiRateLimitPeriod = "hour" + DestinationTypeConfigMockApiRateLimitPeriodConcurrent DestinationTypeConfigMockApiRateLimitPeriod = "concurrent" +) + +func NewDestinationTypeConfigMockApiRateLimitPeriodFromString(s string) (DestinationTypeConfigMockApiRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigMockApiRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigMockApiRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigMockApiRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigMockApiRateLimitPeriodConcurrent, nil + } + var t DestinationTypeConfigMockApiRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func NewIssueTriggerReferenceFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerReference { - return &IssueTriggerReference{IssueTriggerTransformationConfigs: value} +func (d DestinationTypeConfigMockApiRateLimitPeriod) Ptr() *DestinationTypeConfigMockApiRateLimitPeriod { + return &d } -func NewIssueTriggerReferenceFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerReference { - return &IssueTriggerReference{IssueTriggerBackpressureConfigs: value} +// The type config for OAuth2 (Authorization Code). Requires type to be `OAUTH2_AUTHORIZATION_CODE`. +type DestinationTypeConfigOAuth2AuthorizationCode struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigOAuth2AuthorizationCodeAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IssueTriggerReference) UnmarshalJSON(data []byte) error { - valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { - i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs - return nil - } - valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { - i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetUrl() *string { + if d == nil { return nil } - valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { - i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return d.Url +} + +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetRateLimit() *float64 { + if d == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + return d.RateLimit } -func (i IssueTriggerReference) MarshalJSON() ([]byte, error) { - if i.IssueTriggerDeliveryConfigs != nil { - return json.Marshal(i.IssueTriggerDeliveryConfigs) - } - if i.IssueTriggerTransformationConfigs != nil { - return json.Marshal(i.IssueTriggerTransformationConfigs) - } - if i.IssueTriggerBackpressureConfigs != nil { - return json.Marshal(i.IssueTriggerBackpressureConfigs) +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetRateLimitPeriod() *DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod { + if d == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return d.RateLimitPeriod } -type IssueTriggerReferenceVisitor interface { - VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error - VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error - VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (i *IssueTriggerReference) Accept(visitor IssueTriggerReferenceVisitor) error { - if i.IssueTriggerDeliveryConfigs != nil { - return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) - } - if i.IssueTriggerTransformationConfigs != nil { - return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) - } - if i.IssueTriggerBackpressureConfigs != nil { - return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetHttpMethod() *DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod { + if d == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", i) + return d.HttpMethod } -// Slack channel for an issue trigger -type IssueTriggerSlackChannel struct { - // Channel name - ChannelName string `json:"channel_name" url:"channel_name"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetAuth() *DestinationTypeConfigOAuth2AuthorizationCodeAuth { + if d == nil { + return nil + } + return d.Auth } -func (i *IssueTriggerSlackChannel) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigOAuth2AuthorizationCode) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerSlackChannel) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerSlackChannel +func (d *DestinationTypeConfigOAuth2AuthorizationCode) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigOAuth2AuthorizationCode var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerSlackChannel(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigOAuth2AuthorizationCode(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerSlackChannel) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigOAuth2AuthorizationCode) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -// The strategy uses to open the issue -type IssueTriggerStrategy string +type DestinationTypeConfigOAuth2AuthorizationCodeAuth struct { + AuthServer string `json:"auth_server" url:"auth_server"` + ClientId string `json:"client_id" url:"client_id"` + ClientSecret string `json:"client_secret" url:"client_secret"` + RefreshToken string `json:"refresh_token" url:"refresh_token"` + Scope string `json:"scope" url:"scope"` -const ( - IssueTriggerStrategyFirstAttempt IssueTriggerStrategy = "first_attempt" - IssueTriggerStrategyFinalAttempt IssueTriggerStrategy = "final_attempt" -) + extraProperties map[string]interface{} + rawJSON json.RawMessage +} -func NewIssueTriggerStrategyFromString(s string) (IssueTriggerStrategy, error) { - switch s { - case "first_attempt": - return IssueTriggerStrategyFirstAttempt, nil - case "final_attempt": - return IssueTriggerStrategyFinalAttempt, nil +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetAuthServer() string { + if d == nil { + return "" } - var t IssueTriggerStrategy - return "", fmt.Errorf("%s is not a valid %T", s, t) + return d.AuthServer } -func (i IssueTriggerStrategy) Ptr() *IssueTriggerStrategy { - return &i +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetClientId() string { + if d == nil { + return "" + } + return d.ClientId } -// Configurations for a 'Transformation' issue trigger -type IssueTriggerTransformationConfigs struct { - LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` - // A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. - Transformations *IssueTriggerTransformationConfigsTransformations `json:"transformations,omitempty" url:"transformations,omitempty"` +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetClientSecret() string { + if d == nil { + return "" + } + return d.ClientSecret +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetRefreshToken() string { + if d == nil { + return "" + } + return d.RefreshToken } -func (i *IssueTriggerTransformationConfigs) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetScope() string { + if d == nil { + return "" + } + return d.Scope +} + +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueTriggerTransformationConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler IssueTriggerTransformationConfigs +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigOAuth2AuthorizationCodeAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueTriggerTransformationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigOAuth2AuthorizationCodeAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueTriggerTransformationConfigs) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigOAuth2AuthorizationCodeAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) -} - -// A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. -type IssueTriggerTransformationConfigsTransformations struct { - String string - StringList []string -} - -func NewIssueTriggerTransformationConfigsTransformationsFromString(value string) *IssueTriggerTransformationConfigsTransformations { - return &IssueTriggerTransformationConfigsTransformations{String: value} + return fmt.Sprintf("%#v", d) } -func NewIssueTriggerTransformationConfigsTransformationsFromStringList(value []string) *IssueTriggerTransformationConfigsTransformations { - return &IssueTriggerTransformationConfigsTransformations{StringList: value} -} +type DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod string -func (i *IssueTriggerTransformationConfigsTransformations) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} +const ( + DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodGet DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod = "GET" + DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPost DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod = "POST" + DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPut DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod = "PUT" + DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPatch DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod = "PATCH" + DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodDelete DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod = "DELETE" +) -func (i IssueTriggerTransformationConfigsTransformations) MarshalJSON() ([]byte, error) { - if i.String != "" { - return json.Marshal(i.String) - } - if i.StringList != nil { - return json.Marshal(i.StringList) +func NewDestinationTypeConfigOAuth2AuthorizationCodeHttpMethodFromString(s string) (DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodGet, nil + case "POST": + return DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigOAuth2AuthorizationCodeHttpMethodDelete, nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) -} - -type IssueTriggerTransformationConfigsTransformationsVisitor interface { - VisitString(string) error - VisitStringList([]string) error + var t DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i *IssueTriggerTransformationConfigsTransformations) Accept(visitor IssueTriggerTransformationConfigsTransformationsVisitor) error { - if i.String != "" { - return visitor.VisitString(i.String) - } - if i.StringList != nil { - return visitor.VisitStringList(i.StringList) - } - return fmt.Errorf("type %T does not include a non-empty union type", i) +func (d DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod) Ptr() *DestinationTypeConfigOAuth2AuthorizationCodeHttpMethod { + return &d } -// Issue type -type IssueType string +type DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod string const ( - IssueTypeDelivery IssueType = "delivery" - IssueTypeTransformation IssueType = "transformation" - IssueTypeBackpressure IssueType = "backpressure" + DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodSecond DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod = "second" + DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodMinute DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod = "minute" + DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodHour DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod = "hour" + DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodConcurrent DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod = "concurrent" ) -func NewIssueTypeFromString(s string) (IssueType, error) { +func NewDestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodFromString(s string) (DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod, error) { switch s { - case "delivery": - return IssueTypeDelivery, nil - case "transformation": - return IssueTypeTransformation, nil - case "backpressure": - return IssueTypeBackpressure, nil - } - var t IssueType + case "second": + return DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriodConcurrent, nil + } + var t DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (i IssueType) Ptr() *IssueType { - return &i +func (d DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod) Ptr() *DestinationTypeConfigOAuth2AuthorizationCodeRateLimitPeriod { + return &d } -type IssueWithData struct { - Type string - Delivery *DeliveryIssueWithData - Transformation *TransformationIssueWithData -} +// The type config for OAuth2 (Client Credentials). Requires type to be `OAUTH2_CLIENT_CREDENTIALS`. +type DestinationTypeConfigOAuth2ClientCredentials struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + Url *string `json:"url,omitempty" url:"url,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty" url:"rate_limit,omitempty"` + RateLimitPeriod *DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod `json:"rate_limit_period,omitempty" url:"rate_limit_period,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty" url:"path_forwarding_disabled,omitempty"` + HttpMethod *DestinationTypeConfigOAuth2ClientCredentialsHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + Auth *DestinationTypeConfigOAuth2ClientCredentialsAuth `json:"auth,omitempty" url:"auth,omitempty"` -func NewIssueWithDataFromDelivery(value *DeliveryIssueWithData) *IssueWithData { - return &IssueWithData{Type: "delivery", Delivery: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewIssueWithDataFromTransformation(value *TransformationIssueWithData) *IssueWithData { - return &IssueWithData{Type: "transformation", Transformation: value} +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetUrl() *string { + if d == nil { + return nil + } + return d.Url } -func (i *IssueWithData) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - i.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", i) - } - switch unmarshaler.Type { - case "delivery": - value := new(DeliveryIssueWithData) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - i.Delivery = value - case "transformation": - value := new(TransformationIssueWithData) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - i.Transformation = value +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetRateLimit() *float64 { + if d == nil { + return nil } - return nil + return d.RateLimit } -func (i IssueWithData) MarshalJSON() ([]byte, error) { - switch i.Type { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.Type, i) - case "delivery": - return core.MarshalJSONWithExtraProperty(i.Delivery, "type", "delivery") - case "transformation": - return core.MarshalJSONWithExtraProperty(i.Transformation, "type", "transformation") +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetRateLimitPeriod() *DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod { + if d == nil { + return nil } + return d.RateLimitPeriod } -type IssueWithDataVisitor interface { - VisitDelivery(*DeliveryIssueWithData) error - VisitTransformation(*TransformationIssueWithData) error +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetPathForwardingDisabled() *bool { + if d == nil { + return nil + } + return d.PathForwardingDisabled } -func (i *IssueWithData) Accept(visitor IssueWithDataVisitor) error { - switch i.Type { - default: - return fmt.Errorf("invalid type %s in %T", i.Type, i) - case "delivery": - return visitor.VisitDelivery(i.Delivery) - case "transformation": - return visitor.VisitTransformation(i.Transformation) +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetHttpMethod() *DestinationTypeConfigOAuth2ClientCredentialsHttpMethod { + if d == nil { + return nil } + return d.HttpMethod } -type IssueWithDataPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*IssueWithData `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetAuth() *DestinationTypeConfigOAuth2ClientCredentialsAuth { + if d == nil { + return nil + } + return d.Auth } -func (i *IssueWithDataPaginatedResult) GetExtraProperties() map[string]interface{} { - return i.extraProperties +func (d *DestinationTypeConfigOAuth2ClientCredentials) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (i *IssueWithDataPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler IssueWithDataPaginatedResult +func (d *DestinationTypeConfigOAuth2ClientCredentials) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigOAuth2ClientCredentials var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *i = IssueWithDataPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *i) + *d = DestinationTypeConfigOAuth2ClientCredentials(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - i.extraProperties = extraProperties - - i._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (i *IssueWithDataPaginatedResult) String() string { - if len(i._rawJSON) > 0 { - if value, err := core.StringifyJSON(i._rawJSON); err == nil { +func (d *DestinationTypeConfigOAuth2ClientCredentials) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(i); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", i) + return fmt.Sprintf("%#v", d) } -type ListCustomDomainSchema = []*ListCustomDomainSchemaItem - -type ListCustomDomainSchemaItem struct { - Id *string `json:"id,omitempty" url:"id,omitempty"` - Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"` - Status *string `json:"status,omitempty" url:"status,omitempty"` - Ssl *ListCustomDomainSchemaItemSsl `json:"ssl,omitempty" url:"ssl,omitempty"` - VerificationErrors []string `json:"verification_errors,omitempty" url:"verification_errors,omitempty"` - OwnershipVerification *ListCustomDomainSchemaItemOwnershipVerification `json:"ownership_verification,omitempty" url:"ownership_verification,omitempty"` - CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"` +type DestinationTypeConfigOAuth2ClientCredentialsAuth struct { + AuthServer string `json:"auth_server" url:"auth_server"` + ClientId string `json:"client_id" url:"client_id"` + ClientSecret string `json:"client_secret" url:"client_secret"` + Scope string `json:"scope" url:"scope"` + AuthenticationType DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType `json:"authentication_type" url:"authentication_type"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (l *ListCustomDomainSchemaItem) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetAuthServer() string { + if d == nil { + return "" + } + return d.AuthServer } -func (l *ListCustomDomainSchemaItem) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItem - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetClientId() string { + if d == nil { + return "" } - *l = ListCustomDomainSchemaItem(value) + return d.ClientId +} - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetClientSecret() string { + if d == nil { + return "" } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) - return nil + return d.ClientSecret } -func (l *ListCustomDomainSchemaItem) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetScope() string { + if d == nil { + return "" } - return fmt.Sprintf("%#v", l) + return d.Scope } -type ListCustomDomainSchemaItemOwnershipVerification struct { - Type *string `json:"type,omitempty" url:"type,omitempty"` - Name *string `json:"name,omitempty" url:"name,omitempty"` - Value *string `json:"value,omitempty" url:"value,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetAuthenticationType() DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType { + if d == nil { + return "" + } + return d.AuthenticationType } -func (l *ListCustomDomainSchemaItemOwnershipVerification) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (l *ListCustomDomainSchemaItemOwnershipVerification) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItemOwnershipVerification +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) UnmarshalJSON(data []byte) error { + type unmarshaler DestinationTypeConfigOAuth2ClientCredentialsAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomDomainSchemaItemOwnershipVerification(value) - - extraProperties, err := core.ExtractExtraProperties(data, *l) + *d = DestinationTypeConfigOAuth2ClientCredentialsAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (l *ListCustomDomainSchemaItemOwnershipVerification) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (d *DestinationTypeConfigOAuth2ClientCredentialsAuth) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", d) } -type ListCustomDomainSchemaItemSsl struct { - Id *string `json:"id,omitempty" url:"id,omitempty"` - Type *string `json:"type,omitempty" url:"type,omitempty"` - Method *string `json:"method,omitempty" url:"method,omitempty"` - Status *string `json:"status,omitempty" url:"status,omitempty"` - TxtName *string `json:"txt_name,omitempty" url:"txt_name,omitempty"` - TxtValue *string `json:"txt_value,omitempty" url:"txt_value,omitempty"` - ValidationRecords []*ListCustomDomainSchemaItemSslValidationRecordsItem `json:"validation_records,omitempty" url:"validation_records,omitempty"` - DcvDelegationRecords []*ListCustomDomainSchemaItemSslDcvDelegationRecordsItem `json:"dcv_delegation_records,omitempty" url:"dcv_delegation_records,omitempty"` - Settings *ListCustomDomainSchemaItemSslSettings `json:"settings,omitempty" url:"settings,omitempty"` - BundleMethod *string `json:"bundle_method,omitempty" url:"bundle_method,omitempty"` - Wildcard *bool `json:"wildcard,omitempty" url:"wildcard,omitempty"` - CertificateAuthority *string `json:"certificate_authority,omitempty" url:"certificate_authority,omitempty"` +type DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeBasic DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType = "basic" + DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeBearer DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType = "bearer" + DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeXWwwFormUrlencoded DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType = "x-www-form-urlencoded" +) + +func NewDestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeFromString(s string) (DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType, error) { + switch s { + case "basic": + return DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeBasic, nil + case "bearer": + return DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeBearer, nil + case "x-www-form-urlencoded": + return DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationTypeXWwwFormUrlencoded, nil + } + var t DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (l *ListCustomDomainSchemaItemSsl) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (d DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType) Ptr() *DestinationTypeConfigOAuth2ClientCredentialsAuthAuthenticationType { + return &d } -func (l *ListCustomDomainSchemaItemSsl) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItemSsl - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = ListCustomDomainSchemaItemSsl(value) +type DestinationTypeConfigOAuth2ClientCredentialsHttpMethod string - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +const ( + DestinationTypeConfigOAuth2ClientCredentialsHttpMethodGet DestinationTypeConfigOAuth2ClientCredentialsHttpMethod = "GET" + DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPost DestinationTypeConfigOAuth2ClientCredentialsHttpMethod = "POST" + DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPut DestinationTypeConfigOAuth2ClientCredentialsHttpMethod = "PUT" + DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPatch DestinationTypeConfigOAuth2ClientCredentialsHttpMethod = "PATCH" + DestinationTypeConfigOAuth2ClientCredentialsHttpMethodDelete DestinationTypeConfigOAuth2ClientCredentialsHttpMethod = "DELETE" +) + +func NewDestinationTypeConfigOAuth2ClientCredentialsHttpMethodFromString(s string) (DestinationTypeConfigOAuth2ClientCredentialsHttpMethod, error) { + switch s { + case "GET": + return DestinationTypeConfigOAuth2ClientCredentialsHttpMethodGet, nil + case "POST": + return DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPost, nil + case "PUT": + return DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPut, nil + case "PATCH": + return DestinationTypeConfigOAuth2ClientCredentialsHttpMethodPatch, nil + case "DELETE": + return DestinationTypeConfigOAuth2ClientCredentialsHttpMethodDelete, nil } - l.extraProperties = extraProperties + var t DestinationTypeConfigOAuth2ClientCredentialsHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} - l._rawJSON = json.RawMessage(data) - return nil +func (d DestinationTypeConfigOAuth2ClientCredentialsHttpMethod) Ptr() *DestinationTypeConfigOAuth2ClientCredentialsHttpMethod { + return &d } -func (l *ListCustomDomainSchemaItemSsl) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value +type DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod string + +const ( + DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodSecond DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod = "second" + DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodMinute DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod = "minute" + DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodHour DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod = "hour" + DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodConcurrent DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod = "concurrent" +) + +func NewDestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodFromString(s string) (DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod, error) { + switch s { + case "second": + return DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodSecond, nil + case "minute": + return DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodMinute, nil + case "hour": + return DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodHour, nil + case "concurrent": + return DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriodConcurrent, nil } - return fmt.Sprintf("%#v", l) + var t DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -type ListCustomDomainSchemaItemSslDcvDelegationRecordsItem struct { - Cname *string `json:"cname,omitempty" url:"cname,omitempty"` - CnameTarget *string `json:"cname_target,omitempty" url:"cname_target,omitempty"` +func (d DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod) Ptr() *DestinationTypeConfigOAuth2ClientCredentialsRateLimitPeriod { + return &d +} +type DetachedIntegrationFromSource struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (d *DetachedIntegrationFromSource) GetExtraProperties() map[string]interface{} { + return d.extraProperties } -func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItemSslDcvDelegationRecordsItem +func (d *DetachedIntegrationFromSource) UnmarshalJSON(data []byte) error { + type unmarshaler DetachedIntegrationFromSource var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *l = ListCustomDomainSchemaItemSslDcvDelegationRecordsItem(value) - - extraProperties, err := core.ExtractExtraProperties(data, *l) + *d = DetachedIntegrationFromSource(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) if err != nil { return err } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) return nil } -func (l *ListCustomDomainSchemaItemSslDcvDelegationRecordsItem) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { +func (d *DetachedIntegrationFromSource) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(l); err == nil { + if value, err := internal.StringifyJSON(d); err == nil { return value } - return fmt.Sprintf("%#v", l) + return fmt.Sprintf("%#v", d) } -type ListCustomDomainSchemaItemSslSettings struct { - MinTlsVersion *string `json:"min_tls_version,omitempty" url:"min_tls_version,omitempty"` +type Event struct { + // ID of the event + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // ID of the associated connection + WebhookId string `json:"webhook_id" url:"webhook_id"` + // ID of the associated source + SourceId string `json:"source_id" url:"source_id"` + // ID of the associated destination + DestinationId string `json:"destination_id" url:"destination_id"` + // ID of the event data + EventDataId string `json:"event_data_id" url:"event_data_id"` + // ID of the request that created the event + RequestId string `json:"request_id" url:"request_id"` + // Number of delivery attempts made + Attempts int `json:"attempts" url:"attempts"` + // Date of the most recently attempted retry + LastAttemptAt *time.Time `json:"last_attempt_at,omitempty" url:"last_attempt_at,omitempty"` + // Date of the next scheduled retry + NextAttemptAt *time.Time `json:"next_attempt_at,omitempty" url:"next_attempt_at,omitempty"` + // Event status + ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` + ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` + Status EventStatus `json:"status" url:"status"` + // Date of the latest successful attempt + SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` + // ID of the CLI the event is sent to + CliId *string `json:"cli_id,omitempty" url:"cli_id,omitempty"` + // Date the event was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the event was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (l *ListCustomDomainSchemaItemSslSettings) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (e *Event) GetId() string { + if e == nil { + return "" + } + return e.Id } -func (l *ListCustomDomainSchemaItemSslSettings) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItemSslSettings - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (e *Event) GetTeamId() string { + if e == nil { + return "" } - *l = ListCustomDomainSchemaItemSslSettings(value) + return e.TeamId +} - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +func (e *Event) GetWebhookId() string { + if e == nil { + return "" } - l.extraProperties = extraProperties - - l._rawJSON = json.RawMessage(data) - return nil + return e.WebhookId } -func (l *ListCustomDomainSchemaItemSslSettings) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(l); err == nil { - return value +func (e *Event) GetSourceId() string { + if e == nil { + return "" } - return fmt.Sprintf("%#v", l) + return e.SourceId } -type ListCustomDomainSchemaItemSslValidationRecordsItem struct { - Status *string `json:"status,omitempty" url:"status,omitempty"` - TxtName *string `json:"txt_name,omitempty" url:"txt_name,omitempty"` - TxtValue *string `json:"txt_value,omitempty" url:"txt_value,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (e *Event) GetDestinationId() string { + if e == nil { + return "" + } + return e.DestinationId } -func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) GetExtraProperties() map[string]interface{} { - return l.extraProperties +func (e *Event) GetEventDataId() string { + if e == nil { + return "" + } + return e.EventDataId } -func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) UnmarshalJSON(data []byte) error { - type unmarshaler ListCustomDomainSchemaItemSslValidationRecordsItem - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (e *Event) GetRequestId() string { + if e == nil { + return "" } - *l = ListCustomDomainSchemaItemSslValidationRecordsItem(value) + return e.RequestId +} - extraProperties, err := core.ExtractExtraProperties(data, *l) - if err != nil { - return err +func (e *Event) GetAttempts() int { + if e == nil { + return 0 } - l.extraProperties = extraProperties + return e.Attempts +} - l._rawJSON = json.RawMessage(data) - return nil +func (e *Event) GetLastAttemptAt() *time.Time { + if e == nil { + return nil + } + return e.LastAttemptAt } -func (l *ListCustomDomainSchemaItemSslValidationRecordsItem) String() string { - if len(l._rawJSON) > 0 { - if value, err := core.StringifyJSON(l._rawJSON); err == nil { - return value - } +func (e *Event) GetNextAttemptAt() *time.Time { + if e == nil { + return nil } - if value, err := core.StringifyJSON(l); err == nil { - return value + return e.NextAttemptAt +} + +func (e *Event) GetResponseStatus() *int { + if e == nil { + return nil } - return fmt.Sprintf("%#v", l) + return e.ResponseStatus } -type Operators struct { - Gt *time.Time `json:"gt,omitempty" url:"gt,omitempty"` - Gte *time.Time `json:"gte,omitempty" url:"gte,omitempty"` - Le *time.Time `json:"le,omitempty" url:"le,omitempty"` - Lte *time.Time `json:"lte,omitempty" url:"lte,omitempty"` - Any *bool `json:"any,omitempty" url:"any,omitempty"` +func (e *Event) GetErrorCode() *AttemptErrorCodes { + if e == nil { + return nil + } + return e.ErrorCode +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (e *Event) GetStatus() EventStatus { + if e == nil { + return "" + } + return e.Status } -func (o *Operators) GetExtraProperties() map[string]interface{} { - return o.extraProperties +func (e *Event) GetSuccessfulAt() *time.Time { + if e == nil { + return nil + } + return e.SuccessfulAt } -func (o *Operators) UnmarshalJSON(data []byte) error { - type embed Operators +func (e *Event) GetCliId() *string { + if e == nil { + return nil + } + return e.CliId +} + +func (e *Event) GetUpdatedAt() time.Time { + if e == nil { + return time.Time{} + } + return e.UpdatedAt +} + +func (e *Event) GetCreatedAt() time.Time { + if e == nil { + return time.Time{} + } + return e.CreatedAt +} + +func (e *Event) GetData() *ShortEventData { + if e == nil { + return nil + } + return e.Data +} + +func (e *Event) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *Event) UnmarshalJSON(data []byte) error { + type embed Event var unmarshaler = struct { embed - Gt *core.DateTime `json:"gt,omitempty"` - Gte *core.DateTime `json:"gte,omitempty"` - Le *core.DateTime `json:"le,omitempty"` - Lte *core.DateTime `json:"lte,omitempty"` + LastAttemptAt *internal.DateTime `json:"last_attempt_at,omitempty"` + NextAttemptAt *internal.DateTime `json:"next_attempt_at,omitempty"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*o), + embed: embed(*e), } if err := json.Unmarshal(data, &unmarshaler); err != nil { return err } - *o = Operators(unmarshaler.embed) - o.Gt = unmarshaler.Gt.TimePtr() - o.Gte = unmarshaler.Gte.TimePtr() - o.Le = unmarshaler.Le.TimePtr() - o.Lte = unmarshaler.Lte.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *o) + *e = Event(unmarshaler.embed) + e.LastAttemptAt = unmarshaler.LastAttemptAt.TimePtr() + e.NextAttemptAt = unmarshaler.NextAttemptAt.TimePtr() + e.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() + e.UpdatedAt = unmarshaler.UpdatedAt.Time() + e.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } - o.extraProperties = extraProperties - - o._rawJSON = json.RawMessage(data) + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) return nil } -func (o *Operators) MarshalJSON() ([]byte, error) { - type embed Operators +func (e *Event) MarshalJSON() ([]byte, error) { + type embed Event var marshaler = struct { embed - Gt *core.DateTime `json:"gt,omitempty"` - Gte *core.DateTime `json:"gte,omitempty"` - Le *core.DateTime `json:"le,omitempty"` - Lte *core.DateTime `json:"lte,omitempty"` + LastAttemptAt *internal.DateTime `json:"last_attempt_at,omitempty"` + NextAttemptAt *internal.DateTime `json:"next_attempt_at,omitempty"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*o), - Gt: core.NewOptionalDateTime(o.Gt), - Gte: core.NewOptionalDateTime(o.Gte), - Le: core.NewOptionalDateTime(o.Le), - Lte: core.NewOptionalDateTime(o.Lte), + embed: embed(*e), + LastAttemptAt: internal.NewOptionalDateTime(e.LastAttemptAt), + NextAttemptAt: internal.NewOptionalDateTime(e.NextAttemptAt), + SuccessfulAt: internal.NewOptionalDateTime(e.SuccessfulAt), + UpdatedAt: internal.NewDateTime(e.UpdatedAt), + CreatedAt: internal.NewDateTime(e.CreatedAt), } return json.Marshal(marshaler) } -func (o *Operators) String() string { - if len(o._rawJSON) > 0 { - if value, err := core.StringifyJSON(o._rawJSON); err == nil { +func (e *Event) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(o); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } - return fmt.Sprintf("%#v", o) + return fmt.Sprintf("%#v", e) } -type OrderByDirection string +type EventAttempt struct { + // Attempt ID + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // Event ID + EventId string `json:"event_id" url:"event_id"` + // Destination ID + DestinationId string `json:"destination_id" url:"destination_id"` + // Attempt's HTTP response code + ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` + // Sequential number of attempts (up to and including this one) made for the associated event + AttemptNumber *int `json:"attempt_number,omitempty" url:"attempt_number,omitempty"` + Trigger *AttemptTrigger `json:"trigger,omitempty" url:"trigger,omitempty"` + ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` + Body *EventAttemptBody `json:"body,omitempty" url:"body,omitempty"` + // URL of the destination where delivery was attempted + RequestedUrl *string `json:"requested_url,omitempty" url:"requested_url,omitempty"` + // HTTP method used to deliver the attempt + HttpMethod *EventAttemptHttpMethod `json:"http_method,omitempty" url:"http_method,omitempty"` + // ID of associated bulk retry + BulkRetryId *string `json:"bulk_retry_id,omitempty" url:"bulk_retry_id,omitempty"` + Status AttemptStatus `json:"status" url:"status"` + // Date the attempt was successful + SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` + // Date the attempt was delivered + DeliveredAt *time.Time `json:"delivered_at,omitempty" url:"delivered_at,omitempty"` + // Date the destination responded to this attempt + RespondedAt *time.Time `json:"responded_at,omitempty" url:"responded_at,omitempty"` + // Time elapsed between attempt initiation and final delivery (in ms) + DeliveryLatency *int `json:"delivery_latency,omitempty" url:"delivery_latency,omitempty"` + // Time elapsed between attempt initiation and a response from the destination (in ms) + ResponseLatency *int `json:"response_latency,omitempty" url:"response_latency,omitempty"` + // Date the attempt was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the attempt was created + CreatedAt time.Time `json:"created_at" url:"created_at"` -const ( - OrderByDirectionAsc OrderByDirection = "asc" - OrderByDirectionDesc OrderByDirection = "desc" -) + extraProperties map[string]interface{} + rawJSON json.RawMessage +} -func NewOrderByDirectionFromString(s string) (OrderByDirection, error) { - switch s { - case "asc": - return OrderByDirectionAsc, nil - case "desc": - return OrderByDirectionDesc, nil +func (e *EventAttempt) GetId() string { + if e == nil { + return "" } - var t OrderByDirection - return "", fmt.Errorf("%s is not a valid %T", s, t) + return e.Id } -func (o OrderByDirection) Ptr() *OrderByDirection { - return &o +func (e *EventAttempt) GetTeamId() string { + if e == nil { + return "" + } + return e.TeamId } -type RawBody struct { - Body string `json:"body" url:"body"` +func (e *EventAttempt) GetEventId() string { + if e == nil { + return "" + } + return e.EventId +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (e *EventAttempt) GetDestinationId() string { + if e == nil { + return "" + } + return e.DestinationId } -func (r *RawBody) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (e *EventAttempt) GetResponseStatus() *int { + if e == nil { + return nil + } + return e.ResponseStatus } -func (r *RawBody) UnmarshalJSON(data []byte) error { - type unmarshaler RawBody - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (e *EventAttempt) GetAttemptNumber() *int { + if e == nil { + return nil } - *r = RawBody(value) + return e.AttemptNumber +} - extraProperties, err := core.ExtractExtraProperties(data, *r) - if err != nil { - return err +func (e *EventAttempt) GetTrigger() *AttemptTrigger { + if e == nil { + return nil } - r.extraProperties = extraProperties + return e.Trigger +} - r._rawJSON = json.RawMessage(data) - return nil +func (e *EventAttempt) GetErrorCode() *AttemptErrorCodes { + if e == nil { + return nil + } + return e.ErrorCode } -func (r *RawBody) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { - return value - } +func (e *EventAttempt) GetBody() *EventAttemptBody { + if e == nil { + return nil } - if value, err := core.StringifyJSON(r); err == nil { - return value + return e.Body +} + +func (e *EventAttempt) GetRequestedUrl() *string { + if e == nil { + return nil } - return fmt.Sprintf("%#v", r) + return e.RequestedUrl } -type Request struct { - // ID of the request - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // Whether or not the request was verified when received - Verified *bool `json:"verified,omitempty" url:"verified,omitempty"` - // ID of the request data - OriginalEventDataId *string `json:"original_event_data_id,omitempty" url:"original_event_data_id,omitempty"` - RejectionCause RequestRejectionCause `json:"rejection_cause" url:"rejection_cause"` - // The priority attributed to the request when received - IngestPriority *RequestIngestPriority `json:"ingest_priority,omitempty" url:"ingest_priority,omitempty"` - // The time the request was originally received - IngestedAt *time.Time `json:"ingested_at,omitempty" url:"ingested_at,omitempty"` - // ID of the associated source - SourceId string `json:"source_id" url:"source_id"` - // The count of events created from this request (CLI events not included) - EventsCount *int `json:"events_count,omitempty" url:"events_count,omitempty"` - // The count of CLI events created from this request - CliEventsCount *int `json:"cli_events_count,omitempty" url:"cli_events_count,omitempty"` - IgnoredCount *int `json:"ignored_count,omitempty" url:"ignored_count,omitempty"` - // Date the event was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the event was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` +func (e *EventAttempt) GetHttpMethod() *EventAttemptHttpMethod { + if e == nil { + return nil + } + return e.HttpMethod +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (e *EventAttempt) GetBulkRetryId() *string { + if e == nil { + return nil + } + return e.BulkRetryId } -func (r *Request) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (e *EventAttempt) GetStatus() AttemptStatus { + if e == nil { + return "" + } + return e.Status +} + +func (e *EventAttempt) GetSuccessfulAt() *time.Time { + if e == nil { + return nil + } + return e.SuccessfulAt +} + +func (e *EventAttempt) GetDeliveredAt() *time.Time { + if e == nil { + return nil + } + return e.DeliveredAt +} + +func (e *EventAttempt) GetRespondedAt() *time.Time { + if e == nil { + return nil + } + return e.RespondedAt +} + +func (e *EventAttempt) GetDeliveryLatency() *int { + if e == nil { + return nil + } + return e.DeliveryLatency +} + +func (e *EventAttempt) GetResponseLatency() *int { + if e == nil { + return nil + } + return e.ResponseLatency } -func (r *Request) UnmarshalJSON(data []byte) error { - type embed Request +func (e *EventAttempt) GetUpdatedAt() time.Time { + if e == nil { + return time.Time{} + } + return e.UpdatedAt +} + +func (e *EventAttempt) GetCreatedAt() time.Time { + if e == nil { + return time.Time{} + } + return e.CreatedAt +} + +func (e *EventAttempt) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *EventAttempt) UnmarshalJSON(data []byte) error { + type embed EventAttempt var unmarshaler = struct { embed - IngestedAt *core.DateTime `json:"ingested_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + DeliveredAt *internal.DateTime `json:"delivered_at,omitempty"` + RespondedAt *internal.DateTime `json:"responded_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*r), + embed: embed(*e), } if err := json.Unmarshal(data, &unmarshaler); err != nil { return err } - *r = Request(unmarshaler.embed) - r.IngestedAt = unmarshaler.IngestedAt.TimePtr() - r.UpdatedAt = unmarshaler.UpdatedAt.Time() - r.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *e = EventAttempt(unmarshaler.embed) + e.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() + e.DeliveredAt = unmarshaler.DeliveredAt.TimePtr() + e.RespondedAt = unmarshaler.RespondedAt.TimePtr() + e.UpdatedAt = unmarshaler.UpdatedAt.Time() + e.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) return nil } -func (r *Request) MarshalJSON() ([]byte, error) { - type embed Request +func (e *EventAttempt) MarshalJSON() ([]byte, error) { + type embed EventAttempt var marshaler = struct { embed - IngestedAt *core.DateTime `json:"ingested_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` + SuccessfulAt *internal.DateTime `json:"successful_at,omitempty"` + DeliveredAt *internal.DateTime `json:"delivered_at,omitempty"` + RespondedAt *internal.DateTime `json:"responded_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*r), - IngestedAt: core.NewOptionalDateTime(r.IngestedAt), - UpdatedAt: core.NewDateTime(r.UpdatedAt), - CreatedAt: core.NewDateTime(r.CreatedAt), + embed: embed(*e), + SuccessfulAt: internal.NewOptionalDateTime(e.SuccessfulAt), + DeliveredAt: internal.NewOptionalDateTime(e.DeliveredAt), + RespondedAt: internal.NewOptionalDateTime(e.RespondedAt), + UpdatedAt: internal.NewDateTime(e.UpdatedAt), + CreatedAt: internal.NewDateTime(e.CreatedAt), } return json.Marshal(marshaler) } -func (r *Request) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (e *EventAttempt) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", e) } -// The priority attributed to the request when received -type RequestIngestPriority string - -const ( - RequestIngestPriorityNormal RequestIngestPriority = "NORMAL" - RequestIngestPriorityLow RequestIngestPriority = "LOW" -) - -func NewRequestIngestPriorityFromString(s string) (RequestIngestPriority, error) { - switch s { - case "NORMAL": - return RequestIngestPriorityNormal, nil - case "LOW": - return RequestIngestPriorityLow, nil - } - var t RequestIngestPriority - return "", fmt.Errorf("%s is not a valid %T", s, t) -} +type EventAttemptBody struct { + // Response body from the destination + EventAttemptBodyZeroOptional *EventAttemptBodyZero + // Response body from the destination + StringOptional *string -func (r RequestIngestPriority) Ptr() *RequestIngestPriority { - return &r + typ string } -type RequestPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Request `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewEventAttemptBodyFromEventAttemptBodyZeroOptional(value *EventAttemptBodyZero) *EventAttemptBody { + return &EventAttemptBody{typ: "EventAttemptBodyZeroOptional", EventAttemptBodyZeroOptional: value} } -func (r *RequestPaginatedResult) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func NewEventAttemptBodyFromStringOptional(value *string) *EventAttemptBody { + return &EventAttemptBody{typ: "StringOptional", StringOptional: value} } -func (r *RequestPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler RequestPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (e *EventAttemptBody) GetEventAttemptBodyZeroOptional() *EventAttemptBodyZero { + if e == nil { + return nil } - *r = RequestPaginatedResult(value) + return e.EventAttemptBodyZeroOptional +} - extraProperties, err := core.ExtractExtraProperties(data, *r) - if err != nil { - return err +func (e *EventAttemptBody) GetStringOptional() *string { + if e == nil { + return nil } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) - return nil + return e.StringOptional } -func (r *RequestPaginatedResult) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(r); err == nil { - return value +func (e *EventAttemptBody) UnmarshalJSON(data []byte) error { + var valueEventAttemptBodyZeroOptional *EventAttemptBodyZero + if err := json.Unmarshal(data, &valueEventAttemptBodyZeroOptional); err == nil { + e.typ = "EventAttemptBodyZeroOptional" + e.EventAttemptBodyZeroOptional = valueEventAttemptBodyZeroOptional + return nil } - return fmt.Sprintf("%#v", r) + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + e.typ = "StringOptional" + e.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) } -type RequestRejectionCause string - -const ( - RequestRejectionCauseSourceDisabled RequestRejectionCause = "SOURCE_DISABLED" - RequestRejectionCauseNoConnection RequestRejectionCause = "NO_CONNECTION" - RequestRejectionCauseVerificationFailed RequestRejectionCause = "VERIFICATION_FAILED" - RequestRejectionCauseUnsupportedHttpMethod RequestRejectionCause = "UNSUPPORTED_HTTP_METHOD" - RequestRejectionCauseUnsupportedContentType RequestRejectionCause = "UNSUPPORTED_CONTENT_TYPE" - RequestRejectionCauseUnparsableJson RequestRejectionCause = "UNPARSABLE_JSON" - RequestRejectionCausePayloadTooLarge RequestRejectionCause = "PAYLOAD_TOO_LARGE" - RequestRejectionCauseIngestionFatal RequestRejectionCause = "INGESTION_FATAL" - RequestRejectionCauseUnknown RequestRejectionCause = "UNKNOWN" -) - -func NewRequestRejectionCauseFromString(s string) (RequestRejectionCause, error) { - switch s { - case "SOURCE_DISABLED": - return RequestRejectionCauseSourceDisabled, nil - case "NO_CONNECTION": - return RequestRejectionCauseNoConnection, nil - case "VERIFICATION_FAILED": - return RequestRejectionCauseVerificationFailed, nil - case "UNSUPPORTED_HTTP_METHOD": - return RequestRejectionCauseUnsupportedHttpMethod, nil - case "UNSUPPORTED_CONTENT_TYPE": - return RequestRejectionCauseUnsupportedContentType, nil - case "UNPARSABLE_JSON": - return RequestRejectionCauseUnparsableJson, nil - case "PAYLOAD_TOO_LARGE": - return RequestRejectionCausePayloadTooLarge, nil - case "INGESTION_FATAL": - return RequestRejectionCauseIngestionFatal, nil - case "UNKNOWN": - return RequestRejectionCauseUnknown, nil +func (e EventAttemptBody) MarshalJSON() ([]byte, error) { + if e.typ == "EventAttemptBodyZeroOptional" || e.EventAttemptBodyZeroOptional != nil { + return json.Marshal(e.EventAttemptBodyZeroOptional) } - var t RequestRejectionCause - return "", fmt.Errorf("%s is not a valid %T", s, t) + if e.typ == "StringOptional" || e.StringOptional != nil { + return json.Marshal(e.StringOptional) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) } -func (r RequestRejectionCause) Ptr() *RequestRejectionCause { - return &r +type EventAttemptBodyVisitor interface { + VisitEventAttemptBodyZeroOptional(*EventAttemptBodyZero) error + VisitStringOptional(*string) error } -type RetriedEvent struct { - // ID of the event - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // ID of the associated connection - WebhookId string `json:"webhook_id" url:"webhook_id"` - // ID of the associated source - SourceId string `json:"source_id" url:"source_id"` - // ID of the associated destination - DestinationId string `json:"destination_id" url:"destination_id"` - // ID of the event data - EventDataId string `json:"event_data_id" url:"event_data_id"` - // ID of the request that created the event - RequestId string `json:"request_id" url:"request_id"` - // Number of delivery attempts made - Attempts int `json:"attempts" url:"attempts"` - // Date of the most recently attempted retry - LastAttemptAt *time.Time `json:"last_attempt_at,omitempty" url:"last_attempt_at,omitempty"` - // Date of the next scheduled retry - NextAttemptAt *time.Time `json:"next_attempt_at,omitempty" url:"next_attempt_at,omitempty"` - // Event status - ResponseStatus *int `json:"response_status,omitempty" url:"response_status,omitempty"` - ErrorCode *AttemptErrorCodes `json:"error_code,omitempty" url:"error_code,omitempty"` - Status EventStatus `json:"status" url:"status"` - // Date of the latest successful attempt - SuccessfulAt *time.Time `json:"successful_at,omitempty" url:"successful_at,omitempty"` - // ID of the CLI the event is sent to - CliId *string `json:"cli_id,omitempty" url:"cli_id,omitempty"` - // Date the event was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the event was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - Data *ShortEventData `json:"data,omitempty" url:"data,omitempty"` +func (e *EventAttemptBody) Accept(visitor EventAttemptBodyVisitor) error { + if e.typ == "EventAttemptBodyZeroOptional" || e.EventAttemptBodyZeroOptional != nil { + return visitor.VisitEventAttemptBodyZeroOptional(e.EventAttemptBodyZeroOptional) + } + if e.typ == "StringOptional" || e.StringOptional != nil { + return visitor.VisitStringOptional(e.StringOptional) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} +// Response body from the destination +type EventAttemptBodyZero struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (r *RetriedEvent) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (e *EventAttemptBodyZero) GetExtraProperties() map[string]interface{} { + return e.extraProperties } -func (r *RetriedEvent) UnmarshalJSON(data []byte) error { - type embed RetriedEvent - var unmarshaler = struct { - embed - LastAttemptAt *core.DateTime `json:"last_attempt_at,omitempty"` - NextAttemptAt *core.DateTime `json:"next_attempt_at,omitempty"` - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*r), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (e *EventAttemptBodyZero) UnmarshalJSON(data []byte) error { + type unmarshaler EventAttemptBodyZero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetriedEvent(unmarshaler.embed) - r.LastAttemptAt = unmarshaler.LastAttemptAt.TimePtr() - r.NextAttemptAt = unmarshaler.NextAttemptAt.TimePtr() - r.SuccessfulAt = unmarshaler.SuccessfulAt.TimePtr() - r.UpdatedAt = unmarshaler.UpdatedAt.Time() - r.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *e = EventAttemptBodyZero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) return nil } -func (r *RetriedEvent) MarshalJSON() ([]byte, error) { - type embed RetriedEvent - var marshaler = struct { - embed - LastAttemptAt *core.DateTime `json:"last_attempt_at,omitempty"` - NextAttemptAt *core.DateTime `json:"next_attempt_at,omitempty"` - SuccessfulAt *core.DateTime `json:"successful_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*r), - LastAttemptAt: core.NewOptionalDateTime(r.LastAttemptAt), - NextAttemptAt: core.NewOptionalDateTime(r.NextAttemptAt), - SuccessfulAt: core.NewOptionalDateTime(r.SuccessfulAt), - UpdatedAt: core.NewDateTime(r.UpdatedAt), - CreatedAt: core.NewDateTime(r.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (r *RetriedEvent) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (e *EventAttemptBodyZero) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", e) } -type RetryRequest struct { - Request *Request `json:"request,omitempty" url:"request,omitempty"` - Events []*Event `json:"events,omitempty" url:"events,omitempty"` +// HTTP method used to deliver the attempt +type EventAttemptHttpMethod string - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} +const ( + EventAttemptHttpMethodGet EventAttemptHttpMethod = "GET" + EventAttemptHttpMethodPost EventAttemptHttpMethod = "POST" + EventAttemptHttpMethodPut EventAttemptHttpMethod = "PUT" + EventAttemptHttpMethodPatch EventAttemptHttpMethod = "PATCH" + EventAttemptHttpMethodDelete EventAttemptHttpMethod = "DELETE" +) -func (r *RetryRequest) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func NewEventAttemptHttpMethodFromString(s string) (EventAttemptHttpMethod, error) { + switch s { + case "GET": + return EventAttemptHttpMethodGet, nil + case "POST": + return EventAttemptHttpMethodPost, nil + case "PUT": + return EventAttemptHttpMethodPut, nil + case "PATCH": + return EventAttemptHttpMethodPatch, nil + case "DELETE": + return EventAttemptHttpMethodDelete, nil + } + var t EventAttemptHttpMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (r *RetryRequest) UnmarshalJSON(data []byte) error { - type unmarshaler RetryRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *r = RetryRequest(value) +func (e EventAttemptHttpMethod) Ptr() *EventAttemptHttpMethod { + return &e +} - extraProperties, err := core.ExtractExtraProperties(data, *r) - if err != nil { - return err - } - r.extraProperties = extraProperties +type EventPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` + Count *int `json:"count,omitempty" url:"count,omitempty"` + Models []*Event `json:"models,omitempty" url:"models,omitempty"` - r._rawJSON = json.RawMessage(data) - return nil + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RetryRequest) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(r); err == nil { - return value +func (e *EventPaginatedResult) GetPagination() *SeekPagination { + if e == nil { + return nil } - return fmt.Sprintf("%#v", r) + return e.Pagination } -type RetryRule struct { - Strategy RetryStrategy `json:"strategy" url:"strategy"` - // Time in MS between each retry - Interval *int `json:"interval,omitempty" url:"interval,omitempty"` - // Maximum number of retries to attempt - Count *int `json:"count,omitempty" url:"count,omitempty"` - // HTTP codes to retry on. Accepts: range expressions (e.g., "400-499", ">400"), specific codes (e.g., 404), and exclusions (e.g., "!401"). Example: ["500-599", ">400", 404, "!401"] - ResponseStatusCodes []string `json:"response_status_codes,omitempty" url:"response_status_codes,omitempty"` +func (e *EventPaginatedResult) GetCount() *int { + if e == nil { + return nil + } + return e.Count +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (e *EventPaginatedResult) GetModels() []*Event { + if e == nil { + return nil + } + return e.Models } -func (r *RetryRule) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (e *EventPaginatedResult) GetExtraProperties() map[string]interface{} { + return e.extraProperties } -func (r *RetryRule) UnmarshalJSON(data []byte) error { - type unmarshaler RetryRule +func (e *EventPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler EventPaginatedResult var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RetryRule(value) - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *e = EventPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) return nil } -func (r *RetryRule) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (e *EventPaginatedResult) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(e); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", e) } -// Algorithm to use when calculating delay between retries -type RetryStrategy string +type EventStatus string const ( - RetryStrategyLinear RetryStrategy = "linear" - RetryStrategyExponential RetryStrategy = "exponential" + EventStatusScheduled EventStatus = "SCHEDULED" + EventStatusQueued EventStatus = "QUEUED" + EventStatusHold EventStatus = "HOLD" + EventStatusSuccessful EventStatus = "SUCCESSFUL" + EventStatusFailed EventStatus = "FAILED" ) -func NewRetryStrategyFromString(s string) (RetryStrategy, error) { +func NewEventStatusFromString(s string) (EventStatus, error) { switch s { - case "linear": - return RetryStrategyLinear, nil - case "exponential": - return RetryStrategyExponential, nil + case "SCHEDULED": + return EventStatusScheduled, nil + case "QUEUED": + return EventStatusQueued, nil + case "HOLD": + return EventStatusHold, nil + case "SUCCESSFUL": + return EventStatusSuccessful, nil + case "FAILED": + return EventStatusFailed, nil } - var t RetryStrategy + var t EventStatus return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (r RetryStrategy) Ptr() *RetryStrategy { - return &r -} - -type Rule struct { - Type string - Retry *RetryRule - Filter *FilterRule - Transform *TransformRule - Delay *DelayRule +func (e EventStatus) Ptr() *EventStatus { + return &e } -func NewRuleFromRetry(value *RetryRule) *Rule { - return &Rule{Type: "retry", Retry: value} -} +type HandledApiKeyIntegrationConfigs struct { + ApiKey string `json:"api_key" url:"api_key"` -func NewRuleFromFilter(value *FilterRule) *Rule { - return &Rule{Type: "filter", Filter: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewRuleFromTransform(value *TransformRule) *Rule { - return &Rule{Type: "transform", Transform: value} +func (h *HandledApiKeyIntegrationConfigs) GetApiKey() string { + if h == nil { + return "" + } + return h.ApiKey } -func NewRuleFromDelay(value *DelayRule) *Rule { - return &Rule{Type: "delay", Delay: value} +func (h *HandledApiKeyIntegrationConfigs) GetExtraProperties() map[string]interface{} { + return h.extraProperties } -func (r *Rule) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (h *HandledApiKeyIntegrationConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler HandledApiKeyIntegrationConfigs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - r.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", r) - } - switch unmarshaler.Type { - case "retry": - value := new(RetryRule) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - r.Retry = value - case "filter": - value := new(FilterRule) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - r.Filter = value - case "transform": - value := new(TransformRule) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - r.Transform = value - case "delay": - value := new(DelayRule) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - r.Delay = value + *h = HandledApiKeyIntegrationConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *h) + if err != nil { + return err } + h.extraProperties = extraProperties + h.rawJSON = json.RawMessage(data) return nil } -func (r Rule) MarshalJSON() ([]byte, error) { - switch r.Type { - default: - return nil, fmt.Errorf("invalid type %s in %T", r.Type, r) - case "retry": - return core.MarshalJSONWithExtraProperty(r.Retry, "type", "retry") - case "filter": - return core.MarshalJSONWithExtraProperty(r.Filter, "type", "filter") - case "transform": - return core.MarshalJSONWithExtraProperty(r.Transform, "type", "transform") - case "delay": - return core.MarshalJSONWithExtraProperty(r.Delay, "type", "delay") +func (h *HandledApiKeyIntegrationConfigs) String() string { + if len(h.rawJSON) > 0 { + if value, err := internal.StringifyJSON(h.rawJSON); err == nil { + return value + } } -} - -type RuleVisitor interface { - VisitRetry(*RetryRule) error - VisitFilter(*FilterRule) error - VisitTransform(*TransformRule) error - VisitDelay(*DelayRule) error -} - -func (r *Rule) Accept(visitor RuleVisitor) error { - switch r.Type { - default: - return fmt.Errorf("invalid type %s in %T", r.Type, r) - case "retry": - return visitor.VisitRetry(r.Retry) - case "filter": - return visitor.VisitFilter(r.Filter) - case "transform": - return visitor.VisitTransform(r.Transform) - case "delay": - return visitor.VisitDelay(r.Delay) + if value, err := internal.StringifyJSON(h); err == nil { + return value } + return fmt.Sprintf("%#v", h) } -type SeekPagination struct { - OrderBy *SeekPaginationOrderBy `json:"order_by,omitempty" url:"order_by,omitempty"` - Dir *SeekPaginationDir `json:"dir,omitempty" url:"dir,omitempty"` - Limit *int `json:"limit,omitempty" url:"limit,omitempty"` - Prev *string `json:"prev,omitempty" url:"prev,omitempty"` - Next *string `json:"next,omitempty" url:"next,omitempty"` +type HandledHmacConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (s *SeekPagination) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (h *HandledHmacConfigs) GetWebhookSecretKey() string { + if h == nil { + return "" + } + return h.WebhookSecretKey } -func (s *SeekPagination) UnmarshalJSON(data []byte) error { - type unmarshaler SeekPagination +func (h *HandledHmacConfigs) GetExtraProperties() map[string]interface{} { + return h.extraProperties +} + +func (h *HandledHmacConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler HandledHmacConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = SeekPagination(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) + *h = HandledHmacConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *h) if err != nil { return err } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) + h.extraProperties = extraProperties + h.rawJSON = json.RawMessage(data) return nil } -func (s *SeekPagination) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (h *HandledHmacConfigs) String() string { + if len(h.rawJSON) > 0 { + if value, err := internal.StringifyJSON(h.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := internal.StringifyJSON(h); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -type SeekPaginationDir struct { - OrderByDirection OrderByDirection - OrderByDirectionList []OrderByDirection -} - -func NewSeekPaginationDirFromOrderByDirection(value OrderByDirection) *SeekPaginationDir { - return &SeekPaginationDir{OrderByDirection: value} -} - -func NewSeekPaginationDirFromOrderByDirectionList(value []OrderByDirection) *SeekPaginationDir { - return &SeekPaginationDir{OrderByDirectionList: value} -} - -func (s *SeekPaginationDir) UnmarshalJSON(data []byte) error { - var valueOrderByDirection OrderByDirection - if err := json.Unmarshal(data, &valueOrderByDirection); err == nil { - s.OrderByDirection = valueOrderByDirection - return nil - } - var valueOrderByDirectionList []OrderByDirection - if err := json.Unmarshal(data, &valueOrderByDirectionList); err == nil { - s.OrderByDirectionList = valueOrderByDirectionList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + return fmt.Sprintf("%#v", h) } -func (s SeekPaginationDir) MarshalJSON() ([]byte, error) { - if s.OrderByDirection != "" { - return json.Marshal(s.OrderByDirection) - } - if s.OrderByDirectionList != nil { - return json.Marshal(s.OrderByDirectionList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) -} +type HmacAlgorithms string -type SeekPaginationDirVisitor interface { - VisitOrderByDirection(OrderByDirection) error - VisitOrderByDirectionList([]OrderByDirection) error -} +const ( + HmacAlgorithmsMd5 HmacAlgorithms = "md5" + HmacAlgorithmsSha1 HmacAlgorithms = "sha1" + HmacAlgorithmsSha256 HmacAlgorithms = "sha256" + HmacAlgorithmsSha512 HmacAlgorithms = "sha512" +) -func (s *SeekPaginationDir) Accept(visitor SeekPaginationDirVisitor) error { - if s.OrderByDirection != "" { - return visitor.VisitOrderByDirection(s.OrderByDirection) - } - if s.OrderByDirectionList != nil { - return visitor.VisitOrderByDirectionList(s.OrderByDirectionList) +func NewHmacAlgorithmsFromString(s string) (HmacAlgorithms, error) { + switch s { + case "md5": + return HmacAlgorithmsMd5, nil + case "sha1": + return HmacAlgorithmsSha1, nil + case "sha256": + return HmacAlgorithmsSha256, nil + case "sha512": + return HmacAlgorithmsSha512, nil } - return fmt.Errorf("type %T does not include a non-empty union type", s) + var t HmacAlgorithms + return "", fmt.Errorf("%s is not a valid %T", s, t) } -type SeekPaginationOrderBy struct { - String string - StringList []string +func (h HmacAlgorithms) Ptr() *HmacAlgorithms { + return &h } -func NewSeekPaginationOrderByFromString(value string) *SeekPaginationOrderBy { - return &SeekPaginationOrderBy{String: value} -} +type HmacIntegrationConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + Algorithm HmacAlgorithms `json:"algorithm" url:"algorithm"` + HeaderKey string `json:"header_key" url:"header_key"` + Encoding HmacIntegrationConfigsEncoding `json:"encoding" url:"encoding"` -func NewSeekPaginationOrderByFromStringList(value []string) *SeekPaginationOrderBy { - return &SeekPaginationOrderBy{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (s *SeekPaginationOrderBy) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - s.StringList = valueStringList - return nil +func (h *HmacIntegrationConfigs) GetWebhookSecretKey() string { + if h == nil { + return "" } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + return h.WebhookSecretKey } -func (s SeekPaginationOrderBy) MarshalJSON() ([]byte, error) { - if s.String != "" { - return json.Marshal(s.String) - } - if s.StringList != nil { - return json.Marshal(s.StringList) +func (h *HmacIntegrationConfigs) GetAlgorithm() HmacAlgorithms { + if h == nil { + return "" } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) -} - -type SeekPaginationOrderByVisitor interface { - VisitString(string) error - VisitStringList([]string) error + return h.Algorithm } -func (s *SeekPaginationOrderBy) Accept(visitor SeekPaginationOrderByVisitor) error { - if s.String != "" { - return visitor.VisitString(s.String) +func (h *HmacIntegrationConfigs) GetHeaderKey() string { + if h == nil { + return "" } - if s.StringList != nil { - return visitor.VisitStringList(s.StringList) - } - return fmt.Errorf("type %T does not include a non-empty union type", s) + return h.HeaderKey } -type ShopifyIntegrationConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (h *HmacIntegrationConfigs) GetEncoding() HmacIntegrationConfigsEncoding { + if h == nil { + return "" + } + return h.Encoding } -func (s *ShopifyIntegrationConfigs) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (h *HmacIntegrationConfigs) GetExtraProperties() map[string]interface{} { + return h.extraProperties } -func (s *ShopifyIntegrationConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler ShopifyIntegrationConfigs +func (h *HmacIntegrationConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler HmacIntegrationConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShopifyIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) + *h = HmacIntegrationConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *h) if err != nil { return err } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) + h.extraProperties = extraProperties + h.rawJSON = json.RawMessage(data) return nil } -func (s *ShopifyIntegrationConfigs) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (h *HmacIntegrationConfigs) String() string { + if len(h.rawJSON) > 0 { + if value, err := internal.StringifyJSON(h.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := internal.StringifyJSON(h); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", h) } -// Request data -type ShortEventData struct { - // Request path - Path string `json:"path" url:"path"` - // Raw query param string - Query *string `json:"query,omitempty" url:"query,omitempty"` - // JSON representation of query params - ParsedQuery *ShortEventDataParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"` - // JSON representation of the headers - Headers *ShortEventDataHeaders `json:"headers,omitempty" url:"headers,omitempty"` - // JSON or string representation of the body - Body *ShortEventDataBody `json:"body,omitempty" url:"body,omitempty"` - // Whether the payload is considered large payload and not searchable - IsLargePayload *bool `json:"is_large_payload,omitempty" url:"is_large_payload,omitempty"` +type HmacIntegrationConfigsEncoding string + +const ( + HmacIntegrationConfigsEncodingBase64 HmacIntegrationConfigsEncoding = "base64" + HmacIntegrationConfigsEncodingHex HmacIntegrationConfigsEncoding = "hex" +) + +func NewHmacIntegrationConfigsEncodingFromString(s string) (HmacIntegrationConfigsEncoding, error) { + switch s { + case "base64": + return HmacIntegrationConfigsEncodingBase64, nil + case "hex": + return HmacIntegrationConfigsEncodingHex, nil + } + var t HmacIntegrationConfigsEncoding + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (h HmacIntegrationConfigsEncoding) Ptr() *HmacIntegrationConfigsEncoding { + return &h +} + +type Integration struct { + // ID of the integration + Id string `json:"id" url:"id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // Label of the integration + Label string `json:"label" url:"label"` + Provider IntegrationProvider `json:"provider" url:"provider"` + // List of features to enable (see features list below) + Features []IntegrationFeature `json:"features,omitempty" url:"features,omitempty"` + // Decrypted Key/Value object of the associated configuration for that provider + Configs *IntegrationConfigs `json:"configs,omitempty" url:"configs,omitempty"` + // List of source IDs the integration is attached to + Sources []string `json:"sources,omitempty" url:"sources,omitempty"` + // Date the integration was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the integration was created + CreatedAt time.Time `json:"created_at" url:"created_at"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (s *ShortEventData) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (i *Integration) GetId() string { + if i == nil { + return "" + } + return i.Id } -func (s *ShortEventData) UnmarshalJSON(data []byte) error { - type unmarshaler ShortEventData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (i *Integration) GetTeamId() string { + if i == nil { + return "" } - *s = ShortEventData(value) + return i.TeamId +} - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err +func (i *Integration) GetLabel() string { + if i == nil { + return "" } - s.extraProperties = extraProperties + return i.Label +} - s._rawJSON = json.RawMessage(data) - return nil +func (i *Integration) GetProvider() IntegrationProvider { + if i == nil { + return "" + } + return i.Provider } -func (s *ShortEventData) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } +func (i *Integration) GetFeatures() []IntegrationFeature { + if i == nil { + return nil } - if value, err := core.StringifyJSON(s); err == nil { - return value + return i.Features +} + +func (i *Integration) GetConfigs() *IntegrationConfigs { + if i == nil { + return nil } - return fmt.Sprintf("%#v", s) + return i.Configs } -// JSON or string representation of the body -type ShortEventDataBody struct { - String string - ShortEventDataBodyOne *ShortEventDataBodyOne - UnknownList []interface{} +func (i *Integration) GetSources() []string { + if i == nil { + return nil + } + return i.Sources } -func NewShortEventDataBodyFromString(value string) *ShortEventDataBody { - return &ShortEventDataBody{String: value} +func (i *Integration) GetUpdatedAt() time.Time { + if i == nil { + return time.Time{} + } + return i.UpdatedAt } -func NewShortEventDataBodyFromShortEventDataBodyOne(value *ShortEventDataBodyOne) *ShortEventDataBody { - return &ShortEventDataBody{ShortEventDataBodyOne: value} +func (i *Integration) GetCreatedAt() time.Time { + if i == nil { + return time.Time{} + } + return i.CreatedAt } -func NewShortEventDataBodyFromUnknownList(value []interface{}) *ShortEventDataBody { - return &ShortEventDataBody{UnknownList: value} +func (i *Integration) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (s *ShortEventDataBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.String = valueString - return nil +func (i *Integration) UnmarshalJSON(data []byte) error { + type embed Integration + var unmarshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*i), } - valueShortEventDataBodyOne := new(ShortEventDataBodyOne) - if err := json.Unmarshal(data, &valueShortEventDataBodyOne); err == nil { - s.ShortEventDataBodyOne = valueShortEventDataBodyOne - return nil + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err } - var valueUnknownList []interface{} - if err := json.Unmarshal(data, &valueUnknownList); err == nil { - s.UnknownList = valueUnknownList - return nil + *i = Integration(unmarshaler.embed) + i.UpdatedAt = unmarshaler.UpdatedAt.Time() + i.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil } -func (s ShortEventDataBody) MarshalJSON() ([]byte, error) { - if s.String != "" { - return json.Marshal(s.String) - } - if s.ShortEventDataBodyOne != nil { - return json.Marshal(s.ShortEventDataBodyOne) - } - if s.UnknownList != nil { - return json.Marshal(s.UnknownList) +func (i *Integration) MarshalJSON() ([]byte, error) { + type embed Integration + var marshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*i), + UpdatedAt: internal.NewDateTime(i.UpdatedAt), + CreatedAt: internal.NewDateTime(i.CreatedAt), } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) -} - -type ShortEventDataBodyVisitor interface { - VisitString(string) error - VisitShortEventDataBodyOne(*ShortEventDataBodyOne) error - VisitUnknownList([]interface{}) error + return json.Marshal(marshaler) } -func (s *ShortEventDataBody) Accept(visitor ShortEventDataBodyVisitor) error { - if s.String != "" { - return visitor.VisitString(s.String) - } - if s.ShortEventDataBodyOne != nil { - return visitor.VisitShortEventDataBodyOne(s.ShortEventDataBodyOne) +func (i *Integration) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } } - if s.UnknownList != nil { - return visitor.VisitUnknownList(s.UnknownList) + if value, err := internal.StringifyJSON(i); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", s) + return fmt.Sprintf("%#v", i) } -type ShortEventDataBodyOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +// Decrypted Key/Value object of the associated configuration for that provider +type IntegrationConfigs struct { + HmacIntegrationConfigs *HmacIntegrationConfigs + ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs + HandledApiKeyIntegrationConfigs *HandledApiKeyIntegrationConfigs + HandledHmacConfigs *HandledHmacConfigs + BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs + ShopifyIntegrationConfigs *ShopifyIntegrationConfigs + VercelLogDrainsIntegrationConfigs *VercelLogDrainsIntegrationConfigs + IntegrationConfigsSeven *IntegrationConfigsSeven + + typ string } -func (s *ShortEventDataBodyOne) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func NewIntegrationConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "HmacIntegrationConfigs", HmacIntegrationConfigs: value} } -func (s *ShortEventDataBodyOne) UnmarshalJSON(data []byte) error { - type unmarshaler ShortEventDataBodyOne - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = ShortEventDataBodyOne(value) +func NewIntegrationConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "ApiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties +func NewIntegrationConfigsFromHandledApiKeyIntegrationConfigs(value *HandledApiKeyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "HandledApiKeyIntegrationConfigs", HandledApiKeyIntegrationConfigs: value} +} - s._rawJSON = json.RawMessage(data) - return nil +func NewIntegrationConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "HandledHmacConfigs", HandledHmacConfigs: value} } -func (s *ShortEventDataBodyOne) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) +func NewIntegrationConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "BasicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} } -// JSON representation of the headers -type ShortEventDataHeaders struct { - String string - StringStringOptionalMap map[string]*string +func NewIntegrationConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "ShopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} } -func NewShortEventDataHeadersFromString(value string) *ShortEventDataHeaders { - return &ShortEventDataHeaders{String: value} +func NewIntegrationConfigsFromVercelLogDrainsIntegrationConfigs(value *VercelLogDrainsIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typ: "VercelLogDrainsIntegrationConfigs", VercelLogDrainsIntegrationConfigs: value} } -func NewShortEventDataHeadersFromStringStringOptionalMap(value map[string]*string) *ShortEventDataHeaders { - return &ShortEventDataHeaders{StringStringOptionalMap: value} +func NewIntegrationConfigsFromIntegrationConfigsSeven(value *IntegrationConfigsSeven) *IntegrationConfigs { + return &IntegrationConfigs{typ: "IntegrationConfigsSeven", IntegrationConfigsSeven: value} } -func (s *ShortEventDataHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.String = valueString +func (i *IntegrationConfigs) GetHmacIntegrationConfigs() *HmacIntegrationConfigs { + if i == nil { return nil } - var valueStringStringOptionalMap map[string]*string - if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { - s.StringStringOptionalMap = valueStringStringOptionalMap + return i.HmacIntegrationConfigs +} + +func (i *IntegrationConfigs) GetApiKeyIntegrationConfigs() *ApiKeyIntegrationConfigs { + if i == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + return i.ApiKeyIntegrationConfigs } -func (s ShortEventDataHeaders) MarshalJSON() ([]byte, error) { - if s.String != "" { - return json.Marshal(s.String) - } - if s.StringStringOptionalMap != nil { - return json.Marshal(s.StringStringOptionalMap) +func (i *IntegrationConfigs) GetHandledApiKeyIntegrationConfigs() *HandledApiKeyIntegrationConfigs { + if i == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) + return i.HandledApiKeyIntegrationConfigs } -type ShortEventDataHeadersVisitor interface { - VisitString(string) error - VisitStringStringOptionalMap(map[string]*string) error +func (i *IntegrationConfigs) GetHandledHmacConfigs() *HandledHmacConfigs { + if i == nil { + return nil + } + return i.HandledHmacConfigs } -func (s *ShortEventDataHeaders) Accept(visitor ShortEventDataHeadersVisitor) error { - if s.String != "" { - return visitor.VisitString(s.String) - } - if s.StringStringOptionalMap != nil { - return visitor.VisitStringStringOptionalMap(s.StringStringOptionalMap) +func (i *IntegrationConfigs) GetBasicAuthIntegrationConfigs() *BasicAuthIntegrationConfigs { + if i == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", s) + return i.BasicAuthIntegrationConfigs } -// JSON representation of query params -type ShortEventDataParsedQuery struct { - StringOptional *string - ShortEventDataParsedQueryOne *ShortEventDataParsedQueryOne +func (i *IntegrationConfigs) GetShopifyIntegrationConfigs() *ShopifyIntegrationConfigs { + if i == nil { + return nil + } + return i.ShopifyIntegrationConfigs } -func NewShortEventDataParsedQueryFromStringOptional(value *string) *ShortEventDataParsedQuery { - return &ShortEventDataParsedQuery{StringOptional: value} +func (i *IntegrationConfigs) GetVercelLogDrainsIntegrationConfigs() *VercelLogDrainsIntegrationConfigs { + if i == nil { + return nil + } + return i.VercelLogDrainsIntegrationConfigs } -func NewShortEventDataParsedQueryFromShortEventDataParsedQueryOne(value *ShortEventDataParsedQueryOne) *ShortEventDataParsedQuery { - return &ShortEventDataParsedQuery{ShortEventDataParsedQueryOne: value} +func (i *IntegrationConfigs) GetIntegrationConfigsSeven() *IntegrationConfigsSeven { + if i == nil { + return nil + } + return i.IntegrationConfigsSeven } -func (s *ShortEventDataParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - s.StringOptional = valueStringOptional +func (i *IntegrationConfigs) UnmarshalJSON(data []byte) error { + valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) + if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { + i.typ = "HmacIntegrationConfigs" + i.HmacIntegrationConfigs = valueHmacIntegrationConfigs return nil } - valueShortEventDataParsedQueryOne := new(ShortEventDataParsedQueryOne) - if err := json.Unmarshal(data, &valueShortEventDataParsedQueryOne); err == nil { - s.ShortEventDataParsedQueryOne = valueShortEventDataParsedQueryOne + valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { + i.typ = "ApiKeyIntegrationConfigs" + i.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + valueHandledApiKeyIntegrationConfigs := new(HandledApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueHandledApiKeyIntegrationConfigs); err == nil { + i.typ = "HandledApiKeyIntegrationConfigs" + i.HandledApiKeyIntegrationConfigs = valueHandledApiKeyIntegrationConfigs + return nil + } + valueHandledHmacConfigs := new(HandledHmacConfigs) + if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { + i.typ = "HandledHmacConfigs" + i.HandledHmacConfigs = valueHandledHmacConfigs + return nil + } + valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) + if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { + i.typ = "BasicAuthIntegrationConfigs" + i.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs + return nil + } + valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) + if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { + i.typ = "ShopifyIntegrationConfigs" + i.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs + return nil + } + valueVercelLogDrainsIntegrationConfigs := new(VercelLogDrainsIntegrationConfigs) + if err := json.Unmarshal(data, &valueVercelLogDrainsIntegrationConfigs); err == nil { + i.typ = "VercelLogDrainsIntegrationConfigs" + i.VercelLogDrainsIntegrationConfigs = valueVercelLogDrainsIntegrationConfigs + return nil + } + valueIntegrationConfigsSeven := new(IntegrationConfigsSeven) + if err := json.Unmarshal(data, &valueIntegrationConfigsSeven); err == nil { + i.typ = "IntegrationConfigsSeven" + i.IntegrationConfigsSeven = valueIntegrationConfigsSeven + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) } -func (s ShortEventDataParsedQuery) MarshalJSON() ([]byte, error) { - if s.StringOptional != nil { - return json.Marshal(s.StringOptional) +func (i IntegrationConfigs) MarshalJSON() ([]byte, error) { + if i.typ == "HmacIntegrationConfigs" || i.HmacIntegrationConfigs != nil { + return json.Marshal(i.HmacIntegrationConfigs) } - if s.ShortEventDataParsedQueryOne != nil { - return json.Marshal(s.ShortEventDataParsedQueryOne) + if i.typ == "ApiKeyIntegrationConfigs" || i.ApiKeyIntegrationConfigs != nil { + return json.Marshal(i.ApiKeyIntegrationConfigs) } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) + if i.typ == "HandledApiKeyIntegrationConfigs" || i.HandledApiKeyIntegrationConfigs != nil { + return json.Marshal(i.HandledApiKeyIntegrationConfigs) + } + if i.typ == "HandledHmacConfigs" || i.HandledHmacConfigs != nil { + return json.Marshal(i.HandledHmacConfigs) + } + if i.typ == "BasicAuthIntegrationConfigs" || i.BasicAuthIntegrationConfigs != nil { + return json.Marshal(i.BasicAuthIntegrationConfigs) + } + if i.typ == "ShopifyIntegrationConfigs" || i.ShopifyIntegrationConfigs != nil { + return json.Marshal(i.ShopifyIntegrationConfigs) + } + if i.typ == "VercelLogDrainsIntegrationConfigs" || i.VercelLogDrainsIntegrationConfigs != nil { + return json.Marshal(i.VercelLogDrainsIntegrationConfigs) + } + if i.typ == "IntegrationConfigsSeven" || i.IntegrationConfigsSeven != nil { + return json.Marshal(i.IntegrationConfigsSeven) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", i) } -type ShortEventDataParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitShortEventDataParsedQueryOne(*ShortEventDataParsedQueryOne) error +type IntegrationConfigsVisitor interface { + VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error + VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error + VisitHandledApiKeyIntegrationConfigs(*HandledApiKeyIntegrationConfigs) error + VisitHandledHmacConfigs(*HandledHmacConfigs) error + VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error + VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error + VisitVercelLogDrainsIntegrationConfigs(*VercelLogDrainsIntegrationConfigs) error + VisitIntegrationConfigsSeven(*IntegrationConfigsSeven) error } -func (s *ShortEventDataParsedQuery) Accept(visitor ShortEventDataParsedQueryVisitor) error { - if s.StringOptional != nil { - return visitor.VisitStringOptional(s.StringOptional) +func (i *IntegrationConfigs) Accept(visitor IntegrationConfigsVisitor) error { + if i.typ == "HmacIntegrationConfigs" || i.HmacIntegrationConfigs != nil { + return visitor.VisitHmacIntegrationConfigs(i.HmacIntegrationConfigs) } - if s.ShortEventDataParsedQueryOne != nil { - return visitor.VisitShortEventDataParsedQueryOne(s.ShortEventDataParsedQueryOne) + if i.typ == "ApiKeyIntegrationConfigs" || i.ApiKeyIntegrationConfigs != nil { + return visitor.VisitApiKeyIntegrationConfigs(i.ApiKeyIntegrationConfigs) } - return fmt.Errorf("type %T does not include a non-empty union type", s) + if i.typ == "HandledApiKeyIntegrationConfigs" || i.HandledApiKeyIntegrationConfigs != nil { + return visitor.VisitHandledApiKeyIntegrationConfigs(i.HandledApiKeyIntegrationConfigs) + } + if i.typ == "HandledHmacConfigs" || i.HandledHmacConfigs != nil { + return visitor.VisitHandledHmacConfigs(i.HandledHmacConfigs) + } + if i.typ == "BasicAuthIntegrationConfigs" || i.BasicAuthIntegrationConfigs != nil { + return visitor.VisitBasicAuthIntegrationConfigs(i.BasicAuthIntegrationConfigs) + } + if i.typ == "ShopifyIntegrationConfigs" || i.ShopifyIntegrationConfigs != nil { + return visitor.VisitShopifyIntegrationConfigs(i.ShopifyIntegrationConfigs) + } + if i.typ == "VercelLogDrainsIntegrationConfigs" || i.VercelLogDrainsIntegrationConfigs != nil { + return visitor.VisitVercelLogDrainsIntegrationConfigs(i.VercelLogDrainsIntegrationConfigs) + } + if i.typ == "IntegrationConfigsSeven" || i.IntegrationConfigsSeven != nil { + return visitor.VisitIntegrationConfigsSeven(i.IntegrationConfigsSeven) + } + return fmt.Errorf("type %T does not include a non-empty union type", i) } -type ShortEventDataParsedQueryOne struct { +type IntegrationConfigsSeven struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (s *ShortEventDataParsedQueryOne) GetExtraProperties() map[string]interface{} { - return s.extraProperties +func (i *IntegrationConfigsSeven) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (s *ShortEventDataParsedQueryOne) UnmarshalJSON(data []byte) error { - type unmarshaler ShortEventDataParsedQueryOne +func (i *IntegrationConfigsSeven) UnmarshalJSON(data []byte) error { + type unmarshaler IntegrationConfigsSeven var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *s = ShortEventDataParsedQueryOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) - return nil -} - -func (s *ShortEventDataParsedQueryOne) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) -} - -// Associated [Source](#source-object) object -type Source struct { - // ID of the source - Id string `json:"id" url:"id"` - // Name for the source - Name string `json:"name" url:"name"` - // Description of the source - Description *string `json:"description,omitempty" url:"description,omitempty"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // A unique URL that must be supplied to your webhook's provider - Url string `json:"url" url:"url"` - Verification *VerificationConfig `json:"verification,omitempty" url:"verification,omitempty"` - AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` - CustomResponse *SourceCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` - // Date the source was disabled - DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` - // Date the source was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the source was created - CreatedAt time.Time `json:"created_at" url:"created_at"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (s *Source) GetExtraProperties() map[string]interface{} { - return s.extraProperties -} - -func (s *Source) UnmarshalJSON(data []byte) error { - type embed Source - var unmarshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*s), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *s = Source(unmarshaler.embed) - s.DisabledAt = unmarshaler.DisabledAt.TimePtr() - s.UpdatedAt = unmarshaler.UpdatedAt.Time() - s.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err - } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) - return nil -} - -func (s *Source) MarshalJSON() ([]byte, error) { - type embed Source - var marshaler = struct { - embed - DisabledAt *core.DateTime `json:"disabled_at,omitempty"` - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*s), - DisabledAt: core.NewOptionalDateTime(s.DisabledAt), - UpdatedAt: core.NewDateTime(s.UpdatedAt), - CreatedAt: core.NewDateTime(s.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (s *Source) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value - } - return fmt.Sprintf("%#v", s) -} - -// List of allowed HTTP methods. Defaults to PUT, POST, PATCH, DELETE. -type SourceAllowedHttpMethod = []SourceAllowedHttpMethodItem - -type SourceAllowedHttpMethodItem string - -const ( - SourceAllowedHttpMethodItemGet SourceAllowedHttpMethodItem = "GET" - SourceAllowedHttpMethodItemPost SourceAllowedHttpMethodItem = "POST" - SourceAllowedHttpMethodItemPut SourceAllowedHttpMethodItem = "PUT" - SourceAllowedHttpMethodItemPatch SourceAllowedHttpMethodItem = "PATCH" - SourceAllowedHttpMethodItemDelete SourceAllowedHttpMethodItem = "DELETE" -) - -func NewSourceAllowedHttpMethodItemFromString(s string) (SourceAllowedHttpMethodItem, error) { - switch s { - case "GET": - return SourceAllowedHttpMethodItemGet, nil - case "POST": - return SourceAllowedHttpMethodItemPost, nil - case "PUT": - return SourceAllowedHttpMethodItemPut, nil - case "PATCH": - return SourceAllowedHttpMethodItemPatch, nil - case "DELETE": - return SourceAllowedHttpMethodItemDelete, nil - } - var t SourceAllowedHttpMethodItem - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (s SourceAllowedHttpMethodItem) Ptr() *SourceAllowedHttpMethodItem { - return &s -} - -// Custom response object -type SourceCustomResponse struct { - ContentType SourceCustomResponseContentType `json:"content_type" url:"content_type"` - // Body of the custom response - Body string `json:"body" url:"body"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (s *SourceCustomResponse) GetExtraProperties() map[string]interface{} { - return s.extraProperties -} - -func (s *SourceCustomResponse) UnmarshalJSON(data []byte) error { - type unmarshaler SourceCustomResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SourceCustomResponse(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) + *i = IntegrationConfigsSeven(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) if err != nil { return err } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) return nil } -func (s *SourceCustomResponse) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { +func (i *IntegrationConfigsSeven) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(s); err == nil { + if value, err := internal.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", s) + return fmt.Sprintf("%#v", i) } -// Content type of the custom response -type SourceCustomResponseContentType string +type IntegrationFeature string const ( - SourceCustomResponseContentTypeJson SourceCustomResponseContentType = "json" - SourceCustomResponseContentTypeText SourceCustomResponseContentType = "text" - SourceCustomResponseContentTypeXml SourceCustomResponseContentType = "xml" + IntegrationFeatureVerification IntegrationFeature = "VERIFICATION" + IntegrationFeatureHandshake IntegrationFeature = "HANDSHAKE" ) -func NewSourceCustomResponseContentTypeFromString(s string) (SourceCustomResponseContentType, error) { +func NewIntegrationFeatureFromString(s string) (IntegrationFeature, error) { switch s { - case "json": - return SourceCustomResponseContentTypeJson, nil - case "text": - return SourceCustomResponseContentTypeText, nil - case "xml": - return SourceCustomResponseContentTypeXml, nil + case "VERIFICATION": + return IntegrationFeatureVerification, nil + case "HANDSHAKE": + return IntegrationFeatureHandshake, nil } - var t SourceCustomResponseContentType + var t IntegrationFeature return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (s SourceCustomResponseContentType) Ptr() *SourceCustomResponseContentType { - return &s +func (i IntegrationFeature) Ptr() *IntegrationFeature { + return &i } -type SourcePaginatedResult struct { +type IntegrationPaginatedResult struct { Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Source `json:"models,omitempty" url:"models,omitempty"` + Models []*Integration `json:"models,omitempty" url:"models,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (s *SourcePaginatedResult) GetExtraProperties() map[string]interface{} { - return s.extraProperties + rawJSON json.RawMessage } -func (s *SourcePaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler SourcePaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SourcePaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *s) - if err != nil { - return err +func (i *IntegrationPaginatedResult) GetPagination() *SeekPagination { + if i == nil { + return nil } - s.extraProperties = extraProperties - - s._rawJSON = json.RawMessage(data) - return nil + return i.Pagination } -func (s *SourcePaginatedResult) String() string { - if len(s._rawJSON) > 0 { - if value, err := core.StringifyJSON(s._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(s); err == nil { - return value +func (i *IntegrationPaginatedResult) GetCount() *int { + if i == nil { + return nil } - return fmt.Sprintf("%#v", s) + return i.Count } -type ToggleWebhookNotifications struct { - Enabled bool `json:"enabled" url:"enabled"` - Topics []TopicsValue `json:"topics,omitempty" url:"topics,omitempty"` - SourceId string `json:"source_id" url:"source_id"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (i *IntegrationPaginatedResult) GetModels() []*Integration { + if i == nil { + return nil + } + return i.Models } -func (t *ToggleWebhookNotifications) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (i *IntegrationPaginatedResult) GetExtraProperties() map[string]interface{} { + return i.extraProperties } -func (t *ToggleWebhookNotifications) UnmarshalJSON(data []byte) error { - type unmarshaler ToggleWebhookNotifications +func (i *IntegrationPaginatedResult) UnmarshalJSON(data []byte) error { + type unmarshaler IntegrationPaginatedResult var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = ToggleWebhookNotifications(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *i = IntegrationPaginatedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) return nil } -func (t *ToggleWebhookNotifications) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (i *IntegrationPaginatedResult) String() string { + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(i); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", i) } -// Supported topics -type TopicsValue string +type IntegrationProvider string const ( - TopicsValueIssueOpened TopicsValue = "issue.opened" - TopicsValueIssueUpdated TopicsValue = "issue.updated" - TopicsValueDeprecatedAttemptFailed TopicsValue = "deprecated.attempt-failed" - TopicsValueEventSuccessful TopicsValue = "event.successful" -) - -func NewTopicsValueFromString(s string) (TopicsValue, error) { - switch s { - case "issue.opened": - return TopicsValueIssueOpened, nil - case "issue.updated": - return TopicsValueIssueUpdated, nil - case "deprecated.attempt-failed": - return TopicsValueDeprecatedAttemptFailed, nil - case "event.successful": - return TopicsValueEventSuccessful, nil - } - var t TopicsValue - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (t TopicsValue) Ptr() *TopicsValue { - return &t -} - -type TransformRule struct { - // ID of the attached transformation object. Optional input, always set once the rule is defined - TransformationId *string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` - // You can optionally define a new transformation while creating a transform rule - Transformation *TransformRuleTransformation `json:"transformation,omitempty" url:"transformation,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (t *TransformRule) GetExtraProperties() map[string]interface{} { - return t.extraProperties -} - -func (t *TransformRule) UnmarshalJSON(data []byte) error { - type unmarshaler TransformRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformRule(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil -} - -func (t *TransformRule) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(t); err == nil { - return value - } - return fmt.Sprintf("%#v", t) -} - -// You can optionally define a new transformation while creating a transform rule -type TransformRuleTransformation struct { - // The unique name of the transformation - Name string `json:"name" url:"name"` - // A string representation of your JavaScript (ES6) code to run - Code string `json:"code" url:"code"` - // A key-value object of environment variables to encrypt and expose to your transformation code - Env map[string]*string `json:"env,omitempty" url:"env,omitempty"` + IntegrationProviderHmac IntegrationProvider = "HMAC" + IntegrationProviderBasicAuth IntegrationProvider = "BASIC_AUTH" + IntegrationProviderApiKey IntegrationProvider = "API_KEY" + IntegrationProviderWebhook IntegrationProvider = "WEBHOOK" + IntegrationProviderHttp IntegrationProvider = "HTTP" + IntegrationProviderSanity IntegrationProvider = "SANITY" + IntegrationProviderBridge IntegrationProvider = "BRIDGE" + IntegrationProviderCloudsignal IntegrationProvider = "CLOUDSIGNAL" + IntegrationProviderCourier IntegrationProvider = "COURIER" + IntegrationProviderFrontapp IntegrationProvider = "FRONTAPP" + IntegrationProviderZoom IntegrationProvider = "ZOOM" + IntegrationProviderTwitter IntegrationProvider = "TWITTER" + IntegrationProviderRecharge IntegrationProvider = "RECHARGE" + IntegrationProviderStripe IntegrationProvider = "STRIPE" + IntegrationProviderPropertyFinder IntegrationProvider = "PROPERTY-FINDER" + IntegrationProviderShopify IntegrationProvider = "SHOPIFY" + IntegrationProviderTwilio IntegrationProvider = "TWILIO" + IntegrationProviderGithub IntegrationProvider = "GITHUB" + IntegrationProviderPostmark IntegrationProvider = "POSTMARK" + IntegrationProviderTypeform IntegrationProvider = "TYPEFORM" + IntegrationProviderXero IntegrationProvider = "XERO" + IntegrationProviderSvix IntegrationProvider = "SVIX" + IntegrationProviderAdyen IntegrationProvider = "ADYEN" + IntegrationProviderAkeneo IntegrationProvider = "AKENEO" + IntegrationProviderGitlab IntegrationProvider = "GITLAB" + IntegrationProviderWoocommerce IntegrationProvider = "WOOCOMMERCE" + IntegrationProviderOura IntegrationProvider = "OURA" + IntegrationProviderCommercelayer IntegrationProvider = "COMMERCELAYER" + IntegrationProviderHubspot IntegrationProvider = "HUBSPOT" + IntegrationProviderMailgun IntegrationProvider = "MAILGUN" + IntegrationProviderPersona IntegrationProvider = "PERSONA" + IntegrationProviderPipedrive IntegrationProvider = "PIPEDRIVE" + IntegrationProviderSendgrid IntegrationProvider = "SENDGRID" + IntegrationProviderWorkos IntegrationProvider = "WORKOS" + IntegrationProviderSynctera IntegrationProvider = "SYNCTERA" + IntegrationProviderAwsSns IntegrationProvider = "AWS_SNS" + IntegrationProviderThreeDEye IntegrationProvider = "THREE_D_EYE" + IntegrationProviderTwitch IntegrationProvider = "TWITCH" + IntegrationProviderEnode IntegrationProvider = "ENODE" + IntegrationProviderFavro IntegrationProvider = "FAVRO" + IntegrationProviderLinear IntegrationProvider = "LINEAR" + IntegrationProviderShopline IntegrationProvider = "SHOPLINE" + IntegrationProviderWix IntegrationProvider = "WIX" + IntegrationProviderNmi IntegrationProvider = "NMI" + IntegrationProviderOrb IntegrationProvider = "ORB" + IntegrationProviderPylon IntegrationProvider = "PYLON" + IntegrationProviderRazorpay IntegrationProvider = "RAZORPAY" + IntegrationProviderRepay IntegrationProvider = "REPAY" + IntegrationProviderSquare IntegrationProvider = "SQUARE" + IntegrationProviderSolidgate IntegrationProvider = "SOLIDGATE" + IntegrationProviderTrello IntegrationProvider = "TRELLO" + IntegrationProviderEbay IntegrationProvider = "EBAY" + IntegrationProviderTelnyx IntegrationProvider = "TELNYX" + IntegrationProviderDiscord IntegrationProvider = "DISCORD" + IntegrationProviderTokenio IntegrationProvider = "TOKENIO" + IntegrationProviderFiserv IntegrationProvider = "FISERV" + IntegrationProviderBondsmith IntegrationProvider = "BONDSMITH" + IntegrationProviderVercelLogDrains IntegrationProvider = "VERCEL_LOG_DRAINS" + IntegrationProviderVercel IntegrationProvider = "VERCEL" + IntegrationProviderTebex IntegrationProvider = "TEBEX" + IntegrationProviderSlack IntegrationProvider = "SLACK" + IntegrationProviderMailchimp IntegrationProvider = "MAILCHIMP" + IntegrationProviderPaddle IntegrationProvider = "PADDLE" + IntegrationProviderPaypal IntegrationProvider = "PAYPAL" + IntegrationProviderTreezor IntegrationProvider = "TREEZOR" + IntegrationProviderPraxis IntegrationProvider = "PRAXIS" + IntegrationProviderCustomerio IntegrationProvider = "CUSTOMERIO" + IntegrationProviderFacebook IntegrationProvider = "FACEBOOK" + IntegrationProviderWhatsapp IntegrationProvider = "WHATSAPP" + IntegrationProviderReplicate IntegrationProvider = "REPLICATE" + IntegrationProviderTiktok IntegrationProvider = "TIKTOK" + IntegrationProviderAirwallex IntegrationProvider = "AIRWALLEX" + IntegrationProviderZendesk IntegrationProvider = "ZENDESK" + IntegrationProviderUpollo IntegrationProvider = "UPOLLO" +) - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewIntegrationProviderFromString(s string) (IntegrationProvider, error) { + switch s { + case "HMAC": + return IntegrationProviderHmac, nil + case "BASIC_AUTH": + return IntegrationProviderBasicAuth, nil + case "API_KEY": + return IntegrationProviderApiKey, nil + case "WEBHOOK": + return IntegrationProviderWebhook, nil + case "HTTP": + return IntegrationProviderHttp, nil + case "SANITY": + return IntegrationProviderSanity, nil + case "BRIDGE": + return IntegrationProviderBridge, nil + case "CLOUDSIGNAL": + return IntegrationProviderCloudsignal, nil + case "COURIER": + return IntegrationProviderCourier, nil + case "FRONTAPP": + return IntegrationProviderFrontapp, nil + case "ZOOM": + return IntegrationProviderZoom, nil + case "TWITTER": + return IntegrationProviderTwitter, nil + case "RECHARGE": + return IntegrationProviderRecharge, nil + case "STRIPE": + return IntegrationProviderStripe, nil + case "PROPERTY-FINDER": + return IntegrationProviderPropertyFinder, nil + case "SHOPIFY": + return IntegrationProviderShopify, nil + case "TWILIO": + return IntegrationProviderTwilio, nil + case "GITHUB": + return IntegrationProviderGithub, nil + case "POSTMARK": + return IntegrationProviderPostmark, nil + case "TYPEFORM": + return IntegrationProviderTypeform, nil + case "XERO": + return IntegrationProviderXero, nil + case "SVIX": + return IntegrationProviderSvix, nil + case "ADYEN": + return IntegrationProviderAdyen, nil + case "AKENEO": + return IntegrationProviderAkeneo, nil + case "GITLAB": + return IntegrationProviderGitlab, nil + case "WOOCOMMERCE": + return IntegrationProviderWoocommerce, nil + case "OURA": + return IntegrationProviderOura, nil + case "COMMERCELAYER": + return IntegrationProviderCommercelayer, nil + case "HUBSPOT": + return IntegrationProviderHubspot, nil + case "MAILGUN": + return IntegrationProviderMailgun, nil + case "PERSONA": + return IntegrationProviderPersona, nil + case "PIPEDRIVE": + return IntegrationProviderPipedrive, nil + case "SENDGRID": + return IntegrationProviderSendgrid, nil + case "WORKOS": + return IntegrationProviderWorkos, nil + case "SYNCTERA": + return IntegrationProviderSynctera, nil + case "AWS_SNS": + return IntegrationProviderAwsSns, nil + case "THREE_D_EYE": + return IntegrationProviderThreeDEye, nil + case "TWITCH": + return IntegrationProviderTwitch, nil + case "ENODE": + return IntegrationProviderEnode, nil + case "FAVRO": + return IntegrationProviderFavro, nil + case "LINEAR": + return IntegrationProviderLinear, nil + case "SHOPLINE": + return IntegrationProviderShopline, nil + case "WIX": + return IntegrationProviderWix, nil + case "NMI": + return IntegrationProviderNmi, nil + case "ORB": + return IntegrationProviderOrb, nil + case "PYLON": + return IntegrationProviderPylon, nil + case "RAZORPAY": + return IntegrationProviderRazorpay, nil + case "REPAY": + return IntegrationProviderRepay, nil + case "SQUARE": + return IntegrationProviderSquare, nil + case "SOLIDGATE": + return IntegrationProviderSolidgate, nil + case "TRELLO": + return IntegrationProviderTrello, nil + case "EBAY": + return IntegrationProviderEbay, nil + case "TELNYX": + return IntegrationProviderTelnyx, nil + case "DISCORD": + return IntegrationProviderDiscord, nil + case "TOKENIO": + return IntegrationProviderTokenio, nil + case "FISERV": + return IntegrationProviderFiserv, nil + case "BONDSMITH": + return IntegrationProviderBondsmith, nil + case "VERCEL_LOG_DRAINS": + return IntegrationProviderVercelLogDrains, nil + case "VERCEL": + return IntegrationProviderVercel, nil + case "TEBEX": + return IntegrationProviderTebex, nil + case "SLACK": + return IntegrationProviderSlack, nil + case "MAILCHIMP": + return IntegrationProviderMailchimp, nil + case "PADDLE": + return IntegrationProviderPaddle, nil + case "PAYPAL": + return IntegrationProviderPaypal, nil + case "TREEZOR": + return IntegrationProviderTreezor, nil + case "PRAXIS": + return IntegrationProviderPraxis, nil + case "CUSTOMERIO": + return IntegrationProviderCustomerio, nil + case "FACEBOOK": + return IntegrationProviderFacebook, nil + case "WHATSAPP": + return IntegrationProviderWhatsapp, nil + case "REPLICATE": + return IntegrationProviderReplicate, nil + case "TIKTOK": + return IntegrationProviderTiktok, nil + case "AIRWALLEX": + return IntegrationProviderAirwallex, nil + case "ZENDESK": + return IntegrationProviderZendesk, nil + case "UPOLLO": + return IntegrationProviderUpollo, nil + } + var t IntegrationProvider + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (t *TransformRuleTransformation) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (i IntegrationProvider) Ptr() *IntegrationProvider { + return &i } -func (t *TransformRuleTransformation) UnmarshalJSON(data []byte) error { - type unmarshaler TransformRuleTransformation - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformRuleTransformation(value) +type Operators struct { + Gt *time.Time `json:"gt,omitempty" url:"gt,omitempty"` + Gte *time.Time `json:"gte,omitempty" url:"gte,omitempty"` + Le *time.Time `json:"le,omitempty" url:"le,omitempty"` + Lte *time.Time `json:"lte,omitempty" url:"lte,omitempty"` + Any *bool `json:"any,omitempty" url:"any,omitempty"` - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties + extraProperties map[string]interface{} + rawJSON json.RawMessage +} - t._rawJSON = json.RawMessage(data) - return nil +func (o *Operators) GetGt() *time.Time { + if o == nil { + return nil + } + return o.Gt } -func (t *TransformRuleTransformation) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +func (o *Operators) GetGte() *time.Time { + if o == nil { + return nil } - if value, err := core.StringifyJSON(t); err == nil { - return value + return o.Gte +} + +func (o *Operators) GetLe() *time.Time { + if o == nil { + return nil } - return fmt.Sprintf("%#v", t) + return o.Le } -type Transformation struct { - // ID of the transformation - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - // A unique, human-friendly name for the transformation - Name string `json:"name" url:"name"` - // JavaScript code to be executed - Code string `json:"code" url:"code"` - EncryptedEnv *string `json:"encrypted_env,omitempty" url:"encrypted_env,omitempty"` - Iv *string `json:"iv,omitempty" url:"iv,omitempty"` - // Key-value environment variables to be passed to the transformation - Env map[string]*string `json:"env,omitempty" url:"env,omitempty"` - // Date the transformation was last updated - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - // Date the transformation was created - CreatedAt time.Time `json:"created_at" url:"created_at"` +func (o *Operators) GetLte() *time.Time { + if o == nil { + return nil + } + return o.Lte +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (o *Operators) GetAny() *bool { + if o == nil { + return nil + } + return o.Any } -func (t *Transformation) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (o *Operators) GetExtraProperties() map[string]interface{} { + return o.extraProperties } -func (t *Transformation) UnmarshalJSON(data []byte) error { - type embed Transformation +func (o *Operators) UnmarshalJSON(data []byte) error { + type embed Operators var unmarshaler = struct { embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` + Gt *internal.DateTime `json:"gt,omitempty"` + Gte *internal.DateTime `json:"gte,omitempty"` + Le *internal.DateTime `json:"le,omitempty"` + Lte *internal.DateTime `json:"lte,omitempty"` }{ - embed: embed(*t), + embed: embed(*o), } if err := json.Unmarshal(data, &unmarshaler); err != nil { return err } - *t = Transformation(unmarshaler.embed) - t.UpdatedAt = unmarshaler.UpdatedAt.Time() - t.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + *o = Operators(unmarshaler.embed) + o.Gt = unmarshaler.Gt.TimePtr() + o.Gte = unmarshaler.Gte.TimePtr() + o.Le = unmarshaler.Le.TimePtr() + o.Lte = unmarshaler.Lte.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *o) + if err != nil { + return err + } + o.extraProperties = extraProperties + o.rawJSON = json.RawMessage(data) return nil } -func (t *Transformation) MarshalJSON() ([]byte, error) { - type embed Transformation +func (o *Operators) MarshalJSON() ([]byte, error) { + type embed Operators var marshaler = struct { embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` + Gt *internal.DateTime `json:"gt,omitempty"` + Gte *internal.DateTime `json:"gte,omitempty"` + Le *internal.DateTime `json:"le,omitempty"` + Lte *internal.DateTime `json:"lte,omitempty"` }{ - embed: embed(*t), - UpdatedAt: core.NewDateTime(t.UpdatedAt), - CreatedAt: core.NewDateTime(t.CreatedAt), + embed: embed(*o), + Gt: internal.NewOptionalDateTime(o.Gt), + Gte: internal.NewOptionalDateTime(o.Gte), + Le: internal.NewOptionalDateTime(o.Le), + Lte: internal.NewOptionalDateTime(o.Lte), } return json.Marshal(marshaler) } -func (t *Transformation) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (o *Operators) String() string { + if len(o.rawJSON) > 0 { + if value, err := internal.StringifyJSON(o.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(o); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", o) } -type TransformationExecution struct { - Id string `json:"id" url:"id"` - TransformedEventDataId string `json:"transformed_event_data_id" url:"transformed_event_data_id"` - OriginalEventDataId string `json:"original_event_data_id" url:"original_event_data_id"` - TransformationId string `json:"transformation_id" url:"transformation_id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - WebhookId string `json:"webhook_id" url:"webhook_id"` - LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` - Logs []*ConsoleLine `json:"logs,omitempty" url:"logs,omitempty"` - UpdatedAt time.Time `json:"updated_at" url:"updated_at"` - CreatedAt time.Time `json:"created_at" url:"created_at"` - OriginalEventData *ShortEventData `json:"original_event_data,omitempty" url:"original_event_data,omitempty"` - TransformedEventData *ShortEventData `json:"transformed_event_data,omitempty" url:"transformed_event_data,omitempty"` - IssueId *string `json:"issue_id,omitempty" url:"issue_id,omitempty"` +type OrderByDirection string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + OrderByDirectionAsc OrderByDirection = "asc" + OrderByDirectionDesc OrderByDirection = "desc" +) + +func NewOrderByDirectionFromString(s string) (OrderByDirection, error) { + switch s { + case "asc": + return OrderByDirectionAsc, nil + case "desc": + return OrderByDirectionDesc, nil + } + var t OrderByDirection + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (t *TransformationExecution) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (o OrderByDirection) Ptr() *OrderByDirection { + return &o } -func (t *TransformationExecution) UnmarshalJSON(data []byte) error { - type embed TransformationExecution - var unmarshaler = struct { - embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*t), +type RawBody struct { + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RawBody) GetBody() string { + if r == nil { + return "" } - if err := json.Unmarshal(data, &unmarshaler); err != nil { + return r.Body +} + +func (r *RawBody) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RawBody) UnmarshalJSON(data []byte) error { + type unmarshaler RawBody + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationExecution(unmarshaler.embed) - t.UpdatedAt = unmarshaler.UpdatedAt.Time() - t.CreatedAt = unmarshaler.CreatedAt.Time() - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *r = RawBody(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationExecution) MarshalJSON() ([]byte, error) { - type embed TransformationExecution - var marshaler = struct { - embed - UpdatedAt *core.DateTime `json:"updated_at"` - CreatedAt *core.DateTime `json:"created_at"` - }{ - embed: embed(*t), - UpdatedAt: core.NewDateTime(t.UpdatedAt), - CreatedAt: core.NewDateTime(t.CreatedAt), - } - return json.Marshal(marshaler) -} - -func (t *TransformationExecution) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (r *RawBody) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(r); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", r) } -// The minimum log level to open the issue on -type TransformationExecutionLogLevel string +type RequestRejectionCause string const ( - TransformationExecutionLogLevelDebug TransformationExecutionLogLevel = "debug" - TransformationExecutionLogLevelInfo TransformationExecutionLogLevel = "info" - TransformationExecutionLogLevelWarn TransformationExecutionLogLevel = "warn" - TransformationExecutionLogLevelError TransformationExecutionLogLevel = "error" - TransformationExecutionLogLevelFatal TransformationExecutionLogLevel = "fatal" + RequestRejectionCauseSourceDisabled RequestRejectionCause = "SOURCE_DISABLED" + RequestRejectionCauseNoConnection RequestRejectionCause = "NO_CONNECTION" + RequestRejectionCauseVerificationFailed RequestRejectionCause = "VERIFICATION_FAILED" + RequestRejectionCauseUnsupportedHttpMethod RequestRejectionCause = "UNSUPPORTED_HTTP_METHOD" + RequestRejectionCauseUnsupportedContentType RequestRejectionCause = "UNSUPPORTED_CONTENT_TYPE" + RequestRejectionCauseUnparsableJson RequestRejectionCause = "UNPARSABLE_JSON" + RequestRejectionCausePayloadTooLarge RequestRejectionCause = "PAYLOAD_TOO_LARGE" + RequestRejectionCauseIngestionFatal RequestRejectionCause = "INGESTION_FATAL" + RequestRejectionCauseUnknown RequestRejectionCause = "UNKNOWN" ) -func NewTransformationExecutionLogLevelFromString(s string) (TransformationExecutionLogLevel, error) { +func NewRequestRejectionCauseFromString(s string) (RequestRejectionCause, error) { switch s { - case "debug": - return TransformationExecutionLogLevelDebug, nil - case "info": - return TransformationExecutionLogLevelInfo, nil - case "warn": - return TransformationExecutionLogLevelWarn, nil - case "error": - return TransformationExecutionLogLevelError, nil - case "fatal": - return TransformationExecutionLogLevelFatal, nil + case "SOURCE_DISABLED": + return RequestRejectionCauseSourceDisabled, nil + case "NO_CONNECTION": + return RequestRejectionCauseNoConnection, nil + case "VERIFICATION_FAILED": + return RequestRejectionCauseVerificationFailed, nil + case "UNSUPPORTED_HTTP_METHOD": + return RequestRejectionCauseUnsupportedHttpMethod, nil + case "UNSUPPORTED_CONTENT_TYPE": + return RequestRejectionCauseUnsupportedContentType, nil + case "UNPARSABLE_JSON": + return RequestRejectionCauseUnparsableJson, nil + case "PAYLOAD_TOO_LARGE": + return RequestRejectionCausePayloadTooLarge, nil + case "INGESTION_FATAL": + return RequestRejectionCauseIngestionFatal, nil + case "UNKNOWN": + return RequestRejectionCauseUnknown, nil } - var t TransformationExecutionLogLevel + var t RequestRejectionCause return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (t TransformationExecutionLogLevel) Ptr() *TransformationExecutionLogLevel { - return &t +func (r RequestRejectionCause) Ptr() *RequestRejectionCause { + return &r } -type TransformationExecutionPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*TransformationExecution `json:"models,omitempty" url:"models,omitempty"` +type SeekPagination struct { + OrderBy *SeekPaginationOrderBy `json:"order_by,omitempty" url:"order_by,omitempty"` + Dir *SeekPaginationDir `json:"dir,omitempty" url:"dir,omitempty"` + Limit *int `json:"limit,omitempty" url:"limit,omitempty"` + Prev *string `json:"prev,omitempty" url:"prev,omitempty"` + Next *string `json:"next,omitempty" url:"next,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (t *TransformationExecutionPaginatedResult) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *SeekPagination) GetOrderBy() *SeekPaginationOrderBy { + if s == nil { + return nil + } + return s.OrderBy } -func (t *TransformationExecutionPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutionPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SeekPagination) GetDir() *SeekPaginationDir { + if s == nil { + return nil } - *t = TransformationExecutionPaginatedResult(value) + return s.Dir +} - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err +func (s *SeekPagination) GetLimit() *int { + if s == nil { + return nil } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil + return s.Limit } -func (t *TransformationExecutionPaginatedResult) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(t); err == nil { - return value +func (s *SeekPagination) GetPrev() *string { + if s == nil { + return nil } - return fmt.Sprintf("%#v", t) + return s.Prev } -type TransformationExecutorOutput struct { - RequestId *string `json:"request_id,omitempty" url:"request_id,omitempty"` - TransformationId *string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` - ExecutionId *string `json:"execution_id,omitempty" url:"execution_id,omitempty"` - LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` - Request *TransformationExecutorOutputRequest `json:"request,omitempty" url:"request,omitempty"` - Console []*ConsoleLine `json:"console,omitempty" url:"console,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SeekPagination) GetNext() *string { + if s == nil { + return nil + } + return s.Next } -func (t *TransformationExecutorOutput) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *SeekPagination) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (t *TransformationExecutorOutput) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutorOutput +func (s *SeekPagination) UnmarshalJSON(data []byte) error { + type unmarshaler SeekPagination var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationExecutorOutput(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *s = SeekPagination(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationExecutorOutput) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (s *SeekPagination) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", s) } -type TransformationExecutorOutputRequest struct { - Headers *TransformationExecutorOutputRequestHeaders `json:"headers,omitempty" url:"headers,omitempty"` - Path string `json:"path" url:"path"` - Query *TransformationExecutorOutputRequestQuery `json:"query,omitempty" url:"query,omitempty"` - ParsedQuery *TransformationExecutorOutputRequestParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"` - Body *TransformationExecutorOutputRequestBody `json:"body,omitempty" url:"body,omitempty"` +type SeekPaginationDir struct { + OrderByDirection OrderByDirection + OrderByDirectionList []OrderByDirection - extraProperties map[string]interface{} - _rawJSON json.RawMessage + typ string } -func (t *TransformationExecutorOutputRequest) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func NewSeekPaginationDirFromOrderByDirection(value OrderByDirection) *SeekPaginationDir { + return &SeekPaginationDir{typ: "OrderByDirection", OrderByDirection: value} } -func (t *TransformationExecutorOutputRequest) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutorOutputRequest - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformationExecutorOutputRequest(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil +func NewSeekPaginationDirFromOrderByDirectionList(value []OrderByDirection) *SeekPaginationDir { + return &SeekPaginationDir{typ: "OrderByDirectionList", OrderByDirectionList: value} } -func (t *TransformationExecutorOutputRequest) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(t); err == nil { - return value +func (s *SeekPaginationDir) GetOrderByDirection() OrderByDirection { + if s == nil { + return "" } - return fmt.Sprintf("%#v", t) -} - -type TransformationExecutorOutputRequestBody struct { - StringOptional *string - TransformationExecutorOutputRequestBodyOne *TransformationExecutorOutputRequestBodyOne -} - -func NewTransformationExecutorOutputRequestBodyFromStringOptional(value *string) *TransformationExecutorOutputRequestBody { - return &TransformationExecutorOutputRequestBody{StringOptional: value} + return s.OrderByDirection } -func NewTransformationExecutorOutputRequestBodyFromTransformationExecutorOutputRequestBodyOne(value *TransformationExecutorOutputRequestBodyOne) *TransformationExecutorOutputRequestBody { - return &TransformationExecutorOutputRequestBody{TransformationExecutorOutputRequestBodyOne: value} +func (s *SeekPaginationDir) GetOrderByDirectionList() []OrderByDirection { + if s == nil { + return nil + } + return s.OrderByDirectionList } -func (t *TransformationExecutorOutputRequestBody) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - t.StringOptional = valueStringOptional +func (s *SeekPaginationDir) UnmarshalJSON(data []byte) error { + var valueOrderByDirection OrderByDirection + if err := json.Unmarshal(data, &valueOrderByDirection); err == nil { + s.typ = "OrderByDirection" + s.OrderByDirection = valueOrderByDirection return nil } - valueTransformationExecutorOutputRequestBodyOne := new(TransformationExecutorOutputRequestBodyOne) - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestBodyOne); err == nil { - t.TransformationExecutorOutputRequestBodyOne = valueTransformationExecutorOutputRequestBodyOne + var valueOrderByDirectionList []OrderByDirection + if err := json.Unmarshal(data, &valueOrderByDirectionList); err == nil { + s.typ = "OrderByDirectionList" + s.OrderByDirectionList = valueOrderByDirectionList return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -func (t TransformationExecutorOutputRequestBody) MarshalJSON() ([]byte, error) { - if t.StringOptional != nil { - return json.Marshal(t.StringOptional) +func (s SeekPaginationDir) MarshalJSON() ([]byte, error) { + if s.typ == "OrderByDirection" || s.OrderByDirection != "" { + return json.Marshal(s.OrderByDirection) } - if t.TransformationExecutorOutputRequestBodyOne != nil { - return json.Marshal(t.TransformationExecutorOutputRequestBodyOne) + if s.typ == "OrderByDirectionList" || s.OrderByDirectionList != nil { + return json.Marshal(s.OrderByDirectionList) } - return nil, fmt.Errorf("type %T does not include a non-empty union type", t) + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) } -type TransformationExecutorOutputRequestBodyVisitor interface { - VisitStringOptional(*string) error - VisitTransformationExecutorOutputRequestBodyOne(*TransformationExecutorOutputRequestBodyOne) error +type SeekPaginationDirVisitor interface { + VisitOrderByDirection(OrderByDirection) error + VisitOrderByDirectionList([]OrderByDirection) error } -func (t *TransformationExecutorOutputRequestBody) Accept(visitor TransformationExecutorOutputRequestBodyVisitor) error { - if t.StringOptional != nil { - return visitor.VisitStringOptional(t.StringOptional) +func (s *SeekPaginationDir) Accept(visitor SeekPaginationDirVisitor) error { + if s.typ == "OrderByDirection" || s.OrderByDirection != "" { + return visitor.VisitOrderByDirection(s.OrderByDirection) } - if t.TransformationExecutorOutputRequestBodyOne != nil { - return visitor.VisitTransformationExecutorOutputRequestBodyOne(t.TransformationExecutorOutputRequestBodyOne) + if s.typ == "OrderByDirectionList" || s.OrderByDirectionList != nil { + return visitor.VisitOrderByDirectionList(s.OrderByDirectionList) } - return fmt.Errorf("type %T does not include a non-empty union type", t) + return fmt.Errorf("type %T does not include a non-empty union type", s) } -type TransformationExecutorOutputRequestBodyOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +type SeekPaginationOrderBy struct { + String string + StringList []string + + typ string } -func (t *TransformationExecutorOutputRequestBodyOne) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func NewSeekPaginationOrderByFromString(value string) *SeekPaginationOrderBy { + return &SeekPaginationOrderBy{typ: "String", String: value} } -func (t *TransformationExecutorOutputRequestBodyOne) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutorOutputRequestBodyOne - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformationExecutorOutputRequestBodyOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil +func NewSeekPaginationOrderByFromStringList(value []string) *SeekPaginationOrderBy { + return &SeekPaginationOrderBy{typ: "StringList", StringList: value} } -func (t *TransformationExecutorOutputRequestBodyOne) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(t); err == nil { - return value +func (s *SeekPaginationOrderBy) GetString() string { + if s == nil { + return "" } - return fmt.Sprintf("%#v", t) -} - -type TransformationExecutorOutputRequestHeaders struct { - String string - StringUnknownMap map[string]interface{} + return s.String } -func NewTransformationExecutorOutputRequestHeadersFromString(value string) *TransformationExecutorOutputRequestHeaders { - return &TransformationExecutorOutputRequestHeaders{String: value} -} - -func NewTransformationExecutorOutputRequestHeadersFromStringUnknownMap(value map[string]interface{}) *TransformationExecutorOutputRequestHeaders { - return &TransformationExecutorOutputRequestHeaders{StringUnknownMap: value} +func (s *SeekPaginationOrderBy) GetStringList() []string { + if s == nil { + return nil + } + return s.StringList } -func (t *TransformationExecutorOutputRequestHeaders) UnmarshalJSON(data []byte) error { +func (s *SeekPaginationOrderBy) UnmarshalJSON(data []byte) error { var valueString string if err := json.Unmarshal(data, &valueString); err == nil { - t.String = valueString + s.typ = "String" + s.String = valueString return nil } - var valueStringUnknownMap map[string]interface{} - if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { - t.StringUnknownMap = valueStringUnknownMap + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + s.typ = "StringList" + s.StringList = valueStringList return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -func (t TransformationExecutorOutputRequestHeaders) MarshalJSON() ([]byte, error) { - if t.String != "" { - return json.Marshal(t.String) +func (s SeekPaginationOrderBy) MarshalJSON() ([]byte, error) { + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) } - if t.StringUnknownMap != nil { - return json.Marshal(t.StringUnknownMap) + if s.typ == "StringList" || s.StringList != nil { + return json.Marshal(s.StringList) } - return nil, fmt.Errorf("type %T does not include a non-empty union type", t) + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) } -type TransformationExecutorOutputRequestHeadersVisitor interface { +type SeekPaginationOrderByVisitor interface { VisitString(string) error - VisitStringUnknownMap(map[string]interface{}) error -} - -func (t *TransformationExecutorOutputRequestHeaders) Accept(visitor TransformationExecutorOutputRequestHeadersVisitor) error { - if t.String != "" { - return visitor.VisitString(t.String) - } - if t.StringUnknownMap != nil { - return visitor.VisitStringUnknownMap(t.StringUnknownMap) - } - return fmt.Errorf("type %T does not include a non-empty union type", t) -} - -type TransformationExecutorOutputRequestParsedQuery struct { - StringOptional *string - TransformationExecutorOutputRequestParsedQueryOne *TransformationExecutorOutputRequestParsedQueryOne -} - -func NewTransformationExecutorOutputRequestParsedQueryFromStringOptional(value *string) *TransformationExecutorOutputRequestParsedQuery { - return &TransformationExecutorOutputRequestParsedQuery{StringOptional: value} -} - -func NewTransformationExecutorOutputRequestParsedQueryFromTransformationExecutorOutputRequestParsedQueryOne(value *TransformationExecutorOutputRequestParsedQueryOne) *TransformationExecutorOutputRequestParsedQuery { - return &TransformationExecutorOutputRequestParsedQuery{TransformationExecutorOutputRequestParsedQueryOne: value} + VisitStringList([]string) error } -func (t *TransformationExecutorOutputRequestParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - t.StringOptional = valueStringOptional - return nil +func (s *SeekPaginationOrderBy) Accept(visitor SeekPaginationOrderByVisitor) error { + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) } - valueTransformationExecutorOutputRequestParsedQueryOne := new(TransformationExecutorOutputRequestParsedQueryOne) - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestParsedQueryOne); err == nil { - t.TransformationExecutorOutputRequestParsedQueryOne = valueTransformationExecutorOutputRequestParsedQueryOne - return nil + if s.typ == "StringList" || s.StringList != nil { + return visitor.VisitStringList(s.StringList) } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) + return fmt.Errorf("type %T does not include a non-empty union type", s) } -func (t TransformationExecutorOutputRequestParsedQuery) MarshalJSON() ([]byte, error) { - if t.StringOptional != nil { - return json.Marshal(t.StringOptional) - } - if t.TransformationExecutorOutputRequestParsedQueryOne != nil { - return json.Marshal(t.TransformationExecutorOutputRequestParsedQueryOne) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", t) -} +type ShopifyIntegrationConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` -type TransformationExecutorOutputRequestParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitTransformationExecutorOutputRequestParsedQueryOne(*TransformationExecutorOutputRequestParsedQueryOne) error + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (t *TransformationExecutorOutputRequestParsedQuery) Accept(visitor TransformationExecutorOutputRequestParsedQueryVisitor) error { - if t.StringOptional != nil { - return visitor.VisitStringOptional(t.StringOptional) +func (s *ShopifyIntegrationConfigs) GetWebhookSecretKey() string { + if s == nil { + return "" } - if t.TransformationExecutorOutputRequestParsedQueryOne != nil { - return visitor.VisitTransformationExecutorOutputRequestParsedQueryOne(t.TransformationExecutorOutputRequestParsedQueryOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", t) -} - -type TransformationExecutorOutputRequestParsedQueryOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return s.WebhookSecretKey } -func (t *TransformationExecutorOutputRequestParsedQueryOne) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *ShopifyIntegrationConfigs) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (t *TransformationExecutorOutputRequestParsedQueryOne) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutorOutputRequestParsedQueryOne +func (s *ShopifyIntegrationConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler ShopifyIntegrationConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationExecutorOutputRequestParsedQueryOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *s = ShopifyIntegrationConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationExecutorOutputRequestParsedQueryOne) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (s *ShopifyIntegrationConfigs) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", s) } -type TransformationExecutorOutputRequestQuery struct { - TransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero - String string -} +// Request data +type ShortEventData struct { + // Request path + Path string `json:"path" url:"path"` + // Raw query param string + Query *string `json:"query,omitempty" url:"query,omitempty"` + // JSON representation of query params + ParsedQuery *ShortEventDataParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"` + // JSON representation of the headers + Headers *ShortEventDataHeaders `json:"headers,omitempty" url:"headers,omitempty"` + // JSON or string representation of the body + Body *ShortEventDataBody `json:"body,omitempty" url:"body,omitempty"` + // Whether the payload is considered large payload and not searchable + IsLargePayload *bool `json:"is_large_payload,omitempty" url:"is_large_payload,omitempty"` -func NewTransformationExecutorOutputRequestQueryFromTransformationExecutorOutputRequestQueryZeroOptional(value *TransformationExecutorOutputRequestQueryZero) *TransformationExecutorOutputRequestQuery { - return &TransformationExecutorOutputRequestQuery{TransformationExecutorOutputRequestQueryZeroOptional: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewTransformationExecutorOutputRequestQueryFromString(value string) *TransformationExecutorOutputRequestQuery { - return &TransformationExecutorOutputRequestQuery{String: value} +func (s *ShortEventData) GetPath() string { + if s == nil { + return "" + } + return s.Path } -func (t *TransformationExecutorOutputRequestQuery) UnmarshalJSON(data []byte) error { - var valueTransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestQueryZeroOptional); err == nil { - t.TransformationExecutorOutputRequestQueryZeroOptional = valueTransformationExecutorOutputRequestQueryZeroOptional - return nil - } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - t.String = valueString +func (s *ShortEventData) GetQuery() *string { + if s == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) + return s.Query } -func (t TransformationExecutorOutputRequestQuery) MarshalJSON() ([]byte, error) { - if t.TransformationExecutorOutputRequestQueryZeroOptional != nil { - return json.Marshal(t.TransformationExecutorOutputRequestQueryZeroOptional) - } - if t.String != "" { - return json.Marshal(t.String) +func (s *ShortEventData) GetParsedQuery() *ShortEventDataParsedQuery { + if s == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", t) + return s.ParsedQuery } -type TransformationExecutorOutputRequestQueryVisitor interface { - VisitTransformationExecutorOutputRequestQueryZeroOptional(*TransformationExecutorOutputRequestQueryZero) error - VisitString(string) error +func (s *ShortEventData) GetHeaders() *ShortEventDataHeaders { + if s == nil { + return nil + } + return s.Headers } -func (t *TransformationExecutorOutputRequestQuery) Accept(visitor TransformationExecutorOutputRequestQueryVisitor) error { - if t.TransformationExecutorOutputRequestQueryZeroOptional != nil { - return visitor.VisitTransformationExecutorOutputRequestQueryZeroOptional(t.TransformationExecutorOutputRequestQueryZeroOptional) - } - if t.String != "" { - return visitor.VisitString(t.String) +func (s *ShortEventData) GetBody() *ShortEventDataBody { + if s == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", t) + return s.Body } -type TransformationExecutorOutputRequestQueryZero struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *ShortEventData) GetIsLargePayload() *bool { + if s == nil { + return nil + } + return s.IsLargePayload } -func (t *TransformationExecutorOutputRequestQueryZero) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *ShortEventData) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (t *TransformationExecutorOutputRequestQueryZero) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationExecutorOutputRequestQueryZero +func (s *ShortEventData) UnmarshalJSON(data []byte) error { + type unmarshaler ShortEventData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationExecutorOutputRequestQueryZero(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *s = ShortEventData(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationExecutorOutputRequestQueryZero) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (s *ShortEventData) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", s) } -type TransformationFailedMeta struct { - TransformationId string `json:"transformation_id" url:"transformation_id"` +// JSON or string representation of the body +type ShortEventDataBody struct { + String string + ShortEventDataBodyOne *ShortEventDataBodyOne + UnknownList []interface{} - extraProperties map[string]interface{} - _rawJSON json.RawMessage + typ string } -func (t *TransformationFailedMeta) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func NewShortEventDataBodyFromString(value string) *ShortEventDataBody { + return &ShortEventDataBody{typ: "String", String: value} } -func (t *TransformationFailedMeta) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationFailedMeta - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformationFailedMeta(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err - } - t.extraProperties = extraProperties +func NewShortEventDataBodyFromShortEventDataBodyOne(value *ShortEventDataBodyOne) *ShortEventDataBody { + return &ShortEventDataBody{typ: "ShortEventDataBodyOne", ShortEventDataBodyOne: value} +} - t._rawJSON = json.RawMessage(data) - return nil +func NewShortEventDataBodyFromUnknownList(value []interface{}) *ShortEventDataBody { + return &ShortEventDataBody{typ: "UnknownList", UnknownList: value} } -func (t *TransformationFailedMeta) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +func (s *ShortEventDataBody) GetString() string { + if s == nil { + return "" } - if value, err := core.StringifyJSON(t); err == nil { - return value + return s.String +} + +func (s *ShortEventDataBody) GetShortEventDataBodyOne() *ShortEventDataBodyOne { + if s == nil { + return nil } - return fmt.Sprintf("%#v", t) + return s.ShortEventDataBodyOne } -// Transformation issue -type TransformationIssue struct { - // Issue ID - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - Status IssueStatus `json:"status" url:"status"` - // ISO timestamp for when the issue was last opened - OpenedAt time.Time `json:"opened_at" url:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` - // Deprecated, will always be set to null - LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` - AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at" url:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at" url:"created_at"` - AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` - Reference *TransformationIssueReference `json:"reference,omitempty" url:"reference,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (t *TransformationIssue) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *ShortEventDataBody) GetUnknownList() []interface{} { + if s == nil { + return nil + } + return s.UnknownList } -func (t *TransformationIssue) UnmarshalJSON(data []byte) error { - type embed TransformationIssue - var unmarshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*t), +func (s *ShortEventDataBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typ = "String" + s.String = valueString + return nil } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err + valueShortEventDataBodyOne := new(ShortEventDataBodyOne) + if err := json.Unmarshal(data, &valueShortEventDataBodyOne); err == nil { + s.typ = "ShortEventDataBodyOne" + s.ShortEventDataBodyOne = valueShortEventDataBodyOne + return nil } - *t = TransformationIssue(unmarshaler.embed) - t.OpenedAt = unmarshaler.OpenedAt.Time() - t.FirstSeenAt = unmarshaler.FirstSeenAt.Time() - t.LastSeenAt = unmarshaler.LastSeenAt.Time() - t.DismissedAt = unmarshaler.DismissedAt.TimePtr() - t.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err + var valueUnknownList []interface{} + if err := json.Unmarshal(data, &valueUnknownList); err == nil { + s.typ = "UnknownList" + s.UnknownList = valueUnknownList + return nil } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -func (t *TransformationIssue) MarshalJSON() ([]byte, error) { - type embed TransformationIssue - var marshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*t), - OpenedAt: core.NewDateTime(t.OpenedAt), - FirstSeenAt: core.NewDateTime(t.FirstSeenAt), - LastSeenAt: core.NewDateTime(t.LastSeenAt), - DismissedAt: core.NewOptionalDateTime(t.DismissedAt), - AutoResolvedAt: core.NewOptionalDateTime(t.AutoResolvedAt), +func (s ShortEventDataBody) MarshalJSON() ([]byte, error) { + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) } - return json.Marshal(marshaler) + if s.typ == "ShortEventDataBodyOne" || s.ShortEventDataBodyOne != nil { + return json.Marshal(s.ShortEventDataBodyOne) + } + if s.typ == "UnknownList" || s.UnknownList != nil { + return json.Marshal(s.UnknownList) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) } -func (t *TransformationIssue) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +type ShortEventDataBodyVisitor interface { + VisitString(string) error + VisitShortEventDataBodyOne(*ShortEventDataBodyOne) error + VisitUnknownList([]interface{}) error +} + +func (s *ShortEventDataBody) Accept(visitor ShortEventDataBodyVisitor) error { + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) } - if value, err := core.StringifyJSON(t); err == nil { - return value + if s.typ == "ShortEventDataBodyOne" || s.ShortEventDataBodyOne != nil { + return visitor.VisitShortEventDataBodyOne(s.ShortEventDataBodyOne) } - return fmt.Sprintf("%#v", t) + if s.typ == "UnknownList" || s.UnknownList != nil { + return visitor.VisitUnknownList(s.UnknownList) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) } -// Keys used as the aggregation keys a 'transformation' type issue -type TransformationIssueAggregationKeys struct { - TransformationId []string `json:"transformation_id,omitempty" url:"transformation_id,omitempty"` - LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` - +type ShortEventDataBodyOne struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (t *TransformationIssueAggregationKeys) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (s *ShortEventDataBodyOne) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (t *TransformationIssueAggregationKeys) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationIssueAggregationKeys +func (s *ShortEventDataBodyOne) UnmarshalJSON(data []byte) error { + type unmarshaler ShortEventDataBodyOne var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationIssueAggregationKeys(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *s = ShortEventDataBodyOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationIssueAggregationKeys) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (s *ShortEventDataBodyOne) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", s) } -// Transformation issue data -type TransformationIssueData struct { - TransformationExecution *TransformationExecution `json:"transformation_execution,omitempty" url:"transformation_execution,omitempty"` - TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty" url:"trigger_attempt,omitempty"` +// JSON representation of the headers +type ShortEventDataHeaders struct { + String string + StringStringOptionalMap map[string]*string + + typ string +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewShortEventDataHeadersFromString(value string) *ShortEventDataHeaders { + return &ShortEventDataHeaders{typ: "String", String: value} } -func (t *TransformationIssueData) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func NewShortEventDataHeadersFromStringStringOptionalMap(value map[string]*string) *ShortEventDataHeaders { + return &ShortEventDataHeaders{typ: "StringStringOptionalMap", StringStringOptionalMap: value} } -func (t *TransformationIssueData) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationIssueData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *ShortEventDataHeaders) GetString() string { + if s == nil { + return "" } - *t = TransformationIssueData(value) + return s.String +} - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err +func (s *ShortEventDataHeaders) GetStringStringOptionalMap() map[string]*string { + if s == nil { + return nil } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil + return s.StringStringOptionalMap } -func (t *TransformationIssueData) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +func (s *ShortEventDataHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typ = "String" + s.String = valueString + return nil } - if value, err := core.StringifyJSON(t); err == nil { - return value + var valueStringStringOptionalMap map[string]*string + if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { + s.typ = "StringStringOptionalMap" + s.StringStringOptionalMap = valueStringStringOptionalMap + return nil } - return fmt.Sprintf("%#v", t) + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -// Reference to the event request transformation an issue is being created for. -type TransformationIssueReference struct { - TransformationExecutionId string `json:"transformation_execution_id" url:"transformation_execution_id"` - // Deprecated but still found on historical issues - TriggerEventRequestTransformationId *string `json:"trigger_event_request_transformation_id,omitempty" url:"trigger_event_request_transformation_id,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s ShortEventDataHeaders) MarshalJSON() ([]byte, error) { + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) + } + if s.typ == "StringStringOptionalMap" || s.StringStringOptionalMap != nil { + return json.Marshal(s.StringStringOptionalMap) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) } -func (t *TransformationIssueReference) GetExtraProperties() map[string]interface{} { - return t.extraProperties +type ShortEventDataHeadersVisitor interface { + VisitString(string) error + VisitStringStringOptionalMap(map[string]*string) error } -func (t *TransformationIssueReference) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationIssueReference - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *ShortEventDataHeaders) Accept(visitor ShortEventDataHeadersVisitor) error { + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) } - *t = TransformationIssueReference(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err + if s.typ == "StringStringOptionalMap" || s.StringStringOptionalMap != nil { + return visitor.VisitStringStringOptionalMap(s.StringStringOptionalMap) } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil + return fmt.Errorf("type %T does not include a non-empty union type", s) } -func (t *TransformationIssueReference) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(t); err == nil { - return value - } - return fmt.Sprintf("%#v", t) +// JSON representation of query params +type ShortEventDataParsedQuery struct { + StringOptional *string + ShortEventDataParsedQueryOne *ShortEventDataParsedQueryOne + + typ string } -// Transformation issue -type TransformationIssueWithData struct { - // Issue ID - Id string `json:"id" url:"id"` - // ID of the project - TeamId string `json:"team_id" url:"team_id"` - Status IssueStatus `json:"status" url:"status"` - // ISO timestamp for when the issue was last opened - OpenedAt time.Time `json:"opened_at" url:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt time.Time `json:"first_seen_at" url:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt time.Time `json:"last_seen_at" url:"last_seen_at"` - // Deprecated, will always be set to null - LastUpdatedBy *string `json:"last_updated_by,omitempty" url:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *time.Time `json:"dismissed_at,omitempty" url:"dismissed_at,omitempty"` - AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty" url:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty" url:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at" url:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at" url:"created_at"` - AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty" url:"aggregation_keys,omitempty"` - Reference *TransformationIssueReference `json:"reference,omitempty" url:"reference,omitempty"` - Data *TransformationIssueData `json:"data,omitempty" url:"data,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (t *TransformationIssueWithData) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func NewShortEventDataParsedQueryFromStringOptional(value *string) *ShortEventDataParsedQuery { + return &ShortEventDataParsedQuery{typ: "StringOptional", StringOptional: value} } -func (t *TransformationIssueWithData) UnmarshalJSON(data []byte) error { - type embed TransformationIssueWithData - var unmarshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*t), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *t = TransformationIssueWithData(unmarshaler.embed) - t.OpenedAt = unmarshaler.OpenedAt.Time() - t.FirstSeenAt = unmarshaler.FirstSeenAt.Time() - t.LastSeenAt = unmarshaler.LastSeenAt.Time() - t.DismissedAt = unmarshaler.DismissedAt.TimePtr() - t.AutoResolvedAt = unmarshaler.AutoResolvedAt.TimePtr() +func NewShortEventDataParsedQueryFromShortEventDataParsedQueryOne(value *ShortEventDataParsedQueryOne) *ShortEventDataParsedQuery { + return &ShortEventDataParsedQuery{typ: "ShortEventDataParsedQueryOne", ShortEventDataParsedQueryOne: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err +func (s *ShortEventDataParsedQuery) GetStringOptional() *string { + if s == nil { + return nil } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) - return nil + return s.StringOptional } -func (t *TransformationIssueWithData) MarshalJSON() ([]byte, error) { - type embed TransformationIssueWithData - var marshaler = struct { - embed - OpenedAt *core.DateTime `json:"opened_at"` - FirstSeenAt *core.DateTime `json:"first_seen_at"` - LastSeenAt *core.DateTime `json:"last_seen_at"` - DismissedAt *core.DateTime `json:"dismissed_at,omitempty"` - AutoResolvedAt *core.DateTime `json:"auto_resolved_at,omitempty"` - }{ - embed: embed(*t), - OpenedAt: core.NewDateTime(t.OpenedAt), - FirstSeenAt: core.NewDateTime(t.FirstSeenAt), - LastSeenAt: core.NewDateTime(t.LastSeenAt), - DismissedAt: core.NewOptionalDateTime(t.DismissedAt), - AutoResolvedAt: core.NewOptionalDateTime(t.AutoResolvedAt), +func (s *ShortEventDataParsedQuery) GetShortEventDataParsedQueryOne() *ShortEventDataParsedQueryOne { + if s == nil { + return nil } - return json.Marshal(marshaler) + return s.ShortEventDataParsedQueryOne } -func (t *TransformationIssueWithData) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +func (s *ShortEventDataParsedQuery) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + s.typ = "StringOptional" + s.StringOptional = valueStringOptional + return nil } - if value, err := core.StringifyJSON(t); err == nil { - return value + valueShortEventDataParsedQueryOne := new(ShortEventDataParsedQueryOne) + if err := json.Unmarshal(data, &valueShortEventDataParsedQueryOne); err == nil { + s.typ = "ShortEventDataParsedQueryOne" + s.ShortEventDataParsedQueryOne = valueShortEventDataParsedQueryOne + return nil } - return fmt.Sprintf("%#v", t) -} - -type TransformationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty" url:"pagination,omitempty"` - Count *int `json:"count,omitempty" url:"count,omitempty"` - Models []*Transformation `json:"models,omitempty" url:"models,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (t *TransformationPaginatedResult) GetExtraProperties() map[string]interface{} { - return t.extraProperties + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -func (t *TransformationPaginatedResult) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationPaginatedResult - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s ShortEventDataParsedQuery) MarshalJSON() ([]byte, error) { + if s.typ == "StringOptional" || s.StringOptional != nil { + return json.Marshal(s.StringOptional) } - *t = TransformationPaginatedResult(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) - if err != nil { - return err + if s.typ == "ShortEventDataParsedQueryOne" || s.ShortEventDataParsedQueryOne != nil { + return json.Marshal(s.ShortEventDataParsedQueryOne) } - t.extraProperties = extraProperties + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} - t._rawJSON = json.RawMessage(data) - return nil +type ShortEventDataParsedQueryVisitor interface { + VisitStringOptional(*string) error + VisitShortEventDataParsedQueryOne(*ShortEventDataParsedQueryOne) error } -func (t *TransformationPaginatedResult) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { - return value - } +func (s *ShortEventDataParsedQuery) Accept(visitor ShortEventDataParsedQueryVisitor) error { + if s.typ == "StringOptional" || s.StringOptional != nil { + return visitor.VisitStringOptional(s.StringOptional) } - if value, err := core.StringifyJSON(t); err == nil { - return value + if s.typ == "ShortEventDataParsedQueryOne" || s.ShortEventDataParsedQueryOne != nil { + return visitor.VisitShortEventDataParsedQueryOne(s.ShortEventDataParsedQueryOne) } - return fmt.Sprintf("%#v", t) + return fmt.Errorf("type %T does not include a non-empty union type", s) } -type VercelLogDrainsIntegrationConfigs struct { - WebhookSecretKey *string `json:"webhook_secret_key,omitempty" url:"webhook_secret_key,omitempty"` - VercelLogDrainsSecret string `json:"vercel_log_drains_secret" url:"vercel_log_drains_secret"` - +type ShortEventDataParsedQueryOne struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VercelLogDrainsIntegrationConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *ShortEventDataParsedQueryOne) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (v *VercelLogDrainsIntegrationConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VercelLogDrainsIntegrationConfigs +func (s *ShortEventDataParsedQueryOne) UnmarshalJSON(data []byte) error { + type unmarshaler ShortEventDataParsedQueryOne var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VercelLogDrainsIntegrationConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *s = ShortEventDataParsedQueryOne(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (v *VercelLogDrainsIntegrationConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (s *ShortEventDataParsedQueryOne) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", s) } -type Verification3DEye struct { - Configs *Verification3DEyeConfigs `json:"configs,omitempty" url:"configs,omitempty"` +// Associated [Source](#source-object) object +type Source struct { + // ID of the source + Id string `json:"id" url:"id"` + // Name for the source + Name string `json:"name" url:"name"` + // Description of the source + Description *string `json:"description,omitempty" url:"description,omitempty"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + // A unique URL that must be supplied to your webhook's provider + Url string `json:"url" url:"url"` + Verification *VerificationConfig `json:"verification,omitempty" url:"verification,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + // Date the source was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty" url:"disabled_at,omitempty"` + // Date the source was last updated + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + // Date the source was created + CreatedAt time.Time `json:"created_at" url:"created_at"` + // Type of the source + Type *string `json:"type,omitempty" url:"type,omitempty"` + Config *SourceConfig `json:"config,omitempty" url:"config,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *Verification3DEye) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *Source) GetId() string { + if s == nil { + return "" + } + return s.Id } -func (v *Verification3DEye) UnmarshalJSON(data []byte) error { - type unmarshaler Verification3DEye - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *Source) GetName() string { + if s == nil { + return "" } - *v = Verification3DEye(value) + return s.Name +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *Source) GetDescription() *string { + if s == nil { + return nil } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil + return s.Description } -func (v *Verification3DEye) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *Source) GetTeamId() string { + if s == nil { + return "" } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) + return s.TeamId } -// The verification configs for 3dEye. Only included if the ?include=verification.configs query param is present -type Verification3DEyeConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *Source) GetUrl() string { + if s == nil { + return "" + } + return s.Url } -func (v *Verification3DEyeConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *Source) GetVerification() *VerificationConfig { + if s == nil { + return nil + } + return s.Verification } -func (v *Verification3DEyeConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler Verification3DEyeConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *Source) GetAllowedHttpMethods() *SourceAllowedHttpMethod { + if s == nil { + return nil } - *v = Verification3DEyeConfigs(value) + return s.AllowedHttpMethods +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *Source) GetCustomResponse() *SourceCustomResponse { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.CustomResponse +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *Source) GetDisabledAt() *time.Time { + if s == nil { + return nil + } + return s.DisabledAt } -func (v *Verification3DEyeConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *Source) GetUpdatedAt() time.Time { + if s == nil { + return time.Time{} } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.UpdatedAt +} + +func (s *Source) GetCreatedAt() time.Time { + if s == nil { + return time.Time{} } - return fmt.Sprintf("%#v", v) + return s.CreatedAt } -type VerificationAdyen struct { - Configs *VerificationAdyenConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (s *Source) GetType() *string { + if s == nil { + return nil + } + return s.Type +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *Source) GetConfig() *SourceConfig { + if s == nil { + return nil + } + return s.Config } -func (v *VerificationAdyen) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *Source) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (v *VerificationAdyen) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAdyen - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { +func (s *Source) UnmarshalJSON(data []byte) error { + type embed Source + var unmarshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*s), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { return err } - *v = VerificationAdyen(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *s = Source(unmarshaler.embed) + s.DisabledAt = unmarshaler.DisabledAt.TimePtr() + s.UpdatedAt = unmarshaler.UpdatedAt.Time() + s.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationAdyen) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (s *Source) MarshalJSON() ([]byte, error) { + type embed Source + var marshaler = struct { + embed + DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*s), + DisabledAt: internal.NewOptionalDateTime(s.DisabledAt), + UpdatedAt: internal.NewDateTime(s.UpdatedAt), + CreatedAt: internal.NewDateTime(s.CreatedAt), + } + return json.Marshal(marshaler) +} + +func (s *Source) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", s) } -// The verification configs for Adyen. Only included if the ?include=verification.configs query param is present -type VerificationAdyenConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} +// List of allowed HTTP methods. Defaults to PUT, POST, PATCH, DELETE. +type SourceAllowedHttpMethod = []SourceAllowedHttpMethodItem -func (v *VerificationAdyenConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} +type SourceAllowedHttpMethodItem string -func (v *VerificationAdyenConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAdyenConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationAdyenConfigs(value) +const ( + SourceAllowedHttpMethodItemGet SourceAllowedHttpMethodItem = "GET" + SourceAllowedHttpMethodItemPost SourceAllowedHttpMethodItem = "POST" + SourceAllowedHttpMethodItemPut SourceAllowedHttpMethodItem = "PUT" + SourceAllowedHttpMethodItemPatch SourceAllowedHttpMethodItem = "PATCH" + SourceAllowedHttpMethodItemDelete SourceAllowedHttpMethodItem = "DELETE" +) - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func NewSourceAllowedHttpMethodItemFromString(s string) (SourceAllowedHttpMethodItem, error) { + switch s { + case "GET": + return SourceAllowedHttpMethodItemGet, nil + case "POST": + return SourceAllowedHttpMethodItemPost, nil + case "PUT": + return SourceAllowedHttpMethodItemPut, nil + case "PATCH": + return SourceAllowedHttpMethodItemPatch, nil + case "DELETE": + return SourceAllowedHttpMethodItemDelete, nil } - v.extraProperties = extraProperties + var t SourceAllowedHttpMethodItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} - v._rawJSON = json.RawMessage(data) - return nil +func (s SourceAllowedHttpMethodItem) Ptr() *SourceAllowedHttpMethodItem { + return &s } -func (v *VerificationAdyenConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +// Configuration object for the source type +type SourceConfig struct { + Verification *VerificationConfig `json:"verification,omitempty" url:"verification,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceConfig) GetVerification() *VerificationConfig { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.Verification } -type VerificationAkeneo struct { - Configs *VerificationAkeneoConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (s *SourceConfig) GetAllowedHttpMethods() *SourceAllowedHttpMethod { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceConfig) GetCustomResponse() *SourceCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse } -func (v *VerificationAkeneo) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceConfig) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (v *VerificationAkeneo) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAkeneo +func (s *SourceConfig) UnmarshalJSON(data []byte) error { + type unmarshaler SourceConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationAkeneo(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *s = SourceConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationAkeneo) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (s *SourceConfig) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", s) } -// The verification configs for Akeneo. Only included if the ?include=verification.configs query param is present -type VerificationAkeneoConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +// Custom response object +type SourceCustomResponse struct { + ContentType SourceCustomResponseContentType `json:"content_type" url:"content_type"` + // Body of the custom response + Body string `json:"body" url:"body"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationAkeneoConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceCustomResponse) GetContentType() SourceCustomResponseContentType { + if s == nil { + return "" + } + return s.ContentType +} + +func (s *SourceCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties } -func (v *VerificationAkeneoConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAkeneoConfigs +func (s *SourceCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceCustomResponse var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationAkeneoConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *s = SourceCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationAkeneoConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (s *SourceCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", s) } -type VerificationApiKey struct { - Configs *VerificationApiKeyConfigs `json:"configs,omitempty" url:"configs,omitempty"` +// Content type of the custom response +type SourceCustomResponseContentType string - extraProperties map[string]interface{} - _rawJSON json.RawMessage +const ( + SourceCustomResponseContentTypeJson SourceCustomResponseContentType = "json" + SourceCustomResponseContentTypeText SourceCustomResponseContentType = "text" + SourceCustomResponseContentTypeXml SourceCustomResponseContentType = "xml" +) + +func NewSourceCustomResponseContentTypeFromString(s string) (SourceCustomResponseContentType, error) { + switch s { + case "json": + return SourceCustomResponseContentTypeJson, nil + case "text": + return SourceCustomResponseContentTypeText, nil + case "xml": + return SourceCustomResponseContentTypeXml, nil + } + var t SourceCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (v *VerificationApiKey) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s SourceCustomResponseContentType) Ptr() *SourceCustomResponseContentType { + return &s } -func (v *VerificationApiKey) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationApiKey - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationApiKey(value) +// The type configs for the specified type +type SourceTypeConfig struct { + SourceTypeConfigHmac *SourceTypeConfigHmac + SourceTypeConfigBasicAuth *SourceTypeConfigBasicAuth + SourceTypeConfigApiKey *SourceTypeConfigApiKey + SourceTypeConfigWebhook *SourceTypeConfigWebhook + SourceTypeConfigHttp *SourceTypeConfigHttp + SourceTypeConfigSanity *SourceTypeConfigSanity + SourceTypeConfigBridge *SourceTypeConfigBridge + SourceTypeConfigCloudSignal *SourceTypeConfigCloudSignal + SourceTypeConfigCourier *SourceTypeConfigCourier + SourceTypeConfigFrontApp *SourceTypeConfigFrontApp + SourceTypeConfigZoom *SourceTypeConfigZoom + SourceTypeConfigTwitter *SourceTypeConfigTwitter + SourceTypeConfigStripe *SourceTypeConfigStripe + SourceTypeConfigPropertyFinder *SourceTypeConfigPropertyFinder + SourceTypeConfigShopify *SourceTypeConfigShopify + SourceTypeConfigTwilio *SourceTypeConfigTwilio + SourceTypeConfigGitHub *SourceTypeConfigGitHub + SourceTypeConfigPostmark *SourceTypeConfigPostmark + SourceTypeConfigTypeform *SourceTypeConfigTypeform + SourceTypeConfigXero *SourceTypeConfigXero + SourceTypeConfigSvix *SourceTypeConfigSvix + SourceTypeConfigAdyen *SourceTypeConfigAdyen + SourceTypeConfigAkeneo *SourceTypeConfigAkeneo + SourceTypeConfigGitLab *SourceTypeConfigGitLab + SourceTypeConfigWooCommerce *SourceTypeConfigWooCommerce + SourceTypeConfigOura *SourceTypeConfigOura + SourceTypeConfigCommerceLayer *SourceTypeConfigCommerceLayer + SourceTypeConfigHubspot *SourceTypeConfigHubspot + SourceTypeConfigMailgun *SourceTypeConfigMailgun + SourceTypeConfigPersona *SourceTypeConfigPersona + SourceTypeConfigPipedrive *SourceTypeConfigPipedrive + SourceTypeConfigSendgrid *SourceTypeConfigSendgrid + SourceTypeConfigWorkOs *SourceTypeConfigWorkOs + SourceTypeConfigSynctera *SourceTypeConfigSynctera + SourceTypeConfigAwssns *SourceTypeConfigAwssns + SourceTypeConfigTwitch *SourceTypeConfigTwitch + SourceTypeConfigEnode *SourceTypeConfigEnode + SourceTypeConfigFavro *SourceTypeConfigFavro + SourceTypeConfigLinear *SourceTypeConfigLinear + SourceTypeConfigShopline *SourceTypeConfigShopline + SourceTypeConfigWix *SourceTypeConfigWix + SourceTypeConfigNmiPaymentGateway *SourceTypeConfigNmiPaymentGateway + SourceTypeConfigOrb *SourceTypeConfigOrb + SourceTypeConfigPylon *SourceTypeConfigPylon + SourceTypeConfigRazorpay *SourceTypeConfigRazorpay + SourceTypeConfigSquare *SourceTypeConfigSquare + SourceTypeConfigSolidgate *SourceTypeConfigSolidgate + SourceTypeConfigTrello *SourceTypeConfigTrello + SourceTypeConfigEbay *SourceTypeConfigEbay + SourceTypeConfigTelnyx *SourceTypeConfigTelnyx + SourceTypeConfigDiscord *SourceTypeConfigDiscord + SourceTypeConfigTokenIo *SourceTypeConfigTokenIo + SourceTypeConfigFiserv *SourceTypeConfigFiserv + SourceTypeConfigBondsmith *SourceTypeConfigBondsmith + SourceTypeConfigVercelLogDrains *SourceTypeConfigVercelLogDrains + SourceTypeConfigVercelWebhooks *SourceTypeConfigVercelWebhooks + SourceTypeConfigSlack *SourceTypeConfigSlack + SourceTypeConfigMailchimp *SourceTypeConfigMailchimp + SourceTypeConfigPaddle *SourceTypeConfigPaddle + SourceTypeConfigPaypal *SourceTypeConfigPaypal + SourceTypeConfigTreezor *SourceTypeConfigTreezor + SourceTypeConfigPraxis *SourceTypeConfigPraxis + SourceTypeConfigCustomerIo *SourceTypeConfigCustomerIo + SourceTypeConfigFacebook *SourceTypeConfigFacebook + SourceTypeConfigWhatsApp *SourceTypeConfigWhatsApp + SourceTypeConfigUpollo *SourceTypeConfigUpollo - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties + typ string +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigHmac(value *SourceTypeConfigHmac) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigHmac", SourceTypeConfigHmac: value} } -func (v *VerificationApiKey) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigBasicAuth(value *SourceTypeConfigBasicAuth) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigBasicAuth", SourceTypeConfigBasicAuth: value} } -// The verification configs for API Key. Only included if the ?include=verification.configs query param is present -type VerificationApiKeyConfigs struct { - HeaderKey string `json:"header_key" url:"header_key"` - ApiKey string `json:"api_key" url:"api_key"` +func NewSourceTypeConfigFromSourceTypeConfigApiKey(value *SourceTypeConfigApiKey) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigApiKey", SourceTypeConfigApiKey: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigWebhook(value *SourceTypeConfigWebhook) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigWebhook", SourceTypeConfigWebhook: value} } -func (v *VerificationApiKeyConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigHttp(value *SourceTypeConfigHttp) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigHttp", SourceTypeConfigHttp: value} } -func (v *VerificationApiKeyConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationApiKeyConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationApiKeyConfigs(value) +func NewSourceTypeConfigFromSourceTypeConfigSanity(value *SourceTypeConfigSanity) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSanity", SourceTypeConfigSanity: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigBridge(value *SourceTypeConfigBridge) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigBridge", SourceTypeConfigBridge: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigCloudSignal(value *SourceTypeConfigCloudSignal) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigCloudSignal", SourceTypeConfigCloudSignal: value} } -func (v *VerificationApiKeyConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigCourier(value *SourceTypeConfigCourier) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigCourier", SourceTypeConfigCourier: value} } -type VerificationAwssns struct { - Configs *VerificationAwssnsConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewSourceTypeConfigFromSourceTypeConfigFrontApp(value *SourceTypeConfigFrontApp) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigFrontApp", SourceTypeConfigFrontApp: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigZoom(value *SourceTypeConfigZoom) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigZoom", SourceTypeConfigZoom: value} } -func (v *VerificationAwssns) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigTwitter(value *SourceTypeConfigTwitter) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTwitter", SourceTypeConfigTwitter: value} } -func (v *VerificationAwssns) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAwssns - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationAwssns(value) +func NewSourceTypeConfigFromSourceTypeConfigStripe(value *SourceTypeConfigStripe) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigStripe", SourceTypeConfigStripe: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigPropertyFinder(value *SourceTypeConfigPropertyFinder) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPropertyFinder", SourceTypeConfigPropertyFinder: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigShopify(value *SourceTypeConfigShopify) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigShopify", SourceTypeConfigShopify: value} } -func (v *VerificationAwssns) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigTwilio(value *SourceTypeConfigTwilio) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTwilio", SourceTypeConfigTwilio: value} } -// The verification configs for AWS SNS. Only included if the ?include=verification.configs query param is present -type VerificationAwssnsConfigs struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigGitHub(value *SourceTypeConfigGitHub) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigGitHub", SourceTypeConfigGitHub: value} } -func (v *VerificationAwssnsConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigPostmark(value *SourceTypeConfigPostmark) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPostmark", SourceTypeConfigPostmark: value} } -func (v *VerificationAwssnsConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationAwssnsConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationAwssnsConfigs(value) +func NewSourceTypeConfigFromSourceTypeConfigTypeform(value *SourceTypeConfigTypeform) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTypeform", SourceTypeConfigTypeform: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigXero(value *SourceTypeConfigXero) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigXero", SourceTypeConfigXero: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigSvix(value *SourceTypeConfigSvix) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSvix", SourceTypeConfigSvix: value} } -func (v *VerificationAwssnsConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigAdyen(value *SourceTypeConfigAdyen) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigAdyen", SourceTypeConfigAdyen: value} } -type VerificationBasicAuth struct { - Configs *VerificationBasicAuthConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewSourceTypeConfigFromSourceTypeConfigAkeneo(value *SourceTypeConfigAkeneo) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigAkeneo", SourceTypeConfigAkeneo: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigGitLab(value *SourceTypeConfigGitLab) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigGitLab", SourceTypeConfigGitLab: value} } -func (v *VerificationBasicAuth) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigWooCommerce(value *SourceTypeConfigWooCommerce) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigWooCommerce", SourceTypeConfigWooCommerce: value} } -func (v *VerificationBasicAuth) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBasicAuth - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationBasicAuth(value) +func NewSourceTypeConfigFromSourceTypeConfigOura(value *SourceTypeConfigOura) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigOura", SourceTypeConfigOura: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigCommerceLayer(value *SourceTypeConfigCommerceLayer) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigCommerceLayer", SourceTypeConfigCommerceLayer: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigHubspot(value *SourceTypeConfigHubspot) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigHubspot", SourceTypeConfigHubspot: value} } -func (v *VerificationBasicAuth) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigMailgun(value *SourceTypeConfigMailgun) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigMailgun", SourceTypeConfigMailgun: value} } -// The verification configs for Basic Auth. Only included if the ?include=verification.configs query param is present -type VerificationBasicAuthConfigs struct { - Username string `json:"username" url:"username"` - Password string `json:"password" url:"password"` +func NewSourceTypeConfigFromSourceTypeConfigPersona(value *SourceTypeConfigPersona) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPersona", SourceTypeConfigPersona: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigPipedrive(value *SourceTypeConfigPipedrive) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPipedrive", SourceTypeConfigPipedrive: value} } -func (v *VerificationBasicAuthConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigSendgrid(value *SourceTypeConfigSendgrid) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSendgrid", SourceTypeConfigSendgrid: value} } -func (v *VerificationBasicAuthConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBasicAuthConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationBasicAuthConfigs(value) +func NewSourceTypeConfigFromSourceTypeConfigWorkOs(value *SourceTypeConfigWorkOs) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigWorkOs", SourceTypeConfigWorkOs: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigSynctera(value *SourceTypeConfigSynctera) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSynctera", SourceTypeConfigSynctera: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigAwssns(value *SourceTypeConfigAwssns) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigAwssns", SourceTypeConfigAwssns: value} } -func (v *VerificationBasicAuthConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigTwitch(value *SourceTypeConfigTwitch) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTwitch", SourceTypeConfigTwitch: value} } -type VerificationBondsmith struct { - Configs *VerificationBondsmithConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewSourceTypeConfigFromSourceTypeConfigEnode(value *SourceTypeConfigEnode) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigEnode", SourceTypeConfigEnode: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigFavro(value *SourceTypeConfigFavro) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigFavro", SourceTypeConfigFavro: value} } -func (v *VerificationBondsmith) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigLinear(value *SourceTypeConfigLinear) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigLinear", SourceTypeConfigLinear: value} } -func (v *VerificationBondsmith) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBondsmith - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationBondsmith(value) +func NewSourceTypeConfigFromSourceTypeConfigShopline(value *SourceTypeConfigShopline) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigShopline", SourceTypeConfigShopline: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigWix(value *SourceTypeConfigWix) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigWix", SourceTypeConfigWix: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigNmiPaymentGateway(value *SourceTypeConfigNmiPaymentGateway) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigNmiPaymentGateway", SourceTypeConfigNmiPaymentGateway: value} } -func (v *VerificationBondsmith) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigOrb(value *SourceTypeConfigOrb) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigOrb", SourceTypeConfigOrb: value} } -// The verification configs for Bondsmith. Only included if the ?include=verification.configs query param is present -type VerificationBondsmithConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func NewSourceTypeConfigFromSourceTypeConfigPylon(value *SourceTypeConfigPylon) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPylon", SourceTypeConfigPylon: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigRazorpay(value *SourceTypeConfigRazorpay) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigRazorpay", SourceTypeConfigRazorpay: value} } -func (v *VerificationBondsmithConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigSquare(value *SourceTypeConfigSquare) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSquare", SourceTypeConfigSquare: value} } -func (v *VerificationBondsmithConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBondsmithConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationBondsmithConfigs(value) +func NewSourceTypeConfigFromSourceTypeConfigSolidgate(value *SourceTypeConfigSolidgate) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSolidgate", SourceTypeConfigSolidgate: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewSourceTypeConfigFromSourceTypeConfigTrello(value *SourceTypeConfigTrello) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTrello", SourceTypeConfigTrello: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewSourceTypeConfigFromSourceTypeConfigEbay(value *SourceTypeConfigEbay) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigEbay", SourceTypeConfigEbay: value} } -func (v *VerificationBondsmithConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewSourceTypeConfigFromSourceTypeConfigTelnyx(value *SourceTypeConfigTelnyx) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTelnyx", SourceTypeConfigTelnyx: value} } -type VerificationBridge struct { - Configs *VerificationBridgeConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewSourceTypeConfigFromSourceTypeConfigDiscord(value *SourceTypeConfigDiscord) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigDiscord", SourceTypeConfigDiscord: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewSourceTypeConfigFromSourceTypeConfigTokenIo(value *SourceTypeConfigTokenIo) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTokenIo", SourceTypeConfigTokenIo: value} } -func (v *VerificationBridge) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewSourceTypeConfigFromSourceTypeConfigFiserv(value *SourceTypeConfigFiserv) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigFiserv", SourceTypeConfigFiserv: value} } -func (v *VerificationBridge) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBridge - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func NewSourceTypeConfigFromSourceTypeConfigBondsmith(value *SourceTypeConfigBondsmith) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigBondsmith", SourceTypeConfigBondsmith: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigVercelLogDrains(value *SourceTypeConfigVercelLogDrains) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigVercelLogDrains", SourceTypeConfigVercelLogDrains: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigVercelWebhooks(value *SourceTypeConfigVercelWebhooks) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigVercelWebhooks", SourceTypeConfigVercelWebhooks: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigSlack(value *SourceTypeConfigSlack) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigSlack", SourceTypeConfigSlack: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigMailchimp(value *SourceTypeConfigMailchimp) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigMailchimp", SourceTypeConfigMailchimp: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigPaddle(value *SourceTypeConfigPaddle) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPaddle", SourceTypeConfigPaddle: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigPaypal(value *SourceTypeConfigPaypal) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPaypal", SourceTypeConfigPaypal: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigTreezor(value *SourceTypeConfigTreezor) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigTreezor", SourceTypeConfigTreezor: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigPraxis(value *SourceTypeConfigPraxis) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigPraxis", SourceTypeConfigPraxis: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigCustomerIo(value *SourceTypeConfigCustomerIo) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigCustomerIo", SourceTypeConfigCustomerIo: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigFacebook(value *SourceTypeConfigFacebook) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigFacebook", SourceTypeConfigFacebook: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigWhatsApp(value *SourceTypeConfigWhatsApp) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigWhatsApp", SourceTypeConfigWhatsApp: value} +} + +func NewSourceTypeConfigFromSourceTypeConfigUpollo(value *SourceTypeConfigUpollo) *SourceTypeConfig { + return &SourceTypeConfig{typ: "SourceTypeConfigUpollo", SourceTypeConfigUpollo: value} +} + +func (s *SourceTypeConfig) GetSourceTypeConfigHmac() *SourceTypeConfigHmac { + if s == nil { + return nil } - *v = VerificationBridge(value) + return s.SourceTypeConfigHmac +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigBasicAuth() *SourceTypeConfigBasicAuth { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigBasicAuth +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigApiKey() *SourceTypeConfigApiKey { + if s == nil { + return nil + } + return s.SourceTypeConfigApiKey } -func (v *VerificationBridge) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigWebhook() *SourceTypeConfigWebhook { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigWebhook +} + +func (s *SourceTypeConfig) GetSourceTypeConfigHttp() *SourceTypeConfigHttp { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigHttp } -// The verification configs for Bridge. Only included if the ?include=verification.configs query param is present -type VerificationBridgeConfigs struct { - PublicKey string `json:"public_key" url:"public_key"` +func (s *SourceTypeConfig) GetSourceTypeConfigSanity() *SourceTypeConfigSanity { + if s == nil { + return nil + } + return s.SourceTypeConfigSanity +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceTypeConfig) GetSourceTypeConfigBridge() *SourceTypeConfigBridge { + if s == nil { + return nil + } + return s.SourceTypeConfigBridge } -func (v *VerificationBridgeConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceTypeConfig) GetSourceTypeConfigCloudSignal() *SourceTypeConfigCloudSignal { + if s == nil { + return nil + } + return s.SourceTypeConfigCloudSignal } -func (v *VerificationBridgeConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationBridgeConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigCourier() *SourceTypeConfigCourier { + if s == nil { + return nil } - *v = VerificationBridgeConfigs(value) + return s.SourceTypeConfigCourier +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigFrontApp() *SourceTypeConfigFrontApp { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigFrontApp +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigZoom() *SourceTypeConfigZoom { + if s == nil { + return nil + } + return s.SourceTypeConfigZoom } -func (v *VerificationBridgeConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigTwitter() *SourceTypeConfigTwitter { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigTwitter +} + +func (s *SourceTypeConfig) GetSourceTypeConfigStripe() *SourceTypeConfigStripe { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigStripe } -type VerificationCloudSignal struct { - Configs *VerificationCloudSignalConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (s *SourceTypeConfig) GetSourceTypeConfigPropertyFinder() *SourceTypeConfigPropertyFinder { + if s == nil { + return nil + } + return s.SourceTypeConfigPropertyFinder +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceTypeConfig) GetSourceTypeConfigShopify() *SourceTypeConfigShopify { + if s == nil { + return nil + } + return s.SourceTypeConfigShopify } -func (v *VerificationCloudSignal) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceTypeConfig) GetSourceTypeConfigTwilio() *SourceTypeConfigTwilio { + if s == nil { + return nil + } + return s.SourceTypeConfigTwilio } -func (v *VerificationCloudSignal) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCloudSignal - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigGitHub() *SourceTypeConfigGitHub { + if s == nil { + return nil } - *v = VerificationCloudSignal(value) + return s.SourceTypeConfigGitHub +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigPostmark() *SourceTypeConfigPostmark { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigPostmark +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigTypeform() *SourceTypeConfigTypeform { + if s == nil { + return nil + } + return s.SourceTypeConfigTypeform } -func (v *VerificationCloudSignal) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigXero() *SourceTypeConfigXero { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigXero +} + +func (s *SourceTypeConfig) GetSourceTypeConfigSvix() *SourceTypeConfigSvix { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigSvix } -// The verification configs for Cloud Signal. Only included if the ?include=verification.configs query param is present -type VerificationCloudSignalConfigs struct { - ApiKey string `json:"api_key" url:"api_key"` +func (s *SourceTypeConfig) GetSourceTypeConfigAdyen() *SourceTypeConfigAdyen { + if s == nil { + return nil + } + return s.SourceTypeConfigAdyen +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceTypeConfig) GetSourceTypeConfigAkeneo() *SourceTypeConfigAkeneo { + if s == nil { + return nil + } + return s.SourceTypeConfigAkeneo } -func (v *VerificationCloudSignalConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceTypeConfig) GetSourceTypeConfigGitLab() *SourceTypeConfigGitLab { + if s == nil { + return nil + } + return s.SourceTypeConfigGitLab } -func (v *VerificationCloudSignalConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCloudSignalConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigWooCommerce() *SourceTypeConfigWooCommerce { + if s == nil { + return nil } - *v = VerificationCloudSignalConfigs(value) + return s.SourceTypeConfigWooCommerce +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigOura() *SourceTypeConfigOura { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigOura +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigCommerceLayer() *SourceTypeConfigCommerceLayer { + if s == nil { + return nil + } + return s.SourceTypeConfigCommerceLayer } -func (v *VerificationCloudSignalConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigHubspot() *SourceTypeConfigHubspot { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigHubspot +} + +func (s *SourceTypeConfig) GetSourceTypeConfigMailgun() *SourceTypeConfigMailgun { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigMailgun } -type VerificationCommercelayer struct { - Configs *VerificationCommercelayerConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (s *SourceTypeConfig) GetSourceTypeConfigPersona() *SourceTypeConfigPersona { + if s == nil { + return nil + } + return s.SourceTypeConfigPersona +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceTypeConfig) GetSourceTypeConfigPipedrive() *SourceTypeConfigPipedrive { + if s == nil { + return nil + } + return s.SourceTypeConfigPipedrive } -func (v *VerificationCommercelayer) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceTypeConfig) GetSourceTypeConfigSendgrid() *SourceTypeConfigSendgrid { + if s == nil { + return nil + } + return s.SourceTypeConfigSendgrid } -func (v *VerificationCommercelayer) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCommercelayer - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigWorkOs() *SourceTypeConfigWorkOs { + if s == nil { + return nil } - *v = VerificationCommercelayer(value) + return s.SourceTypeConfigWorkOs +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigSynctera() *SourceTypeConfigSynctera { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigSynctera +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigAwssns() *SourceTypeConfigAwssns { + if s == nil { + return nil + } + return s.SourceTypeConfigAwssns } -func (v *VerificationCommercelayer) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigTwitch() *SourceTypeConfigTwitch { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigTwitch +} + +func (s *SourceTypeConfig) GetSourceTypeConfigEnode() *SourceTypeConfigEnode { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigEnode } -// The verification configs for Commercelayer. Only included if the ?include=verification.configs query param is present -type VerificationCommercelayerConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func (s *SourceTypeConfig) GetSourceTypeConfigFavro() *SourceTypeConfigFavro { + if s == nil { + return nil + } + return s.SourceTypeConfigFavro +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (s *SourceTypeConfig) GetSourceTypeConfigLinear() *SourceTypeConfigLinear { + if s == nil { + return nil + } + return s.SourceTypeConfigLinear } -func (v *VerificationCommercelayerConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (s *SourceTypeConfig) GetSourceTypeConfigShopline() *SourceTypeConfigShopline { + if s == nil { + return nil + } + return s.SourceTypeConfigShopline } -func (v *VerificationCommercelayerConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCommercelayerConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigWix() *SourceTypeConfigWix { + if s == nil { + return nil } - *v = VerificationCommercelayerConfigs(value) + return s.SourceTypeConfigWix +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (s *SourceTypeConfig) GetSourceTypeConfigNmiPaymentGateway() *SourceTypeConfigNmiPaymentGateway { + if s == nil { + return nil } - v.extraProperties = extraProperties + return s.SourceTypeConfigNmiPaymentGateway +} - v._rawJSON = json.RawMessage(data) - return nil +func (s *SourceTypeConfig) GetSourceTypeConfigOrb() *SourceTypeConfigOrb { + if s == nil { + return nil + } + return s.SourceTypeConfigOrb } -func (v *VerificationCommercelayerConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (s *SourceTypeConfig) GetSourceTypeConfigPylon() *SourceTypeConfigPylon { + if s == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return s.SourceTypeConfigPylon +} + +func (s *SourceTypeConfig) GetSourceTypeConfigRazorpay() *SourceTypeConfigRazorpay { + if s == nil { + return nil } - return fmt.Sprintf("%#v", v) + return s.SourceTypeConfigRazorpay } -// The verification configs for the specified verification type -type VerificationConfig struct { - Type string - Hmac *VerificationHmac - BasicAuth *VerificationBasicAuth - ApiKey *VerificationApiKey - Bridge *VerificationBridge - Cloudsignal *VerificationCloudSignal - Courier *VerificationCourier - Frontapp *VerificationFrontApp - Twitter *VerificationTwitter - Stripe *VerificationStripe - Recharge *VerificationRecharge - Twilio *VerificationTwilio - Github *VerificationGitHub - Shopify *VerificationShopify - Postmark *VerificationPostmark - Typeform *VerificationTypeform - Xero *VerificationXero - Svix *VerificationSvix - Zoom *VerificationZoom - Akeneo *VerificationAkeneo - Adyen *VerificationAdyen - Gitlab *VerificationGitLab - PropertyFinder *VerificationPropertyFinder - Woocommerce *VerificationWooCommerce - Oura *VerificationOura - Commercelayer *VerificationCommercelayer - Hubspot *VerificationHubspot - Mailgun *VerificationMailgun - Persona *VerificationPersona - Pipedrive *VerificationPipedrive - Sendgrid *VerificationSendGrid - Workos *VerificationWorkOs - Synctera *VerificationSynctera - AwsSns *VerificationAwssns - ThreeDEye *Verification3DEye - Twitch *VerificationTwitch - Enode *VerificationEnode - Favro *VerificationFavro - Linear *VerificationLinear - Shopline *VerificationShopline - Wix *VerificationWix - Nmi *VerificationNmiPaymentGateway - Orb *VerificationOrb - Pylon *VerificationPylon - Repay *VerificationRepay - Square *VerificationSquare - Solidgate *VerificationSolidGate - Trello *VerificationTrello - Sanity *VerificationSanity - Ebay *VerificationEbay - Telnyx *VerificationTelnyx - Discord *VerificationDiscord - Tokenio *VerificationTokenIo - Fiserv *VerificationFiserv - Bondsmith *VerificationBondsmith - VercelLogDrains *VerificationVercelLogDrains - Vercel *VerificationVercel - Tebex *VerificationTebex - Slack *VerificationSlack - Razorpay *VerificationRazorpay - Mailchimp *VerificationMailchimp - Paddle *VerificationPaddle - Paypal *VerificationPaypal - Treezor *VerificationTreezor - Praxis *VerificationPraxis -} - -func NewVerificationConfigFromHmac(value *VerificationHmac) *VerificationConfig { - return &VerificationConfig{Type: "hmac", Hmac: value} -} - -func NewVerificationConfigFromBasicAuth(value *VerificationBasicAuth) *VerificationConfig { - return &VerificationConfig{Type: "basic_auth", BasicAuth: value} -} - -func NewVerificationConfigFromApiKey(value *VerificationApiKey) *VerificationConfig { - return &VerificationConfig{Type: "api_key", ApiKey: value} -} - -func NewVerificationConfigFromBridge(value *VerificationBridge) *VerificationConfig { - return &VerificationConfig{Type: "bridge", Bridge: value} -} - -func NewVerificationConfigFromCloudsignal(value *VerificationCloudSignal) *VerificationConfig { - return &VerificationConfig{Type: "cloudsignal", Cloudsignal: value} -} - -func NewVerificationConfigFromCourier(value *VerificationCourier) *VerificationConfig { - return &VerificationConfig{Type: "courier", Courier: value} -} - -func NewVerificationConfigFromFrontapp(value *VerificationFrontApp) *VerificationConfig { - return &VerificationConfig{Type: "frontapp", Frontapp: value} -} - -func NewVerificationConfigFromTwitter(value *VerificationTwitter) *VerificationConfig { - return &VerificationConfig{Type: "twitter", Twitter: value} -} - -func NewVerificationConfigFromStripe(value *VerificationStripe) *VerificationConfig { - return &VerificationConfig{Type: "stripe", Stripe: value} -} - -func NewVerificationConfigFromRecharge(value *VerificationRecharge) *VerificationConfig { - return &VerificationConfig{Type: "recharge", Recharge: value} -} - -func NewVerificationConfigFromTwilio(value *VerificationTwilio) *VerificationConfig { - return &VerificationConfig{Type: "twilio", Twilio: value} -} - -func NewVerificationConfigFromGithub(value *VerificationGitHub) *VerificationConfig { - return &VerificationConfig{Type: "github", Github: value} -} - -func NewVerificationConfigFromShopify(value *VerificationShopify) *VerificationConfig { - return &VerificationConfig{Type: "shopify", Shopify: value} -} - -func NewVerificationConfigFromPostmark(value *VerificationPostmark) *VerificationConfig { - return &VerificationConfig{Type: "postmark", Postmark: value} -} - -func NewVerificationConfigFromTypeform(value *VerificationTypeform) *VerificationConfig { - return &VerificationConfig{Type: "typeform", Typeform: value} -} - -func NewVerificationConfigFromXero(value *VerificationXero) *VerificationConfig { - return &VerificationConfig{Type: "xero", Xero: value} -} - -func NewVerificationConfigFromSvix(value *VerificationSvix) *VerificationConfig { - return &VerificationConfig{Type: "svix", Svix: value} -} - -func NewVerificationConfigFromZoom(value *VerificationZoom) *VerificationConfig { - return &VerificationConfig{Type: "zoom", Zoom: value} -} - -func NewVerificationConfigFromAkeneo(value *VerificationAkeneo) *VerificationConfig { - return &VerificationConfig{Type: "akeneo", Akeneo: value} -} - -func NewVerificationConfigFromAdyen(value *VerificationAdyen) *VerificationConfig { - return &VerificationConfig{Type: "adyen", Adyen: value} -} - -func NewVerificationConfigFromGitlab(value *VerificationGitLab) *VerificationConfig { - return &VerificationConfig{Type: "gitlab", Gitlab: value} -} - -func NewVerificationConfigFromPropertyFinder(value *VerificationPropertyFinder) *VerificationConfig { - return &VerificationConfig{Type: "property-finder", PropertyFinder: value} -} - -func NewVerificationConfigFromWoocommerce(value *VerificationWooCommerce) *VerificationConfig { - return &VerificationConfig{Type: "woocommerce", Woocommerce: value} -} - -func NewVerificationConfigFromOura(value *VerificationOura) *VerificationConfig { - return &VerificationConfig{Type: "oura", Oura: value} -} - -func NewVerificationConfigFromCommercelayer(value *VerificationCommercelayer) *VerificationConfig { - return &VerificationConfig{Type: "commercelayer", Commercelayer: value} -} - -func NewVerificationConfigFromHubspot(value *VerificationHubspot) *VerificationConfig { - return &VerificationConfig{Type: "hubspot", Hubspot: value} -} - -func NewVerificationConfigFromMailgun(value *VerificationMailgun) *VerificationConfig { - return &VerificationConfig{Type: "mailgun", Mailgun: value} -} - -func NewVerificationConfigFromPersona(value *VerificationPersona) *VerificationConfig { - return &VerificationConfig{Type: "persona", Persona: value} +func (s *SourceTypeConfig) GetSourceTypeConfigSquare() *SourceTypeConfigSquare { + if s == nil { + return nil + } + return s.SourceTypeConfigSquare } -func NewVerificationConfigFromPipedrive(value *VerificationPipedrive) *VerificationConfig { - return &VerificationConfig{Type: "pipedrive", Pipedrive: value} +func (s *SourceTypeConfig) GetSourceTypeConfigSolidgate() *SourceTypeConfigSolidgate { + if s == nil { + return nil + } + return s.SourceTypeConfigSolidgate } -func NewVerificationConfigFromSendgrid(value *VerificationSendGrid) *VerificationConfig { - return &VerificationConfig{Type: "sendgrid", Sendgrid: value} +func (s *SourceTypeConfig) GetSourceTypeConfigTrello() *SourceTypeConfigTrello { + if s == nil { + return nil + } + return s.SourceTypeConfigTrello } -func NewVerificationConfigFromWorkos(value *VerificationWorkOs) *VerificationConfig { - return &VerificationConfig{Type: "workos", Workos: value} +func (s *SourceTypeConfig) GetSourceTypeConfigEbay() *SourceTypeConfigEbay { + if s == nil { + return nil + } + return s.SourceTypeConfigEbay } -func NewVerificationConfigFromSynctera(value *VerificationSynctera) *VerificationConfig { - return &VerificationConfig{Type: "synctera", Synctera: value} +func (s *SourceTypeConfig) GetSourceTypeConfigTelnyx() *SourceTypeConfigTelnyx { + if s == nil { + return nil + } + return s.SourceTypeConfigTelnyx } -func NewVerificationConfigFromAwsSns(value *VerificationAwssns) *VerificationConfig { - return &VerificationConfig{Type: "aws_sns", AwsSns: value} +func (s *SourceTypeConfig) GetSourceTypeConfigDiscord() *SourceTypeConfigDiscord { + if s == nil { + return nil + } + return s.SourceTypeConfigDiscord } -func NewVerificationConfigFromThreeDEye(value *Verification3DEye) *VerificationConfig { - return &VerificationConfig{Type: "three_d_eye", ThreeDEye: value} +func (s *SourceTypeConfig) GetSourceTypeConfigTokenIo() *SourceTypeConfigTokenIo { + if s == nil { + return nil + } + return s.SourceTypeConfigTokenIo } -func NewVerificationConfigFromTwitch(value *VerificationTwitch) *VerificationConfig { - return &VerificationConfig{Type: "twitch", Twitch: value} +func (s *SourceTypeConfig) GetSourceTypeConfigFiserv() *SourceTypeConfigFiserv { + if s == nil { + return nil + } + return s.SourceTypeConfigFiserv } -func NewVerificationConfigFromEnode(value *VerificationEnode) *VerificationConfig { - return &VerificationConfig{Type: "enode", Enode: value} +func (s *SourceTypeConfig) GetSourceTypeConfigBondsmith() *SourceTypeConfigBondsmith { + if s == nil { + return nil + } + return s.SourceTypeConfigBondsmith } -func NewVerificationConfigFromFavro(value *VerificationFavro) *VerificationConfig { - return &VerificationConfig{Type: "favro", Favro: value} +func (s *SourceTypeConfig) GetSourceTypeConfigVercelLogDrains() *SourceTypeConfigVercelLogDrains { + if s == nil { + return nil + } + return s.SourceTypeConfigVercelLogDrains } -func NewVerificationConfigFromLinear(value *VerificationLinear) *VerificationConfig { - return &VerificationConfig{Type: "linear", Linear: value} +func (s *SourceTypeConfig) GetSourceTypeConfigVercelWebhooks() *SourceTypeConfigVercelWebhooks { + if s == nil { + return nil + } + return s.SourceTypeConfigVercelWebhooks } -func NewVerificationConfigFromShopline(value *VerificationShopline) *VerificationConfig { - return &VerificationConfig{Type: "shopline", Shopline: value} +func (s *SourceTypeConfig) GetSourceTypeConfigSlack() *SourceTypeConfigSlack { + if s == nil { + return nil + } + return s.SourceTypeConfigSlack } -func NewVerificationConfigFromWix(value *VerificationWix) *VerificationConfig { - return &VerificationConfig{Type: "wix", Wix: value} +func (s *SourceTypeConfig) GetSourceTypeConfigMailchimp() *SourceTypeConfigMailchimp { + if s == nil { + return nil + } + return s.SourceTypeConfigMailchimp } -func NewVerificationConfigFromNmi(value *VerificationNmiPaymentGateway) *VerificationConfig { - return &VerificationConfig{Type: "nmi", Nmi: value} +func (s *SourceTypeConfig) GetSourceTypeConfigPaddle() *SourceTypeConfigPaddle { + if s == nil { + return nil + } + return s.SourceTypeConfigPaddle } -func NewVerificationConfigFromOrb(value *VerificationOrb) *VerificationConfig { - return &VerificationConfig{Type: "orb", Orb: value} +func (s *SourceTypeConfig) GetSourceTypeConfigPaypal() *SourceTypeConfigPaypal { + if s == nil { + return nil + } + return s.SourceTypeConfigPaypal } -func NewVerificationConfigFromPylon(value *VerificationPylon) *VerificationConfig { - return &VerificationConfig{Type: "pylon", Pylon: value} +func (s *SourceTypeConfig) GetSourceTypeConfigTreezor() *SourceTypeConfigTreezor { + if s == nil { + return nil + } + return s.SourceTypeConfigTreezor } -func NewVerificationConfigFromRepay(value *VerificationRepay) *VerificationConfig { - return &VerificationConfig{Type: "repay", Repay: value} +func (s *SourceTypeConfig) GetSourceTypeConfigPraxis() *SourceTypeConfigPraxis { + if s == nil { + return nil + } + return s.SourceTypeConfigPraxis } -func NewVerificationConfigFromSquare(value *VerificationSquare) *VerificationConfig { - return &VerificationConfig{Type: "square", Square: value} +func (s *SourceTypeConfig) GetSourceTypeConfigCustomerIo() *SourceTypeConfigCustomerIo { + if s == nil { + return nil + } + return s.SourceTypeConfigCustomerIo } -func NewVerificationConfigFromSolidgate(value *VerificationSolidGate) *VerificationConfig { - return &VerificationConfig{Type: "solidgate", Solidgate: value} +func (s *SourceTypeConfig) GetSourceTypeConfigFacebook() *SourceTypeConfigFacebook { + if s == nil { + return nil + } + return s.SourceTypeConfigFacebook } -func NewVerificationConfigFromTrello(value *VerificationTrello) *VerificationConfig { - return &VerificationConfig{Type: "trello", Trello: value} +func (s *SourceTypeConfig) GetSourceTypeConfigWhatsApp() *SourceTypeConfigWhatsApp { + if s == nil { + return nil + } + return s.SourceTypeConfigWhatsApp } -func NewVerificationConfigFromSanity(value *VerificationSanity) *VerificationConfig { - return &VerificationConfig{Type: "sanity", Sanity: value} +func (s *SourceTypeConfig) GetSourceTypeConfigUpollo() *SourceTypeConfigUpollo { + if s == nil { + return nil + } + return s.SourceTypeConfigUpollo } -func NewVerificationConfigFromEbay(value *VerificationEbay) *VerificationConfig { - return &VerificationConfig{Type: "ebay", Ebay: value} +func (s *SourceTypeConfig) UnmarshalJSON(data []byte) error { + valueSourceTypeConfigHmac := new(SourceTypeConfigHmac) + if err := json.Unmarshal(data, &valueSourceTypeConfigHmac); err == nil { + s.typ = "SourceTypeConfigHmac" + s.SourceTypeConfigHmac = valueSourceTypeConfigHmac + return nil + } + valueSourceTypeConfigBasicAuth := new(SourceTypeConfigBasicAuth) + if err := json.Unmarshal(data, &valueSourceTypeConfigBasicAuth); err == nil { + s.typ = "SourceTypeConfigBasicAuth" + s.SourceTypeConfigBasicAuth = valueSourceTypeConfigBasicAuth + return nil + } + valueSourceTypeConfigApiKey := new(SourceTypeConfigApiKey) + if err := json.Unmarshal(data, &valueSourceTypeConfigApiKey); err == nil { + s.typ = "SourceTypeConfigApiKey" + s.SourceTypeConfigApiKey = valueSourceTypeConfigApiKey + return nil + } + valueSourceTypeConfigWebhook := new(SourceTypeConfigWebhook) + if err := json.Unmarshal(data, &valueSourceTypeConfigWebhook); err == nil { + s.typ = "SourceTypeConfigWebhook" + s.SourceTypeConfigWebhook = valueSourceTypeConfigWebhook + return nil + } + valueSourceTypeConfigHttp := new(SourceTypeConfigHttp) + if err := json.Unmarshal(data, &valueSourceTypeConfigHttp); err == nil { + s.typ = "SourceTypeConfigHttp" + s.SourceTypeConfigHttp = valueSourceTypeConfigHttp + return nil + } + valueSourceTypeConfigSanity := new(SourceTypeConfigSanity) + if err := json.Unmarshal(data, &valueSourceTypeConfigSanity); err == nil { + s.typ = "SourceTypeConfigSanity" + s.SourceTypeConfigSanity = valueSourceTypeConfigSanity + return nil + } + valueSourceTypeConfigBridge := new(SourceTypeConfigBridge) + if err := json.Unmarshal(data, &valueSourceTypeConfigBridge); err == nil { + s.typ = "SourceTypeConfigBridge" + s.SourceTypeConfigBridge = valueSourceTypeConfigBridge + return nil + } + valueSourceTypeConfigCloudSignal := new(SourceTypeConfigCloudSignal) + if err := json.Unmarshal(data, &valueSourceTypeConfigCloudSignal); err == nil { + s.typ = "SourceTypeConfigCloudSignal" + s.SourceTypeConfigCloudSignal = valueSourceTypeConfigCloudSignal + return nil + } + valueSourceTypeConfigCourier := new(SourceTypeConfigCourier) + if err := json.Unmarshal(data, &valueSourceTypeConfigCourier); err == nil { + s.typ = "SourceTypeConfigCourier" + s.SourceTypeConfigCourier = valueSourceTypeConfigCourier + return nil + } + valueSourceTypeConfigFrontApp := new(SourceTypeConfigFrontApp) + if err := json.Unmarshal(data, &valueSourceTypeConfigFrontApp); err == nil { + s.typ = "SourceTypeConfigFrontApp" + s.SourceTypeConfigFrontApp = valueSourceTypeConfigFrontApp + return nil + } + valueSourceTypeConfigZoom := new(SourceTypeConfigZoom) + if err := json.Unmarshal(data, &valueSourceTypeConfigZoom); err == nil { + s.typ = "SourceTypeConfigZoom" + s.SourceTypeConfigZoom = valueSourceTypeConfigZoom + return nil + } + valueSourceTypeConfigTwitter := new(SourceTypeConfigTwitter) + if err := json.Unmarshal(data, &valueSourceTypeConfigTwitter); err == nil { + s.typ = "SourceTypeConfigTwitter" + s.SourceTypeConfigTwitter = valueSourceTypeConfigTwitter + return nil + } + valueSourceTypeConfigStripe := new(SourceTypeConfigStripe) + if err := json.Unmarshal(data, &valueSourceTypeConfigStripe); err == nil { + s.typ = "SourceTypeConfigStripe" + s.SourceTypeConfigStripe = valueSourceTypeConfigStripe + return nil + } + valueSourceTypeConfigPropertyFinder := new(SourceTypeConfigPropertyFinder) + if err := json.Unmarshal(data, &valueSourceTypeConfigPropertyFinder); err == nil { + s.typ = "SourceTypeConfigPropertyFinder" + s.SourceTypeConfigPropertyFinder = valueSourceTypeConfigPropertyFinder + return nil + } + valueSourceTypeConfigShopify := new(SourceTypeConfigShopify) + if err := json.Unmarshal(data, &valueSourceTypeConfigShopify); err == nil { + s.typ = "SourceTypeConfigShopify" + s.SourceTypeConfigShopify = valueSourceTypeConfigShopify + return nil + } + valueSourceTypeConfigTwilio := new(SourceTypeConfigTwilio) + if err := json.Unmarshal(data, &valueSourceTypeConfigTwilio); err == nil { + s.typ = "SourceTypeConfigTwilio" + s.SourceTypeConfigTwilio = valueSourceTypeConfigTwilio + return nil + } + valueSourceTypeConfigGitHub := new(SourceTypeConfigGitHub) + if err := json.Unmarshal(data, &valueSourceTypeConfigGitHub); err == nil { + s.typ = "SourceTypeConfigGitHub" + s.SourceTypeConfigGitHub = valueSourceTypeConfigGitHub + return nil + } + valueSourceTypeConfigPostmark := new(SourceTypeConfigPostmark) + if err := json.Unmarshal(data, &valueSourceTypeConfigPostmark); err == nil { + s.typ = "SourceTypeConfigPostmark" + s.SourceTypeConfigPostmark = valueSourceTypeConfigPostmark + return nil + } + valueSourceTypeConfigTypeform := new(SourceTypeConfigTypeform) + if err := json.Unmarshal(data, &valueSourceTypeConfigTypeform); err == nil { + s.typ = "SourceTypeConfigTypeform" + s.SourceTypeConfigTypeform = valueSourceTypeConfigTypeform + return nil + } + valueSourceTypeConfigXero := new(SourceTypeConfigXero) + if err := json.Unmarshal(data, &valueSourceTypeConfigXero); err == nil { + s.typ = "SourceTypeConfigXero" + s.SourceTypeConfigXero = valueSourceTypeConfigXero + return nil + } + valueSourceTypeConfigSvix := new(SourceTypeConfigSvix) + if err := json.Unmarshal(data, &valueSourceTypeConfigSvix); err == nil { + s.typ = "SourceTypeConfigSvix" + s.SourceTypeConfigSvix = valueSourceTypeConfigSvix + return nil + } + valueSourceTypeConfigAdyen := new(SourceTypeConfigAdyen) + if err := json.Unmarshal(data, &valueSourceTypeConfigAdyen); err == nil { + s.typ = "SourceTypeConfigAdyen" + s.SourceTypeConfigAdyen = valueSourceTypeConfigAdyen + return nil + } + valueSourceTypeConfigAkeneo := new(SourceTypeConfigAkeneo) + if err := json.Unmarshal(data, &valueSourceTypeConfigAkeneo); err == nil { + s.typ = "SourceTypeConfigAkeneo" + s.SourceTypeConfigAkeneo = valueSourceTypeConfigAkeneo + return nil + } + valueSourceTypeConfigGitLab := new(SourceTypeConfigGitLab) + if err := json.Unmarshal(data, &valueSourceTypeConfigGitLab); err == nil { + s.typ = "SourceTypeConfigGitLab" + s.SourceTypeConfigGitLab = valueSourceTypeConfigGitLab + return nil + } + valueSourceTypeConfigWooCommerce := new(SourceTypeConfigWooCommerce) + if err := json.Unmarshal(data, &valueSourceTypeConfigWooCommerce); err == nil { + s.typ = "SourceTypeConfigWooCommerce" + s.SourceTypeConfigWooCommerce = valueSourceTypeConfigWooCommerce + return nil + } + valueSourceTypeConfigOura := new(SourceTypeConfigOura) + if err := json.Unmarshal(data, &valueSourceTypeConfigOura); err == nil { + s.typ = "SourceTypeConfigOura" + s.SourceTypeConfigOura = valueSourceTypeConfigOura + return nil + } + valueSourceTypeConfigCommerceLayer := new(SourceTypeConfigCommerceLayer) + if err := json.Unmarshal(data, &valueSourceTypeConfigCommerceLayer); err == nil { + s.typ = "SourceTypeConfigCommerceLayer" + s.SourceTypeConfigCommerceLayer = valueSourceTypeConfigCommerceLayer + return nil + } + valueSourceTypeConfigHubspot := new(SourceTypeConfigHubspot) + if err := json.Unmarshal(data, &valueSourceTypeConfigHubspot); err == nil { + s.typ = "SourceTypeConfigHubspot" + s.SourceTypeConfigHubspot = valueSourceTypeConfigHubspot + return nil + } + valueSourceTypeConfigMailgun := new(SourceTypeConfigMailgun) + if err := json.Unmarshal(data, &valueSourceTypeConfigMailgun); err == nil { + s.typ = "SourceTypeConfigMailgun" + s.SourceTypeConfigMailgun = valueSourceTypeConfigMailgun + return nil + } + valueSourceTypeConfigPersona := new(SourceTypeConfigPersona) + if err := json.Unmarshal(data, &valueSourceTypeConfigPersona); err == nil { + s.typ = "SourceTypeConfigPersona" + s.SourceTypeConfigPersona = valueSourceTypeConfigPersona + return nil + } + valueSourceTypeConfigPipedrive := new(SourceTypeConfigPipedrive) + if err := json.Unmarshal(data, &valueSourceTypeConfigPipedrive); err == nil { + s.typ = "SourceTypeConfigPipedrive" + s.SourceTypeConfigPipedrive = valueSourceTypeConfigPipedrive + return nil + } + valueSourceTypeConfigSendgrid := new(SourceTypeConfigSendgrid) + if err := json.Unmarshal(data, &valueSourceTypeConfigSendgrid); err == nil { + s.typ = "SourceTypeConfigSendgrid" + s.SourceTypeConfigSendgrid = valueSourceTypeConfigSendgrid + return nil + } + valueSourceTypeConfigWorkOs := new(SourceTypeConfigWorkOs) + if err := json.Unmarshal(data, &valueSourceTypeConfigWorkOs); err == nil { + s.typ = "SourceTypeConfigWorkOs" + s.SourceTypeConfigWorkOs = valueSourceTypeConfigWorkOs + return nil + } + valueSourceTypeConfigSynctera := new(SourceTypeConfigSynctera) + if err := json.Unmarshal(data, &valueSourceTypeConfigSynctera); err == nil { + s.typ = "SourceTypeConfigSynctera" + s.SourceTypeConfigSynctera = valueSourceTypeConfigSynctera + return nil + } + valueSourceTypeConfigAwssns := new(SourceTypeConfigAwssns) + if err := json.Unmarshal(data, &valueSourceTypeConfigAwssns); err == nil { + s.typ = "SourceTypeConfigAwssns" + s.SourceTypeConfigAwssns = valueSourceTypeConfigAwssns + return nil + } + valueSourceTypeConfigTwitch := new(SourceTypeConfigTwitch) + if err := json.Unmarshal(data, &valueSourceTypeConfigTwitch); err == nil { + s.typ = "SourceTypeConfigTwitch" + s.SourceTypeConfigTwitch = valueSourceTypeConfigTwitch + return nil + } + valueSourceTypeConfigEnode := new(SourceTypeConfigEnode) + if err := json.Unmarshal(data, &valueSourceTypeConfigEnode); err == nil { + s.typ = "SourceTypeConfigEnode" + s.SourceTypeConfigEnode = valueSourceTypeConfigEnode + return nil + } + valueSourceTypeConfigFavro := new(SourceTypeConfigFavro) + if err := json.Unmarshal(data, &valueSourceTypeConfigFavro); err == nil { + s.typ = "SourceTypeConfigFavro" + s.SourceTypeConfigFavro = valueSourceTypeConfigFavro + return nil + } + valueSourceTypeConfigLinear := new(SourceTypeConfigLinear) + if err := json.Unmarshal(data, &valueSourceTypeConfigLinear); err == nil { + s.typ = "SourceTypeConfigLinear" + s.SourceTypeConfigLinear = valueSourceTypeConfigLinear + return nil + } + valueSourceTypeConfigShopline := new(SourceTypeConfigShopline) + if err := json.Unmarshal(data, &valueSourceTypeConfigShopline); err == nil { + s.typ = "SourceTypeConfigShopline" + s.SourceTypeConfigShopline = valueSourceTypeConfigShopline + return nil + } + valueSourceTypeConfigWix := new(SourceTypeConfigWix) + if err := json.Unmarshal(data, &valueSourceTypeConfigWix); err == nil { + s.typ = "SourceTypeConfigWix" + s.SourceTypeConfigWix = valueSourceTypeConfigWix + return nil + } + valueSourceTypeConfigNmiPaymentGateway := new(SourceTypeConfigNmiPaymentGateway) + if err := json.Unmarshal(data, &valueSourceTypeConfigNmiPaymentGateway); err == nil { + s.typ = "SourceTypeConfigNmiPaymentGateway" + s.SourceTypeConfigNmiPaymentGateway = valueSourceTypeConfigNmiPaymentGateway + return nil + } + valueSourceTypeConfigOrb := new(SourceTypeConfigOrb) + if err := json.Unmarshal(data, &valueSourceTypeConfigOrb); err == nil { + s.typ = "SourceTypeConfigOrb" + s.SourceTypeConfigOrb = valueSourceTypeConfigOrb + return nil + } + valueSourceTypeConfigPylon := new(SourceTypeConfigPylon) + if err := json.Unmarshal(data, &valueSourceTypeConfigPylon); err == nil { + s.typ = "SourceTypeConfigPylon" + s.SourceTypeConfigPylon = valueSourceTypeConfigPylon + return nil + } + valueSourceTypeConfigRazorpay := new(SourceTypeConfigRazorpay) + if err := json.Unmarshal(data, &valueSourceTypeConfigRazorpay); err == nil { + s.typ = "SourceTypeConfigRazorpay" + s.SourceTypeConfigRazorpay = valueSourceTypeConfigRazorpay + return nil + } + valueSourceTypeConfigSquare := new(SourceTypeConfigSquare) + if err := json.Unmarshal(data, &valueSourceTypeConfigSquare); err == nil { + s.typ = "SourceTypeConfigSquare" + s.SourceTypeConfigSquare = valueSourceTypeConfigSquare + return nil + } + valueSourceTypeConfigSolidgate := new(SourceTypeConfigSolidgate) + if err := json.Unmarshal(data, &valueSourceTypeConfigSolidgate); err == nil { + s.typ = "SourceTypeConfigSolidgate" + s.SourceTypeConfigSolidgate = valueSourceTypeConfigSolidgate + return nil + } + valueSourceTypeConfigTrello := new(SourceTypeConfigTrello) + if err := json.Unmarshal(data, &valueSourceTypeConfigTrello); err == nil { + s.typ = "SourceTypeConfigTrello" + s.SourceTypeConfigTrello = valueSourceTypeConfigTrello + return nil + } + valueSourceTypeConfigEbay := new(SourceTypeConfigEbay) + if err := json.Unmarshal(data, &valueSourceTypeConfigEbay); err == nil { + s.typ = "SourceTypeConfigEbay" + s.SourceTypeConfigEbay = valueSourceTypeConfigEbay + return nil + } + valueSourceTypeConfigTelnyx := new(SourceTypeConfigTelnyx) + if err := json.Unmarshal(data, &valueSourceTypeConfigTelnyx); err == nil { + s.typ = "SourceTypeConfigTelnyx" + s.SourceTypeConfigTelnyx = valueSourceTypeConfigTelnyx + return nil + } + valueSourceTypeConfigDiscord := new(SourceTypeConfigDiscord) + if err := json.Unmarshal(data, &valueSourceTypeConfigDiscord); err == nil { + s.typ = "SourceTypeConfigDiscord" + s.SourceTypeConfigDiscord = valueSourceTypeConfigDiscord + return nil + } + valueSourceTypeConfigTokenIo := new(SourceTypeConfigTokenIo) + if err := json.Unmarshal(data, &valueSourceTypeConfigTokenIo); err == nil { + s.typ = "SourceTypeConfigTokenIo" + s.SourceTypeConfigTokenIo = valueSourceTypeConfigTokenIo + return nil + } + valueSourceTypeConfigFiserv := new(SourceTypeConfigFiserv) + if err := json.Unmarshal(data, &valueSourceTypeConfigFiserv); err == nil { + s.typ = "SourceTypeConfigFiserv" + s.SourceTypeConfigFiserv = valueSourceTypeConfigFiserv + return nil + } + valueSourceTypeConfigBondsmith := new(SourceTypeConfigBondsmith) + if err := json.Unmarshal(data, &valueSourceTypeConfigBondsmith); err == nil { + s.typ = "SourceTypeConfigBondsmith" + s.SourceTypeConfigBondsmith = valueSourceTypeConfigBondsmith + return nil + } + valueSourceTypeConfigVercelLogDrains := new(SourceTypeConfigVercelLogDrains) + if err := json.Unmarshal(data, &valueSourceTypeConfigVercelLogDrains); err == nil { + s.typ = "SourceTypeConfigVercelLogDrains" + s.SourceTypeConfigVercelLogDrains = valueSourceTypeConfigVercelLogDrains + return nil + } + valueSourceTypeConfigVercelWebhooks := new(SourceTypeConfigVercelWebhooks) + if err := json.Unmarshal(data, &valueSourceTypeConfigVercelWebhooks); err == nil { + s.typ = "SourceTypeConfigVercelWebhooks" + s.SourceTypeConfigVercelWebhooks = valueSourceTypeConfigVercelWebhooks + return nil + } + valueSourceTypeConfigSlack := new(SourceTypeConfigSlack) + if err := json.Unmarshal(data, &valueSourceTypeConfigSlack); err == nil { + s.typ = "SourceTypeConfigSlack" + s.SourceTypeConfigSlack = valueSourceTypeConfigSlack + return nil + } + valueSourceTypeConfigMailchimp := new(SourceTypeConfigMailchimp) + if err := json.Unmarshal(data, &valueSourceTypeConfigMailchimp); err == nil { + s.typ = "SourceTypeConfigMailchimp" + s.SourceTypeConfigMailchimp = valueSourceTypeConfigMailchimp + return nil + } + valueSourceTypeConfigPaddle := new(SourceTypeConfigPaddle) + if err := json.Unmarshal(data, &valueSourceTypeConfigPaddle); err == nil { + s.typ = "SourceTypeConfigPaddle" + s.SourceTypeConfigPaddle = valueSourceTypeConfigPaddle + return nil + } + valueSourceTypeConfigPaypal := new(SourceTypeConfigPaypal) + if err := json.Unmarshal(data, &valueSourceTypeConfigPaypal); err == nil { + s.typ = "SourceTypeConfigPaypal" + s.SourceTypeConfigPaypal = valueSourceTypeConfigPaypal + return nil + } + valueSourceTypeConfigTreezor := new(SourceTypeConfigTreezor) + if err := json.Unmarshal(data, &valueSourceTypeConfigTreezor); err == nil { + s.typ = "SourceTypeConfigTreezor" + s.SourceTypeConfigTreezor = valueSourceTypeConfigTreezor + return nil + } + valueSourceTypeConfigPraxis := new(SourceTypeConfigPraxis) + if err := json.Unmarshal(data, &valueSourceTypeConfigPraxis); err == nil { + s.typ = "SourceTypeConfigPraxis" + s.SourceTypeConfigPraxis = valueSourceTypeConfigPraxis + return nil + } + valueSourceTypeConfigCustomerIo := new(SourceTypeConfigCustomerIo) + if err := json.Unmarshal(data, &valueSourceTypeConfigCustomerIo); err == nil { + s.typ = "SourceTypeConfigCustomerIo" + s.SourceTypeConfigCustomerIo = valueSourceTypeConfigCustomerIo + return nil + } + valueSourceTypeConfigFacebook := new(SourceTypeConfigFacebook) + if err := json.Unmarshal(data, &valueSourceTypeConfigFacebook); err == nil { + s.typ = "SourceTypeConfigFacebook" + s.SourceTypeConfigFacebook = valueSourceTypeConfigFacebook + return nil + } + valueSourceTypeConfigWhatsApp := new(SourceTypeConfigWhatsApp) + if err := json.Unmarshal(data, &valueSourceTypeConfigWhatsApp); err == nil { + s.typ = "SourceTypeConfigWhatsApp" + s.SourceTypeConfigWhatsApp = valueSourceTypeConfigWhatsApp + return nil + } + valueSourceTypeConfigUpollo := new(SourceTypeConfigUpollo) + if err := json.Unmarshal(data, &valueSourceTypeConfigUpollo); err == nil { + s.typ = "SourceTypeConfigUpollo" + s.SourceTypeConfigUpollo = valueSourceTypeConfigUpollo + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SourceTypeConfig) MarshalJSON() ([]byte, error) { + if s.typ == "SourceTypeConfigHmac" || s.SourceTypeConfigHmac != nil { + return json.Marshal(s.SourceTypeConfigHmac) + } + if s.typ == "SourceTypeConfigBasicAuth" || s.SourceTypeConfigBasicAuth != nil { + return json.Marshal(s.SourceTypeConfigBasicAuth) + } + if s.typ == "SourceTypeConfigApiKey" || s.SourceTypeConfigApiKey != nil { + return json.Marshal(s.SourceTypeConfigApiKey) + } + if s.typ == "SourceTypeConfigWebhook" || s.SourceTypeConfigWebhook != nil { + return json.Marshal(s.SourceTypeConfigWebhook) + } + if s.typ == "SourceTypeConfigHttp" || s.SourceTypeConfigHttp != nil { + return json.Marshal(s.SourceTypeConfigHttp) + } + if s.typ == "SourceTypeConfigSanity" || s.SourceTypeConfigSanity != nil { + return json.Marshal(s.SourceTypeConfigSanity) + } + if s.typ == "SourceTypeConfigBridge" || s.SourceTypeConfigBridge != nil { + return json.Marshal(s.SourceTypeConfigBridge) + } + if s.typ == "SourceTypeConfigCloudSignal" || s.SourceTypeConfigCloudSignal != nil { + return json.Marshal(s.SourceTypeConfigCloudSignal) + } + if s.typ == "SourceTypeConfigCourier" || s.SourceTypeConfigCourier != nil { + return json.Marshal(s.SourceTypeConfigCourier) + } + if s.typ == "SourceTypeConfigFrontApp" || s.SourceTypeConfigFrontApp != nil { + return json.Marshal(s.SourceTypeConfigFrontApp) + } + if s.typ == "SourceTypeConfigZoom" || s.SourceTypeConfigZoom != nil { + return json.Marshal(s.SourceTypeConfigZoom) + } + if s.typ == "SourceTypeConfigTwitter" || s.SourceTypeConfigTwitter != nil { + return json.Marshal(s.SourceTypeConfigTwitter) + } + if s.typ == "SourceTypeConfigStripe" || s.SourceTypeConfigStripe != nil { + return json.Marshal(s.SourceTypeConfigStripe) + } + if s.typ == "SourceTypeConfigPropertyFinder" || s.SourceTypeConfigPropertyFinder != nil { + return json.Marshal(s.SourceTypeConfigPropertyFinder) + } + if s.typ == "SourceTypeConfigShopify" || s.SourceTypeConfigShopify != nil { + return json.Marshal(s.SourceTypeConfigShopify) + } + if s.typ == "SourceTypeConfigTwilio" || s.SourceTypeConfigTwilio != nil { + return json.Marshal(s.SourceTypeConfigTwilio) + } + if s.typ == "SourceTypeConfigGitHub" || s.SourceTypeConfigGitHub != nil { + return json.Marshal(s.SourceTypeConfigGitHub) + } + if s.typ == "SourceTypeConfigPostmark" || s.SourceTypeConfigPostmark != nil { + return json.Marshal(s.SourceTypeConfigPostmark) + } + if s.typ == "SourceTypeConfigTypeform" || s.SourceTypeConfigTypeform != nil { + return json.Marshal(s.SourceTypeConfigTypeform) + } + if s.typ == "SourceTypeConfigXero" || s.SourceTypeConfigXero != nil { + return json.Marshal(s.SourceTypeConfigXero) + } + if s.typ == "SourceTypeConfigSvix" || s.SourceTypeConfigSvix != nil { + return json.Marshal(s.SourceTypeConfigSvix) + } + if s.typ == "SourceTypeConfigAdyen" || s.SourceTypeConfigAdyen != nil { + return json.Marshal(s.SourceTypeConfigAdyen) + } + if s.typ == "SourceTypeConfigAkeneo" || s.SourceTypeConfigAkeneo != nil { + return json.Marshal(s.SourceTypeConfigAkeneo) + } + if s.typ == "SourceTypeConfigGitLab" || s.SourceTypeConfigGitLab != nil { + return json.Marshal(s.SourceTypeConfigGitLab) + } + if s.typ == "SourceTypeConfigWooCommerce" || s.SourceTypeConfigWooCommerce != nil { + return json.Marshal(s.SourceTypeConfigWooCommerce) + } + if s.typ == "SourceTypeConfigOura" || s.SourceTypeConfigOura != nil { + return json.Marshal(s.SourceTypeConfigOura) + } + if s.typ == "SourceTypeConfigCommerceLayer" || s.SourceTypeConfigCommerceLayer != nil { + return json.Marshal(s.SourceTypeConfigCommerceLayer) + } + if s.typ == "SourceTypeConfigHubspot" || s.SourceTypeConfigHubspot != nil { + return json.Marshal(s.SourceTypeConfigHubspot) + } + if s.typ == "SourceTypeConfigMailgun" || s.SourceTypeConfigMailgun != nil { + return json.Marshal(s.SourceTypeConfigMailgun) + } + if s.typ == "SourceTypeConfigPersona" || s.SourceTypeConfigPersona != nil { + return json.Marshal(s.SourceTypeConfigPersona) + } + if s.typ == "SourceTypeConfigPipedrive" || s.SourceTypeConfigPipedrive != nil { + return json.Marshal(s.SourceTypeConfigPipedrive) + } + if s.typ == "SourceTypeConfigSendgrid" || s.SourceTypeConfigSendgrid != nil { + return json.Marshal(s.SourceTypeConfigSendgrid) + } + if s.typ == "SourceTypeConfigWorkOs" || s.SourceTypeConfigWorkOs != nil { + return json.Marshal(s.SourceTypeConfigWorkOs) + } + if s.typ == "SourceTypeConfigSynctera" || s.SourceTypeConfigSynctera != nil { + return json.Marshal(s.SourceTypeConfigSynctera) + } + if s.typ == "SourceTypeConfigAwssns" || s.SourceTypeConfigAwssns != nil { + return json.Marshal(s.SourceTypeConfigAwssns) + } + if s.typ == "SourceTypeConfigTwitch" || s.SourceTypeConfigTwitch != nil { + return json.Marshal(s.SourceTypeConfigTwitch) + } + if s.typ == "SourceTypeConfigEnode" || s.SourceTypeConfigEnode != nil { + return json.Marshal(s.SourceTypeConfigEnode) + } + if s.typ == "SourceTypeConfigFavro" || s.SourceTypeConfigFavro != nil { + return json.Marshal(s.SourceTypeConfigFavro) + } + if s.typ == "SourceTypeConfigLinear" || s.SourceTypeConfigLinear != nil { + return json.Marshal(s.SourceTypeConfigLinear) + } + if s.typ == "SourceTypeConfigShopline" || s.SourceTypeConfigShopline != nil { + return json.Marshal(s.SourceTypeConfigShopline) + } + if s.typ == "SourceTypeConfigWix" || s.SourceTypeConfigWix != nil { + return json.Marshal(s.SourceTypeConfigWix) + } + if s.typ == "SourceTypeConfigNmiPaymentGateway" || s.SourceTypeConfigNmiPaymentGateway != nil { + return json.Marshal(s.SourceTypeConfigNmiPaymentGateway) + } + if s.typ == "SourceTypeConfigOrb" || s.SourceTypeConfigOrb != nil { + return json.Marshal(s.SourceTypeConfigOrb) + } + if s.typ == "SourceTypeConfigPylon" || s.SourceTypeConfigPylon != nil { + return json.Marshal(s.SourceTypeConfigPylon) + } + if s.typ == "SourceTypeConfigRazorpay" || s.SourceTypeConfigRazorpay != nil { + return json.Marshal(s.SourceTypeConfigRazorpay) + } + if s.typ == "SourceTypeConfigSquare" || s.SourceTypeConfigSquare != nil { + return json.Marshal(s.SourceTypeConfigSquare) + } + if s.typ == "SourceTypeConfigSolidgate" || s.SourceTypeConfigSolidgate != nil { + return json.Marshal(s.SourceTypeConfigSolidgate) + } + if s.typ == "SourceTypeConfigTrello" || s.SourceTypeConfigTrello != nil { + return json.Marshal(s.SourceTypeConfigTrello) + } + if s.typ == "SourceTypeConfigEbay" || s.SourceTypeConfigEbay != nil { + return json.Marshal(s.SourceTypeConfigEbay) + } + if s.typ == "SourceTypeConfigTelnyx" || s.SourceTypeConfigTelnyx != nil { + return json.Marshal(s.SourceTypeConfigTelnyx) + } + if s.typ == "SourceTypeConfigDiscord" || s.SourceTypeConfigDiscord != nil { + return json.Marshal(s.SourceTypeConfigDiscord) + } + if s.typ == "SourceTypeConfigTokenIo" || s.SourceTypeConfigTokenIo != nil { + return json.Marshal(s.SourceTypeConfigTokenIo) + } + if s.typ == "SourceTypeConfigFiserv" || s.SourceTypeConfigFiserv != nil { + return json.Marshal(s.SourceTypeConfigFiserv) + } + if s.typ == "SourceTypeConfigBondsmith" || s.SourceTypeConfigBondsmith != nil { + return json.Marshal(s.SourceTypeConfigBondsmith) + } + if s.typ == "SourceTypeConfigVercelLogDrains" || s.SourceTypeConfigVercelLogDrains != nil { + return json.Marshal(s.SourceTypeConfigVercelLogDrains) + } + if s.typ == "SourceTypeConfigVercelWebhooks" || s.SourceTypeConfigVercelWebhooks != nil { + return json.Marshal(s.SourceTypeConfigVercelWebhooks) + } + if s.typ == "SourceTypeConfigSlack" || s.SourceTypeConfigSlack != nil { + return json.Marshal(s.SourceTypeConfigSlack) + } + if s.typ == "SourceTypeConfigMailchimp" || s.SourceTypeConfigMailchimp != nil { + return json.Marshal(s.SourceTypeConfigMailchimp) + } + if s.typ == "SourceTypeConfigPaddle" || s.SourceTypeConfigPaddle != nil { + return json.Marshal(s.SourceTypeConfigPaddle) + } + if s.typ == "SourceTypeConfigPaypal" || s.SourceTypeConfigPaypal != nil { + return json.Marshal(s.SourceTypeConfigPaypal) + } + if s.typ == "SourceTypeConfigTreezor" || s.SourceTypeConfigTreezor != nil { + return json.Marshal(s.SourceTypeConfigTreezor) + } + if s.typ == "SourceTypeConfigPraxis" || s.SourceTypeConfigPraxis != nil { + return json.Marshal(s.SourceTypeConfigPraxis) + } + if s.typ == "SourceTypeConfigCustomerIo" || s.SourceTypeConfigCustomerIo != nil { + return json.Marshal(s.SourceTypeConfigCustomerIo) + } + if s.typ == "SourceTypeConfigFacebook" || s.SourceTypeConfigFacebook != nil { + return json.Marshal(s.SourceTypeConfigFacebook) + } + if s.typ == "SourceTypeConfigWhatsApp" || s.SourceTypeConfigWhatsApp != nil { + return json.Marshal(s.SourceTypeConfigWhatsApp) + } + if s.typ == "SourceTypeConfigUpollo" || s.SourceTypeConfigUpollo != nil { + return json.Marshal(s.SourceTypeConfigUpollo) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SourceTypeConfigVisitor interface { + VisitSourceTypeConfigHmac(*SourceTypeConfigHmac) error + VisitSourceTypeConfigBasicAuth(*SourceTypeConfigBasicAuth) error + VisitSourceTypeConfigApiKey(*SourceTypeConfigApiKey) error + VisitSourceTypeConfigWebhook(*SourceTypeConfigWebhook) error + VisitSourceTypeConfigHttp(*SourceTypeConfigHttp) error + VisitSourceTypeConfigSanity(*SourceTypeConfigSanity) error + VisitSourceTypeConfigBridge(*SourceTypeConfigBridge) error + VisitSourceTypeConfigCloudSignal(*SourceTypeConfigCloudSignal) error + VisitSourceTypeConfigCourier(*SourceTypeConfigCourier) error + VisitSourceTypeConfigFrontApp(*SourceTypeConfigFrontApp) error + VisitSourceTypeConfigZoom(*SourceTypeConfigZoom) error + VisitSourceTypeConfigTwitter(*SourceTypeConfigTwitter) error + VisitSourceTypeConfigStripe(*SourceTypeConfigStripe) error + VisitSourceTypeConfigPropertyFinder(*SourceTypeConfigPropertyFinder) error + VisitSourceTypeConfigShopify(*SourceTypeConfigShopify) error + VisitSourceTypeConfigTwilio(*SourceTypeConfigTwilio) error + VisitSourceTypeConfigGitHub(*SourceTypeConfigGitHub) error + VisitSourceTypeConfigPostmark(*SourceTypeConfigPostmark) error + VisitSourceTypeConfigTypeform(*SourceTypeConfigTypeform) error + VisitSourceTypeConfigXero(*SourceTypeConfigXero) error + VisitSourceTypeConfigSvix(*SourceTypeConfigSvix) error + VisitSourceTypeConfigAdyen(*SourceTypeConfigAdyen) error + VisitSourceTypeConfigAkeneo(*SourceTypeConfigAkeneo) error + VisitSourceTypeConfigGitLab(*SourceTypeConfigGitLab) error + VisitSourceTypeConfigWooCommerce(*SourceTypeConfigWooCommerce) error + VisitSourceTypeConfigOura(*SourceTypeConfigOura) error + VisitSourceTypeConfigCommerceLayer(*SourceTypeConfigCommerceLayer) error + VisitSourceTypeConfigHubspot(*SourceTypeConfigHubspot) error + VisitSourceTypeConfigMailgun(*SourceTypeConfigMailgun) error + VisitSourceTypeConfigPersona(*SourceTypeConfigPersona) error + VisitSourceTypeConfigPipedrive(*SourceTypeConfigPipedrive) error + VisitSourceTypeConfigSendgrid(*SourceTypeConfigSendgrid) error + VisitSourceTypeConfigWorkOs(*SourceTypeConfigWorkOs) error + VisitSourceTypeConfigSynctera(*SourceTypeConfigSynctera) error + VisitSourceTypeConfigAwssns(*SourceTypeConfigAwssns) error + VisitSourceTypeConfigTwitch(*SourceTypeConfigTwitch) error + VisitSourceTypeConfigEnode(*SourceTypeConfigEnode) error + VisitSourceTypeConfigFavro(*SourceTypeConfigFavro) error + VisitSourceTypeConfigLinear(*SourceTypeConfigLinear) error + VisitSourceTypeConfigShopline(*SourceTypeConfigShopline) error + VisitSourceTypeConfigWix(*SourceTypeConfigWix) error + VisitSourceTypeConfigNmiPaymentGateway(*SourceTypeConfigNmiPaymentGateway) error + VisitSourceTypeConfigOrb(*SourceTypeConfigOrb) error + VisitSourceTypeConfigPylon(*SourceTypeConfigPylon) error + VisitSourceTypeConfigRazorpay(*SourceTypeConfigRazorpay) error + VisitSourceTypeConfigSquare(*SourceTypeConfigSquare) error + VisitSourceTypeConfigSolidgate(*SourceTypeConfigSolidgate) error + VisitSourceTypeConfigTrello(*SourceTypeConfigTrello) error + VisitSourceTypeConfigEbay(*SourceTypeConfigEbay) error + VisitSourceTypeConfigTelnyx(*SourceTypeConfigTelnyx) error + VisitSourceTypeConfigDiscord(*SourceTypeConfigDiscord) error + VisitSourceTypeConfigTokenIo(*SourceTypeConfigTokenIo) error + VisitSourceTypeConfigFiserv(*SourceTypeConfigFiserv) error + VisitSourceTypeConfigBondsmith(*SourceTypeConfigBondsmith) error + VisitSourceTypeConfigVercelLogDrains(*SourceTypeConfigVercelLogDrains) error + VisitSourceTypeConfigVercelWebhooks(*SourceTypeConfigVercelWebhooks) error + VisitSourceTypeConfigSlack(*SourceTypeConfigSlack) error + VisitSourceTypeConfigMailchimp(*SourceTypeConfigMailchimp) error + VisitSourceTypeConfigPaddle(*SourceTypeConfigPaddle) error + VisitSourceTypeConfigPaypal(*SourceTypeConfigPaypal) error + VisitSourceTypeConfigTreezor(*SourceTypeConfigTreezor) error + VisitSourceTypeConfigPraxis(*SourceTypeConfigPraxis) error + VisitSourceTypeConfigCustomerIo(*SourceTypeConfigCustomerIo) error + VisitSourceTypeConfigFacebook(*SourceTypeConfigFacebook) error + VisitSourceTypeConfigWhatsApp(*SourceTypeConfigWhatsApp) error + VisitSourceTypeConfigUpollo(*SourceTypeConfigUpollo) error +} + +func (s *SourceTypeConfig) Accept(visitor SourceTypeConfigVisitor) error { + if s.typ == "SourceTypeConfigHmac" || s.SourceTypeConfigHmac != nil { + return visitor.VisitSourceTypeConfigHmac(s.SourceTypeConfigHmac) + } + if s.typ == "SourceTypeConfigBasicAuth" || s.SourceTypeConfigBasicAuth != nil { + return visitor.VisitSourceTypeConfigBasicAuth(s.SourceTypeConfigBasicAuth) + } + if s.typ == "SourceTypeConfigApiKey" || s.SourceTypeConfigApiKey != nil { + return visitor.VisitSourceTypeConfigApiKey(s.SourceTypeConfigApiKey) + } + if s.typ == "SourceTypeConfigWebhook" || s.SourceTypeConfigWebhook != nil { + return visitor.VisitSourceTypeConfigWebhook(s.SourceTypeConfigWebhook) + } + if s.typ == "SourceTypeConfigHttp" || s.SourceTypeConfigHttp != nil { + return visitor.VisitSourceTypeConfigHttp(s.SourceTypeConfigHttp) + } + if s.typ == "SourceTypeConfigSanity" || s.SourceTypeConfigSanity != nil { + return visitor.VisitSourceTypeConfigSanity(s.SourceTypeConfigSanity) + } + if s.typ == "SourceTypeConfigBridge" || s.SourceTypeConfigBridge != nil { + return visitor.VisitSourceTypeConfigBridge(s.SourceTypeConfigBridge) + } + if s.typ == "SourceTypeConfigCloudSignal" || s.SourceTypeConfigCloudSignal != nil { + return visitor.VisitSourceTypeConfigCloudSignal(s.SourceTypeConfigCloudSignal) + } + if s.typ == "SourceTypeConfigCourier" || s.SourceTypeConfigCourier != nil { + return visitor.VisitSourceTypeConfigCourier(s.SourceTypeConfigCourier) + } + if s.typ == "SourceTypeConfigFrontApp" || s.SourceTypeConfigFrontApp != nil { + return visitor.VisitSourceTypeConfigFrontApp(s.SourceTypeConfigFrontApp) + } + if s.typ == "SourceTypeConfigZoom" || s.SourceTypeConfigZoom != nil { + return visitor.VisitSourceTypeConfigZoom(s.SourceTypeConfigZoom) + } + if s.typ == "SourceTypeConfigTwitter" || s.SourceTypeConfigTwitter != nil { + return visitor.VisitSourceTypeConfigTwitter(s.SourceTypeConfigTwitter) + } + if s.typ == "SourceTypeConfigStripe" || s.SourceTypeConfigStripe != nil { + return visitor.VisitSourceTypeConfigStripe(s.SourceTypeConfigStripe) + } + if s.typ == "SourceTypeConfigPropertyFinder" || s.SourceTypeConfigPropertyFinder != nil { + return visitor.VisitSourceTypeConfigPropertyFinder(s.SourceTypeConfigPropertyFinder) + } + if s.typ == "SourceTypeConfigShopify" || s.SourceTypeConfigShopify != nil { + return visitor.VisitSourceTypeConfigShopify(s.SourceTypeConfigShopify) + } + if s.typ == "SourceTypeConfigTwilio" || s.SourceTypeConfigTwilio != nil { + return visitor.VisitSourceTypeConfigTwilio(s.SourceTypeConfigTwilio) + } + if s.typ == "SourceTypeConfigGitHub" || s.SourceTypeConfigGitHub != nil { + return visitor.VisitSourceTypeConfigGitHub(s.SourceTypeConfigGitHub) + } + if s.typ == "SourceTypeConfigPostmark" || s.SourceTypeConfigPostmark != nil { + return visitor.VisitSourceTypeConfigPostmark(s.SourceTypeConfigPostmark) + } + if s.typ == "SourceTypeConfigTypeform" || s.SourceTypeConfigTypeform != nil { + return visitor.VisitSourceTypeConfigTypeform(s.SourceTypeConfigTypeform) + } + if s.typ == "SourceTypeConfigXero" || s.SourceTypeConfigXero != nil { + return visitor.VisitSourceTypeConfigXero(s.SourceTypeConfigXero) + } + if s.typ == "SourceTypeConfigSvix" || s.SourceTypeConfigSvix != nil { + return visitor.VisitSourceTypeConfigSvix(s.SourceTypeConfigSvix) + } + if s.typ == "SourceTypeConfigAdyen" || s.SourceTypeConfigAdyen != nil { + return visitor.VisitSourceTypeConfigAdyen(s.SourceTypeConfigAdyen) + } + if s.typ == "SourceTypeConfigAkeneo" || s.SourceTypeConfigAkeneo != nil { + return visitor.VisitSourceTypeConfigAkeneo(s.SourceTypeConfigAkeneo) + } + if s.typ == "SourceTypeConfigGitLab" || s.SourceTypeConfigGitLab != nil { + return visitor.VisitSourceTypeConfigGitLab(s.SourceTypeConfigGitLab) + } + if s.typ == "SourceTypeConfigWooCommerce" || s.SourceTypeConfigWooCommerce != nil { + return visitor.VisitSourceTypeConfigWooCommerce(s.SourceTypeConfigWooCommerce) + } + if s.typ == "SourceTypeConfigOura" || s.SourceTypeConfigOura != nil { + return visitor.VisitSourceTypeConfigOura(s.SourceTypeConfigOura) + } + if s.typ == "SourceTypeConfigCommerceLayer" || s.SourceTypeConfigCommerceLayer != nil { + return visitor.VisitSourceTypeConfigCommerceLayer(s.SourceTypeConfigCommerceLayer) + } + if s.typ == "SourceTypeConfigHubspot" || s.SourceTypeConfigHubspot != nil { + return visitor.VisitSourceTypeConfigHubspot(s.SourceTypeConfigHubspot) + } + if s.typ == "SourceTypeConfigMailgun" || s.SourceTypeConfigMailgun != nil { + return visitor.VisitSourceTypeConfigMailgun(s.SourceTypeConfigMailgun) + } + if s.typ == "SourceTypeConfigPersona" || s.SourceTypeConfigPersona != nil { + return visitor.VisitSourceTypeConfigPersona(s.SourceTypeConfigPersona) + } + if s.typ == "SourceTypeConfigPipedrive" || s.SourceTypeConfigPipedrive != nil { + return visitor.VisitSourceTypeConfigPipedrive(s.SourceTypeConfigPipedrive) + } + if s.typ == "SourceTypeConfigSendgrid" || s.SourceTypeConfigSendgrid != nil { + return visitor.VisitSourceTypeConfigSendgrid(s.SourceTypeConfigSendgrid) + } + if s.typ == "SourceTypeConfigWorkOs" || s.SourceTypeConfigWorkOs != nil { + return visitor.VisitSourceTypeConfigWorkOs(s.SourceTypeConfigWorkOs) + } + if s.typ == "SourceTypeConfigSynctera" || s.SourceTypeConfigSynctera != nil { + return visitor.VisitSourceTypeConfigSynctera(s.SourceTypeConfigSynctera) + } + if s.typ == "SourceTypeConfigAwssns" || s.SourceTypeConfigAwssns != nil { + return visitor.VisitSourceTypeConfigAwssns(s.SourceTypeConfigAwssns) + } + if s.typ == "SourceTypeConfigTwitch" || s.SourceTypeConfigTwitch != nil { + return visitor.VisitSourceTypeConfigTwitch(s.SourceTypeConfigTwitch) + } + if s.typ == "SourceTypeConfigEnode" || s.SourceTypeConfigEnode != nil { + return visitor.VisitSourceTypeConfigEnode(s.SourceTypeConfigEnode) + } + if s.typ == "SourceTypeConfigFavro" || s.SourceTypeConfigFavro != nil { + return visitor.VisitSourceTypeConfigFavro(s.SourceTypeConfigFavro) + } + if s.typ == "SourceTypeConfigLinear" || s.SourceTypeConfigLinear != nil { + return visitor.VisitSourceTypeConfigLinear(s.SourceTypeConfigLinear) + } + if s.typ == "SourceTypeConfigShopline" || s.SourceTypeConfigShopline != nil { + return visitor.VisitSourceTypeConfigShopline(s.SourceTypeConfigShopline) + } + if s.typ == "SourceTypeConfigWix" || s.SourceTypeConfigWix != nil { + return visitor.VisitSourceTypeConfigWix(s.SourceTypeConfigWix) + } + if s.typ == "SourceTypeConfigNmiPaymentGateway" || s.SourceTypeConfigNmiPaymentGateway != nil { + return visitor.VisitSourceTypeConfigNmiPaymentGateway(s.SourceTypeConfigNmiPaymentGateway) + } + if s.typ == "SourceTypeConfigOrb" || s.SourceTypeConfigOrb != nil { + return visitor.VisitSourceTypeConfigOrb(s.SourceTypeConfigOrb) + } + if s.typ == "SourceTypeConfigPylon" || s.SourceTypeConfigPylon != nil { + return visitor.VisitSourceTypeConfigPylon(s.SourceTypeConfigPylon) + } + if s.typ == "SourceTypeConfigRazorpay" || s.SourceTypeConfigRazorpay != nil { + return visitor.VisitSourceTypeConfigRazorpay(s.SourceTypeConfigRazorpay) + } + if s.typ == "SourceTypeConfigSquare" || s.SourceTypeConfigSquare != nil { + return visitor.VisitSourceTypeConfigSquare(s.SourceTypeConfigSquare) + } + if s.typ == "SourceTypeConfigSolidgate" || s.SourceTypeConfigSolidgate != nil { + return visitor.VisitSourceTypeConfigSolidgate(s.SourceTypeConfigSolidgate) + } + if s.typ == "SourceTypeConfigTrello" || s.SourceTypeConfigTrello != nil { + return visitor.VisitSourceTypeConfigTrello(s.SourceTypeConfigTrello) + } + if s.typ == "SourceTypeConfigEbay" || s.SourceTypeConfigEbay != nil { + return visitor.VisitSourceTypeConfigEbay(s.SourceTypeConfigEbay) + } + if s.typ == "SourceTypeConfigTelnyx" || s.SourceTypeConfigTelnyx != nil { + return visitor.VisitSourceTypeConfigTelnyx(s.SourceTypeConfigTelnyx) + } + if s.typ == "SourceTypeConfigDiscord" || s.SourceTypeConfigDiscord != nil { + return visitor.VisitSourceTypeConfigDiscord(s.SourceTypeConfigDiscord) + } + if s.typ == "SourceTypeConfigTokenIo" || s.SourceTypeConfigTokenIo != nil { + return visitor.VisitSourceTypeConfigTokenIo(s.SourceTypeConfigTokenIo) + } + if s.typ == "SourceTypeConfigFiserv" || s.SourceTypeConfigFiserv != nil { + return visitor.VisitSourceTypeConfigFiserv(s.SourceTypeConfigFiserv) + } + if s.typ == "SourceTypeConfigBondsmith" || s.SourceTypeConfigBondsmith != nil { + return visitor.VisitSourceTypeConfigBondsmith(s.SourceTypeConfigBondsmith) + } + if s.typ == "SourceTypeConfigVercelLogDrains" || s.SourceTypeConfigVercelLogDrains != nil { + return visitor.VisitSourceTypeConfigVercelLogDrains(s.SourceTypeConfigVercelLogDrains) + } + if s.typ == "SourceTypeConfigVercelWebhooks" || s.SourceTypeConfigVercelWebhooks != nil { + return visitor.VisitSourceTypeConfigVercelWebhooks(s.SourceTypeConfigVercelWebhooks) + } + if s.typ == "SourceTypeConfigSlack" || s.SourceTypeConfigSlack != nil { + return visitor.VisitSourceTypeConfigSlack(s.SourceTypeConfigSlack) + } + if s.typ == "SourceTypeConfigMailchimp" || s.SourceTypeConfigMailchimp != nil { + return visitor.VisitSourceTypeConfigMailchimp(s.SourceTypeConfigMailchimp) + } + if s.typ == "SourceTypeConfigPaddle" || s.SourceTypeConfigPaddle != nil { + return visitor.VisitSourceTypeConfigPaddle(s.SourceTypeConfigPaddle) + } + if s.typ == "SourceTypeConfigPaypal" || s.SourceTypeConfigPaypal != nil { + return visitor.VisitSourceTypeConfigPaypal(s.SourceTypeConfigPaypal) + } + if s.typ == "SourceTypeConfigTreezor" || s.SourceTypeConfigTreezor != nil { + return visitor.VisitSourceTypeConfigTreezor(s.SourceTypeConfigTreezor) + } + if s.typ == "SourceTypeConfigPraxis" || s.SourceTypeConfigPraxis != nil { + return visitor.VisitSourceTypeConfigPraxis(s.SourceTypeConfigPraxis) + } + if s.typ == "SourceTypeConfigCustomerIo" || s.SourceTypeConfigCustomerIo != nil { + return visitor.VisitSourceTypeConfigCustomerIo(s.SourceTypeConfigCustomerIo) + } + if s.typ == "SourceTypeConfigFacebook" || s.SourceTypeConfigFacebook != nil { + return visitor.VisitSourceTypeConfigFacebook(s.SourceTypeConfigFacebook) + } + if s.typ == "SourceTypeConfigWhatsApp" || s.SourceTypeConfigWhatsApp != nil { + return visitor.VisitSourceTypeConfigWhatsApp(s.SourceTypeConfigWhatsApp) + } + if s.typ == "SourceTypeConfigUpollo" || s.SourceTypeConfigUpollo != nil { + return visitor.VisitSourceTypeConfigUpollo(s.SourceTypeConfigUpollo) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) +} + +// The type config for Adyen. Requires type to be `ADYEN`. +type SourceTypeConfigAdyen struct { + AllowedHttpMethods []SourceTypeConfigAdyenAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigAdyenAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAdyen) GetAllowedHttpMethods() []SourceTypeConfigAdyenAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigAdyen) GetAuth() *SourceTypeConfigAdyenAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigAdyen) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAdyen) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAdyen + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAdyen(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAdyen) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigAdyenAllowedHttpMethodsItem string + +const ( + SourceTypeConfigAdyenAllowedHttpMethodsItemGet SourceTypeConfigAdyenAllowedHttpMethodsItem = "GET" + SourceTypeConfigAdyenAllowedHttpMethodsItemPost SourceTypeConfigAdyenAllowedHttpMethodsItem = "POST" + SourceTypeConfigAdyenAllowedHttpMethodsItemPut SourceTypeConfigAdyenAllowedHttpMethodsItem = "PUT" + SourceTypeConfigAdyenAllowedHttpMethodsItemPatch SourceTypeConfigAdyenAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigAdyenAllowedHttpMethodsItemDelete SourceTypeConfigAdyenAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigAdyenAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigAdyenAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigAdyenAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigAdyenAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigAdyenAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigAdyenAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigAdyenAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigAdyenAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigAdyenAllowedHttpMethodsItem) Ptr() *SourceTypeConfigAdyenAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigAdyenAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAdyenAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigAdyenAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAdyenAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAdyenAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAdyenAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAdyenAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Akeneo. Requires type to be `AKENEO`. +type SourceTypeConfigAkeneo struct { + AllowedHttpMethods []SourceTypeConfigAkeneoAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigAkeneoAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAkeneo) GetAllowedHttpMethods() []SourceTypeConfigAkeneoAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigAkeneo) GetAuth() *SourceTypeConfigAkeneoAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigAkeneo) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAkeneo) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAkeneo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAkeneo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAkeneo) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigAkeneoAllowedHttpMethodsItem string + +const ( + SourceTypeConfigAkeneoAllowedHttpMethodsItemGet SourceTypeConfigAkeneoAllowedHttpMethodsItem = "GET" + SourceTypeConfigAkeneoAllowedHttpMethodsItemPost SourceTypeConfigAkeneoAllowedHttpMethodsItem = "POST" + SourceTypeConfigAkeneoAllowedHttpMethodsItemPut SourceTypeConfigAkeneoAllowedHttpMethodsItem = "PUT" + SourceTypeConfigAkeneoAllowedHttpMethodsItemPatch SourceTypeConfigAkeneoAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigAkeneoAllowedHttpMethodsItemDelete SourceTypeConfigAkeneoAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigAkeneoAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigAkeneoAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigAkeneoAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigAkeneoAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigAkeneoAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigAkeneoAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigAkeneoAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigAkeneoAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigAkeneoAllowedHttpMethodsItem) Ptr() *SourceTypeConfigAkeneoAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigAkeneoAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAkeneoAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigAkeneoAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAkeneoAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAkeneoAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAkeneoAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAkeneoAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for API Key. Requires type to be `API_KEY`. +type SourceTypeConfigApiKey struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + AllowedHttpMethods []SourceTypeConfigApiKeyAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceTypeConfigApiKeyCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + Auth *SourceTypeConfigApiKeyAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigApiKey) GetAllowedHttpMethods() []SourceTypeConfigApiKeyAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigApiKey) GetCustomResponse() *SourceTypeConfigApiKeyCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse +} + +func (s *SourceTypeConfigApiKey) GetAuth() *SourceTypeConfigApiKeyAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigApiKey) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigApiKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigApiKey) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigApiKeyAllowedHttpMethodsItem string + +const ( + SourceTypeConfigApiKeyAllowedHttpMethodsItemGet SourceTypeConfigApiKeyAllowedHttpMethodsItem = "GET" + SourceTypeConfigApiKeyAllowedHttpMethodsItemPost SourceTypeConfigApiKeyAllowedHttpMethodsItem = "POST" + SourceTypeConfigApiKeyAllowedHttpMethodsItemPut SourceTypeConfigApiKeyAllowedHttpMethodsItem = "PUT" + SourceTypeConfigApiKeyAllowedHttpMethodsItemPatch SourceTypeConfigApiKeyAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigApiKeyAllowedHttpMethodsItemDelete SourceTypeConfigApiKeyAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigApiKeyAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigApiKeyAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigApiKeyAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigApiKeyAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigApiKeyAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigApiKeyAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigApiKeyAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigApiKeyAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigApiKeyAllowedHttpMethodsItem) Ptr() *SourceTypeConfigApiKeyAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigApiKeyAuth struct { + HeaderKey string `json:"header_key" url:"header_key"` + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigApiKeyAuth) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigApiKeyAuth) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigApiKeyAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigApiKeyAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigApiKeyAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigApiKeyAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigApiKeyAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigApiKeyCustomResponse struct { + ContentType *SourceTypeConfigApiKeyCustomResponseContentType `json:"content_type,omitempty" url:"content_type,omitempty"` + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigApiKeyCustomResponse) GetContentType() *SourceTypeConfigApiKeyCustomResponseContentType { + if s == nil { + return nil + } + return s.ContentType +} + +func (s *SourceTypeConfigApiKeyCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceTypeConfigApiKeyCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigApiKeyCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigApiKeyCustomResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigApiKeyCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigApiKeyCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigApiKeyCustomResponseContentType string + +const ( + SourceTypeConfigApiKeyCustomResponseContentTypeJson SourceTypeConfigApiKeyCustomResponseContentType = "json" + SourceTypeConfigApiKeyCustomResponseContentTypeText SourceTypeConfigApiKeyCustomResponseContentType = "text" + SourceTypeConfigApiKeyCustomResponseContentTypeXml SourceTypeConfigApiKeyCustomResponseContentType = "xml" +) + +func NewSourceTypeConfigApiKeyCustomResponseContentTypeFromString(s string) (SourceTypeConfigApiKeyCustomResponseContentType, error) { + switch s { + case "json": + return SourceTypeConfigApiKeyCustomResponseContentTypeJson, nil + case "text": + return SourceTypeConfigApiKeyCustomResponseContentTypeText, nil + case "xml": + return SourceTypeConfigApiKeyCustomResponseContentTypeXml, nil + } + var t SourceTypeConfigApiKeyCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigApiKeyCustomResponseContentType) Ptr() *SourceTypeConfigApiKeyCustomResponseContentType { + return &s +} + +// The type config for AWS SNS. Requires type to be `AWS_SNS`. +type SourceTypeConfigAwssns struct { + AllowedHttpMethods []SourceTypeConfigAwssnsAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigAwssnsAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAwssns) GetAllowedHttpMethods() []SourceTypeConfigAwssnsAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigAwssns) GetAuth() *SourceTypeConfigAwssnsAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigAwssns) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAwssns) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAwssns + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAwssns(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAwssns) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigAwssnsAllowedHttpMethodsItem string + +const ( + SourceTypeConfigAwssnsAllowedHttpMethodsItemGet SourceTypeConfigAwssnsAllowedHttpMethodsItem = "GET" + SourceTypeConfigAwssnsAllowedHttpMethodsItemPost SourceTypeConfigAwssnsAllowedHttpMethodsItem = "POST" + SourceTypeConfigAwssnsAllowedHttpMethodsItemPut SourceTypeConfigAwssnsAllowedHttpMethodsItem = "PUT" + SourceTypeConfigAwssnsAllowedHttpMethodsItemPatch SourceTypeConfigAwssnsAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigAwssnsAllowedHttpMethodsItemDelete SourceTypeConfigAwssnsAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigAwssnsAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigAwssnsAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigAwssnsAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigAwssnsAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigAwssnsAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigAwssnsAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigAwssnsAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigAwssnsAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigAwssnsAllowedHttpMethodsItem) Ptr() *SourceTypeConfigAwssnsAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigAwssnsAuth struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigAwssnsAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigAwssnsAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigAwssnsAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigAwssnsAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigAwssnsAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Basic Auth. Requires type to be `BASIC_AUTH`. +type SourceTypeConfigBasicAuth struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + AllowedHttpMethods []SourceTypeConfigBasicAuthAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceTypeConfigBasicAuthCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + Auth *SourceTypeConfigBasicAuthAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBasicAuth) GetAllowedHttpMethods() []SourceTypeConfigBasicAuthAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigBasicAuth) GetCustomResponse() *SourceTypeConfigBasicAuthCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse +} + +func (s *SourceTypeConfigBasicAuth) GetAuth() *SourceTypeConfigBasicAuthAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigBasicAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBasicAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBasicAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBasicAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBasicAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigBasicAuthAllowedHttpMethodsItem string + +const ( + SourceTypeConfigBasicAuthAllowedHttpMethodsItemGet SourceTypeConfigBasicAuthAllowedHttpMethodsItem = "GET" + SourceTypeConfigBasicAuthAllowedHttpMethodsItemPost SourceTypeConfigBasicAuthAllowedHttpMethodsItem = "POST" + SourceTypeConfigBasicAuthAllowedHttpMethodsItemPut SourceTypeConfigBasicAuthAllowedHttpMethodsItem = "PUT" + SourceTypeConfigBasicAuthAllowedHttpMethodsItemPatch SourceTypeConfigBasicAuthAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigBasicAuthAllowedHttpMethodsItemDelete SourceTypeConfigBasicAuthAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigBasicAuthAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigBasicAuthAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigBasicAuthAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigBasicAuthAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigBasicAuthAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigBasicAuthAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigBasicAuthAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigBasicAuthAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigBasicAuthAllowedHttpMethodsItem) Ptr() *SourceTypeConfigBasicAuthAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigBasicAuthAuth struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBasicAuthAuth) GetUsername() *string { + if s == nil { + return nil + } + return s.Username +} + +func (s *SourceTypeConfigBasicAuthAuth) GetPassword() *string { + if s == nil { + return nil + } + return s.Password +} + +func (s *SourceTypeConfigBasicAuthAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBasicAuthAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBasicAuthAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBasicAuthAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBasicAuthAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigBasicAuthCustomResponse struct { + ContentType *SourceTypeConfigBasicAuthCustomResponseContentType `json:"content_type,omitempty" url:"content_type,omitempty"` + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBasicAuthCustomResponse) GetContentType() *SourceTypeConfigBasicAuthCustomResponseContentType { + if s == nil { + return nil + } + return s.ContentType +} + +func (s *SourceTypeConfigBasicAuthCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceTypeConfigBasicAuthCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBasicAuthCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBasicAuthCustomResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBasicAuthCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBasicAuthCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigBasicAuthCustomResponseContentType string + +const ( + SourceTypeConfigBasicAuthCustomResponseContentTypeJson SourceTypeConfigBasicAuthCustomResponseContentType = "json" + SourceTypeConfigBasicAuthCustomResponseContentTypeText SourceTypeConfigBasicAuthCustomResponseContentType = "text" + SourceTypeConfigBasicAuthCustomResponseContentTypeXml SourceTypeConfigBasicAuthCustomResponseContentType = "xml" +) + +func NewSourceTypeConfigBasicAuthCustomResponseContentTypeFromString(s string) (SourceTypeConfigBasicAuthCustomResponseContentType, error) { + switch s { + case "json": + return SourceTypeConfigBasicAuthCustomResponseContentTypeJson, nil + case "text": + return SourceTypeConfigBasicAuthCustomResponseContentTypeText, nil + case "xml": + return SourceTypeConfigBasicAuthCustomResponseContentTypeXml, nil + } + var t SourceTypeConfigBasicAuthCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigBasicAuthCustomResponseContentType) Ptr() *SourceTypeConfigBasicAuthCustomResponseContentType { + return &s +} + +// The type config for Bondsmith. Requires type to be `BONDSMITH`. +type SourceTypeConfigBondsmith struct { + AllowedHttpMethods []SourceTypeConfigBondsmithAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigBondsmithAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBondsmith) GetAllowedHttpMethods() []SourceTypeConfigBondsmithAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigBondsmith) GetAuth() *SourceTypeConfigBondsmithAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigBondsmith) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBondsmith) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBondsmith + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBondsmith(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBondsmith) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigBondsmithAllowedHttpMethodsItem string + +const ( + SourceTypeConfigBondsmithAllowedHttpMethodsItemGet SourceTypeConfigBondsmithAllowedHttpMethodsItem = "GET" + SourceTypeConfigBondsmithAllowedHttpMethodsItemPost SourceTypeConfigBondsmithAllowedHttpMethodsItem = "POST" + SourceTypeConfigBondsmithAllowedHttpMethodsItemPut SourceTypeConfigBondsmithAllowedHttpMethodsItem = "PUT" + SourceTypeConfigBondsmithAllowedHttpMethodsItemPatch SourceTypeConfigBondsmithAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigBondsmithAllowedHttpMethodsItemDelete SourceTypeConfigBondsmithAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigBondsmithAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigBondsmithAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigBondsmithAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigBondsmithAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigBondsmithAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigBondsmithAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigBondsmithAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigBondsmithAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigBondsmithAllowedHttpMethodsItem) Ptr() *SourceTypeConfigBondsmithAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigBondsmithAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBondsmithAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigBondsmithAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBondsmithAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBondsmithAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBondsmithAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBondsmithAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Bridge. Requires type to be `BRIDGE`. +type SourceTypeConfigBridge struct { + AllowedHttpMethods []SourceTypeConfigBridgeAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigBridgeAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBridge) GetAllowedHttpMethods() []SourceTypeConfigBridgeAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigBridge) GetAuth() *SourceTypeConfigBridgeAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigBridge) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBridge) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBridge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBridge(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBridge) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigBridgeAllowedHttpMethodsItem string + +const ( + SourceTypeConfigBridgeAllowedHttpMethodsItemGet SourceTypeConfigBridgeAllowedHttpMethodsItem = "GET" + SourceTypeConfigBridgeAllowedHttpMethodsItemPost SourceTypeConfigBridgeAllowedHttpMethodsItem = "POST" + SourceTypeConfigBridgeAllowedHttpMethodsItemPut SourceTypeConfigBridgeAllowedHttpMethodsItem = "PUT" + SourceTypeConfigBridgeAllowedHttpMethodsItemPatch SourceTypeConfigBridgeAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigBridgeAllowedHttpMethodsItemDelete SourceTypeConfigBridgeAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigBridgeAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigBridgeAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigBridgeAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigBridgeAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigBridgeAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigBridgeAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigBridgeAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigBridgeAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigBridgeAllowedHttpMethodsItem) Ptr() *SourceTypeConfigBridgeAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigBridgeAuth struct { + PublicKey string `json:"public_key" url:"public_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigBridgeAuth) GetPublicKey() string { + if s == nil { + return "" + } + return s.PublicKey +} + +func (s *SourceTypeConfigBridgeAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigBridgeAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigBridgeAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigBridgeAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigBridgeAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Cloud Signal. Requires type to be `CLOUDSIGNAL`. +type SourceTypeConfigCloudSignal struct { + AllowedHttpMethods []SourceTypeConfigCloudSignalAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigCloudSignalAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCloudSignal) GetAllowedHttpMethods() []SourceTypeConfigCloudSignalAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigCloudSignal) GetAuth() *SourceTypeConfigCloudSignalAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigCloudSignal) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCloudSignal) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCloudSignal + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCloudSignal(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCloudSignal) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigCloudSignalAllowedHttpMethodsItem string + +const ( + SourceTypeConfigCloudSignalAllowedHttpMethodsItemGet SourceTypeConfigCloudSignalAllowedHttpMethodsItem = "GET" + SourceTypeConfigCloudSignalAllowedHttpMethodsItemPost SourceTypeConfigCloudSignalAllowedHttpMethodsItem = "POST" + SourceTypeConfigCloudSignalAllowedHttpMethodsItemPut SourceTypeConfigCloudSignalAllowedHttpMethodsItem = "PUT" + SourceTypeConfigCloudSignalAllowedHttpMethodsItemPatch SourceTypeConfigCloudSignalAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigCloudSignalAllowedHttpMethodsItemDelete SourceTypeConfigCloudSignalAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigCloudSignalAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigCloudSignalAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigCloudSignalAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigCloudSignalAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigCloudSignalAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigCloudSignalAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigCloudSignalAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigCloudSignalAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigCloudSignalAllowedHttpMethodsItem) Ptr() *SourceTypeConfigCloudSignalAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigCloudSignalAuth struct { + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCloudSignalAuth) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigCloudSignalAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCloudSignalAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCloudSignalAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCloudSignalAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCloudSignalAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Commerce Layer. Requires type to be `COMMERCELAYER`. +type SourceTypeConfigCommerceLayer struct { + AllowedHttpMethods []SourceTypeConfigCommerceLayerAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigCommerceLayerAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCommerceLayer) GetAllowedHttpMethods() []SourceTypeConfigCommerceLayerAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigCommerceLayer) GetAuth() *SourceTypeConfigCommerceLayerAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigCommerceLayer) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCommerceLayer) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCommerceLayer + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCommerceLayer(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCommerceLayer) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigCommerceLayerAllowedHttpMethodsItem string + +const ( + SourceTypeConfigCommerceLayerAllowedHttpMethodsItemGet SourceTypeConfigCommerceLayerAllowedHttpMethodsItem = "GET" + SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPost SourceTypeConfigCommerceLayerAllowedHttpMethodsItem = "POST" + SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPut SourceTypeConfigCommerceLayerAllowedHttpMethodsItem = "PUT" + SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPatch SourceTypeConfigCommerceLayerAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigCommerceLayerAllowedHttpMethodsItemDelete SourceTypeConfigCommerceLayerAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigCommerceLayerAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigCommerceLayerAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigCommerceLayerAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigCommerceLayerAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigCommerceLayerAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigCommerceLayerAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigCommerceLayerAllowedHttpMethodsItem) Ptr() *SourceTypeConfigCommerceLayerAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigCommerceLayerAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCommerceLayerAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigCommerceLayerAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCommerceLayerAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCommerceLayerAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCommerceLayerAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCommerceLayerAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Courier. Requires type to be `COURIER`. +type SourceTypeConfigCourier struct { + AllowedHttpMethods []SourceTypeConfigCourierAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigCourierAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCourier) GetAllowedHttpMethods() []SourceTypeConfigCourierAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigCourier) GetAuth() *SourceTypeConfigCourierAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigCourier) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCourier) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCourier + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCourier(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCourier) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigCourierAllowedHttpMethodsItem string + +const ( + SourceTypeConfigCourierAllowedHttpMethodsItemGet SourceTypeConfigCourierAllowedHttpMethodsItem = "GET" + SourceTypeConfigCourierAllowedHttpMethodsItemPost SourceTypeConfigCourierAllowedHttpMethodsItem = "POST" + SourceTypeConfigCourierAllowedHttpMethodsItemPut SourceTypeConfigCourierAllowedHttpMethodsItem = "PUT" + SourceTypeConfigCourierAllowedHttpMethodsItemPatch SourceTypeConfigCourierAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigCourierAllowedHttpMethodsItemDelete SourceTypeConfigCourierAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigCourierAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigCourierAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigCourierAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigCourierAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigCourierAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigCourierAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigCourierAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigCourierAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigCourierAllowedHttpMethodsItem) Ptr() *SourceTypeConfigCourierAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigCourierAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCourierAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigCourierAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCourierAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCourierAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCourierAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCourierAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Customer.IO. Requires type to be `CUSTOMERIO`. +type SourceTypeConfigCustomerIo struct { + AllowedHttpMethods []SourceTypeConfigCustomerIoAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigCustomerIoAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCustomerIo) GetAllowedHttpMethods() []SourceTypeConfigCustomerIoAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigCustomerIo) GetAuth() *SourceTypeConfigCustomerIoAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigCustomerIo) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCustomerIo) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCustomerIo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCustomerIo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCustomerIo) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigCustomerIoAllowedHttpMethodsItem string + +const ( + SourceTypeConfigCustomerIoAllowedHttpMethodsItemGet SourceTypeConfigCustomerIoAllowedHttpMethodsItem = "GET" + SourceTypeConfigCustomerIoAllowedHttpMethodsItemPost SourceTypeConfigCustomerIoAllowedHttpMethodsItem = "POST" + SourceTypeConfigCustomerIoAllowedHttpMethodsItemPut SourceTypeConfigCustomerIoAllowedHttpMethodsItem = "PUT" + SourceTypeConfigCustomerIoAllowedHttpMethodsItemPatch SourceTypeConfigCustomerIoAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigCustomerIoAllowedHttpMethodsItemDelete SourceTypeConfigCustomerIoAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigCustomerIoAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigCustomerIoAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigCustomerIoAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigCustomerIoAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigCustomerIoAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigCustomerIoAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigCustomerIoAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigCustomerIoAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigCustomerIoAllowedHttpMethodsItem) Ptr() *SourceTypeConfigCustomerIoAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigCustomerIoAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigCustomerIoAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigCustomerIoAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigCustomerIoAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigCustomerIoAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigCustomerIoAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigCustomerIoAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Discord. Requires type to be `DISCORD`. +type SourceTypeConfigDiscord struct { + AllowedHttpMethods []SourceTypeConfigDiscordAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigDiscordAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigDiscord) GetAllowedHttpMethods() []SourceTypeConfigDiscordAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigDiscord) GetAuth() *SourceTypeConfigDiscordAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigDiscord) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigDiscord) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigDiscord + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigDiscord(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigDiscord) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigDiscordAllowedHttpMethodsItem string + +const ( + SourceTypeConfigDiscordAllowedHttpMethodsItemGet SourceTypeConfigDiscordAllowedHttpMethodsItem = "GET" + SourceTypeConfigDiscordAllowedHttpMethodsItemPost SourceTypeConfigDiscordAllowedHttpMethodsItem = "POST" + SourceTypeConfigDiscordAllowedHttpMethodsItemPut SourceTypeConfigDiscordAllowedHttpMethodsItem = "PUT" + SourceTypeConfigDiscordAllowedHttpMethodsItemPatch SourceTypeConfigDiscordAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigDiscordAllowedHttpMethodsItemDelete SourceTypeConfigDiscordAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigDiscordAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigDiscordAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigDiscordAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigDiscordAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigDiscordAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigDiscordAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigDiscordAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigDiscordAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigDiscordAllowedHttpMethodsItem) Ptr() *SourceTypeConfigDiscordAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigDiscordAuth struct { + PublicKey string `json:"public_key" url:"public_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigDiscordAuth) GetPublicKey() string { + if s == nil { + return "" + } + return s.PublicKey +} + +func (s *SourceTypeConfigDiscordAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigDiscordAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigDiscordAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigDiscordAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigDiscordAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Ebay. Requires type to be `EBAY`. +type SourceTypeConfigEbay struct { + AllowedHttpMethods []SourceTypeConfigEbayAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigEbayAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigEbay) GetAllowedHttpMethods() []SourceTypeConfigEbayAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigEbay) GetAuth() *SourceTypeConfigEbayAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigEbay) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigEbay) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigEbay + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigEbay(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigEbay) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigEbayAllowedHttpMethodsItem string + +const ( + SourceTypeConfigEbayAllowedHttpMethodsItemGet SourceTypeConfigEbayAllowedHttpMethodsItem = "GET" + SourceTypeConfigEbayAllowedHttpMethodsItemPost SourceTypeConfigEbayAllowedHttpMethodsItem = "POST" + SourceTypeConfigEbayAllowedHttpMethodsItemPut SourceTypeConfigEbayAllowedHttpMethodsItem = "PUT" + SourceTypeConfigEbayAllowedHttpMethodsItemPatch SourceTypeConfigEbayAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigEbayAllowedHttpMethodsItemDelete SourceTypeConfigEbayAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigEbayAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigEbayAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigEbayAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigEbayAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigEbayAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigEbayAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigEbayAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigEbayAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigEbayAllowedHttpMethodsItem) Ptr() *SourceTypeConfigEbayAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigEbayAuth struct { + Environment SourceTypeConfigEbayAuthEnvironment `json:"environment" url:"environment"` + DevId string `json:"dev_id" url:"dev_id"` + ClientId string `json:"client_id" url:"client_id"` + ClientSecret string `json:"client_secret" url:"client_secret"` + VerificationToken string `json:"verification_token" url:"verification_token"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigEbayAuth) GetEnvironment() SourceTypeConfigEbayAuthEnvironment { + if s == nil { + return "" + } + return s.Environment +} + +func (s *SourceTypeConfigEbayAuth) GetDevId() string { + if s == nil { + return "" + } + return s.DevId +} + +func (s *SourceTypeConfigEbayAuth) GetClientId() string { + if s == nil { + return "" + } + return s.ClientId +} + +func (s *SourceTypeConfigEbayAuth) GetClientSecret() string { + if s == nil { + return "" + } + return s.ClientSecret +} + +func (s *SourceTypeConfigEbayAuth) GetVerificationToken() string { + if s == nil { + return "" + } + return s.VerificationToken +} + +func (s *SourceTypeConfigEbayAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigEbayAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigEbayAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigEbayAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigEbayAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigEbayAuthEnvironment string + +const ( + SourceTypeConfigEbayAuthEnvironmentProduction SourceTypeConfigEbayAuthEnvironment = "PRODUCTION" + SourceTypeConfigEbayAuthEnvironmentSandbox SourceTypeConfigEbayAuthEnvironment = "SANDBOX" +) + +func NewSourceTypeConfigEbayAuthEnvironmentFromString(s string) (SourceTypeConfigEbayAuthEnvironment, error) { + switch s { + case "PRODUCTION": + return SourceTypeConfigEbayAuthEnvironmentProduction, nil + case "SANDBOX": + return SourceTypeConfigEbayAuthEnvironmentSandbox, nil + } + var t SourceTypeConfigEbayAuthEnvironment + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigEbayAuthEnvironment) Ptr() *SourceTypeConfigEbayAuthEnvironment { + return &s +} + +// The type config for Enode. Requires type to be `ENODE`. +type SourceTypeConfigEnode struct { + AllowedHttpMethods []SourceTypeConfigEnodeAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigEnodeAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigEnode) GetAllowedHttpMethods() []SourceTypeConfigEnodeAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigEnode) GetAuth() *SourceTypeConfigEnodeAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigEnode) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigEnode) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigEnode + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigEnode(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigEnode) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigEnodeAllowedHttpMethodsItem string + +const ( + SourceTypeConfigEnodeAllowedHttpMethodsItemGet SourceTypeConfigEnodeAllowedHttpMethodsItem = "GET" + SourceTypeConfigEnodeAllowedHttpMethodsItemPost SourceTypeConfigEnodeAllowedHttpMethodsItem = "POST" + SourceTypeConfigEnodeAllowedHttpMethodsItemPut SourceTypeConfigEnodeAllowedHttpMethodsItem = "PUT" + SourceTypeConfigEnodeAllowedHttpMethodsItemPatch SourceTypeConfigEnodeAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigEnodeAllowedHttpMethodsItemDelete SourceTypeConfigEnodeAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigEnodeAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigEnodeAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigEnodeAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigEnodeAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigEnodeAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigEnodeAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigEnodeAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigEnodeAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigEnodeAllowedHttpMethodsItem) Ptr() *SourceTypeConfigEnodeAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigEnodeAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigEnodeAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigEnodeAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigEnodeAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigEnodeAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigEnodeAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigEnodeAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Facebook. Requires type to be `FACEBOOK`. +type SourceTypeConfigFacebook struct { + AllowedHttpMethods []SourceTypeConfigFacebookAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigFacebookAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFacebook) GetAllowedHttpMethods() []SourceTypeConfigFacebookAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigFacebook) GetAuth() *SourceTypeConfigFacebookAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigFacebook) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFacebook) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFacebook + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFacebook(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFacebook) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigFacebookAllowedHttpMethodsItem string + +const ( + SourceTypeConfigFacebookAllowedHttpMethodsItemGet SourceTypeConfigFacebookAllowedHttpMethodsItem = "GET" + SourceTypeConfigFacebookAllowedHttpMethodsItemPost SourceTypeConfigFacebookAllowedHttpMethodsItem = "POST" + SourceTypeConfigFacebookAllowedHttpMethodsItemPut SourceTypeConfigFacebookAllowedHttpMethodsItem = "PUT" + SourceTypeConfigFacebookAllowedHttpMethodsItemPatch SourceTypeConfigFacebookAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigFacebookAllowedHttpMethodsItemDelete SourceTypeConfigFacebookAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigFacebookAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigFacebookAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigFacebookAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigFacebookAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigFacebookAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigFacebookAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigFacebookAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigFacebookAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigFacebookAllowedHttpMethodsItem) Ptr() *SourceTypeConfigFacebookAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigFacebookAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFacebookAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigFacebookAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFacebookAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFacebookAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFacebookAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFacebookAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Favro. Requires type to be `FAVRO`. +type SourceTypeConfigFavro struct { + AllowedHttpMethods []SourceTypeConfigFavroAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigFavroAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFavro) GetAllowedHttpMethods() []SourceTypeConfigFavroAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigFavro) GetAuth() *SourceTypeConfigFavroAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigFavro) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFavro) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFavro + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFavro(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFavro) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigFavroAllowedHttpMethodsItem string + +const ( + SourceTypeConfigFavroAllowedHttpMethodsItemGet SourceTypeConfigFavroAllowedHttpMethodsItem = "GET" + SourceTypeConfigFavroAllowedHttpMethodsItemPost SourceTypeConfigFavroAllowedHttpMethodsItem = "POST" + SourceTypeConfigFavroAllowedHttpMethodsItemPut SourceTypeConfigFavroAllowedHttpMethodsItem = "PUT" + SourceTypeConfigFavroAllowedHttpMethodsItemPatch SourceTypeConfigFavroAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigFavroAllowedHttpMethodsItemDelete SourceTypeConfigFavroAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigFavroAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigFavroAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigFavroAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigFavroAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigFavroAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigFavroAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigFavroAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigFavroAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigFavroAllowedHttpMethodsItem) Ptr() *SourceTypeConfigFavroAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigFavroAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFavroAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigFavroAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFavroAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFavroAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFavroAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFavroAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Fiserv. Requires type to be `FISERV`. +type SourceTypeConfigFiserv struct { + AllowedHttpMethods []SourceTypeConfigFiservAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigFiservAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFiserv) GetAllowedHttpMethods() []SourceTypeConfigFiservAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigFiserv) GetAuth() *SourceTypeConfigFiservAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigFiserv) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFiserv) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFiserv + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFiserv(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFiserv) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigFiservAllowedHttpMethodsItem string + +const ( + SourceTypeConfigFiservAllowedHttpMethodsItemGet SourceTypeConfigFiservAllowedHttpMethodsItem = "GET" + SourceTypeConfigFiservAllowedHttpMethodsItemPost SourceTypeConfigFiservAllowedHttpMethodsItem = "POST" + SourceTypeConfigFiservAllowedHttpMethodsItemPut SourceTypeConfigFiservAllowedHttpMethodsItem = "PUT" + SourceTypeConfigFiservAllowedHttpMethodsItemPatch SourceTypeConfigFiservAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigFiservAllowedHttpMethodsItemDelete SourceTypeConfigFiservAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigFiservAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigFiservAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigFiservAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigFiservAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigFiservAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigFiservAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigFiservAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigFiservAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigFiservAllowedHttpMethodsItem) Ptr() *SourceTypeConfigFiservAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigFiservAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + StoreName *string `json:"store_name,omitempty" url:"store_name,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFiservAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigFiservAuth) GetStoreName() *string { + if s == nil { + return nil + } + return s.StoreName +} + +func (s *SourceTypeConfigFiservAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFiservAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFiservAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFiservAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFiservAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for FrontApp. Requires type to be `FRONTAPP`. +type SourceTypeConfigFrontApp struct { + AllowedHttpMethods []SourceTypeConfigFrontAppAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigFrontAppAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFrontApp) GetAllowedHttpMethods() []SourceTypeConfigFrontAppAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigFrontApp) GetAuth() *SourceTypeConfigFrontAppAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigFrontApp) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFrontApp) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFrontApp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFrontApp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFrontApp) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigFrontAppAllowedHttpMethodsItem string + +const ( + SourceTypeConfigFrontAppAllowedHttpMethodsItemGet SourceTypeConfigFrontAppAllowedHttpMethodsItem = "GET" + SourceTypeConfigFrontAppAllowedHttpMethodsItemPost SourceTypeConfigFrontAppAllowedHttpMethodsItem = "POST" + SourceTypeConfigFrontAppAllowedHttpMethodsItemPut SourceTypeConfigFrontAppAllowedHttpMethodsItem = "PUT" + SourceTypeConfigFrontAppAllowedHttpMethodsItemPatch SourceTypeConfigFrontAppAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigFrontAppAllowedHttpMethodsItemDelete SourceTypeConfigFrontAppAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigFrontAppAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigFrontAppAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigFrontAppAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigFrontAppAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigFrontAppAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigFrontAppAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigFrontAppAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigFrontAppAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigFrontAppAllowedHttpMethodsItem) Ptr() *SourceTypeConfigFrontAppAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigFrontAppAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigFrontAppAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigFrontAppAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigFrontAppAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigFrontAppAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigFrontAppAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigFrontAppAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for GitHub. Requires type to be `GITHUB`. +type SourceTypeConfigGitHub struct { + AllowedHttpMethods []SourceTypeConfigGitHubAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigGitHubAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigGitHub) GetAllowedHttpMethods() []SourceTypeConfigGitHubAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigGitHub) GetAuth() *SourceTypeConfigGitHubAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigGitHub) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigGitHub) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigGitHub + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigGitHub(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigGitHub) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigGitHubAllowedHttpMethodsItem string + +const ( + SourceTypeConfigGitHubAllowedHttpMethodsItemGet SourceTypeConfigGitHubAllowedHttpMethodsItem = "GET" + SourceTypeConfigGitHubAllowedHttpMethodsItemPost SourceTypeConfigGitHubAllowedHttpMethodsItem = "POST" + SourceTypeConfigGitHubAllowedHttpMethodsItemPut SourceTypeConfigGitHubAllowedHttpMethodsItem = "PUT" + SourceTypeConfigGitHubAllowedHttpMethodsItemPatch SourceTypeConfigGitHubAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigGitHubAllowedHttpMethodsItemDelete SourceTypeConfigGitHubAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigGitHubAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigGitHubAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigGitHubAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigGitHubAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigGitHubAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigGitHubAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigGitHubAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigGitHubAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigGitHubAllowedHttpMethodsItem) Ptr() *SourceTypeConfigGitHubAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigGitHubAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigGitHubAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigGitHubAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigGitHubAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigGitHubAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigGitHubAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigGitHubAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for GitLab. Requires type to be `GITLAB`. +type SourceTypeConfigGitLab struct { + AllowedHttpMethods []SourceTypeConfigGitLabAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigGitLabAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigGitLab) GetAllowedHttpMethods() []SourceTypeConfigGitLabAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigGitLab) GetAuth() *SourceTypeConfigGitLabAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigGitLab) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigGitLab) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigGitLab + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigGitLab(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigGitLab) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigGitLabAllowedHttpMethodsItem string + +const ( + SourceTypeConfigGitLabAllowedHttpMethodsItemGet SourceTypeConfigGitLabAllowedHttpMethodsItem = "GET" + SourceTypeConfigGitLabAllowedHttpMethodsItemPost SourceTypeConfigGitLabAllowedHttpMethodsItem = "POST" + SourceTypeConfigGitLabAllowedHttpMethodsItemPut SourceTypeConfigGitLabAllowedHttpMethodsItem = "PUT" + SourceTypeConfigGitLabAllowedHttpMethodsItemPatch SourceTypeConfigGitLabAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigGitLabAllowedHttpMethodsItemDelete SourceTypeConfigGitLabAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigGitLabAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigGitLabAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigGitLabAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigGitLabAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigGitLabAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigGitLabAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigGitLabAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigGitLabAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigGitLabAllowedHttpMethodsItem) Ptr() *SourceTypeConfigGitLabAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigGitLabAuth struct { + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigGitLabAuth) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigGitLabAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigGitLabAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigGitLabAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigGitLabAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigGitLabAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for HMAC. Requires type to be `HMAC`. +type SourceTypeConfigHmac struct { + Type *string `json:"type,omitempty" url:"type,omitempty"` + AllowedHttpMethods []SourceTypeConfigHmacAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceTypeConfigHmacCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + Auth *SourceTypeConfigHmacAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHmac) GetAllowedHttpMethods() []SourceTypeConfigHmacAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigHmac) GetCustomResponse() *SourceTypeConfigHmacCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse +} + +func (s *SourceTypeConfigHmac) GetAuth() *SourceTypeConfigHmacAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigHmac) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHmac) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHmac + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHmac(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHmac) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHmacAllowedHttpMethodsItem string + +const ( + SourceTypeConfigHmacAllowedHttpMethodsItemGet SourceTypeConfigHmacAllowedHttpMethodsItem = "GET" + SourceTypeConfigHmacAllowedHttpMethodsItemPost SourceTypeConfigHmacAllowedHttpMethodsItem = "POST" + SourceTypeConfigHmacAllowedHttpMethodsItemPut SourceTypeConfigHmacAllowedHttpMethodsItem = "PUT" + SourceTypeConfigHmacAllowedHttpMethodsItemPatch SourceTypeConfigHmacAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigHmacAllowedHttpMethodsItemDelete SourceTypeConfigHmacAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigHmacAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigHmacAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigHmacAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigHmacAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigHmacAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigHmacAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigHmacAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigHmacAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHmacAllowedHttpMethodsItem) Ptr() *SourceTypeConfigHmacAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigHmacAuth struct { + Algorithm SourceTypeConfigHmacAuthAlgorithm `json:"algorithm" url:"algorithm"` + Encoding SourceTypeConfigHmacAuthEncoding `json:"encoding" url:"encoding"` + HeaderKey string `json:"header_key" url:"header_key"` + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHmacAuth) GetAlgorithm() SourceTypeConfigHmacAuthAlgorithm { + if s == nil { + return "" + } + return s.Algorithm +} + +func (s *SourceTypeConfigHmacAuth) GetEncoding() SourceTypeConfigHmacAuthEncoding { + if s == nil { + return "" + } + return s.Encoding +} + +func (s *SourceTypeConfigHmacAuth) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigHmacAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigHmacAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHmacAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHmacAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHmacAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHmacAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHmacAuthAlgorithm string + +const ( + SourceTypeConfigHmacAuthAlgorithmSha1 SourceTypeConfigHmacAuthAlgorithm = "sha1" + SourceTypeConfigHmacAuthAlgorithmSha256 SourceTypeConfigHmacAuthAlgorithm = "sha256" + SourceTypeConfigHmacAuthAlgorithmSha512 SourceTypeConfigHmacAuthAlgorithm = "sha512" + SourceTypeConfigHmacAuthAlgorithmMd5 SourceTypeConfigHmacAuthAlgorithm = "md5" +) + +func NewSourceTypeConfigHmacAuthAlgorithmFromString(s string) (SourceTypeConfigHmacAuthAlgorithm, error) { + switch s { + case "sha1": + return SourceTypeConfigHmacAuthAlgorithmSha1, nil + case "sha256": + return SourceTypeConfigHmacAuthAlgorithmSha256, nil + case "sha512": + return SourceTypeConfigHmacAuthAlgorithmSha512, nil + case "md5": + return SourceTypeConfigHmacAuthAlgorithmMd5, nil + } + var t SourceTypeConfigHmacAuthAlgorithm + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHmacAuthAlgorithm) Ptr() *SourceTypeConfigHmacAuthAlgorithm { + return &s +} + +type SourceTypeConfigHmacAuthEncoding string + +const ( + SourceTypeConfigHmacAuthEncodingBase64 SourceTypeConfigHmacAuthEncoding = "base64" + SourceTypeConfigHmacAuthEncodingBase64Url SourceTypeConfigHmacAuthEncoding = "base64url" + SourceTypeConfigHmacAuthEncodingHex SourceTypeConfigHmacAuthEncoding = "hex" +) + +func NewSourceTypeConfigHmacAuthEncodingFromString(s string) (SourceTypeConfigHmacAuthEncoding, error) { + switch s { + case "base64": + return SourceTypeConfigHmacAuthEncodingBase64, nil + case "base64url": + return SourceTypeConfigHmacAuthEncodingBase64Url, nil + case "hex": + return SourceTypeConfigHmacAuthEncodingHex, nil + } + var t SourceTypeConfigHmacAuthEncoding + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHmacAuthEncoding) Ptr() *SourceTypeConfigHmacAuthEncoding { + return &s +} + +type SourceTypeConfigHmacCustomResponse struct { + ContentType *SourceTypeConfigHmacCustomResponseContentType `json:"content_type,omitempty" url:"content_type,omitempty"` + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHmacCustomResponse) GetContentType() *SourceTypeConfigHmacCustomResponseContentType { + if s == nil { + return nil + } + return s.ContentType +} + +func (s *SourceTypeConfigHmacCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceTypeConfigHmacCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHmacCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHmacCustomResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHmacCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHmacCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHmacCustomResponseContentType string + +const ( + SourceTypeConfigHmacCustomResponseContentTypeJson SourceTypeConfigHmacCustomResponseContentType = "json" + SourceTypeConfigHmacCustomResponseContentTypeText SourceTypeConfigHmacCustomResponseContentType = "text" + SourceTypeConfigHmacCustomResponseContentTypeXml SourceTypeConfigHmacCustomResponseContentType = "xml" +) + +func NewSourceTypeConfigHmacCustomResponseContentTypeFromString(s string) (SourceTypeConfigHmacCustomResponseContentType, error) { + switch s { + case "json": + return SourceTypeConfigHmacCustomResponseContentTypeJson, nil + case "text": + return SourceTypeConfigHmacCustomResponseContentTypeText, nil + case "xml": + return SourceTypeConfigHmacCustomResponseContentTypeXml, nil + } + var t SourceTypeConfigHmacCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHmacCustomResponseContentType) Ptr() *SourceTypeConfigHmacCustomResponseContentType { + return &s +} + +// The type config for HTTP. Requires type to be `HTTP`. +type SourceTypeConfigHttp struct { + AllowedHttpMethods []SourceTypeConfigHttpAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceTypeConfigHttpCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + Type *SourceTypeConfigHttpType `json:"type,omitempty" url:"type,omitempty"` + Auth *SourceTypeConfigHttpAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHttp) GetAllowedHttpMethods() []SourceTypeConfigHttpAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigHttp) GetCustomResponse() *SourceTypeConfigHttpCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse +} + +func (s *SourceTypeConfigHttp) GetType() *SourceTypeConfigHttpType { + if s == nil { + return nil + } + return s.Type +} + +func (s *SourceTypeConfigHttp) GetAuth() *SourceTypeConfigHttpAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigHttp) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHttp) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHttp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHttp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHttp) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHttpAllowedHttpMethodsItem string + +const ( + SourceTypeConfigHttpAllowedHttpMethodsItemGet SourceTypeConfigHttpAllowedHttpMethodsItem = "GET" + SourceTypeConfigHttpAllowedHttpMethodsItemPost SourceTypeConfigHttpAllowedHttpMethodsItem = "POST" + SourceTypeConfigHttpAllowedHttpMethodsItemPut SourceTypeConfigHttpAllowedHttpMethodsItem = "PUT" + SourceTypeConfigHttpAllowedHttpMethodsItemPatch SourceTypeConfigHttpAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigHttpAllowedHttpMethodsItemDelete SourceTypeConfigHttpAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigHttpAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigHttpAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigHttpAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigHttpAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigHttpAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigHttpAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigHttpAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigHttpAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHttpAllowedHttpMethodsItem) Ptr() *SourceTypeConfigHttpAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigHttpAuth struct { + SourceTypeConfigHttpAuthAlgorithm *SourceTypeConfigHttpAuthAlgorithm + SourceTypeConfigHttpAuthPassword *SourceTypeConfigHttpAuthPassword + SourceTypeConfigHttpAuthApiKey *SourceTypeConfigHttpAuthApiKey + + typ string +} + +func NewSourceTypeConfigHttpAuthFromSourceTypeConfigHttpAuthAlgorithm(value *SourceTypeConfigHttpAuthAlgorithm) *SourceTypeConfigHttpAuth { + return &SourceTypeConfigHttpAuth{typ: "SourceTypeConfigHttpAuthAlgorithm", SourceTypeConfigHttpAuthAlgorithm: value} +} + +func NewSourceTypeConfigHttpAuthFromSourceTypeConfigHttpAuthPassword(value *SourceTypeConfigHttpAuthPassword) *SourceTypeConfigHttpAuth { + return &SourceTypeConfigHttpAuth{typ: "SourceTypeConfigHttpAuthPassword", SourceTypeConfigHttpAuthPassword: value} +} + +func NewSourceTypeConfigHttpAuthFromSourceTypeConfigHttpAuthApiKey(value *SourceTypeConfigHttpAuthApiKey) *SourceTypeConfigHttpAuth { + return &SourceTypeConfigHttpAuth{typ: "SourceTypeConfigHttpAuthApiKey", SourceTypeConfigHttpAuthApiKey: value} +} + +func (s *SourceTypeConfigHttpAuth) GetSourceTypeConfigHttpAuthAlgorithm() *SourceTypeConfigHttpAuthAlgorithm { + if s == nil { + return nil + } + return s.SourceTypeConfigHttpAuthAlgorithm +} + +func (s *SourceTypeConfigHttpAuth) GetSourceTypeConfigHttpAuthPassword() *SourceTypeConfigHttpAuthPassword { + if s == nil { + return nil + } + return s.SourceTypeConfigHttpAuthPassword +} + +func (s *SourceTypeConfigHttpAuth) GetSourceTypeConfigHttpAuthApiKey() *SourceTypeConfigHttpAuthApiKey { + if s == nil { + return nil + } + return s.SourceTypeConfigHttpAuthApiKey +} + +func (s *SourceTypeConfigHttpAuth) UnmarshalJSON(data []byte) error { + valueSourceTypeConfigHttpAuthAlgorithm := new(SourceTypeConfigHttpAuthAlgorithm) + if err := json.Unmarshal(data, &valueSourceTypeConfigHttpAuthAlgorithm); err == nil { + s.typ = "SourceTypeConfigHttpAuthAlgorithm" + s.SourceTypeConfigHttpAuthAlgorithm = valueSourceTypeConfigHttpAuthAlgorithm + return nil + } + valueSourceTypeConfigHttpAuthPassword := new(SourceTypeConfigHttpAuthPassword) + if err := json.Unmarshal(data, &valueSourceTypeConfigHttpAuthPassword); err == nil { + s.typ = "SourceTypeConfigHttpAuthPassword" + s.SourceTypeConfigHttpAuthPassword = valueSourceTypeConfigHttpAuthPassword + return nil + } + valueSourceTypeConfigHttpAuthApiKey := new(SourceTypeConfigHttpAuthApiKey) + if err := json.Unmarshal(data, &valueSourceTypeConfigHttpAuthApiKey); err == nil { + s.typ = "SourceTypeConfigHttpAuthApiKey" + s.SourceTypeConfigHttpAuthApiKey = valueSourceTypeConfigHttpAuthApiKey + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SourceTypeConfigHttpAuth) MarshalJSON() ([]byte, error) { + if s.typ == "SourceTypeConfigHttpAuthAlgorithm" || s.SourceTypeConfigHttpAuthAlgorithm != nil { + return json.Marshal(s.SourceTypeConfigHttpAuthAlgorithm) + } + if s.typ == "SourceTypeConfigHttpAuthPassword" || s.SourceTypeConfigHttpAuthPassword != nil { + return json.Marshal(s.SourceTypeConfigHttpAuthPassword) + } + if s.typ == "SourceTypeConfigHttpAuthApiKey" || s.SourceTypeConfigHttpAuthApiKey != nil { + return json.Marshal(s.SourceTypeConfigHttpAuthApiKey) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SourceTypeConfigHttpAuthVisitor interface { + VisitSourceTypeConfigHttpAuthAlgorithm(*SourceTypeConfigHttpAuthAlgorithm) error + VisitSourceTypeConfigHttpAuthPassword(*SourceTypeConfigHttpAuthPassword) error + VisitSourceTypeConfigHttpAuthApiKey(*SourceTypeConfigHttpAuthApiKey) error +} + +func (s *SourceTypeConfigHttpAuth) Accept(visitor SourceTypeConfigHttpAuthVisitor) error { + if s.typ == "SourceTypeConfigHttpAuthAlgorithm" || s.SourceTypeConfigHttpAuthAlgorithm != nil { + return visitor.VisitSourceTypeConfigHttpAuthAlgorithm(s.SourceTypeConfigHttpAuthAlgorithm) + } + if s.typ == "SourceTypeConfigHttpAuthPassword" || s.SourceTypeConfigHttpAuthPassword != nil { + return visitor.VisitSourceTypeConfigHttpAuthPassword(s.SourceTypeConfigHttpAuthPassword) + } + if s.typ == "SourceTypeConfigHttpAuthApiKey" || s.SourceTypeConfigHttpAuthApiKey != nil { + return visitor.VisitSourceTypeConfigHttpAuthApiKey(s.SourceTypeConfigHttpAuthApiKey) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SourceTypeConfigHttpAuthAlgorithm struct { + Algorithm SourceTypeConfigHttpAuthAlgorithmAlgorithm `json:"algorithm" url:"algorithm"` + Encoding SourceTypeConfigHttpAuthAlgorithmEncoding `json:"encoding" url:"encoding"` + HeaderKey string `json:"header_key" url:"header_key"` + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) GetAlgorithm() SourceTypeConfigHttpAuthAlgorithmAlgorithm { + if s == nil { + return "" + } + return s.Algorithm +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) GetEncoding() SourceTypeConfigHttpAuthAlgorithmEncoding { + if s == nil { + return "" + } + return s.Encoding +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHttpAuthAlgorithm + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHttpAuthAlgorithm(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHttpAuthAlgorithm) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHttpAuthAlgorithmAlgorithm string + +const ( + SourceTypeConfigHttpAuthAlgorithmAlgorithmSha1 SourceTypeConfigHttpAuthAlgorithmAlgorithm = "sha1" + SourceTypeConfigHttpAuthAlgorithmAlgorithmSha256 SourceTypeConfigHttpAuthAlgorithmAlgorithm = "sha256" + SourceTypeConfigHttpAuthAlgorithmAlgorithmSha512 SourceTypeConfigHttpAuthAlgorithmAlgorithm = "sha512" + SourceTypeConfigHttpAuthAlgorithmAlgorithmMd5 SourceTypeConfigHttpAuthAlgorithmAlgorithm = "md5" +) + +func NewSourceTypeConfigHttpAuthAlgorithmAlgorithmFromString(s string) (SourceTypeConfigHttpAuthAlgorithmAlgorithm, error) { + switch s { + case "sha1": + return SourceTypeConfigHttpAuthAlgorithmAlgorithmSha1, nil + case "sha256": + return SourceTypeConfigHttpAuthAlgorithmAlgorithmSha256, nil + case "sha512": + return SourceTypeConfigHttpAuthAlgorithmAlgorithmSha512, nil + case "md5": + return SourceTypeConfigHttpAuthAlgorithmAlgorithmMd5, nil + } + var t SourceTypeConfigHttpAuthAlgorithmAlgorithm + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHttpAuthAlgorithmAlgorithm) Ptr() *SourceTypeConfigHttpAuthAlgorithmAlgorithm { + return &s +} + +type SourceTypeConfigHttpAuthAlgorithmEncoding string + +const ( + SourceTypeConfigHttpAuthAlgorithmEncodingBase64 SourceTypeConfigHttpAuthAlgorithmEncoding = "base64" + SourceTypeConfigHttpAuthAlgorithmEncodingBase64Url SourceTypeConfigHttpAuthAlgorithmEncoding = "base64url" + SourceTypeConfigHttpAuthAlgorithmEncodingHex SourceTypeConfigHttpAuthAlgorithmEncoding = "hex" +) + +func NewSourceTypeConfigHttpAuthAlgorithmEncodingFromString(s string) (SourceTypeConfigHttpAuthAlgorithmEncoding, error) { + switch s { + case "base64": + return SourceTypeConfigHttpAuthAlgorithmEncodingBase64, nil + case "base64url": + return SourceTypeConfigHttpAuthAlgorithmEncodingBase64Url, nil + case "hex": + return SourceTypeConfigHttpAuthAlgorithmEncodingHex, nil + } + var t SourceTypeConfigHttpAuthAlgorithmEncoding + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHttpAuthAlgorithmEncoding) Ptr() *SourceTypeConfigHttpAuthAlgorithmEncoding { + return &s +} + +type SourceTypeConfigHttpAuthApiKey struct { + HeaderKey string `json:"header_key" url:"header_key"` + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHttpAuthApiKey) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigHttpAuthApiKey) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigHttpAuthApiKey) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHttpAuthApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHttpAuthApiKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHttpAuthApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHttpAuthApiKey) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHttpAuthPassword struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHttpAuthPassword) GetUsername() *string { + if s == nil { + return nil + } + return s.Username +} + +func (s *SourceTypeConfigHttpAuthPassword) GetPassword() *string { + if s == nil { + return nil + } + return s.Password +} + +func (s *SourceTypeConfigHttpAuthPassword) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHttpAuthPassword) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHttpAuthPassword + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHttpAuthPassword(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHttpAuthPassword) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHttpCustomResponse struct { + ContentType *SourceTypeConfigHttpCustomResponseContentType `json:"content_type,omitempty" url:"content_type,omitempty"` + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHttpCustomResponse) GetContentType() *SourceTypeConfigHttpCustomResponseContentType { + if s == nil { + return nil + } + return s.ContentType +} + +func (s *SourceTypeConfigHttpCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceTypeConfigHttpCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHttpCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHttpCustomResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHttpCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHttpCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHttpCustomResponseContentType string + +const ( + SourceTypeConfigHttpCustomResponseContentTypeJson SourceTypeConfigHttpCustomResponseContentType = "json" + SourceTypeConfigHttpCustomResponseContentTypeText SourceTypeConfigHttpCustomResponseContentType = "text" + SourceTypeConfigHttpCustomResponseContentTypeXml SourceTypeConfigHttpCustomResponseContentType = "xml" +) + +func NewSourceTypeConfigHttpCustomResponseContentTypeFromString(s string) (SourceTypeConfigHttpCustomResponseContentType, error) { + switch s { + case "json": + return SourceTypeConfigHttpCustomResponseContentTypeJson, nil + case "text": + return SourceTypeConfigHttpCustomResponseContentTypeText, nil + case "xml": + return SourceTypeConfigHttpCustomResponseContentTypeXml, nil + } + var t SourceTypeConfigHttpCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHttpCustomResponseContentType) Ptr() *SourceTypeConfigHttpCustomResponseContentType { + return &s +} + +type SourceTypeConfigHttpType string + +const ( + SourceTypeConfigHttpTypeHmac SourceTypeConfigHttpType = "HMAC" + SourceTypeConfigHttpTypeBasicAuth SourceTypeConfigHttpType = "BASIC_AUTH" + SourceTypeConfigHttpTypeApiKey SourceTypeConfigHttpType = "API_KEY" +) + +func NewSourceTypeConfigHttpTypeFromString(s string) (SourceTypeConfigHttpType, error) { + switch s { + case "HMAC": + return SourceTypeConfigHttpTypeHmac, nil + case "BASIC_AUTH": + return SourceTypeConfigHttpTypeBasicAuth, nil + case "API_KEY": + return SourceTypeConfigHttpTypeApiKey, nil + } + var t SourceTypeConfigHttpType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHttpType) Ptr() *SourceTypeConfigHttpType { + return &s +} + +// The type config for Hubspot. Requires type to be `HUBSPOT`. +type SourceTypeConfigHubspot struct { + AllowedHttpMethods []SourceTypeConfigHubspotAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigHubspotAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHubspot) GetAllowedHttpMethods() []SourceTypeConfigHubspotAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigHubspot) GetAuth() *SourceTypeConfigHubspotAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigHubspot) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHubspot) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHubspot + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHubspot(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHubspot) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigHubspotAllowedHttpMethodsItem string + +const ( + SourceTypeConfigHubspotAllowedHttpMethodsItemGet SourceTypeConfigHubspotAllowedHttpMethodsItem = "GET" + SourceTypeConfigHubspotAllowedHttpMethodsItemPost SourceTypeConfigHubspotAllowedHttpMethodsItem = "POST" + SourceTypeConfigHubspotAllowedHttpMethodsItemPut SourceTypeConfigHubspotAllowedHttpMethodsItem = "PUT" + SourceTypeConfigHubspotAllowedHttpMethodsItemPatch SourceTypeConfigHubspotAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigHubspotAllowedHttpMethodsItemDelete SourceTypeConfigHubspotAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigHubspotAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigHubspotAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigHubspotAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigHubspotAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigHubspotAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigHubspotAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigHubspotAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigHubspotAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigHubspotAllowedHttpMethodsItem) Ptr() *SourceTypeConfigHubspotAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigHubspotAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigHubspotAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigHubspotAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigHubspotAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigHubspotAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigHubspotAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigHubspotAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Linear. Requires type to be `LINEAR`. +type SourceTypeConfigLinear struct { + AllowedHttpMethods []SourceTypeConfigLinearAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigLinearAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigLinear) GetAllowedHttpMethods() []SourceTypeConfigLinearAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigLinear) GetAuth() *SourceTypeConfigLinearAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigLinear) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigLinear) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigLinear + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigLinear(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigLinear) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigLinearAllowedHttpMethodsItem string + +const ( + SourceTypeConfigLinearAllowedHttpMethodsItemGet SourceTypeConfigLinearAllowedHttpMethodsItem = "GET" + SourceTypeConfigLinearAllowedHttpMethodsItemPost SourceTypeConfigLinearAllowedHttpMethodsItem = "POST" + SourceTypeConfigLinearAllowedHttpMethodsItemPut SourceTypeConfigLinearAllowedHttpMethodsItem = "PUT" + SourceTypeConfigLinearAllowedHttpMethodsItemPatch SourceTypeConfigLinearAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigLinearAllowedHttpMethodsItemDelete SourceTypeConfigLinearAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigLinearAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigLinearAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigLinearAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigLinearAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigLinearAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigLinearAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigLinearAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigLinearAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigLinearAllowedHttpMethodsItem) Ptr() *SourceTypeConfigLinearAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigLinearAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigLinearAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigLinearAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigLinearAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigLinearAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigLinearAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigLinearAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Mailchimp. Requires type to be `MAILCHIMP`. +type SourceTypeConfigMailchimp struct { + AllowedHttpMethods []SourceTypeConfigMailchimpAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigMailchimpAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigMailchimp) GetAllowedHttpMethods() []SourceTypeConfigMailchimpAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigMailchimp) GetAuth() *SourceTypeConfigMailchimpAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigMailchimp) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigMailchimp) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigMailchimp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigMailchimp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigMailchimp) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigMailchimpAllowedHttpMethodsItem string + +const ( + SourceTypeConfigMailchimpAllowedHttpMethodsItemGet SourceTypeConfigMailchimpAllowedHttpMethodsItem = "GET" + SourceTypeConfigMailchimpAllowedHttpMethodsItemPost SourceTypeConfigMailchimpAllowedHttpMethodsItem = "POST" + SourceTypeConfigMailchimpAllowedHttpMethodsItemPut SourceTypeConfigMailchimpAllowedHttpMethodsItem = "PUT" + SourceTypeConfigMailchimpAllowedHttpMethodsItemPatch SourceTypeConfigMailchimpAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigMailchimpAllowedHttpMethodsItemDelete SourceTypeConfigMailchimpAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigMailchimpAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigMailchimpAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigMailchimpAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigMailchimpAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigMailchimpAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigMailchimpAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigMailchimpAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigMailchimpAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigMailchimpAllowedHttpMethodsItem) Ptr() *SourceTypeConfigMailchimpAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigMailchimpAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigMailchimpAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigMailchimpAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigMailchimpAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigMailchimpAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigMailchimpAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigMailchimpAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Mailgun. Requires type to be `MAILGUN`. +type SourceTypeConfigMailgun struct { + AllowedHttpMethods []SourceTypeConfigMailgunAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigMailgunAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigMailgun) GetAllowedHttpMethods() []SourceTypeConfigMailgunAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigMailgun) GetAuth() *SourceTypeConfigMailgunAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigMailgun) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigMailgun) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigMailgun + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigMailgun(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigMailgun) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigMailgunAllowedHttpMethodsItem string + +const ( + SourceTypeConfigMailgunAllowedHttpMethodsItemGet SourceTypeConfigMailgunAllowedHttpMethodsItem = "GET" + SourceTypeConfigMailgunAllowedHttpMethodsItemPost SourceTypeConfigMailgunAllowedHttpMethodsItem = "POST" + SourceTypeConfigMailgunAllowedHttpMethodsItemPut SourceTypeConfigMailgunAllowedHttpMethodsItem = "PUT" + SourceTypeConfigMailgunAllowedHttpMethodsItemPatch SourceTypeConfigMailgunAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigMailgunAllowedHttpMethodsItemDelete SourceTypeConfigMailgunAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigMailgunAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigMailgunAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigMailgunAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigMailgunAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigMailgunAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigMailgunAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigMailgunAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigMailgunAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigMailgunAllowedHttpMethodsItem) Ptr() *SourceTypeConfigMailgunAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigMailgunAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigMailgunAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigMailgunAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigMailgunAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigMailgunAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigMailgunAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigMailgunAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for NMI Payment Gateway. Requires type to be `NMI`. +type SourceTypeConfigNmiPaymentGateway struct { + AllowedHttpMethods []SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigNmiPaymentGatewayAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigNmiPaymentGateway) GetAllowedHttpMethods() []SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigNmiPaymentGateway) GetAuth() *SourceTypeConfigNmiPaymentGatewayAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigNmiPaymentGateway) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigNmiPaymentGateway) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigNmiPaymentGateway + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigNmiPaymentGateway(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigNmiPaymentGateway) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem string + +const ( + SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemGet SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem = "GET" + SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPost SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem = "POST" + SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPut SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem = "PUT" + SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPatch SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemDelete SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem) Ptr() *SourceTypeConfigNmiPaymentGatewayAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigNmiPaymentGatewayAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigNmiPaymentGatewayAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigNmiPaymentGatewayAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigNmiPaymentGatewayAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigNmiPaymentGatewayAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigNmiPaymentGatewayAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigNmiPaymentGatewayAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Orb. Requires type to be `ORB`. +type SourceTypeConfigOrb struct { + AllowedHttpMethods []SourceTypeConfigOrbAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigOrbAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigOrb) GetAllowedHttpMethods() []SourceTypeConfigOrbAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigOrb) GetAuth() *SourceTypeConfigOrbAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigOrb) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigOrb) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigOrb + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigOrb(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigOrb) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigOrbAllowedHttpMethodsItem string + +const ( + SourceTypeConfigOrbAllowedHttpMethodsItemGet SourceTypeConfigOrbAllowedHttpMethodsItem = "GET" + SourceTypeConfigOrbAllowedHttpMethodsItemPost SourceTypeConfigOrbAllowedHttpMethodsItem = "POST" + SourceTypeConfigOrbAllowedHttpMethodsItemPut SourceTypeConfigOrbAllowedHttpMethodsItem = "PUT" + SourceTypeConfigOrbAllowedHttpMethodsItemPatch SourceTypeConfigOrbAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigOrbAllowedHttpMethodsItemDelete SourceTypeConfigOrbAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigOrbAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigOrbAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigOrbAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigOrbAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigOrbAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigOrbAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigOrbAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigOrbAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigOrbAllowedHttpMethodsItem) Ptr() *SourceTypeConfigOrbAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigOrbAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigOrbAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigOrbAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigOrbAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigOrbAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigOrbAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigOrbAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Oura. Requires type to be `OURA`. +type SourceTypeConfigOura struct { + AllowedHttpMethods []SourceTypeConfigOuraAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigOuraAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigOura) GetAllowedHttpMethods() []SourceTypeConfigOuraAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigOura) GetAuth() *SourceTypeConfigOuraAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigOura) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigOura) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigOura + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigOura(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigOura) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigOuraAllowedHttpMethodsItem string + +const ( + SourceTypeConfigOuraAllowedHttpMethodsItemGet SourceTypeConfigOuraAllowedHttpMethodsItem = "GET" + SourceTypeConfigOuraAllowedHttpMethodsItemPost SourceTypeConfigOuraAllowedHttpMethodsItem = "POST" + SourceTypeConfigOuraAllowedHttpMethodsItemPut SourceTypeConfigOuraAllowedHttpMethodsItem = "PUT" + SourceTypeConfigOuraAllowedHttpMethodsItemPatch SourceTypeConfigOuraAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigOuraAllowedHttpMethodsItemDelete SourceTypeConfigOuraAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigOuraAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigOuraAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigOuraAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigOuraAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigOuraAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigOuraAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigOuraAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigOuraAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigOuraAllowedHttpMethodsItem) Ptr() *SourceTypeConfigOuraAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigOuraAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigOuraAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigOuraAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigOuraAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigOuraAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigOuraAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigOuraAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Paddle. Requires type to be `PADDLE`. +type SourceTypeConfigPaddle struct { + AllowedHttpMethods []SourceTypeConfigPaddleAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPaddleAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPaddle) GetAllowedHttpMethods() []SourceTypeConfigPaddleAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPaddle) GetAuth() *SourceTypeConfigPaddleAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPaddle) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPaddle) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPaddle + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPaddle(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPaddle) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPaddleAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPaddleAllowedHttpMethodsItemGet SourceTypeConfigPaddleAllowedHttpMethodsItem = "GET" + SourceTypeConfigPaddleAllowedHttpMethodsItemPost SourceTypeConfigPaddleAllowedHttpMethodsItem = "POST" + SourceTypeConfigPaddleAllowedHttpMethodsItemPut SourceTypeConfigPaddleAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPaddleAllowedHttpMethodsItemPatch SourceTypeConfigPaddleAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPaddleAllowedHttpMethodsItemDelete SourceTypeConfigPaddleAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPaddleAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPaddleAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPaddleAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPaddleAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPaddleAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPaddleAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPaddleAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPaddleAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPaddleAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPaddleAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPaddleAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPaddleAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigPaddleAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPaddleAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPaddleAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPaddleAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPaddleAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Paypal. Requires type to be `PAYPAL`. +type SourceTypeConfigPaypal struct { + AllowedHttpMethods []SourceTypeConfigPaypalAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPaypalAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPaypal) GetAllowedHttpMethods() []SourceTypeConfigPaypalAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPaypal) GetAuth() *SourceTypeConfigPaypalAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPaypal) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPaypal) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPaypal + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPaypal(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPaypal) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPaypalAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPaypalAllowedHttpMethodsItemGet SourceTypeConfigPaypalAllowedHttpMethodsItem = "GET" + SourceTypeConfigPaypalAllowedHttpMethodsItemPost SourceTypeConfigPaypalAllowedHttpMethodsItem = "POST" + SourceTypeConfigPaypalAllowedHttpMethodsItemPut SourceTypeConfigPaypalAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPaypalAllowedHttpMethodsItemPatch SourceTypeConfigPaypalAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPaypalAllowedHttpMethodsItemDelete SourceTypeConfigPaypalAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPaypalAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPaypalAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPaypalAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPaypalAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPaypalAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPaypalAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPaypalAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPaypalAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPaypalAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPaypalAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPaypalAuth struct { + WebhookId string `json:"webhook_id" url:"webhook_id"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPaypalAuth) GetWebhookId() string { + if s == nil { + return "" + } + return s.WebhookId +} + +func (s *SourceTypeConfigPaypalAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPaypalAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPaypalAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPaypalAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPaypalAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Persona. Requires type to be `PERSONA`. +type SourceTypeConfigPersona struct { + AllowedHttpMethods []SourceTypeConfigPersonaAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPersonaAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPersona) GetAllowedHttpMethods() []SourceTypeConfigPersonaAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPersona) GetAuth() *SourceTypeConfigPersonaAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPersona) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPersona) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPersona + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPersona(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPersona) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPersonaAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPersonaAllowedHttpMethodsItemGet SourceTypeConfigPersonaAllowedHttpMethodsItem = "GET" + SourceTypeConfigPersonaAllowedHttpMethodsItemPost SourceTypeConfigPersonaAllowedHttpMethodsItem = "POST" + SourceTypeConfigPersonaAllowedHttpMethodsItemPut SourceTypeConfigPersonaAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPersonaAllowedHttpMethodsItemPatch SourceTypeConfigPersonaAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPersonaAllowedHttpMethodsItemDelete SourceTypeConfigPersonaAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPersonaAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPersonaAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPersonaAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPersonaAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPersonaAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPersonaAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPersonaAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPersonaAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPersonaAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPersonaAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPersonaAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPersonaAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigPersonaAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPersonaAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPersonaAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPersonaAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPersonaAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Pipedrive. Requires type to be `PIPEDRIVE`. +type SourceTypeConfigPipedrive struct { + AllowedHttpMethods []SourceTypeConfigPipedriveAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPipedriveAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPipedrive) GetAllowedHttpMethods() []SourceTypeConfigPipedriveAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPipedrive) GetAuth() *SourceTypeConfigPipedriveAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPipedrive) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPipedrive) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPipedrive + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPipedrive(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPipedrive) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPipedriveAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPipedriveAllowedHttpMethodsItemGet SourceTypeConfigPipedriveAllowedHttpMethodsItem = "GET" + SourceTypeConfigPipedriveAllowedHttpMethodsItemPost SourceTypeConfigPipedriveAllowedHttpMethodsItem = "POST" + SourceTypeConfigPipedriveAllowedHttpMethodsItemPut SourceTypeConfigPipedriveAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPipedriveAllowedHttpMethodsItemPatch SourceTypeConfigPipedriveAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPipedriveAllowedHttpMethodsItemDelete SourceTypeConfigPipedriveAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPipedriveAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPipedriveAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPipedriveAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPipedriveAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPipedriveAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPipedriveAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPipedriveAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPipedriveAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPipedriveAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPipedriveAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPipedriveAuth struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPipedriveAuth) GetUsername() *string { + if s == nil { + return nil + } + return s.Username +} + +func (s *SourceTypeConfigPipedriveAuth) GetPassword() *string { + if s == nil { + return nil + } + return s.Password +} + +func (s *SourceTypeConfigPipedriveAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPipedriveAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPipedriveAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPipedriveAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPipedriveAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Postmark. Requires type to be `POSTMARK`. +type SourceTypeConfigPostmark struct { + AllowedHttpMethods []SourceTypeConfigPostmarkAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPostmarkAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPostmark) GetAllowedHttpMethods() []SourceTypeConfigPostmarkAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPostmark) GetAuth() *SourceTypeConfigPostmarkAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPostmark) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPostmark) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPostmark + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPostmark(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPostmark) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPostmarkAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPostmarkAllowedHttpMethodsItemGet SourceTypeConfigPostmarkAllowedHttpMethodsItem = "GET" + SourceTypeConfigPostmarkAllowedHttpMethodsItemPost SourceTypeConfigPostmarkAllowedHttpMethodsItem = "POST" + SourceTypeConfigPostmarkAllowedHttpMethodsItemPut SourceTypeConfigPostmarkAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPostmarkAllowedHttpMethodsItemPatch SourceTypeConfigPostmarkAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPostmarkAllowedHttpMethodsItemDelete SourceTypeConfigPostmarkAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPostmarkAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPostmarkAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPostmarkAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPostmarkAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPostmarkAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPostmarkAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPostmarkAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPostmarkAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPostmarkAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPostmarkAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPostmarkAuth struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPostmarkAuth) GetUsername() *string { + if s == nil { + return nil + } + return s.Username +} + +func (s *SourceTypeConfigPostmarkAuth) GetPassword() *string { + if s == nil { + return nil + } + return s.Password +} + +func (s *SourceTypeConfigPostmarkAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPostmarkAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPostmarkAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPostmarkAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPostmarkAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Praxis. Requires type to be `PRAXIS`. +type SourceTypeConfigPraxis struct { + AllowedHttpMethods []SourceTypeConfigPraxisAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPraxisAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPraxis) GetAllowedHttpMethods() []SourceTypeConfigPraxisAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPraxis) GetAuth() *SourceTypeConfigPraxisAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPraxis) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPraxis) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPraxis + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPraxis(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPraxis) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPraxisAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPraxisAllowedHttpMethodsItemGet SourceTypeConfigPraxisAllowedHttpMethodsItem = "GET" + SourceTypeConfigPraxisAllowedHttpMethodsItemPost SourceTypeConfigPraxisAllowedHttpMethodsItem = "POST" + SourceTypeConfigPraxisAllowedHttpMethodsItemPut SourceTypeConfigPraxisAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPraxisAllowedHttpMethodsItemPatch SourceTypeConfigPraxisAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPraxisAllowedHttpMethodsItemDelete SourceTypeConfigPraxisAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPraxisAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPraxisAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPraxisAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPraxisAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPraxisAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPraxisAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPraxisAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPraxisAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPraxisAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPraxisAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPraxisAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPraxisAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigPraxisAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPraxisAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPraxisAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPraxisAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPraxisAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Property Finder. Requires type to be `PROPERTY-FINDER`. +type SourceTypeConfigPropertyFinder struct { + AllowedHttpMethods []SourceTypeConfigPropertyFinderAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPropertyFinderAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPropertyFinder) GetAllowedHttpMethods() []SourceTypeConfigPropertyFinderAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPropertyFinder) GetAuth() *SourceTypeConfigPropertyFinderAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPropertyFinder) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPropertyFinder) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPropertyFinder + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPropertyFinder(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPropertyFinder) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPropertyFinderAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPropertyFinderAllowedHttpMethodsItemGet SourceTypeConfigPropertyFinderAllowedHttpMethodsItem = "GET" + SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPost SourceTypeConfigPropertyFinderAllowedHttpMethodsItem = "POST" + SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPut SourceTypeConfigPropertyFinderAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPatch SourceTypeConfigPropertyFinderAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPropertyFinderAllowedHttpMethodsItemDelete SourceTypeConfigPropertyFinderAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPropertyFinderAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPropertyFinderAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPropertyFinderAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPropertyFinderAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPropertyFinderAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPropertyFinderAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPropertyFinderAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPropertyFinderAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPropertyFinderAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPropertyFinderAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigPropertyFinderAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPropertyFinderAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPropertyFinderAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPropertyFinderAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPropertyFinderAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Pylon. Requires type to be `PYLON`. +type SourceTypeConfigPylon struct { + AllowedHttpMethods []SourceTypeConfigPylonAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigPylonAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPylon) GetAllowedHttpMethods() []SourceTypeConfigPylonAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigPylon) GetAuth() *SourceTypeConfigPylonAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigPylon) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPylon) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPylon + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPylon(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPylon) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigPylonAllowedHttpMethodsItem string + +const ( + SourceTypeConfigPylonAllowedHttpMethodsItemGet SourceTypeConfigPylonAllowedHttpMethodsItem = "GET" + SourceTypeConfigPylonAllowedHttpMethodsItemPost SourceTypeConfigPylonAllowedHttpMethodsItem = "POST" + SourceTypeConfigPylonAllowedHttpMethodsItemPut SourceTypeConfigPylonAllowedHttpMethodsItem = "PUT" + SourceTypeConfigPylonAllowedHttpMethodsItemPatch SourceTypeConfigPylonAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigPylonAllowedHttpMethodsItemDelete SourceTypeConfigPylonAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigPylonAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigPylonAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigPylonAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigPylonAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigPylonAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigPylonAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigPylonAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigPylonAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigPylonAllowedHttpMethodsItem) Ptr() *SourceTypeConfigPylonAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigPylonAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigPylonAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigPylonAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigPylonAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigPylonAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigPylonAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigPylonAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Razorpay. Requires type to be `RAZORPAY`. +type SourceTypeConfigRazorpay struct { + AllowedHttpMethods []SourceTypeConfigRazorpayAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigRazorpayAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigRazorpay) GetAllowedHttpMethods() []SourceTypeConfigRazorpayAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigRazorpay) GetAuth() *SourceTypeConfigRazorpayAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigRazorpay) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigRazorpay) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigRazorpay + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigRazorpay(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigRazorpay) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigRazorpayAllowedHttpMethodsItem string + +const ( + SourceTypeConfigRazorpayAllowedHttpMethodsItemGet SourceTypeConfigRazorpayAllowedHttpMethodsItem = "GET" + SourceTypeConfigRazorpayAllowedHttpMethodsItemPost SourceTypeConfigRazorpayAllowedHttpMethodsItem = "POST" + SourceTypeConfigRazorpayAllowedHttpMethodsItemPut SourceTypeConfigRazorpayAllowedHttpMethodsItem = "PUT" + SourceTypeConfigRazorpayAllowedHttpMethodsItemPatch SourceTypeConfigRazorpayAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigRazorpayAllowedHttpMethodsItemDelete SourceTypeConfigRazorpayAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigRazorpayAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigRazorpayAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigRazorpayAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigRazorpayAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigRazorpayAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigRazorpayAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigRazorpayAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigRazorpayAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigRazorpayAllowedHttpMethodsItem) Ptr() *SourceTypeConfigRazorpayAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigRazorpayAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigRazorpayAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigRazorpayAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigRazorpayAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigRazorpayAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigRazorpayAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigRazorpayAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Sanity. Requires type to be `SANITY`. +type SourceTypeConfigSanity struct { + AllowedHttpMethods []SourceTypeConfigSanityAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSanityAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSanity) GetAllowedHttpMethods() []SourceTypeConfigSanityAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSanity) GetAuth() *SourceTypeConfigSanityAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSanity) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSanity) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSanity + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSanity(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSanity) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSanityAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSanityAllowedHttpMethodsItemGet SourceTypeConfigSanityAllowedHttpMethodsItem = "GET" + SourceTypeConfigSanityAllowedHttpMethodsItemPost SourceTypeConfigSanityAllowedHttpMethodsItem = "POST" + SourceTypeConfigSanityAllowedHttpMethodsItemPut SourceTypeConfigSanityAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSanityAllowedHttpMethodsItemPatch SourceTypeConfigSanityAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSanityAllowedHttpMethodsItemDelete SourceTypeConfigSanityAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSanityAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSanityAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSanityAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSanityAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSanityAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSanityAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSanityAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSanityAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSanityAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSanityAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSanityAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSanityAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSanityAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSanityAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSanityAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSanityAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSanityAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Sendgrid. Requires type to be `SENDGRID`. +type SourceTypeConfigSendgrid struct { + AllowedHttpMethods []SourceTypeConfigSendgridAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSendgridAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSendgrid) GetAllowedHttpMethods() []SourceTypeConfigSendgridAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSendgrid) GetAuth() *SourceTypeConfigSendgridAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSendgrid) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSendgrid) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSendgrid + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSendgrid(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSendgrid) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSendgridAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSendgridAllowedHttpMethodsItemGet SourceTypeConfigSendgridAllowedHttpMethodsItem = "GET" + SourceTypeConfigSendgridAllowedHttpMethodsItemPost SourceTypeConfigSendgridAllowedHttpMethodsItem = "POST" + SourceTypeConfigSendgridAllowedHttpMethodsItemPut SourceTypeConfigSendgridAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSendgridAllowedHttpMethodsItemPatch SourceTypeConfigSendgridAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSendgridAllowedHttpMethodsItemDelete SourceTypeConfigSendgridAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSendgridAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSendgridAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSendgridAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSendgridAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSendgridAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSendgridAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSendgridAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSendgridAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSendgridAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSendgridAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSendgridAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSendgridAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSendgridAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSendgridAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSendgridAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSendgridAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSendgridAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Shopify. Requires type to be `SHOPIFY`. +type SourceTypeConfigShopify struct { + AllowedHttpMethods []SourceTypeConfigShopifyAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigShopifyAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigShopify) GetAllowedHttpMethods() []SourceTypeConfigShopifyAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigShopify) GetAuth() *SourceTypeConfigShopifyAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigShopify) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigShopify) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigShopify + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigShopify(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigShopify) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigShopifyAllowedHttpMethodsItem string + +const ( + SourceTypeConfigShopifyAllowedHttpMethodsItemGet SourceTypeConfigShopifyAllowedHttpMethodsItem = "GET" + SourceTypeConfigShopifyAllowedHttpMethodsItemPost SourceTypeConfigShopifyAllowedHttpMethodsItem = "POST" + SourceTypeConfigShopifyAllowedHttpMethodsItemPut SourceTypeConfigShopifyAllowedHttpMethodsItem = "PUT" + SourceTypeConfigShopifyAllowedHttpMethodsItemPatch SourceTypeConfigShopifyAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigShopifyAllowedHttpMethodsItemDelete SourceTypeConfigShopifyAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigShopifyAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigShopifyAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigShopifyAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigShopifyAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigShopifyAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigShopifyAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigShopifyAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigShopifyAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigShopifyAllowedHttpMethodsItem) Ptr() *SourceTypeConfigShopifyAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigShopifyAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigShopifyAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigShopifyAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigShopifyAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigShopifyAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigShopifyAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigShopifyAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Shopline. Requires type to be `SHOPLINE`. +type SourceTypeConfigShopline struct { + AllowedHttpMethods []SourceTypeConfigShoplineAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigShoplineAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigShopline) GetAllowedHttpMethods() []SourceTypeConfigShoplineAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigShopline) GetAuth() *SourceTypeConfigShoplineAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigShopline) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigShopline) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigShopline + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigShopline(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigShopline) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigShoplineAllowedHttpMethodsItem string + +const ( + SourceTypeConfigShoplineAllowedHttpMethodsItemGet SourceTypeConfigShoplineAllowedHttpMethodsItem = "GET" + SourceTypeConfigShoplineAllowedHttpMethodsItemPost SourceTypeConfigShoplineAllowedHttpMethodsItem = "POST" + SourceTypeConfigShoplineAllowedHttpMethodsItemPut SourceTypeConfigShoplineAllowedHttpMethodsItem = "PUT" + SourceTypeConfigShoplineAllowedHttpMethodsItemPatch SourceTypeConfigShoplineAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigShoplineAllowedHttpMethodsItemDelete SourceTypeConfigShoplineAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigShoplineAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigShoplineAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigShoplineAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigShoplineAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigShoplineAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigShoplineAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigShoplineAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigShoplineAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigShoplineAllowedHttpMethodsItem) Ptr() *SourceTypeConfigShoplineAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigShoplineAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigShoplineAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigShoplineAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigShoplineAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigShoplineAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigShoplineAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigShoplineAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Slack. Requires type to be `SLACK`. +type SourceTypeConfigSlack struct { + AllowedHttpMethods []SourceTypeConfigSlackAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSlackAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSlack) GetAllowedHttpMethods() []SourceTypeConfigSlackAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSlack) GetAuth() *SourceTypeConfigSlackAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSlack) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSlack) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSlack + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSlack(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSlack) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSlackAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSlackAllowedHttpMethodsItemGet SourceTypeConfigSlackAllowedHttpMethodsItem = "GET" + SourceTypeConfigSlackAllowedHttpMethodsItemPost SourceTypeConfigSlackAllowedHttpMethodsItem = "POST" + SourceTypeConfigSlackAllowedHttpMethodsItemPut SourceTypeConfigSlackAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSlackAllowedHttpMethodsItemPatch SourceTypeConfigSlackAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSlackAllowedHttpMethodsItemDelete SourceTypeConfigSlackAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSlackAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSlackAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSlackAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSlackAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSlackAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSlackAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSlackAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSlackAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSlackAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSlackAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSlackAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSlackAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSlackAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSlackAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSlackAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSlackAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSlackAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Solidgate. Requires type to be `SOLIDGATE`. +type SourceTypeConfigSolidgate struct { + AllowedHttpMethods []SourceTypeConfigSolidgateAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSolidgateAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSolidgate) GetAllowedHttpMethods() []SourceTypeConfigSolidgateAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSolidgate) GetAuth() *SourceTypeConfigSolidgateAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSolidgate) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSolidgate) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSolidgate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSolidgate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSolidgate) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSolidgateAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSolidgateAllowedHttpMethodsItemGet SourceTypeConfigSolidgateAllowedHttpMethodsItem = "GET" + SourceTypeConfigSolidgateAllowedHttpMethodsItemPost SourceTypeConfigSolidgateAllowedHttpMethodsItem = "POST" + SourceTypeConfigSolidgateAllowedHttpMethodsItemPut SourceTypeConfigSolidgateAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSolidgateAllowedHttpMethodsItemPatch SourceTypeConfigSolidgateAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSolidgateAllowedHttpMethodsItemDelete SourceTypeConfigSolidgateAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSolidgateAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSolidgateAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSolidgateAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSolidgateAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSolidgateAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSolidgateAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSolidgateAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSolidgateAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSolidgateAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSolidgateAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSolidgateAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSolidgateAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSolidgateAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSolidgateAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSolidgateAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSolidgateAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSolidgateAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Square. Requires type to be `SQUARE`. +type SourceTypeConfigSquare struct { + AllowedHttpMethods []SourceTypeConfigSquareAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSquareAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSquare) GetAllowedHttpMethods() []SourceTypeConfigSquareAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSquare) GetAuth() *SourceTypeConfigSquareAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSquare) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSquare) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSquare + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSquare(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSquare) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSquareAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSquareAllowedHttpMethodsItemGet SourceTypeConfigSquareAllowedHttpMethodsItem = "GET" + SourceTypeConfigSquareAllowedHttpMethodsItemPost SourceTypeConfigSquareAllowedHttpMethodsItem = "POST" + SourceTypeConfigSquareAllowedHttpMethodsItemPut SourceTypeConfigSquareAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSquareAllowedHttpMethodsItemPatch SourceTypeConfigSquareAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSquareAllowedHttpMethodsItemDelete SourceTypeConfigSquareAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSquareAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSquareAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSquareAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSquareAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSquareAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSquareAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSquareAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSquareAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSquareAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSquareAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSquareAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSquareAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSquareAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSquareAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSquareAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSquareAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSquareAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Stripe. Requires type to be `STRIPE`. +type SourceTypeConfigStripe struct { + AllowedHttpMethods []SourceTypeConfigStripeAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigStripeAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigStripe) GetAllowedHttpMethods() []SourceTypeConfigStripeAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigStripe) GetAuth() *SourceTypeConfigStripeAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigStripe) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigStripe) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigStripe + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigStripe(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigStripe) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigStripeAllowedHttpMethodsItem string + +const ( + SourceTypeConfigStripeAllowedHttpMethodsItemGet SourceTypeConfigStripeAllowedHttpMethodsItem = "GET" + SourceTypeConfigStripeAllowedHttpMethodsItemPost SourceTypeConfigStripeAllowedHttpMethodsItem = "POST" + SourceTypeConfigStripeAllowedHttpMethodsItemPut SourceTypeConfigStripeAllowedHttpMethodsItem = "PUT" + SourceTypeConfigStripeAllowedHttpMethodsItemPatch SourceTypeConfigStripeAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigStripeAllowedHttpMethodsItemDelete SourceTypeConfigStripeAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigStripeAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigStripeAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigStripeAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigStripeAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigStripeAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigStripeAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigStripeAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigStripeAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigStripeAllowedHttpMethodsItem) Ptr() *SourceTypeConfigStripeAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigStripeAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigStripeAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigStripeAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigStripeAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigStripeAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigStripeAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigStripeAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Svix. Requires type to be `SVIX`. +type SourceTypeConfigSvix struct { + AllowedHttpMethods []SourceTypeConfigSvixAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSvixAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSvix) GetAllowedHttpMethods() []SourceTypeConfigSvixAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSvix) GetAuth() *SourceTypeConfigSvixAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSvix) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSvix) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSvix + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSvix(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSvix) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSvixAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSvixAllowedHttpMethodsItemGet SourceTypeConfigSvixAllowedHttpMethodsItem = "GET" + SourceTypeConfigSvixAllowedHttpMethodsItemPost SourceTypeConfigSvixAllowedHttpMethodsItem = "POST" + SourceTypeConfigSvixAllowedHttpMethodsItemPut SourceTypeConfigSvixAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSvixAllowedHttpMethodsItemPatch SourceTypeConfigSvixAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSvixAllowedHttpMethodsItemDelete SourceTypeConfigSvixAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSvixAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSvixAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSvixAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSvixAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSvixAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSvixAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSvixAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSvixAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSvixAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSvixAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSvixAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSvixAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSvixAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSvixAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSvixAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSvixAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSvixAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Synctera. Requires type to be `SYNCTERA`. +type SourceTypeConfigSynctera struct { + AllowedHttpMethods []SourceTypeConfigSyncteraAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigSyncteraAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSynctera) GetAllowedHttpMethods() []SourceTypeConfigSyncteraAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigSynctera) GetAuth() *SourceTypeConfigSyncteraAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigSynctera) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSynctera) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSynctera + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSynctera(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSynctera) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigSyncteraAllowedHttpMethodsItem string + +const ( + SourceTypeConfigSyncteraAllowedHttpMethodsItemGet SourceTypeConfigSyncteraAllowedHttpMethodsItem = "GET" + SourceTypeConfigSyncteraAllowedHttpMethodsItemPost SourceTypeConfigSyncteraAllowedHttpMethodsItem = "POST" + SourceTypeConfigSyncteraAllowedHttpMethodsItemPut SourceTypeConfigSyncteraAllowedHttpMethodsItem = "PUT" + SourceTypeConfigSyncteraAllowedHttpMethodsItemPatch SourceTypeConfigSyncteraAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigSyncteraAllowedHttpMethodsItemDelete SourceTypeConfigSyncteraAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigSyncteraAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigSyncteraAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigSyncteraAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigSyncteraAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigSyncteraAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigSyncteraAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigSyncteraAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigSyncteraAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigSyncteraAllowedHttpMethodsItem) Ptr() *SourceTypeConfigSyncteraAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigSyncteraAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigSyncteraAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigSyncteraAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigSyncteraAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigSyncteraAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigSyncteraAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigSyncteraAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Telnyx. Requires type to be `TELNYX`. +type SourceTypeConfigTelnyx struct { + AllowedHttpMethods []SourceTypeConfigTelnyxAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTelnyxAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTelnyx) GetAllowedHttpMethods() []SourceTypeConfigTelnyxAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTelnyx) GetAuth() *SourceTypeConfigTelnyxAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTelnyx) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTelnyx) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTelnyx + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTelnyx(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTelnyx) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTelnyxAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTelnyxAllowedHttpMethodsItemGet SourceTypeConfigTelnyxAllowedHttpMethodsItem = "GET" + SourceTypeConfigTelnyxAllowedHttpMethodsItemPost SourceTypeConfigTelnyxAllowedHttpMethodsItem = "POST" + SourceTypeConfigTelnyxAllowedHttpMethodsItemPut SourceTypeConfigTelnyxAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTelnyxAllowedHttpMethodsItemPatch SourceTypeConfigTelnyxAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTelnyxAllowedHttpMethodsItemDelete SourceTypeConfigTelnyxAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTelnyxAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTelnyxAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTelnyxAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTelnyxAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTelnyxAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTelnyxAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTelnyxAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTelnyxAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTelnyxAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTelnyxAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTelnyxAuth struct { + PublicKey string `json:"public_key" url:"public_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTelnyxAuth) GetPublicKey() string { + if s == nil { + return "" + } + return s.PublicKey +} + +func (s *SourceTypeConfigTelnyxAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTelnyxAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTelnyxAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTelnyxAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTelnyxAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for TokenIO. Requires type to be `TOKENIO`. +type SourceTypeConfigTokenIo struct { + AllowedHttpMethods []SourceTypeConfigTokenIoAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTokenIoAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTokenIo) GetAllowedHttpMethods() []SourceTypeConfigTokenIoAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTokenIo) GetAuth() *SourceTypeConfigTokenIoAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTokenIo) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTokenIo) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTokenIo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTokenIo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTokenIo) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTokenIoAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTokenIoAllowedHttpMethodsItemGet SourceTypeConfigTokenIoAllowedHttpMethodsItem = "GET" + SourceTypeConfigTokenIoAllowedHttpMethodsItemPost SourceTypeConfigTokenIoAllowedHttpMethodsItem = "POST" + SourceTypeConfigTokenIoAllowedHttpMethodsItemPut SourceTypeConfigTokenIoAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTokenIoAllowedHttpMethodsItemPatch SourceTypeConfigTokenIoAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTokenIoAllowedHttpMethodsItemDelete SourceTypeConfigTokenIoAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTokenIoAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTokenIoAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTokenIoAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTokenIoAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTokenIoAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTokenIoAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTokenIoAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTokenIoAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTokenIoAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTokenIoAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTokenIoAuth struct { + PublicKey string `json:"public_key" url:"public_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTokenIoAuth) GetPublicKey() string { + if s == nil { + return "" + } + return s.PublicKey +} + +func (s *SourceTypeConfigTokenIoAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTokenIoAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTokenIoAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTokenIoAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTokenIoAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Treezor. Requires type to be `TREEZOR`. +type SourceTypeConfigTreezor struct { + AllowedHttpMethods []SourceTypeConfigTreezorAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTreezorAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTreezor) GetAllowedHttpMethods() []SourceTypeConfigTreezorAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTreezor) GetAuth() *SourceTypeConfigTreezorAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTreezor) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTreezor) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTreezor + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTreezor(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTreezor) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTreezorAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTreezorAllowedHttpMethodsItemGet SourceTypeConfigTreezorAllowedHttpMethodsItem = "GET" + SourceTypeConfigTreezorAllowedHttpMethodsItemPost SourceTypeConfigTreezorAllowedHttpMethodsItem = "POST" + SourceTypeConfigTreezorAllowedHttpMethodsItemPut SourceTypeConfigTreezorAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTreezorAllowedHttpMethodsItemPatch SourceTypeConfigTreezorAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTreezorAllowedHttpMethodsItemDelete SourceTypeConfigTreezorAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTreezorAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTreezorAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTreezorAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTreezorAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTreezorAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTreezorAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTreezorAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTreezorAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTreezorAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTreezorAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTreezorAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTreezorAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigTreezorAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTreezorAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTreezorAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTreezorAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTreezorAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Trello. Requires type to be `TRELLO`. +type SourceTypeConfigTrello struct { + AllowedHttpMethods []SourceTypeConfigTrelloAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTrelloAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTrello) GetAllowedHttpMethods() []SourceTypeConfigTrelloAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTrello) GetAuth() *SourceTypeConfigTrelloAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTrello) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTrello) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTrello + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTrello(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTrello) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTrelloAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTrelloAllowedHttpMethodsItemGet SourceTypeConfigTrelloAllowedHttpMethodsItem = "GET" + SourceTypeConfigTrelloAllowedHttpMethodsItemPost SourceTypeConfigTrelloAllowedHttpMethodsItem = "POST" + SourceTypeConfigTrelloAllowedHttpMethodsItemPut SourceTypeConfigTrelloAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTrelloAllowedHttpMethodsItemPatch SourceTypeConfigTrelloAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTrelloAllowedHttpMethodsItemDelete SourceTypeConfigTrelloAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTrelloAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTrelloAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTrelloAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTrelloAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTrelloAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTrelloAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTrelloAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTrelloAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTrelloAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTrelloAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTrelloAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTrelloAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigTrelloAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTrelloAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTrelloAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTrelloAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTrelloAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Twilio. Requires type to be `TWILIO`. +type SourceTypeConfigTwilio struct { + AllowedHttpMethods []SourceTypeConfigTwilioAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTwilioAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwilio) GetAllowedHttpMethods() []SourceTypeConfigTwilioAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTwilio) GetAuth() *SourceTypeConfigTwilioAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTwilio) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwilio) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwilio + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwilio(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwilio) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTwilioAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTwilioAllowedHttpMethodsItemGet SourceTypeConfigTwilioAllowedHttpMethodsItem = "GET" + SourceTypeConfigTwilioAllowedHttpMethodsItemPost SourceTypeConfigTwilioAllowedHttpMethodsItem = "POST" + SourceTypeConfigTwilioAllowedHttpMethodsItemPut SourceTypeConfigTwilioAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTwilioAllowedHttpMethodsItemPatch SourceTypeConfigTwilioAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTwilioAllowedHttpMethodsItemDelete SourceTypeConfigTwilioAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTwilioAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTwilioAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTwilioAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTwilioAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTwilioAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTwilioAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTwilioAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTwilioAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTwilioAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTwilioAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTwilioAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwilioAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigTwilioAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwilioAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwilioAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwilioAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwilioAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Twitch. Requires type to be `TWITCH`. +type SourceTypeConfigTwitch struct { + AllowedHttpMethods []SourceTypeConfigTwitchAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTwitchAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwitch) GetAllowedHttpMethods() []SourceTypeConfigTwitchAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTwitch) GetAuth() *SourceTypeConfigTwitchAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTwitch) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwitch) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwitch + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwitch(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwitch) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTwitchAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTwitchAllowedHttpMethodsItemGet SourceTypeConfigTwitchAllowedHttpMethodsItem = "GET" + SourceTypeConfigTwitchAllowedHttpMethodsItemPost SourceTypeConfigTwitchAllowedHttpMethodsItem = "POST" + SourceTypeConfigTwitchAllowedHttpMethodsItemPut SourceTypeConfigTwitchAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTwitchAllowedHttpMethodsItemPatch SourceTypeConfigTwitchAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTwitchAllowedHttpMethodsItemDelete SourceTypeConfigTwitchAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTwitchAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTwitchAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTwitchAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTwitchAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTwitchAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTwitchAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTwitchAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTwitchAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTwitchAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTwitchAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTwitchAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwitchAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigTwitchAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwitchAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwitchAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwitchAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwitchAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Twitter. Requires type to be `TWITTER`. +type SourceTypeConfigTwitter struct { + AllowedHttpMethods []SourceTypeConfigTwitterAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTwitterAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwitter) GetAllowedHttpMethods() []SourceTypeConfigTwitterAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTwitter) GetAuth() *SourceTypeConfigTwitterAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTwitter) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwitter) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwitter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwitter(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwitter) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTwitterAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTwitterAllowedHttpMethodsItemGet SourceTypeConfigTwitterAllowedHttpMethodsItem = "GET" + SourceTypeConfigTwitterAllowedHttpMethodsItemPost SourceTypeConfigTwitterAllowedHttpMethodsItem = "POST" + SourceTypeConfigTwitterAllowedHttpMethodsItemPut SourceTypeConfigTwitterAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTwitterAllowedHttpMethodsItemPatch SourceTypeConfigTwitterAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTwitterAllowedHttpMethodsItemDelete SourceTypeConfigTwitterAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTwitterAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTwitterAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTwitterAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTwitterAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTwitterAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTwitterAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTwitterAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTwitterAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTwitterAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTwitterAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTwitterAuth struct { + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTwitterAuth) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigTwitterAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTwitterAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTwitterAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTwitterAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTwitterAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Typeform. Requires type to be `TYPEFORM`. +type SourceTypeConfigTypeform struct { + AllowedHttpMethods []SourceTypeConfigTypeformAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigTypeformAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTypeform) GetAllowedHttpMethods() []SourceTypeConfigTypeformAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigTypeform) GetAuth() *SourceTypeConfigTypeformAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigTypeform) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTypeform) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTypeform + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTypeform(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTypeform) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigTypeformAllowedHttpMethodsItem string + +const ( + SourceTypeConfigTypeformAllowedHttpMethodsItemGet SourceTypeConfigTypeformAllowedHttpMethodsItem = "GET" + SourceTypeConfigTypeformAllowedHttpMethodsItemPost SourceTypeConfigTypeformAllowedHttpMethodsItem = "POST" + SourceTypeConfigTypeformAllowedHttpMethodsItemPut SourceTypeConfigTypeformAllowedHttpMethodsItem = "PUT" + SourceTypeConfigTypeformAllowedHttpMethodsItemPatch SourceTypeConfigTypeformAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigTypeformAllowedHttpMethodsItemDelete SourceTypeConfigTypeformAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigTypeformAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigTypeformAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigTypeformAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigTypeformAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigTypeformAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigTypeformAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigTypeformAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigTypeformAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigTypeformAllowedHttpMethodsItem) Ptr() *SourceTypeConfigTypeformAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigTypeformAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigTypeformAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigTypeformAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigTypeformAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigTypeformAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigTypeformAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigTypeformAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Upollo. Requires type to be `UPOLLO`. +type SourceTypeConfigUpollo struct { + AllowedHttpMethods []SourceTypeConfigUpolloAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigUpolloAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigUpollo) GetAllowedHttpMethods() []SourceTypeConfigUpolloAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigUpollo) GetAuth() *SourceTypeConfigUpolloAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigUpollo) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigUpollo) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigUpollo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigUpollo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigUpollo) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigUpolloAllowedHttpMethodsItem string + +const ( + SourceTypeConfigUpolloAllowedHttpMethodsItemGet SourceTypeConfigUpolloAllowedHttpMethodsItem = "GET" + SourceTypeConfigUpolloAllowedHttpMethodsItemPost SourceTypeConfigUpolloAllowedHttpMethodsItem = "POST" + SourceTypeConfigUpolloAllowedHttpMethodsItemPut SourceTypeConfigUpolloAllowedHttpMethodsItem = "PUT" + SourceTypeConfigUpolloAllowedHttpMethodsItemPatch SourceTypeConfigUpolloAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigUpolloAllowedHttpMethodsItemDelete SourceTypeConfigUpolloAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigUpolloAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigUpolloAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigUpolloAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigUpolloAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigUpolloAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigUpolloAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigUpolloAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigUpolloAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigUpolloAllowedHttpMethodsItem) Ptr() *SourceTypeConfigUpolloAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigUpolloAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigUpolloAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigUpolloAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigUpolloAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigUpolloAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigUpolloAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigUpolloAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Vercel Log Drains. Requires type to be `VERCEL_LOG_DRAINS`. +type SourceTypeConfigVercelLogDrains struct { + VercelLogDrainsSecret *string `json:"vercel_log_drains_secret,omitempty" url:"vercel_log_drains_secret,omitempty"` + AllowedHttpMethods []SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigVercelLogDrainsAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigVercelLogDrains) GetVercelLogDrainsSecret() *string { + if s == nil { + return nil + } + return s.VercelLogDrainsSecret +} + +func (s *SourceTypeConfigVercelLogDrains) GetAllowedHttpMethods() []SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigVercelLogDrains) GetAuth() *SourceTypeConfigVercelLogDrainsAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigVercelLogDrains) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigVercelLogDrains) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigVercelLogDrains + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigVercelLogDrains(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigVercelLogDrains) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem string + +const ( + SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemGet SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem = "GET" + SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPost SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem = "POST" + SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPut SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem = "PUT" + SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPatch SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemDelete SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem) Ptr() *SourceTypeConfigVercelLogDrainsAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigVercelLogDrainsAuth struct { + WebhookSecretKey *string `json:"webhook_secret_key,omitempty" url:"webhook_secret_key,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigVercelLogDrainsAuth) GetWebhookSecretKey() *string { + if s == nil { + return nil + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigVercelLogDrainsAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigVercelLogDrainsAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigVercelLogDrainsAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigVercelLogDrainsAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigVercelLogDrainsAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Vercel Webhooks. Requires type to be `VERCEL`. +type SourceTypeConfigVercelWebhooks struct { + AllowedHttpMethods []SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigVercelWebhooksAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigVercelWebhooks) GetAllowedHttpMethods() []SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigVercelWebhooks) GetAuth() *SourceTypeConfigVercelWebhooksAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigVercelWebhooks) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigVercelWebhooks) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigVercelWebhooks + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigVercelWebhooks(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigVercelWebhooks) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem string + +const ( + SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemGet SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem = "GET" + SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPost SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem = "POST" + SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPut SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem = "PUT" + SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPatch SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemDelete SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigVercelWebhooksAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigVercelWebhooksAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem) Ptr() *SourceTypeConfigVercelWebhooksAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigVercelWebhooksAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigVercelWebhooksAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigVercelWebhooksAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigVercelWebhooksAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigVercelWebhooksAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigVercelWebhooksAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigVercelWebhooksAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Webhook. Requires type to be `WEBHOOK`. +type SourceTypeConfigWebhook struct { + AllowedHttpMethods []SourceTypeConfigWebhookAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + CustomResponse *SourceTypeConfigWebhookCustomResponse `json:"custom_response,omitempty" url:"custom_response,omitempty"` + Type *SourceTypeConfigWebhookType `json:"type,omitempty" url:"type,omitempty"` + Auth *SourceTypeConfigWebhookAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWebhook) GetAllowedHttpMethods() []SourceTypeConfigWebhookAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigWebhook) GetCustomResponse() *SourceTypeConfigWebhookCustomResponse { + if s == nil { + return nil + } + return s.CustomResponse +} + +func (s *SourceTypeConfigWebhook) GetType() *SourceTypeConfigWebhookType { + if s == nil { + return nil + } + return s.Type +} + +func (s *SourceTypeConfigWebhook) GetAuth() *SourceTypeConfigWebhookAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigWebhook) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWebhook) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWebhook + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWebhook(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWebhook) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWebhookAllowedHttpMethodsItem string + +const ( + SourceTypeConfigWebhookAllowedHttpMethodsItemGet SourceTypeConfigWebhookAllowedHttpMethodsItem = "GET" + SourceTypeConfigWebhookAllowedHttpMethodsItemPost SourceTypeConfigWebhookAllowedHttpMethodsItem = "POST" + SourceTypeConfigWebhookAllowedHttpMethodsItemPut SourceTypeConfigWebhookAllowedHttpMethodsItem = "PUT" + SourceTypeConfigWebhookAllowedHttpMethodsItemPatch SourceTypeConfigWebhookAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigWebhookAllowedHttpMethodsItemDelete SourceTypeConfigWebhookAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigWebhookAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigWebhookAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigWebhookAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigWebhookAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigWebhookAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigWebhookAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigWebhookAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigWebhookAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWebhookAllowedHttpMethodsItem) Ptr() *SourceTypeConfigWebhookAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigWebhookAuth struct { + SourceTypeConfigWebhookAuthAlgorithm *SourceTypeConfigWebhookAuthAlgorithm + SourceTypeConfigWebhookAuthPassword *SourceTypeConfigWebhookAuthPassword + SourceTypeConfigWebhookAuthApiKey *SourceTypeConfigWebhookAuthApiKey + + typ string +} + +func NewSourceTypeConfigWebhookAuthFromSourceTypeConfigWebhookAuthAlgorithm(value *SourceTypeConfigWebhookAuthAlgorithm) *SourceTypeConfigWebhookAuth { + return &SourceTypeConfigWebhookAuth{typ: "SourceTypeConfigWebhookAuthAlgorithm", SourceTypeConfigWebhookAuthAlgorithm: value} +} + +func NewSourceTypeConfigWebhookAuthFromSourceTypeConfigWebhookAuthPassword(value *SourceTypeConfigWebhookAuthPassword) *SourceTypeConfigWebhookAuth { + return &SourceTypeConfigWebhookAuth{typ: "SourceTypeConfigWebhookAuthPassword", SourceTypeConfigWebhookAuthPassword: value} +} + +func NewSourceTypeConfigWebhookAuthFromSourceTypeConfigWebhookAuthApiKey(value *SourceTypeConfigWebhookAuthApiKey) *SourceTypeConfigWebhookAuth { + return &SourceTypeConfigWebhookAuth{typ: "SourceTypeConfigWebhookAuthApiKey", SourceTypeConfigWebhookAuthApiKey: value} +} + +func (s *SourceTypeConfigWebhookAuth) GetSourceTypeConfigWebhookAuthAlgorithm() *SourceTypeConfigWebhookAuthAlgorithm { + if s == nil { + return nil + } + return s.SourceTypeConfigWebhookAuthAlgorithm +} + +func (s *SourceTypeConfigWebhookAuth) GetSourceTypeConfigWebhookAuthPassword() *SourceTypeConfigWebhookAuthPassword { + if s == nil { + return nil + } + return s.SourceTypeConfigWebhookAuthPassword +} + +func (s *SourceTypeConfigWebhookAuth) GetSourceTypeConfigWebhookAuthApiKey() *SourceTypeConfigWebhookAuthApiKey { + if s == nil { + return nil + } + return s.SourceTypeConfigWebhookAuthApiKey +} + +func (s *SourceTypeConfigWebhookAuth) UnmarshalJSON(data []byte) error { + valueSourceTypeConfigWebhookAuthAlgorithm := new(SourceTypeConfigWebhookAuthAlgorithm) + if err := json.Unmarshal(data, &valueSourceTypeConfigWebhookAuthAlgorithm); err == nil { + s.typ = "SourceTypeConfigWebhookAuthAlgorithm" + s.SourceTypeConfigWebhookAuthAlgorithm = valueSourceTypeConfigWebhookAuthAlgorithm + return nil + } + valueSourceTypeConfigWebhookAuthPassword := new(SourceTypeConfigWebhookAuthPassword) + if err := json.Unmarshal(data, &valueSourceTypeConfigWebhookAuthPassword); err == nil { + s.typ = "SourceTypeConfigWebhookAuthPassword" + s.SourceTypeConfigWebhookAuthPassword = valueSourceTypeConfigWebhookAuthPassword + return nil + } + valueSourceTypeConfigWebhookAuthApiKey := new(SourceTypeConfigWebhookAuthApiKey) + if err := json.Unmarshal(data, &valueSourceTypeConfigWebhookAuthApiKey); err == nil { + s.typ = "SourceTypeConfigWebhookAuthApiKey" + s.SourceTypeConfigWebhookAuthApiKey = valueSourceTypeConfigWebhookAuthApiKey + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SourceTypeConfigWebhookAuth) MarshalJSON() ([]byte, error) { + if s.typ == "SourceTypeConfigWebhookAuthAlgorithm" || s.SourceTypeConfigWebhookAuthAlgorithm != nil { + return json.Marshal(s.SourceTypeConfigWebhookAuthAlgorithm) + } + if s.typ == "SourceTypeConfigWebhookAuthPassword" || s.SourceTypeConfigWebhookAuthPassword != nil { + return json.Marshal(s.SourceTypeConfigWebhookAuthPassword) + } + if s.typ == "SourceTypeConfigWebhookAuthApiKey" || s.SourceTypeConfigWebhookAuthApiKey != nil { + return json.Marshal(s.SourceTypeConfigWebhookAuthApiKey) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SourceTypeConfigWebhookAuthVisitor interface { + VisitSourceTypeConfigWebhookAuthAlgorithm(*SourceTypeConfigWebhookAuthAlgorithm) error + VisitSourceTypeConfigWebhookAuthPassword(*SourceTypeConfigWebhookAuthPassword) error + VisitSourceTypeConfigWebhookAuthApiKey(*SourceTypeConfigWebhookAuthApiKey) error +} + +func (s *SourceTypeConfigWebhookAuth) Accept(visitor SourceTypeConfigWebhookAuthVisitor) error { + if s.typ == "SourceTypeConfigWebhookAuthAlgorithm" || s.SourceTypeConfigWebhookAuthAlgorithm != nil { + return visitor.VisitSourceTypeConfigWebhookAuthAlgorithm(s.SourceTypeConfigWebhookAuthAlgorithm) + } + if s.typ == "SourceTypeConfigWebhookAuthPassword" || s.SourceTypeConfigWebhookAuthPassword != nil { + return visitor.VisitSourceTypeConfigWebhookAuthPassword(s.SourceTypeConfigWebhookAuthPassword) + } + if s.typ == "SourceTypeConfigWebhookAuthApiKey" || s.SourceTypeConfigWebhookAuthApiKey != nil { + return visitor.VisitSourceTypeConfigWebhookAuthApiKey(s.SourceTypeConfigWebhookAuthApiKey) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SourceTypeConfigWebhookAuthAlgorithm struct { + Algorithm SourceTypeConfigWebhookAuthAlgorithmAlgorithm `json:"algorithm" url:"algorithm"` + Encoding SourceTypeConfigWebhookAuthAlgorithmEncoding `json:"encoding" url:"encoding"` + HeaderKey string `json:"header_key" url:"header_key"` + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) GetAlgorithm() SourceTypeConfigWebhookAuthAlgorithmAlgorithm { + if s == nil { + return "" + } + return s.Algorithm +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) GetEncoding() SourceTypeConfigWebhookAuthAlgorithmEncoding { + if s == nil { + return "" + } + return s.Encoding +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWebhookAuthAlgorithm + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWebhookAuthAlgorithm(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWebhookAuthAlgorithm) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWebhookAuthAlgorithmAlgorithm string + +const ( + SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha1 SourceTypeConfigWebhookAuthAlgorithmAlgorithm = "sha1" + SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha256 SourceTypeConfigWebhookAuthAlgorithmAlgorithm = "sha256" + SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha512 SourceTypeConfigWebhookAuthAlgorithmAlgorithm = "sha512" + SourceTypeConfigWebhookAuthAlgorithmAlgorithmMd5 SourceTypeConfigWebhookAuthAlgorithmAlgorithm = "md5" +) + +func NewSourceTypeConfigWebhookAuthAlgorithmAlgorithmFromString(s string) (SourceTypeConfigWebhookAuthAlgorithmAlgorithm, error) { + switch s { + case "sha1": + return SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha1, nil + case "sha256": + return SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha256, nil + case "sha512": + return SourceTypeConfigWebhookAuthAlgorithmAlgorithmSha512, nil + case "md5": + return SourceTypeConfigWebhookAuthAlgorithmAlgorithmMd5, nil + } + var t SourceTypeConfigWebhookAuthAlgorithmAlgorithm + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWebhookAuthAlgorithmAlgorithm) Ptr() *SourceTypeConfigWebhookAuthAlgorithmAlgorithm { + return &s +} + +type SourceTypeConfigWebhookAuthAlgorithmEncoding string + +const ( + SourceTypeConfigWebhookAuthAlgorithmEncodingBase64 SourceTypeConfigWebhookAuthAlgorithmEncoding = "base64" + SourceTypeConfigWebhookAuthAlgorithmEncodingBase64Url SourceTypeConfigWebhookAuthAlgorithmEncoding = "base64url" + SourceTypeConfigWebhookAuthAlgorithmEncodingHex SourceTypeConfigWebhookAuthAlgorithmEncoding = "hex" +) + +func NewSourceTypeConfigWebhookAuthAlgorithmEncodingFromString(s string) (SourceTypeConfigWebhookAuthAlgorithmEncoding, error) { + switch s { + case "base64": + return SourceTypeConfigWebhookAuthAlgorithmEncodingBase64, nil + case "base64url": + return SourceTypeConfigWebhookAuthAlgorithmEncodingBase64Url, nil + case "hex": + return SourceTypeConfigWebhookAuthAlgorithmEncodingHex, nil + } + var t SourceTypeConfigWebhookAuthAlgorithmEncoding + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWebhookAuthAlgorithmEncoding) Ptr() *SourceTypeConfigWebhookAuthAlgorithmEncoding { + return &s +} + +type SourceTypeConfigWebhookAuthApiKey struct { + HeaderKey string `json:"header_key" url:"header_key"` + ApiKey string `json:"api_key" url:"api_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWebhookAuthApiKey) GetHeaderKey() string { + if s == nil { + return "" + } + return s.HeaderKey +} + +func (s *SourceTypeConfigWebhookAuthApiKey) GetApiKey() string { + if s == nil { + return "" + } + return s.ApiKey +} + +func (s *SourceTypeConfigWebhookAuthApiKey) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWebhookAuthApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWebhookAuthApiKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWebhookAuthApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWebhookAuthApiKey) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWebhookAuthPassword struct { + Username *string `json:"username,omitempty" url:"username,omitempty"` + Password *string `json:"password,omitempty" url:"password,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWebhookAuthPassword) GetUsername() *string { + if s == nil { + return nil + } + return s.Username +} + +func (s *SourceTypeConfigWebhookAuthPassword) GetPassword() *string { + if s == nil { + return nil + } + return s.Password +} + +func (s *SourceTypeConfigWebhookAuthPassword) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWebhookAuthPassword) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWebhookAuthPassword + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWebhookAuthPassword(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWebhookAuthPassword) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWebhookCustomResponse struct { + ContentType *SourceTypeConfigWebhookCustomResponseContentType `json:"content_type,omitempty" url:"content_type,omitempty"` + Body string `json:"body" url:"body"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWebhookCustomResponse) GetContentType() *SourceTypeConfigWebhookCustomResponseContentType { + if s == nil { + return nil + } + return s.ContentType +} + +func (s *SourceTypeConfigWebhookCustomResponse) GetBody() string { + if s == nil { + return "" + } + return s.Body +} + +func (s *SourceTypeConfigWebhookCustomResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWebhookCustomResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWebhookCustomResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWebhookCustomResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWebhookCustomResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWebhookCustomResponseContentType string + +const ( + SourceTypeConfigWebhookCustomResponseContentTypeJson SourceTypeConfigWebhookCustomResponseContentType = "json" + SourceTypeConfigWebhookCustomResponseContentTypeText SourceTypeConfigWebhookCustomResponseContentType = "text" + SourceTypeConfigWebhookCustomResponseContentTypeXml SourceTypeConfigWebhookCustomResponseContentType = "xml" +) + +func NewSourceTypeConfigWebhookCustomResponseContentTypeFromString(s string) (SourceTypeConfigWebhookCustomResponseContentType, error) { + switch s { + case "json": + return SourceTypeConfigWebhookCustomResponseContentTypeJson, nil + case "text": + return SourceTypeConfigWebhookCustomResponseContentTypeText, nil + case "xml": + return SourceTypeConfigWebhookCustomResponseContentTypeXml, nil + } + var t SourceTypeConfigWebhookCustomResponseContentType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWebhookCustomResponseContentType) Ptr() *SourceTypeConfigWebhookCustomResponseContentType { + return &s +} + +type SourceTypeConfigWebhookType string + +const ( + SourceTypeConfigWebhookTypeHmac SourceTypeConfigWebhookType = "HMAC" + SourceTypeConfigWebhookTypeBasicAuth SourceTypeConfigWebhookType = "BASIC_AUTH" + SourceTypeConfigWebhookTypeApiKey SourceTypeConfigWebhookType = "API_KEY" +) + +func NewSourceTypeConfigWebhookTypeFromString(s string) (SourceTypeConfigWebhookType, error) { + switch s { + case "HMAC": + return SourceTypeConfigWebhookTypeHmac, nil + case "BASIC_AUTH": + return SourceTypeConfigWebhookTypeBasicAuth, nil + case "API_KEY": + return SourceTypeConfigWebhookTypeApiKey, nil + } + var t SourceTypeConfigWebhookType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWebhookType) Ptr() *SourceTypeConfigWebhookType { + return &s +} + +// The type config for WhatsApp. Requires type to be `WHATSAPP`. +type SourceTypeConfigWhatsApp struct { + AllowedHttpMethods []SourceTypeConfigWhatsAppAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigWhatsAppAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWhatsApp) GetAllowedHttpMethods() []SourceTypeConfigWhatsAppAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigWhatsApp) GetAuth() *SourceTypeConfigWhatsAppAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigWhatsApp) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWhatsApp) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWhatsApp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWhatsApp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWhatsApp) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWhatsAppAllowedHttpMethodsItem string + +const ( + SourceTypeConfigWhatsAppAllowedHttpMethodsItemGet SourceTypeConfigWhatsAppAllowedHttpMethodsItem = "GET" + SourceTypeConfigWhatsAppAllowedHttpMethodsItemPost SourceTypeConfigWhatsAppAllowedHttpMethodsItem = "POST" + SourceTypeConfigWhatsAppAllowedHttpMethodsItemPut SourceTypeConfigWhatsAppAllowedHttpMethodsItem = "PUT" + SourceTypeConfigWhatsAppAllowedHttpMethodsItemPatch SourceTypeConfigWhatsAppAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigWhatsAppAllowedHttpMethodsItemDelete SourceTypeConfigWhatsAppAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigWhatsAppAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigWhatsAppAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigWhatsAppAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigWhatsAppAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigWhatsAppAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigWhatsAppAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigWhatsAppAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigWhatsAppAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWhatsAppAllowedHttpMethodsItem) Ptr() *SourceTypeConfigWhatsAppAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigWhatsAppAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWhatsAppAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigWhatsAppAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWhatsAppAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWhatsAppAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWhatsAppAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWhatsAppAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Wix. Requires type to be `WIX`. +type SourceTypeConfigWix struct { + AllowedHttpMethods []SourceTypeConfigWixAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigWixAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWix) GetAllowedHttpMethods() []SourceTypeConfigWixAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigWix) GetAuth() *SourceTypeConfigWixAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigWix) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWix) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWix + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWix(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWix) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWixAllowedHttpMethodsItem string + +const ( + SourceTypeConfigWixAllowedHttpMethodsItemGet SourceTypeConfigWixAllowedHttpMethodsItem = "GET" + SourceTypeConfigWixAllowedHttpMethodsItemPost SourceTypeConfigWixAllowedHttpMethodsItem = "POST" + SourceTypeConfigWixAllowedHttpMethodsItemPut SourceTypeConfigWixAllowedHttpMethodsItem = "PUT" + SourceTypeConfigWixAllowedHttpMethodsItemPatch SourceTypeConfigWixAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigWixAllowedHttpMethodsItemDelete SourceTypeConfigWixAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigWixAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigWixAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigWixAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigWixAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigWixAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigWixAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigWixAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigWixAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWixAllowedHttpMethodsItem) Ptr() *SourceTypeConfigWixAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigWixAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWixAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigWixAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWixAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWixAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWixAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWixAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for WooCommerce. Requires type to be `WOOCOMMERCE`. +type SourceTypeConfigWooCommerce struct { + AllowedHttpMethods []SourceTypeConfigWooCommerceAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigWooCommerceAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWooCommerce) GetAllowedHttpMethods() []SourceTypeConfigWooCommerceAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigWooCommerce) GetAuth() *SourceTypeConfigWooCommerceAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigWooCommerce) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWooCommerce) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWooCommerce + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWooCommerce(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWooCommerce) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWooCommerceAllowedHttpMethodsItem string + +const ( + SourceTypeConfigWooCommerceAllowedHttpMethodsItemGet SourceTypeConfigWooCommerceAllowedHttpMethodsItem = "GET" + SourceTypeConfigWooCommerceAllowedHttpMethodsItemPost SourceTypeConfigWooCommerceAllowedHttpMethodsItem = "POST" + SourceTypeConfigWooCommerceAllowedHttpMethodsItemPut SourceTypeConfigWooCommerceAllowedHttpMethodsItem = "PUT" + SourceTypeConfigWooCommerceAllowedHttpMethodsItemPatch SourceTypeConfigWooCommerceAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigWooCommerceAllowedHttpMethodsItemDelete SourceTypeConfigWooCommerceAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigWooCommerceAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigWooCommerceAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigWooCommerceAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigWooCommerceAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigWooCommerceAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigWooCommerceAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigWooCommerceAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigWooCommerceAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWooCommerceAllowedHttpMethodsItem) Ptr() *SourceTypeConfigWooCommerceAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigWooCommerceAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWooCommerceAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigWooCommerceAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWooCommerceAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWooCommerceAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWooCommerceAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWooCommerceAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for WorkOS. Requires type to be `WORKOS`. +type SourceTypeConfigWorkOs struct { + AllowedHttpMethods []SourceTypeConfigWorkOsAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigWorkOsAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWorkOs) GetAllowedHttpMethods() []SourceTypeConfigWorkOsAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigWorkOs) GetAuth() *SourceTypeConfigWorkOsAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigWorkOs) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWorkOs) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWorkOs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWorkOs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWorkOs) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigWorkOsAllowedHttpMethodsItem string + +const ( + SourceTypeConfigWorkOsAllowedHttpMethodsItemGet SourceTypeConfigWorkOsAllowedHttpMethodsItem = "GET" + SourceTypeConfigWorkOsAllowedHttpMethodsItemPost SourceTypeConfigWorkOsAllowedHttpMethodsItem = "POST" + SourceTypeConfigWorkOsAllowedHttpMethodsItemPut SourceTypeConfigWorkOsAllowedHttpMethodsItem = "PUT" + SourceTypeConfigWorkOsAllowedHttpMethodsItemPatch SourceTypeConfigWorkOsAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigWorkOsAllowedHttpMethodsItemDelete SourceTypeConfigWorkOsAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigWorkOsAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigWorkOsAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigWorkOsAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigWorkOsAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigWorkOsAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigWorkOsAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigWorkOsAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigWorkOsAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigWorkOsAllowedHttpMethodsItem) Ptr() *SourceTypeConfigWorkOsAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigWorkOsAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigWorkOsAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigWorkOsAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigWorkOsAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigWorkOsAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigWorkOsAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigWorkOsAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Xero. Requires type to be `XERO`. +type SourceTypeConfigXero struct { + AllowedHttpMethods []SourceTypeConfigXeroAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigXeroAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigXero) GetAllowedHttpMethods() []SourceTypeConfigXeroAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigXero) GetAuth() *SourceTypeConfigXeroAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigXero) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigXero) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigXero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigXero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigXero) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigXeroAllowedHttpMethodsItem string + +const ( + SourceTypeConfigXeroAllowedHttpMethodsItemGet SourceTypeConfigXeroAllowedHttpMethodsItem = "GET" + SourceTypeConfigXeroAllowedHttpMethodsItemPost SourceTypeConfigXeroAllowedHttpMethodsItem = "POST" + SourceTypeConfigXeroAllowedHttpMethodsItemPut SourceTypeConfigXeroAllowedHttpMethodsItem = "PUT" + SourceTypeConfigXeroAllowedHttpMethodsItemPatch SourceTypeConfigXeroAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigXeroAllowedHttpMethodsItemDelete SourceTypeConfigXeroAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigXeroAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigXeroAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigXeroAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigXeroAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigXeroAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigXeroAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigXeroAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigXeroAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigXeroAllowedHttpMethodsItem) Ptr() *SourceTypeConfigXeroAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigXeroAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigXeroAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigXeroAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigXeroAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigXeroAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigXeroAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigXeroAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// The type config for Zoom. Requires type to be `ZOOM`. +type SourceTypeConfigZoom struct { + AllowedHttpMethods []SourceTypeConfigZoomAllowedHttpMethodsItem `json:"allowed_http_methods,omitempty" url:"allowed_http_methods,omitempty"` + Auth *SourceTypeConfigZoomAuth `json:"auth,omitempty" url:"auth,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigZoom) GetAllowedHttpMethods() []SourceTypeConfigZoomAllowedHttpMethodsItem { + if s == nil { + return nil + } + return s.AllowedHttpMethods +} + +func (s *SourceTypeConfigZoom) GetAuth() *SourceTypeConfigZoomAuth { + if s == nil { + return nil + } + return s.Auth +} + +func (s *SourceTypeConfigZoom) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigZoom) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigZoom + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigZoom(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigZoom) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SourceTypeConfigZoomAllowedHttpMethodsItem string + +const ( + SourceTypeConfigZoomAllowedHttpMethodsItemGet SourceTypeConfigZoomAllowedHttpMethodsItem = "GET" + SourceTypeConfigZoomAllowedHttpMethodsItemPost SourceTypeConfigZoomAllowedHttpMethodsItem = "POST" + SourceTypeConfigZoomAllowedHttpMethodsItemPut SourceTypeConfigZoomAllowedHttpMethodsItem = "PUT" + SourceTypeConfigZoomAllowedHttpMethodsItemPatch SourceTypeConfigZoomAllowedHttpMethodsItem = "PATCH" + SourceTypeConfigZoomAllowedHttpMethodsItemDelete SourceTypeConfigZoomAllowedHttpMethodsItem = "DELETE" +) + +func NewSourceTypeConfigZoomAllowedHttpMethodsItemFromString(s string) (SourceTypeConfigZoomAllowedHttpMethodsItem, error) { + switch s { + case "GET": + return SourceTypeConfigZoomAllowedHttpMethodsItemGet, nil + case "POST": + return SourceTypeConfigZoomAllowedHttpMethodsItemPost, nil + case "PUT": + return SourceTypeConfigZoomAllowedHttpMethodsItemPut, nil + case "PATCH": + return SourceTypeConfigZoomAllowedHttpMethodsItemPatch, nil + case "DELETE": + return SourceTypeConfigZoomAllowedHttpMethodsItemDelete, nil + } + var t SourceTypeConfigZoomAllowedHttpMethodsItem + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SourceTypeConfigZoomAllowedHttpMethodsItem) Ptr() *SourceTypeConfigZoomAllowedHttpMethodsItem { + return &s +} + +type SourceTypeConfigZoomAuth struct { + WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SourceTypeConfigZoomAuth) GetWebhookSecretKey() string { + if s == nil { + return "" + } + return s.WebhookSecretKey +} + +func (s *SourceTypeConfigZoomAuth) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SourceTypeConfigZoomAuth) UnmarshalJSON(data []byte) error { + type unmarshaler SourceTypeConfigZoomAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SourceTypeConfigZoomAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SourceTypeConfigZoomAuth) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type TransformationExecution struct { + Id string `json:"id" url:"id"` + TransformedEventDataId string `json:"transformed_event_data_id" url:"transformed_event_data_id"` + OriginalEventDataId string `json:"original_event_data_id" url:"original_event_data_id"` + TransformationId string `json:"transformation_id" url:"transformation_id"` + // ID of the project + TeamId string `json:"team_id" url:"team_id"` + WebhookId string `json:"webhook_id" url:"webhook_id"` + LogLevel TransformationExecutionLogLevel `json:"log_level" url:"log_level"` + Logs []*ConsoleLine `json:"logs,omitempty" url:"logs,omitempty"` + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + CreatedAt time.Time `json:"created_at" url:"created_at"` + OriginalEventData *ShortEventData `json:"original_event_data,omitempty" url:"original_event_data,omitempty"` + TransformedEventData *ShortEventData `json:"transformed_event_data,omitempty" url:"transformed_event_data,omitempty"` + IssueId *string `json:"issue_id,omitempty" url:"issue_id,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TransformationExecution) GetId() string { + if t == nil { + return "" + } + return t.Id +} + +func (t *TransformationExecution) GetTransformedEventDataId() string { + if t == nil { + return "" + } + return t.TransformedEventDataId +} + +func (t *TransformationExecution) GetOriginalEventDataId() string { + if t == nil { + return "" + } + return t.OriginalEventDataId +} + +func (t *TransformationExecution) GetTransformationId() string { + if t == nil { + return "" + } + return t.TransformationId +} + +func (t *TransformationExecution) GetTeamId() string { + if t == nil { + return "" + } + return t.TeamId +} + +func (t *TransformationExecution) GetWebhookId() string { + if t == nil { + return "" + } + return t.WebhookId +} + +func (t *TransformationExecution) GetLogLevel() TransformationExecutionLogLevel { + if t == nil { + return "" + } + return t.LogLevel +} + +func (t *TransformationExecution) GetLogs() []*ConsoleLine { + if t == nil { + return nil + } + return t.Logs +} + +func (t *TransformationExecution) GetUpdatedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.UpdatedAt +} + +func (t *TransformationExecution) GetCreatedAt() time.Time { + if t == nil { + return time.Time{} + } + return t.CreatedAt +} + +func (t *TransformationExecution) GetOriginalEventData() *ShortEventData { + if t == nil { + return nil + } + return t.OriginalEventData } -func NewVerificationConfigFromTelnyx(value *VerificationTelnyx) *VerificationConfig { - return &VerificationConfig{Type: "telnyx", Telnyx: value} +func (t *TransformationExecution) GetTransformedEventData() *ShortEventData { + if t == nil { + return nil + } + return t.TransformedEventData } -func NewVerificationConfigFromDiscord(value *VerificationDiscord) *VerificationConfig { - return &VerificationConfig{Type: "discord", Discord: value} +func (t *TransformationExecution) GetIssueId() *string { + if t == nil { + return nil + } + return t.IssueId } -func NewVerificationConfigFromTokenio(value *VerificationTokenIo) *VerificationConfig { - return &VerificationConfig{Type: "tokenio", Tokenio: value} +func (t *TransformationExecution) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func NewVerificationConfigFromFiserv(value *VerificationFiserv) *VerificationConfig { - return &VerificationConfig{Type: "fiserv", Fiserv: value} +func (t *TransformationExecution) UnmarshalJSON(data []byte) error { + type embed TransformationExecution + var unmarshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TransformationExecution(unmarshaler.embed) + t.UpdatedAt = unmarshaler.UpdatedAt.Time() + t.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil } -func NewVerificationConfigFromBondsmith(value *VerificationBondsmith) *VerificationConfig { - return &VerificationConfig{Type: "bondsmith", Bondsmith: value} +func (t *TransformationExecution) MarshalJSON() ([]byte, error) { + type embed TransformationExecution + var marshaler = struct { + embed + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*t), + UpdatedAt: internal.NewDateTime(t.UpdatedAt), + CreatedAt: internal.NewDateTime(t.CreatedAt), + } + return json.Marshal(marshaler) } -func NewVerificationConfigFromVercelLogDrains(value *VerificationVercelLogDrains) *VerificationConfig { - return &VerificationConfig{Type: "vercel_log_drains", VercelLogDrains: value} +func (t *TransformationExecution) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -func NewVerificationConfigFromVercel(value *VerificationVercel) *VerificationConfig { - return &VerificationConfig{Type: "vercel", Vercel: value} +// The minimum log level to open the issue on +type TransformationExecutionLogLevel string + +const ( + TransformationExecutionLogLevelDebug TransformationExecutionLogLevel = "debug" + TransformationExecutionLogLevelInfo TransformationExecutionLogLevel = "info" + TransformationExecutionLogLevelWarn TransformationExecutionLogLevel = "warn" + TransformationExecutionLogLevelError TransformationExecutionLogLevel = "error" + TransformationExecutionLogLevelFatal TransformationExecutionLogLevel = "fatal" +) + +func NewTransformationExecutionLogLevelFromString(s string) (TransformationExecutionLogLevel, error) { + switch s { + case "debug": + return TransformationExecutionLogLevelDebug, nil + case "info": + return TransformationExecutionLogLevelInfo, nil + case "warn": + return TransformationExecutionLogLevelWarn, nil + case "error": + return TransformationExecutionLogLevelError, nil + case "fatal": + return TransformationExecutionLogLevelFatal, nil + } + var t TransformationExecutionLogLevel + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func NewVerificationConfigFromTebex(value *VerificationTebex) *VerificationConfig { - return &VerificationConfig{Type: "tebex", Tebex: value} +func (t TransformationExecutionLogLevel) Ptr() *TransformationExecutionLogLevel { + return &t } -func NewVerificationConfigFromSlack(value *VerificationSlack) *VerificationConfig { - return &VerificationConfig{Type: "slack", Slack: value} +// The type config for 3d Eye. Requires type to be `THREE_D_EYE`. +type Type3DEyeConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *Type3DEyeConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *Type3DEyeConfig) UnmarshalJSON(data []byte) error { + type unmarshaler Type3DEyeConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = Type3DEyeConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *Type3DEyeConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Adyen. Requires type to be `ADYEN`. +type TypeAdyenConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeAdyenConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeAdyenConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeAdyenConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeAdyenConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeAdyenConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Airwallex. Requires type to be `AIRWALLEX`. +type TypeAirwallexConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeAirwallexConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeAirwallexConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeAirwallexConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeAirwallexConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeAirwallexConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Akeneo. Requires type to be `AKENEO`. +type TypeAkeneoConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeAkeneoConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeAkeneoConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeAkeneoConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeAkeneoConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeAkeneoConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for API Key. Requires type to be `API_KEY`. +type TypeApiKeyConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeApiKeyConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeApiKeyConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeApiKeyConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeApiKeyConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeApiKeyConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for AWS SNS. Requires type to be `AWS_SNS`. +type TypeAwssnsConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeAwssnsConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeAwssnsConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeAwssnsConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeAwssnsConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeAwssnsConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Basic Auth. Requires type to be `BASIC_AUTH`. +type TypeBasicAuthConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeBasicAuthConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeBasicAuthConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeBasicAuthConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeBasicAuthConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeBasicAuthConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -func NewVerificationConfigFromRazorpay(value *VerificationRazorpay) *VerificationConfig { - return &VerificationConfig{Type: "razorpay", Razorpay: value} +// The type config for Bondsmith. Requires type to be `BONDSMITH`. +type TypeBondsmithConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewVerificationConfigFromMailchimp(value *VerificationMailchimp) *VerificationConfig { - return &VerificationConfig{Type: "mailchimp", Mailchimp: value} +func (t *TypeBondsmithConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func NewVerificationConfigFromPaddle(value *VerificationPaddle) *VerificationConfig { - return &VerificationConfig{Type: "paddle", Paddle: value} +func (t *TypeBondsmithConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeBondsmithConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeBondsmithConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil } -func NewVerificationConfigFromPaypal(value *VerificationPaypal) *VerificationConfig { - return &VerificationConfig{Type: "paypal", Paypal: value} +func (t *TypeBondsmithConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -func NewVerificationConfigFromTreezor(value *VerificationTreezor) *VerificationConfig { - return &VerificationConfig{Type: "treezor", Treezor: value} +// The type config for Bridge. Requires type to be `BRIDGE`. +type TypeBridgeConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewVerificationConfigFromPraxis(value *VerificationPraxis) *VerificationConfig { - return &VerificationConfig{Type: "praxis", Praxis: value} +func (t *TypeBridgeConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationConfig) UnmarshalJSON(data []byte) error { - var unmarshaler struct { - Type string `json:"type"` - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (t *TypeBridgeConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeBridgeConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - v.Type = unmarshaler.Type - if unmarshaler.Type == "" { - return fmt.Errorf("%T did not include discriminant type", v) + *t = TypeBridgeConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err } - switch unmarshaler.Type { - case "hmac": - value := new(VerificationHmac) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Hmac = value - case "basic_auth": - value := new(VerificationBasicAuth) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.BasicAuth = value - case "api_key": - value := new(VerificationApiKey) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.ApiKey = value - case "bridge": - value := new(VerificationBridge) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Bridge = value - case "cloudsignal": - value := new(VerificationCloudSignal) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Cloudsignal = value - case "courier": - value := new(VerificationCourier) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Courier = value - case "frontapp": - value := new(VerificationFrontApp) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Frontapp = value - case "twitter": - value := new(VerificationTwitter) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Twitter = value - case "stripe": - value := new(VerificationStripe) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Stripe = value - case "recharge": - value := new(VerificationRecharge) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Recharge = value - case "twilio": - value := new(VerificationTwilio) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Twilio = value - case "github": - value := new(VerificationGitHub) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Github = value - case "shopify": - value := new(VerificationShopify) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Shopify = value - case "postmark": - value := new(VerificationPostmark) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Postmark = value - case "typeform": - value := new(VerificationTypeform) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Typeform = value - case "xero": - value := new(VerificationXero) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Xero = value - case "svix": - value := new(VerificationSvix) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Svix = value - case "zoom": - value := new(VerificationZoom) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Zoom = value - case "akeneo": - value := new(VerificationAkeneo) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Akeneo = value - case "adyen": - value := new(VerificationAdyen) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Adyen = value - case "gitlab": - value := new(VerificationGitLab) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Gitlab = value - case "property-finder": - value := new(VerificationPropertyFinder) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.PropertyFinder = value - case "woocommerce": - value := new(VerificationWooCommerce) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Woocommerce = value - case "oura": - value := new(VerificationOura) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Oura = value - case "commercelayer": - value := new(VerificationCommercelayer) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Commercelayer = value - case "hubspot": - value := new(VerificationHubspot) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Hubspot = value - case "mailgun": - value := new(VerificationMailgun) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Mailgun = value - case "persona": - value := new(VerificationPersona) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Persona = value - case "pipedrive": - value := new(VerificationPipedrive) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Pipedrive = value - case "sendgrid": - value := new(VerificationSendGrid) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Sendgrid = value - case "workos": - value := new(VerificationWorkOs) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Workos = value - case "synctera": - value := new(VerificationSynctera) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.Synctera = value - case "aws_sns": - value := new(VerificationAwssns) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.AwsSns = value - case "three_d_eye": - value := new(Verification3DEye) - if err := json.Unmarshal(data, &value); err != nil { - return err - } - v.ThreeDEye = value - case "twitch": - value := new(VerificationTwitch) - if err := json.Unmarshal(data, &value); err != nil { - return err + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeBridgeConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Twitch = value - case "enode": - value := new(VerificationEnode) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Cloud Signal. Requires type to be `CLOUDSIGNAL`. +type TypeCloudSignalConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeCloudSignalConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeCloudSignalConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeCloudSignalConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeCloudSignalConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeCloudSignalConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Enode = value - case "favro": - value := new(VerificationFavro) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Commerce Layer. Requires type to be `COMMERCELAYER`. +type TypeCommerceLayerConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeCommerceLayerConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeCommerceLayerConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeCommerceLayerConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeCommerceLayerConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeCommerceLayerConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Favro = value - case "linear": - value := new(VerificationLinear) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Courier. Requires type to be `COURIER`. +type TypeCourierConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeCourierConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeCourierConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeCourierConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeCourierConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeCourierConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Linear = value - case "shopline": - value := new(VerificationShopline) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Customer.IO. Requires type to be `CUSTOMERIO`. +type TypeCustomerIoConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeCustomerIoConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeCustomerIoConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeCustomerIoConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeCustomerIoConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeCustomerIoConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Shopline = value - case "wix": - value := new(VerificationWix) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Discord. Requires type to be `DISCORD`. +type TypeDiscordConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeDiscordConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeDiscordConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeDiscordConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeDiscordConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeDiscordConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Wix = value - case "nmi": - value := new(VerificationNmiPaymentGateway) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Ebay. Requires type to be `EBAY`. +type TypeEbayConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeEbayConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeEbayConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeEbayConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeEbayConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeEbayConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Nmi = value - case "orb": - value := new(VerificationOrb) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Enode. Requires type to be `ENODE`. +type TypeEnodeConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeEnodeConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeEnodeConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeEnodeConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeEnodeConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeEnodeConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Orb = value - case "pylon": - value := new(VerificationPylon) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Facebook. Requires type to be `FACEBOOK`. +type TypeFacebookConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeFacebookConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeFacebookConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeFacebookConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeFacebookConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeFacebookConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Favro. Requires type to be `FAVRO`. +type TypeFavroConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeFavroConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeFavroConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeFavroConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeFavroConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeFavroConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Pylon = value - case "repay": - value := new(VerificationRepay) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Fiserv. Requires type to be `FISERV`. +type TypeFiservConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeFiservConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeFiservConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeFiservConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeFiservConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeFiservConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Repay = value - case "square": - value := new(VerificationSquare) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for FrontApp. Requires type to be `FRONTAPP`. +type TypeFrontAppConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeFrontAppConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeFrontAppConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeFrontAppConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeFrontAppConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeFrontAppConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Square = value - case "solidgate": - value := new(VerificationSolidGate) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for GitHub. Requires type to be `GITHUB`. +type TypeGitHubConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeGitHubConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeGitHubConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeGitHubConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeGitHubConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeGitHubConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Solidgate = value - case "trello": - value := new(VerificationTrello) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for GitLab. Requires type to be `GITLAB`. +type TypeGitLabConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeGitLabConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeGitLabConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeGitLabConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeGitLabConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeGitLabConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Trello = value - case "sanity": - value := new(VerificationSanity) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for HMAC. Requires type to be `HMAC`. +type TypeHmacConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeHmacConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeHmacConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeHmacConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeHmacConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeHmacConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Sanity = value - case "ebay": - value := new(VerificationEbay) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for HTTP. Requires type to be `HTTP`. +type TypeHttpConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeHttpConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeHttpConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeHttpConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeHttpConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeHttpConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Ebay = value - case "telnyx": - value := new(VerificationTelnyx) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Hubspot. Requires type to be `HUBSPOT`. +type TypeHubspotConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeHubspotConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeHubspotConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeHubspotConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeHubspotConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeHubspotConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Telnyx = value - case "discord": - value := new(VerificationDiscord) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Linear. Requires type to be `LINEAR`. +type TypeLinearConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeLinearConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeLinearConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeLinearConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeLinearConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeLinearConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Mailchimp. Requires type to be `MAILCHIMP`. +type TypeMailchimpConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeMailchimpConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeMailchimpConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeMailchimpConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeMailchimpConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeMailchimpConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Discord = value - case "tokenio": - value := new(VerificationTokenIo) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Mailgun. Requires type to be `MAILGUN`. +type TypeMailgunConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeMailgunConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeMailgunConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeMailgunConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeMailgunConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeMailgunConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Tokenio = value - case "fiserv": - value := new(VerificationFiserv) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for NMI Payment Gateway. Requires type to be `NMI`. +type TypeNmiPaymentGatewayConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeNmiPaymentGatewayConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeNmiPaymentGatewayConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeNmiPaymentGatewayConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeNmiPaymentGatewayConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeNmiPaymentGatewayConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Fiserv = value - case "bondsmith": - value := new(VerificationBondsmith) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Orb. Requires type to be `ORB`. +type TypeOrbConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeOrbConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeOrbConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeOrbConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeOrbConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeOrbConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Bondsmith = value - case "vercel_log_drains": - value := new(VerificationVercelLogDrains) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Oura. Requires type to be `OURA`. +type TypeOuraConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeOuraConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeOuraConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeOuraConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeOuraConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeOuraConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.VercelLogDrains = value - case "vercel": - value := new(VerificationVercel) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Paddle. Requires type to be `PADDLE`. +type TypePaddleConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePaddleConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePaddleConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePaddleConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePaddleConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePaddleConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Vercel = value - case "tebex": - value := new(VerificationTebex) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Paypal. Requires type to be `PAYPAL`. +type TypePaypalConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePaypalConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePaypalConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePaypalConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePaypalConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePaypalConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Tebex = value - case "slack": - value := new(VerificationSlack) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Persona. Requires type to be `PERSONA`. +type TypePersonaConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePersonaConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePersonaConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePersonaConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePersonaConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePersonaConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Slack = value - case "razorpay": - value := new(VerificationRazorpay) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Pipedrive. Requires type to be `PIPEDRIVE`. +type TypePipedriveConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePipedriveConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePipedriveConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePipedriveConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePipedriveConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePipedriveConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Postmark. Requires type to be `POSTMARK`. +type TypePostmarkConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePostmarkConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePostmarkConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePostmarkConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePostmarkConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePostmarkConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Razorpay = value - case "mailchimp": - value := new(VerificationMailchimp) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Praxis. Requires type to be `PRAXIS`. +type TypePraxisConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePraxisConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePraxisConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePraxisConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePraxisConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePraxisConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Mailchimp = value - case "paddle": - value := new(VerificationPaddle) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Property Finder. Requires type to be `PROPERTY-FINDER`. +type TypePropertyFinderConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePropertyFinderConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePropertyFinderConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePropertyFinderConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePropertyFinderConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePropertyFinderConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Paddle = value - case "paypal": - value := new(VerificationPaypal) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Pylon. Requires type to be `PYLON`. +type TypePylonConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypePylonConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypePylonConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypePylonConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypePylonConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypePylonConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Paypal = value - case "treezor": - value := new(VerificationTreezor) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Razorpay. Requires type to be `RAZORPAY`. +type TypeRazorpayConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeRazorpayConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeRazorpayConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeRazorpayConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeRazorpayConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeRazorpayConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Treezor = value - case "praxis": - value := new(VerificationPraxis) - if err := json.Unmarshal(data, &value); err != nil { - return err + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Recharge. Requires type to be `RECHARGE`. +type TypeRechargeConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeRechargeConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeRechargeConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeRechargeConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeRechargeConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeRechargeConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value } - v.Praxis = value } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Repay. Requires type to be `REPAY`. +type TypeRepayConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeRepayConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeRepayConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeRepayConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeRepayConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v VerificationConfig) MarshalJSON() ([]byte, error) { - switch v.Type { - default: - return nil, fmt.Errorf("invalid type %s in %T", v.Type, v) - case "hmac": - return core.MarshalJSONWithExtraProperty(v.Hmac, "type", "hmac") - case "basic_auth": - return core.MarshalJSONWithExtraProperty(v.BasicAuth, "type", "basic_auth") - case "api_key": - return core.MarshalJSONWithExtraProperty(v.ApiKey, "type", "api_key") - case "bridge": - return core.MarshalJSONWithExtraProperty(v.Bridge, "type", "bridge") - case "cloudsignal": - return core.MarshalJSONWithExtraProperty(v.Cloudsignal, "type", "cloudsignal") - case "courier": - return core.MarshalJSONWithExtraProperty(v.Courier, "type", "courier") - case "frontapp": - return core.MarshalJSONWithExtraProperty(v.Frontapp, "type", "frontapp") - case "twitter": - return core.MarshalJSONWithExtraProperty(v.Twitter, "type", "twitter") - case "stripe": - return core.MarshalJSONWithExtraProperty(v.Stripe, "type", "stripe") - case "recharge": - return core.MarshalJSONWithExtraProperty(v.Recharge, "type", "recharge") - case "twilio": - return core.MarshalJSONWithExtraProperty(v.Twilio, "type", "twilio") - case "github": - return core.MarshalJSONWithExtraProperty(v.Github, "type", "github") - case "shopify": - return core.MarshalJSONWithExtraProperty(v.Shopify, "type", "shopify") - case "postmark": - return core.MarshalJSONWithExtraProperty(v.Postmark, "type", "postmark") - case "typeform": - return core.MarshalJSONWithExtraProperty(v.Typeform, "type", "typeform") - case "xero": - return core.MarshalJSONWithExtraProperty(v.Xero, "type", "xero") - case "svix": - return core.MarshalJSONWithExtraProperty(v.Svix, "type", "svix") - case "zoom": - return core.MarshalJSONWithExtraProperty(v.Zoom, "type", "zoom") - case "akeneo": - return core.MarshalJSONWithExtraProperty(v.Akeneo, "type", "akeneo") - case "adyen": - return core.MarshalJSONWithExtraProperty(v.Adyen, "type", "adyen") - case "gitlab": - return core.MarshalJSONWithExtraProperty(v.Gitlab, "type", "gitlab") - case "property-finder": - return core.MarshalJSONWithExtraProperty(v.PropertyFinder, "type", "property-finder") - case "woocommerce": - return core.MarshalJSONWithExtraProperty(v.Woocommerce, "type", "woocommerce") - case "oura": - return core.MarshalJSONWithExtraProperty(v.Oura, "type", "oura") - case "commercelayer": - return core.MarshalJSONWithExtraProperty(v.Commercelayer, "type", "commercelayer") - case "hubspot": - return core.MarshalJSONWithExtraProperty(v.Hubspot, "type", "hubspot") - case "mailgun": - return core.MarshalJSONWithExtraProperty(v.Mailgun, "type", "mailgun") - case "persona": - return core.MarshalJSONWithExtraProperty(v.Persona, "type", "persona") - case "pipedrive": - return core.MarshalJSONWithExtraProperty(v.Pipedrive, "type", "pipedrive") - case "sendgrid": - return core.MarshalJSONWithExtraProperty(v.Sendgrid, "type", "sendgrid") - case "workos": - return core.MarshalJSONWithExtraProperty(v.Workos, "type", "workos") - case "synctera": - return core.MarshalJSONWithExtraProperty(v.Synctera, "type", "synctera") - case "aws_sns": - return core.MarshalJSONWithExtraProperty(v.AwsSns, "type", "aws_sns") - case "three_d_eye": - return core.MarshalJSONWithExtraProperty(v.ThreeDEye, "type", "three_d_eye") - case "twitch": - return core.MarshalJSONWithExtraProperty(v.Twitch, "type", "twitch") - case "enode": - return core.MarshalJSONWithExtraProperty(v.Enode, "type", "enode") - case "favro": - return core.MarshalJSONWithExtraProperty(v.Favro, "type", "favro") - case "linear": - return core.MarshalJSONWithExtraProperty(v.Linear, "type", "linear") - case "shopline": - return core.MarshalJSONWithExtraProperty(v.Shopline, "type", "shopline") - case "wix": - return core.MarshalJSONWithExtraProperty(v.Wix, "type", "wix") - case "nmi": - return core.MarshalJSONWithExtraProperty(v.Nmi, "type", "nmi") - case "orb": - return core.MarshalJSONWithExtraProperty(v.Orb, "type", "orb") - case "pylon": - return core.MarshalJSONWithExtraProperty(v.Pylon, "type", "pylon") - case "repay": - return core.MarshalJSONWithExtraProperty(v.Repay, "type", "repay") - case "square": - return core.MarshalJSONWithExtraProperty(v.Square, "type", "square") - case "solidgate": - return core.MarshalJSONWithExtraProperty(v.Solidgate, "type", "solidgate") - case "trello": - return core.MarshalJSONWithExtraProperty(v.Trello, "type", "trello") - case "sanity": - return core.MarshalJSONWithExtraProperty(v.Sanity, "type", "sanity") - case "ebay": - return core.MarshalJSONWithExtraProperty(v.Ebay, "type", "ebay") - case "telnyx": - return core.MarshalJSONWithExtraProperty(v.Telnyx, "type", "telnyx") - case "discord": - return core.MarshalJSONWithExtraProperty(v.Discord, "type", "discord") - case "tokenio": - return core.MarshalJSONWithExtraProperty(v.Tokenio, "type", "tokenio") - case "fiserv": - return core.MarshalJSONWithExtraProperty(v.Fiserv, "type", "fiserv") - case "bondsmith": - return core.MarshalJSONWithExtraProperty(v.Bondsmith, "type", "bondsmith") - case "vercel_log_drains": - return core.MarshalJSONWithExtraProperty(v.VercelLogDrains, "type", "vercel_log_drains") - case "vercel": - return core.MarshalJSONWithExtraProperty(v.Vercel, "type", "vercel") - case "tebex": - return core.MarshalJSONWithExtraProperty(v.Tebex, "type", "tebex") - case "slack": - return core.MarshalJSONWithExtraProperty(v.Slack, "type", "slack") - case "razorpay": - return core.MarshalJSONWithExtraProperty(v.Razorpay, "type", "razorpay") - case "mailchimp": - return core.MarshalJSONWithExtraProperty(v.Mailchimp, "type", "mailchimp") - case "paddle": - return core.MarshalJSONWithExtraProperty(v.Paddle, "type", "paddle") - case "paypal": - return core.MarshalJSONWithExtraProperty(v.Paypal, "type", "paypal") - case "treezor": - return core.MarshalJSONWithExtraProperty(v.Treezor, "type", "treezor") - case "praxis": - return core.MarshalJSONWithExtraProperty(v.Praxis, "type", "praxis") +func (t *TypeRepayConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Replicate. Requires type to be `REPLICATE`. +type TypeReplicateConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeReplicateConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeReplicateConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeReplicateConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeReplicateConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil } -type VerificationConfigVisitor interface { - VisitHmac(*VerificationHmac) error - VisitBasicAuth(*VerificationBasicAuth) error - VisitApiKey(*VerificationApiKey) error - VisitBridge(*VerificationBridge) error - VisitCloudsignal(*VerificationCloudSignal) error - VisitCourier(*VerificationCourier) error - VisitFrontapp(*VerificationFrontApp) error - VisitTwitter(*VerificationTwitter) error - VisitStripe(*VerificationStripe) error - VisitRecharge(*VerificationRecharge) error - VisitTwilio(*VerificationTwilio) error - VisitGithub(*VerificationGitHub) error - VisitShopify(*VerificationShopify) error - VisitPostmark(*VerificationPostmark) error - VisitTypeform(*VerificationTypeform) error - VisitXero(*VerificationXero) error - VisitSvix(*VerificationSvix) error - VisitZoom(*VerificationZoom) error - VisitAkeneo(*VerificationAkeneo) error - VisitAdyen(*VerificationAdyen) error - VisitGitlab(*VerificationGitLab) error - VisitPropertyFinder(*VerificationPropertyFinder) error - VisitWoocommerce(*VerificationWooCommerce) error - VisitOura(*VerificationOura) error - VisitCommercelayer(*VerificationCommercelayer) error - VisitHubspot(*VerificationHubspot) error - VisitMailgun(*VerificationMailgun) error - VisitPersona(*VerificationPersona) error - VisitPipedrive(*VerificationPipedrive) error - VisitSendgrid(*VerificationSendGrid) error - VisitWorkos(*VerificationWorkOs) error - VisitSynctera(*VerificationSynctera) error - VisitAwsSns(*VerificationAwssns) error - VisitThreeDEye(*Verification3DEye) error - VisitTwitch(*VerificationTwitch) error - VisitEnode(*VerificationEnode) error - VisitFavro(*VerificationFavro) error - VisitLinear(*VerificationLinear) error - VisitShopline(*VerificationShopline) error - VisitWix(*VerificationWix) error - VisitNmi(*VerificationNmiPaymentGateway) error - VisitOrb(*VerificationOrb) error - VisitPylon(*VerificationPylon) error - VisitRepay(*VerificationRepay) error - VisitSquare(*VerificationSquare) error - VisitSolidgate(*VerificationSolidGate) error - VisitTrello(*VerificationTrello) error - VisitSanity(*VerificationSanity) error - VisitEbay(*VerificationEbay) error - VisitTelnyx(*VerificationTelnyx) error - VisitDiscord(*VerificationDiscord) error - VisitTokenio(*VerificationTokenIo) error - VisitFiserv(*VerificationFiserv) error - VisitBondsmith(*VerificationBondsmith) error - VisitVercelLogDrains(*VerificationVercelLogDrains) error - VisitVercel(*VerificationVercel) error - VisitTebex(*VerificationTebex) error - VisitSlack(*VerificationSlack) error - VisitRazorpay(*VerificationRazorpay) error - VisitMailchimp(*VerificationMailchimp) error - VisitPaddle(*VerificationPaddle) error - VisitPaypal(*VerificationPaypal) error - VisitTreezor(*VerificationTreezor) error - VisitPraxis(*VerificationPraxis) error +func (t *TypeReplicateConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) } -func (v *VerificationConfig) Accept(visitor VerificationConfigVisitor) error { - switch v.Type { - default: - return fmt.Errorf("invalid type %s in %T", v.Type, v) - case "hmac": - return visitor.VisitHmac(v.Hmac) - case "basic_auth": - return visitor.VisitBasicAuth(v.BasicAuth) - case "api_key": - return visitor.VisitApiKey(v.ApiKey) - case "bridge": - return visitor.VisitBridge(v.Bridge) - case "cloudsignal": - return visitor.VisitCloudsignal(v.Cloudsignal) - case "courier": - return visitor.VisitCourier(v.Courier) - case "frontapp": - return visitor.VisitFrontapp(v.Frontapp) - case "twitter": - return visitor.VisitTwitter(v.Twitter) - case "stripe": - return visitor.VisitStripe(v.Stripe) - case "recharge": - return visitor.VisitRecharge(v.Recharge) - case "twilio": - return visitor.VisitTwilio(v.Twilio) - case "github": - return visitor.VisitGithub(v.Github) - case "shopify": - return visitor.VisitShopify(v.Shopify) - case "postmark": - return visitor.VisitPostmark(v.Postmark) - case "typeform": - return visitor.VisitTypeform(v.Typeform) - case "xero": - return visitor.VisitXero(v.Xero) - case "svix": - return visitor.VisitSvix(v.Svix) - case "zoom": - return visitor.VisitZoom(v.Zoom) - case "akeneo": - return visitor.VisitAkeneo(v.Akeneo) - case "adyen": - return visitor.VisitAdyen(v.Adyen) - case "gitlab": - return visitor.VisitGitlab(v.Gitlab) - case "property-finder": - return visitor.VisitPropertyFinder(v.PropertyFinder) - case "woocommerce": - return visitor.VisitWoocommerce(v.Woocommerce) - case "oura": - return visitor.VisitOura(v.Oura) - case "commercelayer": - return visitor.VisitCommercelayer(v.Commercelayer) - case "hubspot": - return visitor.VisitHubspot(v.Hubspot) - case "mailgun": - return visitor.VisitMailgun(v.Mailgun) - case "persona": - return visitor.VisitPersona(v.Persona) - case "pipedrive": - return visitor.VisitPipedrive(v.Pipedrive) - case "sendgrid": - return visitor.VisitSendgrid(v.Sendgrid) - case "workos": - return visitor.VisitWorkos(v.Workos) - case "synctera": - return visitor.VisitSynctera(v.Synctera) - case "aws_sns": - return visitor.VisitAwsSns(v.AwsSns) - case "three_d_eye": - return visitor.VisitThreeDEye(v.ThreeDEye) - case "twitch": - return visitor.VisitTwitch(v.Twitch) - case "enode": - return visitor.VisitEnode(v.Enode) - case "favro": - return visitor.VisitFavro(v.Favro) - case "linear": - return visitor.VisitLinear(v.Linear) - case "shopline": - return visitor.VisitShopline(v.Shopline) - case "wix": - return visitor.VisitWix(v.Wix) - case "nmi": - return visitor.VisitNmi(v.Nmi) - case "orb": - return visitor.VisitOrb(v.Orb) - case "pylon": - return visitor.VisitPylon(v.Pylon) - case "repay": - return visitor.VisitRepay(v.Repay) - case "square": - return visitor.VisitSquare(v.Square) - case "solidgate": - return visitor.VisitSolidgate(v.Solidgate) - case "trello": - return visitor.VisitTrello(v.Trello) - case "sanity": - return visitor.VisitSanity(v.Sanity) - case "ebay": - return visitor.VisitEbay(v.Ebay) - case "telnyx": - return visitor.VisitTelnyx(v.Telnyx) - case "discord": - return visitor.VisitDiscord(v.Discord) - case "tokenio": - return visitor.VisitTokenio(v.Tokenio) - case "fiserv": - return visitor.VisitFiserv(v.Fiserv) - case "bondsmith": - return visitor.VisitBondsmith(v.Bondsmith) - case "vercel_log_drains": - return visitor.VisitVercelLogDrains(v.VercelLogDrains) - case "vercel": - return visitor.VisitVercel(v.Vercel) - case "tebex": - return visitor.VisitTebex(v.Tebex) - case "slack": - return visitor.VisitSlack(v.Slack) - case "razorpay": - return visitor.VisitRazorpay(v.Razorpay) - case "mailchimp": - return visitor.VisitMailchimp(v.Mailchimp) - case "paddle": - return visitor.VisitPaddle(v.Paddle) - case "paypal": - return visitor.VisitPaypal(v.Paypal) - case "treezor": - return visitor.VisitTreezor(v.Treezor) - case "praxis": - return visitor.VisitPraxis(v.Praxis) +// The type config for Sanity. Requires type to be `SANITY`. +type TypeSanityConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeSanityConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeSanityConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSanityConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeSanityConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeSanityConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Sendgrid. Requires type to be `SENDGRID`. +type TypeSendgridConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeSendgridConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeSendgridConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSendgridConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeSendgridConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeSendgridConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Shopify. Requires type to be `SHOPIFY`. +type TypeShopifyConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeShopifyConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeShopifyConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeShopifyConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } + *t = TypeShopifyConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil } -type VerificationCourier struct { - Configs *VerificationCourierConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (t *TypeShopifyConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} +// The type config for Shopline. Requires type to be `SHOPLINE`. +type TypeShoplineConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationCourier) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeShoplineConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationCourier) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCourier +func (t *TypeShoplineConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeShoplineConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationCourier(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeShoplineConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationCourier) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeShoplineConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Courier. Only included if the ?include=verification.configs query param is present -type VerificationCourierConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for Slack. Requires type to be `SLACK`. +type TypeSlackConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationCourierConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeSlackConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationCourierConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationCourierConfigs +func (t *TypeSlackConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSlackConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationCourierConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeSlackConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationCourierConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeSlackConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationDiscord struct { - Configs *VerificationDiscordConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Solidgate. Requires type to be `SOLIDGATE`. +type TypeSolidgateConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationDiscord) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeSolidgateConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationDiscord) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationDiscord +func (t *TypeSolidgateConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSolidgateConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationDiscord(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeSolidgateConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationDiscord) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeSolidgateConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Discord. Only included if the ?include=verification.configs query param is present -type VerificationDiscordConfigs struct { - PublicKey string `json:"public_key" url:"public_key"` - +// The type config for Square. Requires type to be `SQUARE`. +type TypeSquareConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationDiscordConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeSquareConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationDiscordConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationDiscordConfigs +func (t *TypeSquareConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSquareConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationDiscordConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeSquareConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationDiscordConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeSquareConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationEbay struct { - Configs *VerificationEbayConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Stripe. Requires type to be `STRIPE`. +type TypeStripeConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationEbay) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeStripeConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationEbay) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationEbay +func (t *TypeStripeConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeStripeConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationEbay(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeStripeConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationEbay) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeStripeConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Ebay. Only included if the ?include=verification.configs query param is present -type VerificationEbayConfigs struct { - Environment string `json:"environment" url:"environment"` - ClientId string `json:"client_id" url:"client_id"` - ClientSecret string `json:"client_secret" url:"client_secret"` - DevId string `json:"dev_id" url:"dev_id"` - VerificationToken string `json:"verification_token" url:"verification_token"` - +// The type config for Svix. Requires type to be `SVIX`. +type TypeSvixConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationEbayConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeSvixConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationEbayConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationEbayConfigs +func (t *TypeSvixConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSvixConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationEbayConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeSvixConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationEbayConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeSvixConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationEnode struct { - Configs *VerificationEnodeConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Synctera. Requires type to be `SYNCTERA`. +type TypeSyncteraConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationEnode) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeSyncteraConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationEnode) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationEnode +func (t *TypeSyncteraConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeSyncteraConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationEnode(value) + *t = TypeSyncteraConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeSyncteraConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Tebex. Requires type to be `TEBEX`. +type TypeTebexConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeTebexConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} - extraProperties, err := core.ExtractExtraProperties(data, *v) +func (t *TypeTebexConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTebexConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTebexConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeTebexConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Telnyx. Requires type to be `TELNYX`. +type TypeTelnyxConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} - v._rawJSON = json.RawMessage(data) +func (t *TypeTelnyxConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeTelnyxConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTelnyxConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTelnyxConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationEnode) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeTelnyxConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Enode. Only included if the ?include=verification.configs query param is present -type VerificationEnodeConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +// The type config for TikTok. Requires type to be `TIKTOK`. +type TypeTikTokConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeTikTokConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeTikTokConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTikTokConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTikTokConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeTikTokConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} +// The type config for TokenIO. Requires type to be `TOKENIO`. +type TypeTokenIoConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationEnodeConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeTokenIoConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationEnodeConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationEnodeConfigs +func (t *TypeTokenIoConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTokenIoConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationEnodeConfigs(value) + *t = TypeTokenIoConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeTokenIoConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Treezor. Requires type to be `TREEZOR`. +type TypeTreezorConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeTreezorConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} - extraProperties, err := core.ExtractExtraProperties(data, *v) +func (t *TypeTreezorConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTreezorConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTreezorConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeTreezorConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// The type config for Trello. Requires type to be `TRELLO`. +type TypeTrelloConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} - v._rawJSON = json.RawMessage(data) +func (t *TypeTrelloConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeTrelloConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTrelloConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTrelloConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationEnodeConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeTrelloConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationFavro struct { - Configs *VerificationFavroConfigs `json:"configs,omitempty" url:"configs,omitempty"` +// The type config for Twilio. Requires type to be `TWILIO`. +type TypeTwilioConfig struct { + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TypeTwilioConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TypeTwilioConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTwilioConfig + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TypeTwilioConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TypeTwilioConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} +// The type config for Twitch. Requires type to be `TWITCH`. +type TypeTwitchConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFavro) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeTwitchConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFavro) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFavro +func (t *TypeTwitchConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTwitchConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFavro(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeTwitchConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFavro) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeTwitchConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Favro. Only included if the ?include=verification.configs query param is present -type VerificationFavroConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for Twitter. Requires type to be `TWITTER`. +type TypeTwitterConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFavroConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeTwitterConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFavroConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFavroConfigs +func (t *TypeTwitterConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTwitterConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFavroConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeTwitterConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFavroConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeTwitterConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationFiserv struct { - Configs *VerificationFiservConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Typeform. Requires type to be `TYPEFORM`. +type TypeTypeformConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFiserv) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeTypeformConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFiserv) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFiserv +func (t *TypeTypeformConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeTypeformConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFiserv(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeTypeformConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFiserv) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeTypeformConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Fiserv. Only included if the ?include=verification.configs query param is present -type VerificationFiservConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for Upollo. Requires type to be `UPOLLO`. +type TypeUpolloConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFiservConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeUpolloConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFiservConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFiservConfigs +func (t *TypeUpolloConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeUpolloConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFiservConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeUpolloConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFiservConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeUpolloConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationFrontApp struct { - Configs *VerificationFrontAppConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Vercel Log Drains. Requires type to be `VERCEL_LOG_DRAINS`. +type TypeVercelLogDrainsConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFrontApp) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeVercelLogDrainsConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFrontApp) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFrontApp +func (t *TypeVercelLogDrainsConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeVercelLogDrainsConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFrontApp(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeVercelLogDrainsConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFrontApp) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeVercelLogDrainsConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for FrontApp. Only included if the ?include=verification.configs query param is present -type VerificationFrontAppConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for Vercel Webhooks. Requires type to be `VERCEL`. +type TypeVercelWebhooksConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationFrontAppConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeVercelWebhooksConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationFrontAppConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationFrontAppConfigs +func (t *TypeVercelWebhooksConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeVercelWebhooksConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationFrontAppConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeVercelWebhooksConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationFrontAppConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeVercelWebhooksConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationGitHub struct { - Configs *VerificationGitHubConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Webhook. Requires type to be `WEBHOOK`. +type TypeWebhookConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationGitHub) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeWebhookConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationGitHub) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationGitHub +func (t *TypeWebhookConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeWebhookConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationGitHub(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeWebhookConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationGitHub) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeWebhookConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for GitHub. Only included if the ?include=verification.configs query param is present -type VerificationGitHubConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for WhatsApp. Requires type to be `WHATSAPP`. +type TypeWhatsAppConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationGitHubConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeWhatsAppConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationGitHubConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationGitHubConfigs +func (t *TypeWhatsAppConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeWhatsAppConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationGitHubConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeWhatsAppConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationGitHubConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeWhatsAppConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationGitLab struct { - Configs *VerificationGitLabConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Wix. Requires type to be `WIX`. +type TypeWixConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationGitLab) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeWixConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationGitLab) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationGitLab +func (t *TypeWixConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeWixConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationGitLab(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeWixConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationGitLab) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeWixConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for GitLab. Only included if the ?include=verification.configs query param is present -type VerificationGitLabConfigs struct { - ApiKey string `json:"api_key" url:"api_key"` - +// The type config for WooCommerce. Requires type to be `WOOCOMMERCE`. +type TypeWooCommerceConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationGitLabConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeWooCommerceConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationGitLabConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationGitLabConfigs +func (t *TypeWooCommerceConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeWooCommerceConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationGitLabConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeWooCommerceConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationGitLabConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeWooCommerceConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationHmac struct { - Configs *VerificationHmacConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for WorkOS. Requires type to be `WORKOS`. +type TypeWorkOsConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationHmac) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeWorkOsConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationHmac) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationHmac +func (t *TypeWorkOsConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeWorkOsConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationHmac(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeWorkOsConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationHmac) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeWorkOsConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for HMAC. Only included if the ?include=verification.configs query param is present -type VerificationHmacConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - Algorithm HmacAlgorithms `json:"algorithm" url:"algorithm"` - HeaderKey string `json:"header_key" url:"header_key"` - Encoding VerificationHmacConfigsEncoding `json:"encoding" url:"encoding"` - +// The type config for Xero. Requires type to be `XERO`. +type TypeXeroConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationHmacConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeXeroConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationHmacConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationHmacConfigs +func (t *TypeXeroConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeXeroConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationHmacConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeXeroConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationHmacConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeXeroConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) -} - -type VerificationHmacConfigsEncoding string - -const ( - VerificationHmacConfigsEncodingBase64 VerificationHmacConfigsEncoding = "base64" - VerificationHmacConfigsEncodingBase64Url VerificationHmacConfigsEncoding = "base64url" - VerificationHmacConfigsEncodingHex VerificationHmacConfigsEncoding = "hex" -) - -func NewVerificationHmacConfigsEncodingFromString(s string) (VerificationHmacConfigsEncoding, error) { - switch s { - case "base64": - return VerificationHmacConfigsEncodingBase64, nil - case "base64url": - return VerificationHmacConfigsEncodingBase64Url, nil - case "hex": - return VerificationHmacConfigsEncodingHex, nil - } - var t VerificationHmacConfigsEncoding - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (v VerificationHmacConfigsEncoding) Ptr() *VerificationHmacConfigsEncoding { - return &v + return fmt.Sprintf("%#v", t) } -type VerificationHubspot struct { - Configs *VerificationHubspotConfigs `json:"configs,omitempty" url:"configs,omitempty"` - +// The type config for Zendesk. Requires type to be `ZENDESK`. +type TypeZendeskConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationHubspot) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeZendeskConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationHubspot) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationHubspot +func (t *TypeZendeskConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeZendeskConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationHubspot(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeZendeskConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationHubspot) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeZendeskConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -// The verification configs for Hubspot. Only included if the ?include=verification.configs query param is present -type VerificationHubspotConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - +// The type config for Zoom. Requires type to be `ZOOM`. +type TypeZoomConfig struct { extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationHubspotConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (t *TypeZoomConfig) GetExtraProperties() map[string]interface{} { + return t.extraProperties } -func (v *VerificationHubspotConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationHubspotConfigs +func (t *TypeZoomConfig) UnmarshalJSON(data []byte) error { + type unmarshaler TypeZoomConfig var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationHubspotConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *t = TypeZoomConfig(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationHubspotConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (t *TypeZoomConfig) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(t); err == nil { return value } - return fmt.Sprintf("%#v", v) + return fmt.Sprintf("%#v", t) } -type VerificationLinear struct { - Configs *VerificationLinearConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VercelLogDrainsIntegrationConfigs struct { + WebhookSecretKey *string `json:"webhook_secret_key,omitempty" url:"webhook_secret_key,omitempty"` + VercelLogDrainsSecret string `json:"vercel_log_drains_secret" url:"vercel_log_drains_secret"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationLinear) GetExtraProperties() map[string]interface{} { +func (v *VercelLogDrainsIntegrationConfigs) GetWebhookSecretKey() *string { + if v == nil { + return nil + } + return v.WebhookSecretKey +} + +func (v *VercelLogDrainsIntegrationConfigs) GetVercelLogDrainsSecret() string { + if v == nil { + return "" + } + return v.VercelLogDrainsSecret +} + +func (v *VercelLogDrainsIntegrationConfigs) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationLinear) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationLinear +func (v *VercelLogDrainsIntegrationConfigs) UnmarshalJSON(data []byte) error { + type unmarshaler VercelLogDrainsIntegrationConfigs var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationLinear(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VercelLogDrainsIntegrationConfigs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationLinear) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VercelLogDrainsIntegrationConfigs) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Linear. Only included if the ?include=verification.configs query param is present -type VerificationLinearConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type Verification3DEye struct { + Configs *Type3DEyeConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *Verification3DEye) GetConfigs() *Type3DEyeConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationLinearConfigs) GetExtraProperties() map[string]interface{} { +func (v *Verification3DEye) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationLinearConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationLinearConfigs +func (v *Verification3DEye) UnmarshalJSON(data []byte) error { + type unmarshaler Verification3DEye var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationLinearConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = Verification3DEye(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationLinearConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *Verification3DEye) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationMailchimp struct { - Configs *VerificationMailchimpConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationAdyen struct { + Configs *TypeAdyenConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationMailchimp) GetExtraProperties() map[string]interface{} { +func (v *VerificationAdyen) GetConfigs() *TypeAdyenConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationAdyen) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationMailchimp) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationMailchimp +func (v *VerificationAdyen) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationAdyen var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationMailchimp(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationAdyen(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationMailchimp) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationAdyen) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Mailchimp. Only included if the ?include=verification.configs query param is present -type VerificationMailchimpConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationAirwallex struct { + Configs *TypeAirwallexConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationAirwallex) GetConfigs() *TypeAirwallexConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationMailchimpConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationAirwallex) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationMailchimpConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationMailchimpConfigs +func (v *VerificationAirwallex) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationAirwallex var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationMailchimpConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationAirwallex(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationMailchimpConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationAirwallex) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationMailgun struct { - Configs *VerificationMailgunConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationAkeneo struct { + Configs *TypeAkeneoConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationMailgun) GetExtraProperties() map[string]interface{} { +func (v *VerificationAkeneo) GetConfigs() *TypeAkeneoConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationAkeneo) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationMailgun) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationMailgun +func (v *VerificationAkeneo) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationAkeneo var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationMailgun(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationAkeneo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationMailgun) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationAkeneo) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Mailgun. Only included if the ?include=verification.configs query param is present -type VerificationMailgunConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationApiKey struct { + Configs *TypeApiKeyConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationApiKey) GetConfigs() *TypeApiKeyConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationMailgunConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationApiKey) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationMailgunConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationMailgunConfigs +func (v *VerificationApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationApiKey var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationMailgunConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationApiKey(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationMailgunConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationApiKey) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationNmiPaymentGateway struct { - Configs *VerificationNmiPaymentGatewayConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationAwssns struct { + Configs *TypeAwssnsConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationNmiPaymentGateway) GetExtraProperties() map[string]interface{} { +func (v *VerificationAwssns) GetConfigs() *TypeAwssnsConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationAwssns) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationNmiPaymentGateway) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationNmiPaymentGateway +func (v *VerificationAwssns) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationAwssns var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationNmiPaymentGateway(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationAwssns(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationNmiPaymentGateway) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationAwssns) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for NMI Payment Gateway. Only included if the ?include=verification.configs query param is present -type VerificationNmiPaymentGatewayConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationBasicAuth struct { + Configs *TypeBasicAuthConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationNmiPaymentGatewayConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationBasicAuth) GetConfigs() *TypeBasicAuthConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationBasicAuth) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationNmiPaymentGatewayConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationNmiPaymentGatewayConfigs +func (v *VerificationBasicAuth) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationBasicAuth var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationNmiPaymentGatewayConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationBasicAuth(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationNmiPaymentGatewayConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationBasicAuth) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationOrb struct { - Configs *VerificationOrbConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationBondsmith struct { + Configs *TypeBondsmithConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationOrb) GetExtraProperties() map[string]interface{} { +func (v *VerificationBondsmith) GetConfigs() *TypeBondsmithConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationBondsmith) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationOrb) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationOrb +func (v *VerificationBondsmith) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationBondsmith var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationOrb(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationBondsmith(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationOrb) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationBondsmith) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Orb. Only included if the ?include=verification.configs query param is present -type VerificationOrbConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationBridge struct { + Configs *TypeBridgeConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationBridge) GetConfigs() *TypeBridgeConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationOrbConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationBridge) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationOrbConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationOrbConfigs +func (v *VerificationBridge) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationBridge var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationOrbConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationBridge(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationOrbConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationBridge) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationOura struct { - Configs *VerificationOuraConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationCloudSignal struct { + Configs *TypeCloudSignalConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationOura) GetExtraProperties() map[string]interface{} { +func (v *VerificationCloudSignal) GetConfigs() *TypeCloudSignalConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationCloudSignal) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationOura) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationOura +func (v *VerificationCloudSignal) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationCloudSignal var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationOura(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationCloudSignal(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationOura) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationCloudSignal) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Oura. Only included if the ?include=verification.configs query param is present -type VerificationOuraConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationCommerceLayer struct { + Configs *TypeCommerceLayerConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationCommerceLayer) GetConfigs() *TypeCommerceLayerConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationOuraConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationCommerceLayer) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationOuraConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationOuraConfigs +func (v *VerificationCommerceLayer) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationCommerceLayer var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationOuraConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationCommerceLayer(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationOuraConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationCommerceLayer) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationPaddle struct { - Configs *VerificationPaddleConfigs `json:"configs,omitempty" url:"configs,omitempty"` +// The verification configs for the specified verification type +type VerificationConfig struct { + Type string + Hmac *VerificationHmac + BasicAuth *VerificationBasicAuth + ApiKey *VerificationApiKey + Webhook *VerificationWebhook + Http *VerificationHttp + Sanity *VerificationSanity + Bridge *VerificationBridge + Cloudsignal *VerificationCloudSignal + Courier *VerificationCourier + Frontapp *VerificationFrontApp + Zoom *VerificationZoom + Twitter *VerificationTwitter + Recharge *VerificationRecharge + Stripe *VerificationStripe + PropertyFinder *VerificationPropertyFinder + Shopify *VerificationShopify + Twilio *VerificationTwilio + Github *VerificationGitHub + Postmark *VerificationPostmark + Typeform *VerificationTypeform + Xero *VerificationXero + Svix *VerificationSvix + Adyen *VerificationAdyen + Akeneo *VerificationAkeneo + Gitlab *VerificationGitLab + Woocommerce *VerificationWooCommerce + Oura *VerificationOura + Commercelayer *VerificationCommerceLayer + Hubspot *VerificationHubspot + Mailgun *VerificationMailgun + Persona *VerificationPersona + Pipedrive *VerificationPipedrive + Sendgrid *VerificationSendgrid + Workos *VerificationWorkOs + Synctera *VerificationSynctera + AwsSns *VerificationAwssns + ThreeDEye *Verification3DEye + Twitch *VerificationTwitch + Enode *VerificationEnode + Favro *VerificationFavro + Linear *VerificationLinear + Shopline *VerificationShopline + Wix *VerificationWix + Nmi *VerificationNmiPaymentGateway + Orb *VerificationOrb + Pylon *VerificationPylon + Razorpay *VerificationRazorpay + Repay *VerificationRepay + Square *VerificationSquare + Solidgate *VerificationSolidgate + Trello *VerificationTrello + Ebay *VerificationEbay + Telnyx *VerificationTelnyx + Discord *VerificationDiscord + Tokenio *VerificationTokenIo + Fiserv *VerificationFiserv + Bondsmith *VerificationBondsmith + VercelLogDrains *VerificationVercelLogDrains + Vercel *VerificationVercelWebhooks + Tebex *VerificationTebex + Slack *VerificationSlack + Mailchimp *VerificationMailchimp + Paddle *VerificationPaddle + Paypal *VerificationPaypal + Treezor *VerificationTreezor + Praxis *VerificationPraxis + Customerio *VerificationCustomerIo + Facebook *VerificationFacebook + Whatsapp *VerificationWhatsApp + Replicate *VerificationReplicate + Tiktok *VerificationTikTok + Airwallex *VerificationAirwallex + Zendesk *VerificationZendesk + Upollo *VerificationUpollo +} + +func NewVerificationConfigFromHmac(value *VerificationHmac) *VerificationConfig { + return &VerificationConfig{Type: "hmac", Hmac: value} +} + +func NewVerificationConfigFromBasicAuth(value *VerificationBasicAuth) *VerificationConfig { + return &VerificationConfig{Type: "basic_auth", BasicAuth: value} +} + +func NewVerificationConfigFromApiKey(value *VerificationApiKey) *VerificationConfig { + return &VerificationConfig{Type: "api_key", ApiKey: value} +} + +func NewVerificationConfigFromWebhook(value *VerificationWebhook) *VerificationConfig { + return &VerificationConfig{Type: "webhook", Webhook: value} +} + +func NewVerificationConfigFromHttp(value *VerificationHttp) *VerificationConfig { + return &VerificationConfig{Type: "http", Http: value} +} + +func NewVerificationConfigFromSanity(value *VerificationSanity) *VerificationConfig { + return &VerificationConfig{Type: "sanity", Sanity: value} +} + +func NewVerificationConfigFromBridge(value *VerificationBridge) *VerificationConfig { + return &VerificationConfig{Type: "bridge", Bridge: value} +} + +func NewVerificationConfigFromCloudsignal(value *VerificationCloudSignal) *VerificationConfig { + return &VerificationConfig{Type: "cloudsignal", Cloudsignal: value} +} + +func NewVerificationConfigFromCourier(value *VerificationCourier) *VerificationConfig { + return &VerificationConfig{Type: "courier", Courier: value} +} + +func NewVerificationConfigFromFrontapp(value *VerificationFrontApp) *VerificationConfig { + return &VerificationConfig{Type: "frontapp", Frontapp: value} +} + +func NewVerificationConfigFromZoom(value *VerificationZoom) *VerificationConfig { + return &VerificationConfig{Type: "zoom", Zoom: value} +} + +func NewVerificationConfigFromTwitter(value *VerificationTwitter) *VerificationConfig { + return &VerificationConfig{Type: "twitter", Twitter: value} +} + +func NewVerificationConfigFromRecharge(value *VerificationRecharge) *VerificationConfig { + return &VerificationConfig{Type: "recharge", Recharge: value} +} + +func NewVerificationConfigFromStripe(value *VerificationStripe) *VerificationConfig { + return &VerificationConfig{Type: "stripe", Stripe: value} +} + +func NewVerificationConfigFromPropertyFinder(value *VerificationPropertyFinder) *VerificationConfig { + return &VerificationConfig{Type: "property-finder", PropertyFinder: value} +} + +func NewVerificationConfigFromShopify(value *VerificationShopify) *VerificationConfig { + return &VerificationConfig{Type: "shopify", Shopify: value} +} + +func NewVerificationConfigFromTwilio(value *VerificationTwilio) *VerificationConfig { + return &VerificationConfig{Type: "twilio", Twilio: value} +} + +func NewVerificationConfigFromGithub(value *VerificationGitHub) *VerificationConfig { + return &VerificationConfig{Type: "github", Github: value} +} + +func NewVerificationConfigFromPostmark(value *VerificationPostmark) *VerificationConfig { + return &VerificationConfig{Type: "postmark", Postmark: value} +} + +func NewVerificationConfigFromTypeform(value *VerificationTypeform) *VerificationConfig { + return &VerificationConfig{Type: "typeform", Typeform: value} +} + +func NewVerificationConfigFromXero(value *VerificationXero) *VerificationConfig { + return &VerificationConfig{Type: "xero", Xero: value} +} + +func NewVerificationConfigFromSvix(value *VerificationSvix) *VerificationConfig { + return &VerificationConfig{Type: "svix", Svix: value} +} + +func NewVerificationConfigFromAdyen(value *VerificationAdyen) *VerificationConfig { + return &VerificationConfig{Type: "adyen", Adyen: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromAkeneo(value *VerificationAkeneo) *VerificationConfig { + return &VerificationConfig{Type: "akeneo", Akeneo: value} } -func (v *VerificationPaddle) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromGitlab(value *VerificationGitLab) *VerificationConfig { + return &VerificationConfig{Type: "gitlab", Gitlab: value} } -func (v *VerificationPaddle) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPaddle - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPaddle(value) +func NewVerificationConfigFromWoocommerce(value *VerificationWooCommerce) *VerificationConfig { + return &VerificationConfig{Type: "woocommerce", Woocommerce: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromOura(value *VerificationOura) *VerificationConfig { + return &VerificationConfig{Type: "oura", Oura: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromCommercelayer(value *VerificationCommerceLayer) *VerificationConfig { + return &VerificationConfig{Type: "commercelayer", Commercelayer: value} } -func (v *VerificationPaddle) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromHubspot(value *VerificationHubspot) *VerificationConfig { + return &VerificationConfig{Type: "hubspot", Hubspot: value} } -// The verification configs for Paddle. Only included if the ?include=verification.configs query param is present -type VerificationPaddleConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func NewVerificationConfigFromMailgun(value *VerificationMailgun) *VerificationConfig { + return &VerificationConfig{Type: "mailgun", Mailgun: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromPersona(value *VerificationPersona) *VerificationConfig { + return &VerificationConfig{Type: "persona", Persona: value} } -func (v *VerificationPaddleConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromPipedrive(value *VerificationPipedrive) *VerificationConfig { + return &VerificationConfig{Type: "pipedrive", Pipedrive: value} } -func (v *VerificationPaddleConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPaddleConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPaddleConfigs(value) +func NewVerificationConfigFromSendgrid(value *VerificationSendgrid) *VerificationConfig { + return &VerificationConfig{Type: "sendgrid", Sendgrid: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromWorkos(value *VerificationWorkOs) *VerificationConfig { + return &VerificationConfig{Type: "workos", Workos: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromSynctera(value *VerificationSynctera) *VerificationConfig { + return &VerificationConfig{Type: "synctera", Synctera: value} } -func (v *VerificationPaddleConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromAwsSns(value *VerificationAwssns) *VerificationConfig { + return &VerificationConfig{Type: "aws_sns", AwsSns: value} } -type VerificationPaypal struct { - Configs *VerificationPaypalConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewVerificationConfigFromThreeDEye(value *Verification3DEye) *VerificationConfig { + return &VerificationConfig{Type: "three_d_eye", ThreeDEye: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromTwitch(value *VerificationTwitch) *VerificationConfig { + return &VerificationConfig{Type: "twitch", Twitch: value} } -func (v *VerificationPaypal) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromEnode(value *VerificationEnode) *VerificationConfig { + return &VerificationConfig{Type: "enode", Enode: value} } -func (v *VerificationPaypal) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPaypal - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPaypal(value) +func NewVerificationConfigFromFavro(value *VerificationFavro) *VerificationConfig { + return &VerificationConfig{Type: "favro", Favro: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromLinear(value *VerificationLinear) *VerificationConfig { + return &VerificationConfig{Type: "linear", Linear: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromShopline(value *VerificationShopline) *VerificationConfig { + return &VerificationConfig{Type: "shopline", Shopline: value} } -func (v *VerificationPaypal) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromWix(value *VerificationWix) *VerificationConfig { + return &VerificationConfig{Type: "wix", Wix: value} } -// The verification configs for Paypal. Only included if the ?include=verification.configs query param is present -type VerificationPaypalConfigs struct { - WebhookId string `json:"webhook_id" url:"webhook_id"` +func NewVerificationConfigFromNmi(value *VerificationNmiPaymentGateway) *VerificationConfig { + return &VerificationConfig{Type: "nmi", Nmi: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromOrb(value *VerificationOrb) *VerificationConfig { + return &VerificationConfig{Type: "orb", Orb: value} } -func (v *VerificationPaypalConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromPylon(value *VerificationPylon) *VerificationConfig { + return &VerificationConfig{Type: "pylon", Pylon: value} } -func (v *VerificationPaypalConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPaypalConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPaypalConfigs(value) +func NewVerificationConfigFromRazorpay(value *VerificationRazorpay) *VerificationConfig { + return &VerificationConfig{Type: "razorpay", Razorpay: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromRepay(value *VerificationRepay) *VerificationConfig { + return &VerificationConfig{Type: "repay", Repay: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromSquare(value *VerificationSquare) *VerificationConfig { + return &VerificationConfig{Type: "square", Square: value} } -func (v *VerificationPaypalConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromSolidgate(value *VerificationSolidgate) *VerificationConfig { + return &VerificationConfig{Type: "solidgate", Solidgate: value} } -type VerificationPersona struct { - Configs *VerificationPersonaConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewVerificationConfigFromTrello(value *VerificationTrello) *VerificationConfig { + return &VerificationConfig{Type: "trello", Trello: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromEbay(value *VerificationEbay) *VerificationConfig { + return &VerificationConfig{Type: "ebay", Ebay: value} } -func (v *VerificationPersona) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromTelnyx(value *VerificationTelnyx) *VerificationConfig { + return &VerificationConfig{Type: "telnyx", Telnyx: value} } -func (v *VerificationPersona) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPersona - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPersona(value) +func NewVerificationConfigFromDiscord(value *VerificationDiscord) *VerificationConfig { + return &VerificationConfig{Type: "discord", Discord: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromTokenio(value *VerificationTokenIo) *VerificationConfig { + return &VerificationConfig{Type: "tokenio", Tokenio: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromFiserv(value *VerificationFiserv) *VerificationConfig { + return &VerificationConfig{Type: "fiserv", Fiserv: value} } -func (v *VerificationPersona) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromBondsmith(value *VerificationBondsmith) *VerificationConfig { + return &VerificationConfig{Type: "bondsmith", Bondsmith: value} } -// The verification configs for Persona. Only included if the ?include=verification.configs query param is present -type VerificationPersonaConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func NewVerificationConfigFromVercelLogDrains(value *VerificationVercelLogDrains) *VerificationConfig { + return &VerificationConfig{Type: "vercel_log_drains", VercelLogDrains: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromVercel(value *VerificationVercelWebhooks) *VerificationConfig { + return &VerificationConfig{Type: "vercel", Vercel: value} } -func (v *VerificationPersonaConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromTebex(value *VerificationTebex) *VerificationConfig { + return &VerificationConfig{Type: "tebex", Tebex: value} } -func (v *VerificationPersonaConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPersonaConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPersonaConfigs(value) +func NewVerificationConfigFromSlack(value *VerificationSlack) *VerificationConfig { + return &VerificationConfig{Type: "slack", Slack: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromMailchimp(value *VerificationMailchimp) *VerificationConfig { + return &VerificationConfig{Type: "mailchimp", Mailchimp: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromPaddle(value *VerificationPaddle) *VerificationConfig { + return &VerificationConfig{Type: "paddle", Paddle: value} } -func (v *VerificationPersonaConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromPaypal(value *VerificationPaypal) *VerificationConfig { + return &VerificationConfig{Type: "paypal", Paypal: value} } -type VerificationPipedrive struct { - Configs *VerificationPipedriveConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func NewVerificationConfigFromTreezor(value *VerificationTreezor) *VerificationConfig { + return &VerificationConfig{Type: "treezor", Treezor: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromPraxis(value *VerificationPraxis) *VerificationConfig { + return &VerificationConfig{Type: "praxis", Praxis: value} } -func (v *VerificationPipedrive) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromCustomerio(value *VerificationCustomerIo) *VerificationConfig { + return &VerificationConfig{Type: "customerio", Customerio: value} } -func (v *VerificationPipedrive) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPipedrive - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationPipedrive(value) +func NewVerificationConfigFromFacebook(value *VerificationFacebook) *VerificationConfig { + return &VerificationConfig{Type: "facebook", Facebook: value} +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties +func NewVerificationConfigFromWhatsapp(value *VerificationWhatsApp) *VerificationConfig { + return &VerificationConfig{Type: "whatsapp", Whatsapp: value} +} - v._rawJSON = json.RawMessage(data) - return nil +func NewVerificationConfigFromReplicate(value *VerificationReplicate) *VerificationConfig { + return &VerificationConfig{Type: "replicate", Replicate: value} } -func (v *VerificationPipedrive) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) +func NewVerificationConfigFromTiktok(value *VerificationTikTok) *VerificationConfig { + return &VerificationConfig{Type: "tiktok", Tiktok: value} } -// The verification configs for Pipedrive. Only included if the ?include=verification.configs query param is present -type VerificationPipedriveConfigs struct { - Username string `json:"username" url:"username"` - Password string `json:"password" url:"password"` +func NewVerificationConfigFromAirwallex(value *VerificationAirwallex) *VerificationConfig { + return &VerificationConfig{Type: "airwallex", Airwallex: value} +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func NewVerificationConfigFromZendesk(value *VerificationZendesk) *VerificationConfig { + return &VerificationConfig{Type: "zendesk", Zendesk: value} } -func (v *VerificationPipedriveConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func NewVerificationConfigFromUpollo(value *VerificationUpollo) *VerificationConfig { + return &VerificationConfig{Type: "upollo", Upollo: value} } -func (v *VerificationPipedriveConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPipedriveConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetType() string { + if v == nil { + return "" } - *v = VerificationPipedriveConfigs(value) + return v.Type +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetHmac() *VerificationHmac { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Hmac +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetBasicAuth() *VerificationBasicAuth { + if v == nil { + return nil + } + return v.BasicAuth } -func (v *VerificationPipedriveConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetApiKey() *VerificationApiKey { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.ApiKey +} + +func (v *VerificationConfig) GetWebhook() *VerificationWebhook { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Webhook } -type VerificationPostmark struct { - Configs *VerificationPostmarkConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (v *VerificationConfig) GetHttp() *VerificationHttp { + if v == nil { + return nil + } + return v.Http +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetSanity() *VerificationSanity { + if v == nil { + return nil + } + return v.Sanity } -func (v *VerificationPostmark) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetBridge() *VerificationBridge { + if v == nil { + return nil + } + return v.Bridge } -func (v *VerificationPostmark) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPostmark - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetCloudsignal() *VerificationCloudSignal { + if v == nil { + return nil } - *v = VerificationPostmark(value) + return v.Cloudsignal +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetCourier() *VerificationCourier { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Courier +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetFrontapp() *VerificationFrontApp { + if v == nil { + return nil + } + return v.Frontapp } -func (v *VerificationPostmark) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetZoom() *VerificationZoom { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Zoom +} + +func (v *VerificationConfig) GetTwitter() *VerificationTwitter { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Twitter } -// The verification configs for Postmark. Only included if the ?include=verification.configs query param is present -type VerificationPostmarkConfigs struct { - Username string `json:"username" url:"username"` - Password string `json:"password" url:"password"` +func (v *VerificationConfig) GetRecharge() *VerificationRecharge { + if v == nil { + return nil + } + return v.Recharge +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetStripe() *VerificationStripe { + if v == nil { + return nil + } + return v.Stripe } -func (v *VerificationPostmarkConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetPropertyFinder() *VerificationPropertyFinder { + if v == nil { + return nil + } + return v.PropertyFinder } -func (v *VerificationPostmarkConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPostmarkConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetShopify() *VerificationShopify { + if v == nil { + return nil } - *v = VerificationPostmarkConfigs(value) + return v.Shopify +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetTwilio() *VerificationTwilio { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Twilio +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetGithub() *VerificationGitHub { + if v == nil { + return nil + } + return v.Github } -func (v *VerificationPostmarkConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetPostmark() *VerificationPostmark { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Postmark +} + +func (v *VerificationConfig) GetTypeform() *VerificationTypeform { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Typeform } -type VerificationPraxis struct { - Configs *VerificationPraxisConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (v *VerificationConfig) GetXero() *VerificationXero { + if v == nil { + return nil + } + return v.Xero +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetSvix() *VerificationSvix { + if v == nil { + return nil + } + return v.Svix } -func (v *VerificationPraxis) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetAdyen() *VerificationAdyen { + if v == nil { + return nil + } + return v.Adyen } -func (v *VerificationPraxis) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPraxis - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetAkeneo() *VerificationAkeneo { + if v == nil { + return nil } - *v = VerificationPraxis(value) + return v.Akeneo +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetGitlab() *VerificationGitLab { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Gitlab +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetWoocommerce() *VerificationWooCommerce { + if v == nil { + return nil + } + return v.Woocommerce } -func (v *VerificationPraxis) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetOura() *VerificationOura { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Oura +} + +func (v *VerificationConfig) GetCommercelayer() *VerificationCommerceLayer { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Commercelayer } -// The verification configs for Praxis. Only included if the ?include=verification.configs query param is present -type VerificationPraxisConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func (v *VerificationConfig) GetHubspot() *VerificationHubspot { + if v == nil { + return nil + } + return v.Hubspot +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetMailgun() *VerificationMailgun { + if v == nil { + return nil + } + return v.Mailgun } -func (v *VerificationPraxisConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetPersona() *VerificationPersona { + if v == nil { + return nil + } + return v.Persona } -func (v *VerificationPraxisConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPraxisConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetPipedrive() *VerificationPipedrive { + if v == nil { + return nil } - *v = VerificationPraxisConfigs(value) + return v.Pipedrive +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetSendgrid() *VerificationSendgrid { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Sendgrid +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetWorkos() *VerificationWorkOs { + if v == nil { + return nil + } + return v.Workos } -func (v *VerificationPraxisConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetSynctera() *VerificationSynctera { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Synctera +} + +func (v *VerificationConfig) GetAwsSns() *VerificationAwssns { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.AwsSns } -type VerificationPropertyFinder struct { - Configs *VerificationPropertyFinderConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (v *VerificationConfig) GetThreeDEye() *Verification3DEye { + if v == nil { + return nil + } + return v.ThreeDEye +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetTwitch() *VerificationTwitch { + if v == nil { + return nil + } + return v.Twitch } -func (v *VerificationPropertyFinder) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetEnode() *VerificationEnode { + if v == nil { + return nil + } + return v.Enode } -func (v *VerificationPropertyFinder) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPropertyFinder - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetFavro() *VerificationFavro { + if v == nil { + return nil } - *v = VerificationPropertyFinder(value) + return v.Favro +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetLinear() *VerificationLinear { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Linear +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetShopline() *VerificationShopline { + if v == nil { + return nil + } + return v.Shopline } -func (v *VerificationPropertyFinder) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetWix() *VerificationWix { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Wix +} + +func (v *VerificationConfig) GetNmi() *VerificationNmiPaymentGateway { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Nmi } -// The verification configs for Property Finder. Only included if the ?include=verification.configs query param is present -type VerificationPropertyFinderConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func (v *VerificationConfig) GetOrb() *VerificationOrb { + if v == nil { + return nil + } + return v.Orb +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetPylon() *VerificationPylon { + if v == nil { + return nil + } + return v.Pylon } -func (v *VerificationPropertyFinderConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetRazorpay() *VerificationRazorpay { + if v == nil { + return nil + } + return v.Razorpay } -func (v *VerificationPropertyFinderConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPropertyFinderConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetRepay() *VerificationRepay { + if v == nil { + return nil } - *v = VerificationPropertyFinderConfigs(value) + return v.Repay +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetSquare() *VerificationSquare { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Square +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetSolidgate() *VerificationSolidgate { + if v == nil { + return nil + } + return v.Solidgate } -func (v *VerificationPropertyFinderConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetTrello() *VerificationTrello { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Trello +} + +func (v *VerificationConfig) GetEbay() *VerificationEbay { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Ebay } -type VerificationPylon struct { - Configs *VerificationPylonConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (v *VerificationConfig) GetTelnyx() *VerificationTelnyx { + if v == nil { + return nil + } + return v.Telnyx +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetDiscord() *VerificationDiscord { + if v == nil { + return nil + } + return v.Discord } -func (v *VerificationPylon) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetTokenio() *VerificationTokenIo { + if v == nil { + return nil + } + return v.Tokenio } -func (v *VerificationPylon) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPylon - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetFiserv() *VerificationFiserv { + if v == nil { + return nil } - *v = VerificationPylon(value) + return v.Fiserv +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetBondsmith() *VerificationBondsmith { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Bondsmith +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetVercelLogDrains() *VerificationVercelLogDrains { + if v == nil { + return nil + } + return v.VercelLogDrains } -func (v *VerificationPylon) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetVercel() *VerificationVercelWebhooks { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Vercel +} + +func (v *VerificationConfig) GetTebex() *VerificationTebex { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Tebex } -// The verification configs for Pylon. Only included if the ?include=verification.configs query param is present -type VerificationPylonConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +func (v *VerificationConfig) GetSlack() *VerificationSlack { + if v == nil { + return nil + } + return v.Slack +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetMailchimp() *VerificationMailchimp { + if v == nil { + return nil + } + return v.Mailchimp } -func (v *VerificationPylonConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetPaddle() *VerificationPaddle { + if v == nil { + return nil + } + return v.Paddle } -func (v *VerificationPylonConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationPylonConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetPaypal() *VerificationPaypal { + if v == nil { + return nil } - *v = VerificationPylonConfigs(value) + return v.Paypal +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetTreezor() *VerificationTreezor { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Treezor +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetPraxis() *VerificationPraxis { + if v == nil { + return nil + } + return v.Praxis } -func (v *VerificationPylonConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } +func (v *VerificationConfig) GetCustomerio() *VerificationCustomerIo { + if v == nil { + return nil } - if value, err := core.StringifyJSON(v); err == nil { - return value + return v.Customerio +} + +func (v *VerificationConfig) GetFacebook() *VerificationFacebook { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) + return v.Facebook } -type VerificationRazorpay struct { - Configs *VerificationRazorpayConfigs `json:"configs,omitempty" url:"configs,omitempty"` +func (v *VerificationConfig) GetWhatsapp() *VerificationWhatsApp { + if v == nil { + return nil + } + return v.Whatsapp +} - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationConfig) GetReplicate() *VerificationReplicate { + if v == nil { + return nil + } + return v.Replicate } -func (v *VerificationRazorpay) GetExtraProperties() map[string]interface{} { - return v.extraProperties +func (v *VerificationConfig) GetTiktok() *VerificationTikTok { + if v == nil { + return nil + } + return v.Tiktok } -func (v *VerificationRazorpay) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRazorpay - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func (v *VerificationConfig) GetAirwallex() *VerificationAirwallex { + if v == nil { + return nil } - *v = VerificationRazorpay(value) + return v.Airwallex +} - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err +func (v *VerificationConfig) GetZendesk() *VerificationZendesk { + if v == nil { + return nil } - v.extraProperties = extraProperties + return v.Zendesk +} - v._rawJSON = json.RawMessage(data) - return nil +func (v *VerificationConfig) GetUpollo() *VerificationUpollo { + if v == nil { + return nil + } + return v.Upollo } -func (v *VerificationRazorpay) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value +func (v *VerificationConfig) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + v.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", v) + } + switch unmarshaler.Type { + case "hmac": + value := new(VerificationHmac) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Hmac = value + case "basic_auth": + value := new(VerificationBasicAuth) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.BasicAuth = value + case "api_key": + value := new(VerificationApiKey) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.ApiKey = value + case "webhook": + value := new(VerificationWebhook) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Webhook = value + case "http": + value := new(VerificationHttp) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Http = value + case "sanity": + value := new(VerificationSanity) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Sanity = value + case "bridge": + value := new(VerificationBridge) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Bridge = value + case "cloudsignal": + value := new(VerificationCloudSignal) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Cloudsignal = value + case "courier": + value := new(VerificationCourier) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Courier = value + case "frontapp": + value := new(VerificationFrontApp) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Frontapp = value + case "zoom": + value := new(VerificationZoom) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Zoom = value + case "twitter": + value := new(VerificationTwitter) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Twitter = value + case "recharge": + value := new(VerificationRecharge) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Recharge = value + case "stripe": + value := new(VerificationStripe) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Stripe = value + case "property-finder": + value := new(VerificationPropertyFinder) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.PropertyFinder = value + case "shopify": + value := new(VerificationShopify) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Shopify = value + case "twilio": + value := new(VerificationTwilio) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Twilio = value + case "github": + value := new(VerificationGitHub) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Github = value + case "postmark": + value := new(VerificationPostmark) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Postmark = value + case "typeform": + value := new(VerificationTypeform) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Typeform = value + case "xero": + value := new(VerificationXero) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Xero = value + case "svix": + value := new(VerificationSvix) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Svix = value + case "adyen": + value := new(VerificationAdyen) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Adyen = value + case "akeneo": + value := new(VerificationAkeneo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Akeneo = value + case "gitlab": + value := new(VerificationGitLab) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Gitlab = value + case "woocommerce": + value := new(VerificationWooCommerce) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Woocommerce = value + case "oura": + value := new(VerificationOura) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Oura = value + case "commercelayer": + value := new(VerificationCommerceLayer) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Commercelayer = value + case "hubspot": + value := new(VerificationHubspot) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Hubspot = value + case "mailgun": + value := new(VerificationMailgun) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Mailgun = value + case "persona": + value := new(VerificationPersona) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Persona = value + case "pipedrive": + value := new(VerificationPipedrive) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Razorpay. Only included if the ?include=verification.configs query param is present -type VerificationRazorpayConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationRazorpayConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationRazorpayConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRazorpayConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationRazorpayConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationRazorpayConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Pipedrive = value + case "sendgrid": + value := new(VerificationSendgrid) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationRecharge struct { - Configs *VerificationRechargeConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationRecharge) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationRecharge) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRecharge - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationRecharge(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationRecharge) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Sendgrid = value + case "workos": + value := new(VerificationWorkOs) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Recharge. Only included if the ?include=verification.configs query param is present -type VerificationRechargeConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationRechargeConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationRechargeConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRechargeConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationRechargeConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationRechargeConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Workos = value + case "synctera": + value := new(VerificationSynctera) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationRepay struct { - Configs *VerificationRepayConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationRepay) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationRepay) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRepay - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationRepay(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationRepay) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Synctera = value + case "aws_sns": + value := new(VerificationAwssns) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Repay. Only included if the ?include=verification.configs query param is present -type VerificationRepayConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationRepayConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationRepayConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationRepayConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationRepayConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationRepayConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.AwsSns = value + case "three_d_eye": + value := new(Verification3DEye) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSanity struct { - Configs *VerificationSanityConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSanity) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSanity) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSanity - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSanity(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSanity) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.ThreeDEye = value + case "twitch": + value := new(VerificationTwitch) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Sanity. Only included if the ?include=verification.configs query param is present -type VerificationSanityConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSanityConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSanityConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSanityConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSanityConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSanityConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Twitch = value + case "enode": + value := new(VerificationEnode) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Enode = value + case "favro": + value := new(VerificationFavro) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Favro = value + case "linear": + value := new(VerificationLinear) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSendGrid struct { - Configs *VerificationSendGridConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSendGrid) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSendGrid) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSendGrid - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSendGrid(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSendGrid) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Linear = value + case "shopline": + value := new(VerificationShopline) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for SendGrid. Only included if the ?include=verification.configs query param is present -type VerificationSendGridConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSendGridConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSendGridConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSendGridConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSendGridConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSendGridConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Shopline = value + case "wix": + value := new(VerificationWix) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationShopify struct { - Configs *VerificationShopifyConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationShopify) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationShopify) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationShopify - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationShopify(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationShopify) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Wix = value + case "nmi": + value := new(VerificationNmiPaymentGateway) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Shopify. Only included if the ?include=verification.configs query param is present -type VerificationShopifyConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationShopifyConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationShopifyConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationShopifyConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationShopifyConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationShopifyConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Nmi = value + case "orb": + value := new(VerificationOrb) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationShopline struct { - Configs *VerificationShoplineConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationShopline) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationShopline) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationShopline - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationShopline(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationShopline) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Orb = value + case "pylon": + value := new(VerificationPylon) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Shopline. Only included if the ?include=verification.configs query param is present -type VerificationShoplineConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationShoplineConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationShoplineConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationShoplineConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationShoplineConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationShoplineConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Pylon = value + case "razorpay": + value := new(VerificationRazorpay) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSlack struct { - Configs *VerificationSlackConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSlack) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSlack) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSlack - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSlack(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSlack) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Razorpay = value + case "repay": + value := new(VerificationRepay) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Repay = value + case "square": + value := new(VerificationSquare) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Square = value + case "solidgate": + value := new(VerificationSolidgate) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Slack. Only included if the ?include=verification.configs query param is present -type VerificationSlackConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSlackConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSlackConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSlackConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSlackConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSlackConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Solidgate = value + case "trello": + value := new(VerificationTrello) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSolidGate struct { - Configs *VerificationSolidGateConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSolidGate) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSolidGate) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSolidGate - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSolidGate(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSolidGate) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Trello = value + case "ebay": + value := new(VerificationEbay) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for SolidGate. Only included if the ?include=verification.configs query param is present -type VerificationSolidGateConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSolidGateConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSolidGateConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSolidGateConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSolidGateConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSolidGateConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Ebay = value + case "telnyx": + value := new(VerificationTelnyx) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSquare struct { - Configs *VerificationSquareConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSquare) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSquare) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSquare - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSquare(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSquare) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Telnyx = value + case "discord": + value := new(VerificationDiscord) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Square. Only included if the ?include=verification.configs query param is present -type VerificationSquareConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSquareConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSquareConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSquareConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSquareConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSquareConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Discord = value + case "tokenio": + value := new(VerificationTokenIo) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationStripe struct { - Configs *VerificationStripeConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationStripe) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationStripe) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationStripe - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationStripe(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationStripe) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Tokenio = value + case "fiserv": + value := new(VerificationFiserv) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Stripe. Only included if the ?include=verification.configs query param is present -type VerificationStripeConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationStripeConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationStripeConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationStripeConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationStripeConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationStripeConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Fiserv = value + case "bondsmith": + value := new(VerificationBondsmith) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Bondsmith = value + case "vercel_log_drains": + value := new(VerificationVercelLogDrains) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.VercelLogDrains = value + case "vercel": + value := new(VerificationVercelWebhooks) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Vercel = value + case "tebex": + value := new(VerificationTebex) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSvix struct { - Configs *VerificationSvixConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSvix) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSvix) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSvix - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSvix(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSvix) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Tebex = value + case "slack": + value := new(VerificationSlack) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Svix. Only included if the ?include=verification.configs query param is present -type VerificationSvixConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSvixConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSvixConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSvixConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSvixConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSvixConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Slack = value + case "mailchimp": + value := new(VerificationMailchimp) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationSynctera struct { - Configs *VerificationSyncteraConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSynctera) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSynctera) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSynctera - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSynctera(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSynctera) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Mailchimp = value + case "paddle": + value := new(VerificationPaddle) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Synctera. Only included if the ?include=verification.configs query param is present -type VerificationSyncteraConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationSyncteraConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationSyncteraConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationSyncteraConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationSyncteraConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationSyncteraConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Paddle = value + case "paypal": + value := new(VerificationPaypal) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationTebex struct { - Configs *VerificationTebexConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTebex) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTebex) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTebex - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTebex(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationTebex) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Paypal = value + case "treezor": + value := new(VerificationTreezor) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Tebex. Only included if the ?include=verification.configs query param is present -type VerificationTebexConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTebexConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTebexConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTebexConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTebexConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationTebexConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Treezor = value + case "praxis": + value := new(VerificationPraxis) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationTelnyx struct { - Configs *VerificationTelnyxConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTelnyx) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTelnyx) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTelnyx - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTelnyx(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationTelnyx) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Praxis = value + case "customerio": + value := new(VerificationCustomerIo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Customerio = value + case "facebook": + value := new(VerificationFacebook) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Facebook = value + case "whatsapp": + value := new(VerificationWhatsApp) + if err := json.Unmarshal(data, &value); err != nil { + return err } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Telnyx. Only included if the ?include=verification.configs query param is present -type VerificationTelnyxConfigs struct { - PublicKey string `json:"public_key" url:"public_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTelnyxConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTelnyxConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTelnyxConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTelnyxConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationTelnyxConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value + v.Whatsapp = value + case "replicate": + value := new(VerificationReplicate) + if err := json.Unmarshal(data, &value); err != nil { + return err } + v.Replicate = value + case "tiktok": + value := new(VerificationTikTok) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Tiktok = value + case "airwallex": + value := new(VerificationAirwallex) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Airwallex = value + case "zendesk": + value := new(VerificationZendesk) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Zendesk = value + case "upollo": + value := new(VerificationUpollo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.Upollo = value } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) -} - -type VerificationTokenIo struct { - Configs *VerificationTokenIoConfigs `json:"configs,omitempty" url:"configs,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTokenIo) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTokenIo) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTokenIo - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTokenIo(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTokenIo) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +func (v VerificationConfig) MarshalJSON() ([]byte, error) { + switch v.Type { + default: + return nil, fmt.Errorf("invalid type %s in %T", v.Type, v) + case "hmac": + return internal.MarshalJSONWithExtraProperty(v.Hmac, "type", "hmac") + case "basic_auth": + return internal.MarshalJSONWithExtraProperty(v.BasicAuth, "type", "basic_auth") + case "api_key": + return internal.MarshalJSONWithExtraProperty(v.ApiKey, "type", "api_key") + case "webhook": + return internal.MarshalJSONWithExtraProperty(v.Webhook, "type", "webhook") + case "http": + return internal.MarshalJSONWithExtraProperty(v.Http, "type", "http") + case "sanity": + return internal.MarshalJSONWithExtraProperty(v.Sanity, "type", "sanity") + case "bridge": + return internal.MarshalJSONWithExtraProperty(v.Bridge, "type", "bridge") + case "cloudsignal": + return internal.MarshalJSONWithExtraProperty(v.Cloudsignal, "type", "cloudsignal") + case "courier": + return internal.MarshalJSONWithExtraProperty(v.Courier, "type", "courier") + case "frontapp": + return internal.MarshalJSONWithExtraProperty(v.Frontapp, "type", "frontapp") + case "zoom": + return internal.MarshalJSONWithExtraProperty(v.Zoom, "type", "zoom") + case "twitter": + return internal.MarshalJSONWithExtraProperty(v.Twitter, "type", "twitter") + case "recharge": + return internal.MarshalJSONWithExtraProperty(v.Recharge, "type", "recharge") + case "stripe": + return internal.MarshalJSONWithExtraProperty(v.Stripe, "type", "stripe") + case "property-finder": + return internal.MarshalJSONWithExtraProperty(v.PropertyFinder, "type", "property-finder") + case "shopify": + return internal.MarshalJSONWithExtraProperty(v.Shopify, "type", "shopify") + case "twilio": + return internal.MarshalJSONWithExtraProperty(v.Twilio, "type", "twilio") + case "github": + return internal.MarshalJSONWithExtraProperty(v.Github, "type", "github") + case "postmark": + return internal.MarshalJSONWithExtraProperty(v.Postmark, "type", "postmark") + case "typeform": + return internal.MarshalJSONWithExtraProperty(v.Typeform, "type", "typeform") + case "xero": + return internal.MarshalJSONWithExtraProperty(v.Xero, "type", "xero") + case "svix": + return internal.MarshalJSONWithExtraProperty(v.Svix, "type", "svix") + case "adyen": + return internal.MarshalJSONWithExtraProperty(v.Adyen, "type", "adyen") + case "akeneo": + return internal.MarshalJSONWithExtraProperty(v.Akeneo, "type", "akeneo") + case "gitlab": + return internal.MarshalJSONWithExtraProperty(v.Gitlab, "type", "gitlab") + case "woocommerce": + return internal.MarshalJSONWithExtraProperty(v.Woocommerce, "type", "woocommerce") + case "oura": + return internal.MarshalJSONWithExtraProperty(v.Oura, "type", "oura") + case "commercelayer": + return internal.MarshalJSONWithExtraProperty(v.Commercelayer, "type", "commercelayer") + case "hubspot": + return internal.MarshalJSONWithExtraProperty(v.Hubspot, "type", "hubspot") + case "mailgun": + return internal.MarshalJSONWithExtraProperty(v.Mailgun, "type", "mailgun") + case "persona": + return internal.MarshalJSONWithExtraProperty(v.Persona, "type", "persona") + case "pipedrive": + return internal.MarshalJSONWithExtraProperty(v.Pipedrive, "type", "pipedrive") + case "sendgrid": + return internal.MarshalJSONWithExtraProperty(v.Sendgrid, "type", "sendgrid") + case "workos": + return internal.MarshalJSONWithExtraProperty(v.Workos, "type", "workos") + case "synctera": + return internal.MarshalJSONWithExtraProperty(v.Synctera, "type", "synctera") + case "aws_sns": + return internal.MarshalJSONWithExtraProperty(v.AwsSns, "type", "aws_sns") + case "three_d_eye": + return internal.MarshalJSONWithExtraProperty(v.ThreeDEye, "type", "three_d_eye") + case "twitch": + return internal.MarshalJSONWithExtraProperty(v.Twitch, "type", "twitch") + case "enode": + return internal.MarshalJSONWithExtraProperty(v.Enode, "type", "enode") + case "favro": + return internal.MarshalJSONWithExtraProperty(v.Favro, "type", "favro") + case "linear": + return internal.MarshalJSONWithExtraProperty(v.Linear, "type", "linear") + case "shopline": + return internal.MarshalJSONWithExtraProperty(v.Shopline, "type", "shopline") + case "wix": + return internal.MarshalJSONWithExtraProperty(v.Wix, "type", "wix") + case "nmi": + return internal.MarshalJSONWithExtraProperty(v.Nmi, "type", "nmi") + case "orb": + return internal.MarshalJSONWithExtraProperty(v.Orb, "type", "orb") + case "pylon": + return internal.MarshalJSONWithExtraProperty(v.Pylon, "type", "pylon") + case "razorpay": + return internal.MarshalJSONWithExtraProperty(v.Razorpay, "type", "razorpay") + case "repay": + return internal.MarshalJSONWithExtraProperty(v.Repay, "type", "repay") + case "square": + return internal.MarshalJSONWithExtraProperty(v.Square, "type", "square") + case "solidgate": + return internal.MarshalJSONWithExtraProperty(v.Solidgate, "type", "solidgate") + case "trello": + return internal.MarshalJSONWithExtraProperty(v.Trello, "type", "trello") + case "ebay": + return internal.MarshalJSONWithExtraProperty(v.Ebay, "type", "ebay") + case "telnyx": + return internal.MarshalJSONWithExtraProperty(v.Telnyx, "type", "telnyx") + case "discord": + return internal.MarshalJSONWithExtraProperty(v.Discord, "type", "discord") + case "tokenio": + return internal.MarshalJSONWithExtraProperty(v.Tokenio, "type", "tokenio") + case "fiserv": + return internal.MarshalJSONWithExtraProperty(v.Fiserv, "type", "fiserv") + case "bondsmith": + return internal.MarshalJSONWithExtraProperty(v.Bondsmith, "type", "bondsmith") + case "vercel_log_drains": + return internal.MarshalJSONWithExtraProperty(v.VercelLogDrains, "type", "vercel_log_drains") + case "vercel": + return internal.MarshalJSONWithExtraProperty(v.Vercel, "type", "vercel") + case "tebex": + return internal.MarshalJSONWithExtraProperty(v.Tebex, "type", "tebex") + case "slack": + return internal.MarshalJSONWithExtraProperty(v.Slack, "type", "slack") + case "mailchimp": + return internal.MarshalJSONWithExtraProperty(v.Mailchimp, "type", "mailchimp") + case "paddle": + return internal.MarshalJSONWithExtraProperty(v.Paddle, "type", "paddle") + case "paypal": + return internal.MarshalJSONWithExtraProperty(v.Paypal, "type", "paypal") + case "treezor": + return internal.MarshalJSONWithExtraProperty(v.Treezor, "type", "treezor") + case "praxis": + return internal.MarshalJSONWithExtraProperty(v.Praxis, "type", "praxis") + case "customerio": + return internal.MarshalJSONWithExtraProperty(v.Customerio, "type", "customerio") + case "facebook": + return internal.MarshalJSONWithExtraProperty(v.Facebook, "type", "facebook") + case "whatsapp": + return internal.MarshalJSONWithExtraProperty(v.Whatsapp, "type", "whatsapp") + case "replicate": + return internal.MarshalJSONWithExtraProperty(v.Replicate, "type", "replicate") + case "tiktok": + return internal.MarshalJSONWithExtraProperty(v.Tiktok, "type", "tiktok") + case "airwallex": + return internal.MarshalJSONWithExtraProperty(v.Airwallex, "type", "airwallex") + case "zendesk": + return internal.MarshalJSONWithExtraProperty(v.Zendesk, "type", "zendesk") + case "upollo": + return internal.MarshalJSONWithExtraProperty(v.Upollo, "type", "upollo") } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for TokenIO. Only included if the ?include=verification.configs query param is present -type VerificationTokenIoConfigs struct { - PublicKey string `json:"public_key" url:"public_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTokenIoConfigs) GetExtraProperties() map[string]interface{} { - return v.extraProperties } -func (v *VerificationTokenIoConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTokenIoConfigs - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTokenIoConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil +type VerificationConfigVisitor interface { + VisitHmac(*VerificationHmac) error + VisitBasicAuth(*VerificationBasicAuth) error + VisitApiKey(*VerificationApiKey) error + VisitWebhook(*VerificationWebhook) error + VisitHttp(*VerificationHttp) error + VisitSanity(*VerificationSanity) error + VisitBridge(*VerificationBridge) error + VisitCloudsignal(*VerificationCloudSignal) error + VisitCourier(*VerificationCourier) error + VisitFrontapp(*VerificationFrontApp) error + VisitZoom(*VerificationZoom) error + VisitTwitter(*VerificationTwitter) error + VisitRecharge(*VerificationRecharge) error + VisitStripe(*VerificationStripe) error + VisitPropertyFinder(*VerificationPropertyFinder) error + VisitShopify(*VerificationShopify) error + VisitTwilio(*VerificationTwilio) error + VisitGithub(*VerificationGitHub) error + VisitPostmark(*VerificationPostmark) error + VisitTypeform(*VerificationTypeform) error + VisitXero(*VerificationXero) error + VisitSvix(*VerificationSvix) error + VisitAdyen(*VerificationAdyen) error + VisitAkeneo(*VerificationAkeneo) error + VisitGitlab(*VerificationGitLab) error + VisitWoocommerce(*VerificationWooCommerce) error + VisitOura(*VerificationOura) error + VisitCommercelayer(*VerificationCommerceLayer) error + VisitHubspot(*VerificationHubspot) error + VisitMailgun(*VerificationMailgun) error + VisitPersona(*VerificationPersona) error + VisitPipedrive(*VerificationPipedrive) error + VisitSendgrid(*VerificationSendgrid) error + VisitWorkos(*VerificationWorkOs) error + VisitSynctera(*VerificationSynctera) error + VisitAwsSns(*VerificationAwssns) error + VisitThreeDEye(*Verification3DEye) error + VisitTwitch(*VerificationTwitch) error + VisitEnode(*VerificationEnode) error + VisitFavro(*VerificationFavro) error + VisitLinear(*VerificationLinear) error + VisitShopline(*VerificationShopline) error + VisitWix(*VerificationWix) error + VisitNmi(*VerificationNmiPaymentGateway) error + VisitOrb(*VerificationOrb) error + VisitPylon(*VerificationPylon) error + VisitRazorpay(*VerificationRazorpay) error + VisitRepay(*VerificationRepay) error + VisitSquare(*VerificationSquare) error + VisitSolidgate(*VerificationSolidgate) error + VisitTrello(*VerificationTrello) error + VisitEbay(*VerificationEbay) error + VisitTelnyx(*VerificationTelnyx) error + VisitDiscord(*VerificationDiscord) error + VisitTokenio(*VerificationTokenIo) error + VisitFiserv(*VerificationFiserv) error + VisitBondsmith(*VerificationBondsmith) error + VisitVercelLogDrains(*VerificationVercelLogDrains) error + VisitVercel(*VerificationVercelWebhooks) error + VisitTebex(*VerificationTebex) error + VisitSlack(*VerificationSlack) error + VisitMailchimp(*VerificationMailchimp) error + VisitPaddle(*VerificationPaddle) error + VisitPaypal(*VerificationPaypal) error + VisitTreezor(*VerificationTreezor) error + VisitPraxis(*VerificationPraxis) error + VisitCustomerio(*VerificationCustomerIo) error + VisitFacebook(*VerificationFacebook) error + VisitWhatsapp(*VerificationWhatsApp) error + VisitReplicate(*VerificationReplicate) error + VisitTiktok(*VerificationTikTok) error + VisitAirwallex(*VerificationAirwallex) error + VisitZendesk(*VerificationZendesk) error + VisitUpollo(*VerificationUpollo) error } -func (v *VerificationTokenIoConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +func (v *VerificationConfig) Accept(visitor VerificationConfigVisitor) error { + switch v.Type { + default: + return fmt.Errorf("invalid type %s in %T", v.Type, v) + case "hmac": + return visitor.VisitHmac(v.Hmac) + case "basic_auth": + return visitor.VisitBasicAuth(v.BasicAuth) + case "api_key": + return visitor.VisitApiKey(v.ApiKey) + case "webhook": + return visitor.VisitWebhook(v.Webhook) + case "http": + return visitor.VisitHttp(v.Http) + case "sanity": + return visitor.VisitSanity(v.Sanity) + case "bridge": + return visitor.VisitBridge(v.Bridge) + case "cloudsignal": + return visitor.VisitCloudsignal(v.Cloudsignal) + case "courier": + return visitor.VisitCourier(v.Courier) + case "frontapp": + return visitor.VisitFrontapp(v.Frontapp) + case "zoom": + return visitor.VisitZoom(v.Zoom) + case "twitter": + return visitor.VisitTwitter(v.Twitter) + case "recharge": + return visitor.VisitRecharge(v.Recharge) + case "stripe": + return visitor.VisitStripe(v.Stripe) + case "property-finder": + return visitor.VisitPropertyFinder(v.PropertyFinder) + case "shopify": + return visitor.VisitShopify(v.Shopify) + case "twilio": + return visitor.VisitTwilio(v.Twilio) + case "github": + return visitor.VisitGithub(v.Github) + case "postmark": + return visitor.VisitPostmark(v.Postmark) + case "typeform": + return visitor.VisitTypeform(v.Typeform) + case "xero": + return visitor.VisitXero(v.Xero) + case "svix": + return visitor.VisitSvix(v.Svix) + case "adyen": + return visitor.VisitAdyen(v.Adyen) + case "akeneo": + return visitor.VisitAkeneo(v.Akeneo) + case "gitlab": + return visitor.VisitGitlab(v.Gitlab) + case "woocommerce": + return visitor.VisitWoocommerce(v.Woocommerce) + case "oura": + return visitor.VisitOura(v.Oura) + case "commercelayer": + return visitor.VisitCommercelayer(v.Commercelayer) + case "hubspot": + return visitor.VisitHubspot(v.Hubspot) + case "mailgun": + return visitor.VisitMailgun(v.Mailgun) + case "persona": + return visitor.VisitPersona(v.Persona) + case "pipedrive": + return visitor.VisitPipedrive(v.Pipedrive) + case "sendgrid": + return visitor.VisitSendgrid(v.Sendgrid) + case "workos": + return visitor.VisitWorkos(v.Workos) + case "synctera": + return visitor.VisitSynctera(v.Synctera) + case "aws_sns": + return visitor.VisitAwsSns(v.AwsSns) + case "three_d_eye": + return visitor.VisitThreeDEye(v.ThreeDEye) + case "twitch": + return visitor.VisitTwitch(v.Twitch) + case "enode": + return visitor.VisitEnode(v.Enode) + case "favro": + return visitor.VisitFavro(v.Favro) + case "linear": + return visitor.VisitLinear(v.Linear) + case "shopline": + return visitor.VisitShopline(v.Shopline) + case "wix": + return visitor.VisitWix(v.Wix) + case "nmi": + return visitor.VisitNmi(v.Nmi) + case "orb": + return visitor.VisitOrb(v.Orb) + case "pylon": + return visitor.VisitPylon(v.Pylon) + case "razorpay": + return visitor.VisitRazorpay(v.Razorpay) + case "repay": + return visitor.VisitRepay(v.Repay) + case "square": + return visitor.VisitSquare(v.Square) + case "solidgate": + return visitor.VisitSolidgate(v.Solidgate) + case "trello": + return visitor.VisitTrello(v.Trello) + case "ebay": + return visitor.VisitEbay(v.Ebay) + case "telnyx": + return visitor.VisitTelnyx(v.Telnyx) + case "discord": + return visitor.VisitDiscord(v.Discord) + case "tokenio": + return visitor.VisitTokenio(v.Tokenio) + case "fiserv": + return visitor.VisitFiserv(v.Fiserv) + case "bondsmith": + return visitor.VisitBondsmith(v.Bondsmith) + case "vercel_log_drains": + return visitor.VisitVercelLogDrains(v.VercelLogDrains) + case "vercel": + return visitor.VisitVercel(v.Vercel) + case "tebex": + return visitor.VisitTebex(v.Tebex) + case "slack": + return visitor.VisitSlack(v.Slack) + case "mailchimp": + return visitor.VisitMailchimp(v.Mailchimp) + case "paddle": + return visitor.VisitPaddle(v.Paddle) + case "paypal": + return visitor.VisitPaypal(v.Paypal) + case "treezor": + return visitor.VisitTreezor(v.Treezor) + case "praxis": + return visitor.VisitPraxis(v.Praxis) + case "customerio": + return visitor.VisitCustomerio(v.Customerio) + case "facebook": + return visitor.VisitFacebook(v.Facebook) + case "whatsapp": + return visitor.VisitWhatsapp(v.Whatsapp) + case "replicate": + return visitor.VisitReplicate(v.Replicate) + case "tiktok": + return visitor.VisitTiktok(v.Tiktok) + case "airwallex": + return visitor.VisitAirwallex(v.Airwallex) + case "zendesk": + return visitor.VisitZendesk(v.Zendesk) + case "upollo": + return visitor.VisitUpollo(v.Upollo) } - return fmt.Sprintf("%#v", v) } -type VerificationTreezor struct { - Configs *VerificationTreezorConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationCourier struct { + Configs *TypeCourierConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTreezor) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTreezor) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTreezor - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTreezor(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil + rawJSON json.RawMessage } -func (v *VerificationTreezor) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +func (v *VerificationCourier) GetConfigs() *TypeCourierConfig { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Treezor. Only included if the ?include=verification.configs query param is present -type VerificationTreezorConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return v.Configs } -func (v *VerificationTreezorConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationCourier) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTreezorConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTreezorConfigs +func (v *VerificationCourier) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationCourier var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTreezorConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationCourier(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTreezorConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationCourier) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationTrello struct { - Configs *VerificationTrelloConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationCustomerIo struct { + Configs *TypeCustomerIoConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTrello) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTrello) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTrello - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTrello(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil + rawJSON json.RawMessage } -func (v *VerificationTrello) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +func (v *VerificationCustomerIo) GetConfigs() *TypeCustomerIoConfig { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Trello. Only included if the ?include=verification.configs query param is present -type VerificationTrelloConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return v.Configs } -func (v *VerificationTrelloConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationCustomerIo) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTrelloConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTrelloConfigs +func (v *VerificationCustomerIo) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationCustomerIo var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTrelloConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationCustomerIo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTrelloConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationCustomerIo) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationTwilio struct { - Configs *VerificationTwilioConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationDiscord struct { + Configs *TypeDiscordConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTwilio) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTwilio) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwilio - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTwilio(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil + rawJSON json.RawMessage } -func (v *VerificationTwilio) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value +func (v *VerificationDiscord) GetConfigs() *TypeDiscordConfig { + if v == nil { + return nil } - return fmt.Sprintf("%#v", v) -} - -// The verification configs for Twilio. Only included if the ?include=verification.configs query param is present -type VerificationTwilioConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return v.Configs } -func (v *VerificationTwilioConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationDiscord) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTwilioConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwilioConfigs +func (v *VerificationDiscord) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationDiscord var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTwilioConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationDiscord(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTwilioConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationDiscord) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationTwitch struct { - Configs *VerificationTwitchConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationEbay struct { + Configs *TypeEbayConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage -} - -func (v *VerificationTwitch) GetExtraProperties() map[string]interface{} { - return v.extraProperties -} - -func (v *VerificationTwitch) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwitch - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *v = VerificationTwitch(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) - if err != nil { - return err - } - v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) - return nil -} - -func (v *VerificationTwitch) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(v); err == nil { - return value - } - return fmt.Sprintf("%#v", v) + rawJSON json.RawMessage } -// The verification configs for Twitch. Only included if the ?include=verification.configs query param is present -type VerificationTwitchConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationEbay) GetConfigs() *TypeEbayConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationTwitchConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationEbay) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTwitchConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwitchConfigs +func (v *VerificationEbay) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationEbay var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTwitchConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationEbay(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTwitchConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationEbay) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationTwitter struct { - Configs *VerificationTwitterConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationEnode struct { + Configs *TypeEnodeConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationTwitter) GetExtraProperties() map[string]interface{} { +func (v *VerificationEnode) GetConfigs() *TypeEnodeConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationEnode) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTwitter) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwitter +func (v *VerificationEnode) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationEnode var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTwitter(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationEnode(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTwitter) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationEnode) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Twitter. Only included if the ?include=verification.configs query param is present -type VerificationTwitterConfigs struct { - ApiKey string `json:"api_key" url:"api_key"` +type VerificationFacebook struct { + Configs *TypeFacebookConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationFacebook) GetConfigs() *TypeFacebookConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationTwitterConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationFacebook) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTwitterConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTwitterConfigs +func (v *VerificationFacebook) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationFacebook var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTwitterConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationFacebook(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTwitterConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationFacebook) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationTypeform struct { - Configs *VerificationTypeformConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationFavro struct { + Configs *TypeFavroConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationTypeform) GetExtraProperties() map[string]interface{} { +func (v *VerificationFavro) GetConfigs() *TypeFavroConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationFavro) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTypeform) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTypeform +func (v *VerificationFavro) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationFavro var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTypeform(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationFavro(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTypeform) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationFavro) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Typeform. Only included if the ?include=verification.configs query param is present -type VerificationTypeformConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationFiserv struct { + Configs *TypeFiservConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationFiserv) GetConfigs() *TypeFiservConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationTypeformConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationFiserv) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationTypeformConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationTypeformConfigs +func (v *VerificationFiserv) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationFiserv var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationTypeformConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationFiserv(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationTypeformConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationFiserv) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationVercel struct { - Configs *VerificationVercelConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationFrontApp struct { + Configs *TypeFrontAppConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationFrontApp) GetConfigs() *TypeFrontAppConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationVercel) GetExtraProperties() map[string]interface{} { +func (v *VerificationFrontApp) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationVercel) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationVercel +func (v *VerificationFrontApp) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationFrontApp var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationVercel(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationFrontApp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationVercel) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationFrontApp) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Vercel. Only included if the ?include=verification.configs query param is present -type VerificationVercelConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationGitHub struct { + Configs *TypeGitHubConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationVercelConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationGitHub) GetConfigs() *TypeGitHubConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationGitHub) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationVercelConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationVercelConfigs +func (v *VerificationGitHub) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationGitHub var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationVercelConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationGitHub(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationVercelConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationGitHub) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationVercelLogDrains struct { - Configs *VerificationVercelLogDrainsConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationGitLab struct { + Configs *TypeGitLabConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationVercelLogDrains) GetExtraProperties() map[string]interface{} { +func (v *VerificationGitLab) GetConfigs() *TypeGitLabConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationGitLab) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationVercelLogDrains) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationVercelLogDrains +func (v *VerificationGitLab) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationGitLab var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationVercelLogDrains(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationGitLab(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationVercelLogDrains) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationGitLab) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Vercel Log Drains. Only included if the ?include=verification.configs query param is present -type VerificationVercelLogDrainsConfigs struct { - WebhookSecretKey *string `json:"webhook_secret_key,omitempty" url:"webhook_secret_key,omitempty"` - VercelLogDrainsSecret string `json:"vercel_log_drains_secret" url:"vercel_log_drains_secret"` +type VerificationHmac struct { + Configs *TypeHmacConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationVercelLogDrainsConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationHmac) GetConfigs() *TypeHmacConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationHmac) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationVercelLogDrainsConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationVercelLogDrainsConfigs +func (v *VerificationHmac) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationHmac var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationVercelLogDrainsConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationHmac(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationVercelLogDrainsConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationHmac) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationWix struct { - Configs *VerificationWixConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationHttp struct { + Configs *TypeHttpConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationWix) GetExtraProperties() map[string]interface{} { +func (v *VerificationHttp) GetConfigs() *TypeHttpConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationHttp) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWix) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWix +func (v *VerificationHttp) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationHttp var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWix(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationHttp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWix) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationHttp) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Wix. Only included if the ?include=verification.configs query param is present -type VerificationWixConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationHubspot struct { + Configs *TypeHubspotConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationHubspot) GetConfigs() *TypeHubspotConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationWixConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationHubspot) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWixConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWixConfigs +func (v *VerificationHubspot) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationHubspot var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWixConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationHubspot(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWixConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationHubspot) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationWooCommerce struct { - Configs *VerificationWooCommerceConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationLinear struct { + Configs *TypeLinearConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationWooCommerce) GetExtraProperties() map[string]interface{} { +func (v *VerificationLinear) GetConfigs() *TypeLinearConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationLinear) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWooCommerce) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWooCommerce +func (v *VerificationLinear) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationLinear var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWooCommerce(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationLinear(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWooCommerce) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationLinear) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for WooCommerce. Only included if the ?include=verification.configs query param is present -type VerificationWooCommerceConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationMailchimp struct { + Configs *TypeMailchimpConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationWooCommerceConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationMailchimp) GetConfigs() *TypeMailchimpConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationMailchimp) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWooCommerceConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWooCommerceConfigs +func (v *VerificationMailchimp) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationMailchimp var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWooCommerceConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationMailchimp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWooCommerceConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationMailchimp) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationWorkOs struct { - Configs *VerificationWorkOsConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationMailgun struct { + Configs *TypeMailgunConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationWorkOs) GetExtraProperties() map[string]interface{} { +func (v *VerificationMailgun) GetConfigs() *TypeMailgunConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationMailgun) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWorkOs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWorkOs +func (v *VerificationMailgun) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationMailgun var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWorkOs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationMailgun(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWorkOs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationMailgun) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for WorkOS. Only included if the ?include=verification.configs query param is present -type VerificationWorkOsConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationNmiPaymentGateway struct { + Configs *TypeNmiPaymentGatewayConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationNmiPaymentGateway) GetConfigs() *TypeNmiPaymentGatewayConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationWorkOsConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationNmiPaymentGateway) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationWorkOsConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationWorkOsConfigs +func (v *VerificationNmiPaymentGateway) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationNmiPaymentGateway var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationWorkOsConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationNmiPaymentGateway(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationWorkOsConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationNmiPaymentGateway) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationXero struct { - Configs *VerificationXeroConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationOrb struct { + Configs *TypeOrbConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationXero) GetExtraProperties() map[string]interface{} { +func (v *VerificationOrb) GetConfigs() *TypeOrbConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationOrb) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationXero) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationXero +func (v *VerificationOrb) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationOrb var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationXero(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationOrb(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationXero) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationOrb) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Xero. Only included if the ?include=verification.configs query param is present -type VerificationXeroConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationOura struct { + Configs *TypeOuraConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationOura) GetConfigs() *TypeOuraConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationXeroConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationOura) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationXeroConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationXeroConfigs +func (v *VerificationOura) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationOura var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationXeroConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationOura(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationXeroConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationOura) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -type VerificationZoom struct { - Configs *VerificationZoomConfigs `json:"configs,omitempty" url:"configs,omitempty"` +type VerificationPaddle struct { + Configs *TypePaddleConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (v *VerificationZoom) GetExtraProperties() map[string]interface{} { +func (v *VerificationPaddle) GetConfigs() *TypePaddleConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationPaddle) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationZoom) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationZoom +func (v *VerificationPaddle) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPaddle var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationZoom(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationPaddle(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationZoom) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationPaddle) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// The verification configs for Zoom. Only included if the ?include=verification.configs query param is present -type VerificationZoomConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key" url:"webhook_secret_key"` +type VerificationPaypal struct { + Configs *TypePaypalConfig `json:"configs,omitempty" url:"configs,omitempty"` extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage +} + +func (v *VerificationPaypal) GetConfigs() *TypePaypalConfig { + if v == nil { + return nil + } + return v.Configs } -func (v *VerificationZoomConfigs) GetExtraProperties() map[string]interface{} { +func (v *VerificationPaypal) GetExtraProperties() map[string]interface{} { return v.extraProperties } -func (v *VerificationZoomConfigs) UnmarshalJSON(data []byte) error { - type unmarshaler VerificationZoomConfigs +func (v *VerificationPaypal) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPaypal var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *v = VerificationZoomConfigs(value) - - extraProperties, err := core.ExtractExtraProperties(data, *v) + *v = VerificationPaypal(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } v.extraProperties = extraProperties - - v._rawJSON = json.RawMessage(data) + v.rawJSON = json.RawMessage(data) return nil } -func (v *VerificationZoomConfigs) String() string { - if len(v._rawJSON) > 0 { - if value, err := core.StringifyJSON(v._rawJSON); err == nil { +func (v *VerificationPaypal) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(v); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } return fmt.Sprintf("%#v", v) } -// Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. -type ConnectionCreateRequestDestinationRateLimitPeriod string - -const ( - ConnectionCreateRequestDestinationRateLimitPeriodSecond ConnectionCreateRequestDestinationRateLimitPeriod = "second" - ConnectionCreateRequestDestinationRateLimitPeriodMinute ConnectionCreateRequestDestinationRateLimitPeriod = "minute" - ConnectionCreateRequestDestinationRateLimitPeriodHour ConnectionCreateRequestDestinationRateLimitPeriod = "hour" - ConnectionCreateRequestDestinationRateLimitPeriodConcurrent ConnectionCreateRequestDestinationRateLimitPeriod = "concurrent" -) - -func NewConnectionCreateRequestDestinationRateLimitPeriodFromString(s string) (ConnectionCreateRequestDestinationRateLimitPeriod, error) { - switch s { - case "second": - return ConnectionCreateRequestDestinationRateLimitPeriodSecond, nil - case "minute": - return ConnectionCreateRequestDestinationRateLimitPeriodMinute, nil - case "hour": - return ConnectionCreateRequestDestinationRateLimitPeriodHour, nil - case "concurrent": - return ConnectionCreateRequestDestinationRateLimitPeriodConcurrent, nil - } - var t ConnectionCreateRequestDestinationRateLimitPeriod - return "", fmt.Errorf("%s is not a valid %T", s, t) -} +type VerificationPersona struct { + Configs *TypePersonaConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (c ConnectionCreateRequestDestinationRateLimitPeriod) Ptr() *ConnectionCreateRequestDestinationRateLimitPeriod { - return &c + extraProperties map[string]interface{} + rawJSON json.RawMessage } -// Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. -type ConnectionUpsertRequestDestinationRateLimitPeriod string - -const ( - ConnectionUpsertRequestDestinationRateLimitPeriodSecond ConnectionUpsertRequestDestinationRateLimitPeriod = "second" - ConnectionUpsertRequestDestinationRateLimitPeriodMinute ConnectionUpsertRequestDestinationRateLimitPeriod = "minute" - ConnectionUpsertRequestDestinationRateLimitPeriodHour ConnectionUpsertRequestDestinationRateLimitPeriod = "hour" - ConnectionUpsertRequestDestinationRateLimitPeriodConcurrent ConnectionUpsertRequestDestinationRateLimitPeriod = "concurrent" -) - -func NewConnectionUpsertRequestDestinationRateLimitPeriodFromString(s string) (ConnectionUpsertRequestDestinationRateLimitPeriod, error) { - switch s { - case "second": - return ConnectionUpsertRequestDestinationRateLimitPeriodSecond, nil - case "minute": - return ConnectionUpsertRequestDestinationRateLimitPeriodMinute, nil - case "hour": - return ConnectionUpsertRequestDestinationRateLimitPeriodHour, nil - case "concurrent": - return ConnectionUpsertRequestDestinationRateLimitPeriodConcurrent, nil +func (v *VerificationPersona) GetConfigs() *TypePersonaConfig { + if v == nil { + return nil } - var t ConnectionUpsertRequestDestinationRateLimitPeriod - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c ConnectionUpsertRequestDestinationRateLimitPeriod) Ptr() *ConnectionUpsertRequestDestinationRateLimitPeriod { - return &c -} - -// Filter by number of attempts -type EventBulkRetryCreateRequestQueryAttempts struct { - Integer int - Operators *Operators -} - -func NewEventBulkRetryCreateRequestQueryAttemptsFromInteger(value int) *EventBulkRetryCreateRequestQueryAttempts { - return &EventBulkRetryCreateRequestQueryAttempts{Integer: value} + return v.Configs } -func NewEventBulkRetryCreateRequestQueryAttemptsFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryAttempts { - return &EventBulkRetryCreateRequestQueryAttempts{Operators: value} +func (v *VerificationPersona) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryAttempts) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - e.Integer = valueInteger - return nil +func (v *VerificationPersona) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPersona + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - e.Operators = valueOperators - return nil + *v = VerificationPersona(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryAttempts) MarshalJSON() ([]byte, error) { - if e.Integer != 0 { - return json.Marshal(e.Integer) +func (v *VerificationPersona) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.Operators != nil { - return json.Marshal(e.Operators) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) -} - -type EventBulkRetryCreateRequestQueryAttemptsVisitor interface { - VisitInteger(int) error - VisitOperators(*Operators) error + return fmt.Sprintf("%#v", v) } -func (e *EventBulkRetryCreateRequestQueryAttempts) Accept(visitor EventBulkRetryCreateRequestQueryAttemptsVisitor) error { - if e.Integer != 0 { - return visitor.VisitInteger(e.Integer) - } - if e.Operators != nil { - return visitor.VisitOperators(e.Operators) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} +type VerificationPipedrive struct { + Configs *TypePipedriveConfig `json:"configs,omitempty" url:"configs,omitempty"` -// URL Encoded string of the JSON to match to the data body -type EventBulkRetryCreateRequestQueryBody struct { - String string - EventBulkRetryCreateRequestQueryBodyOne *EventBulkRetryCreateRequestQueryBodyOne + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQueryBodyFromString(value string) *EventBulkRetryCreateRequestQueryBody { - return &EventBulkRetryCreateRequestQueryBody{String: value} +func (v *VerificationPipedrive) GetConfigs() *TypePipedriveConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryBodyFromEventBulkRetryCreateRequestQueryBodyOne(value *EventBulkRetryCreateRequestQueryBodyOne) *EventBulkRetryCreateRequestQueryBody { - return &EventBulkRetryCreateRequestQueryBody{EventBulkRetryCreateRequestQueryBodyOne: value} +func (v *VerificationPipedrive) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil +func (v *VerificationPipedrive) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPipedrive + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueEventBulkRetryCreateRequestQueryBodyOne := new(EventBulkRetryCreateRequestQueryBodyOne) - if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryBodyOne); err == nil { - e.EventBulkRetryCreateRequestQueryBodyOne = valueEventBulkRetryCreateRequestQueryBodyOne - return nil + *v = VerificationPipedrive(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryBody) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) +func (v *VerificationPipedrive) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.EventBulkRetryCreateRequestQueryBodyOne != nil { - return json.Marshal(e.EventBulkRetryCreateRequestQueryBodyOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -type EventBulkRetryCreateRequestQueryBodyVisitor interface { - VisitString(string) error - VisitEventBulkRetryCreateRequestQueryBodyOne(*EventBulkRetryCreateRequestQueryBodyOne) error -} +type VerificationPostmark struct { + Configs *TypePostmarkConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (e *EventBulkRetryCreateRequestQueryBody) Accept(visitor EventBulkRetryCreateRequestQueryBodyVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) - } - if e.EventBulkRetryCreateRequestQueryBodyOne != nil { - return visitor.VisitEventBulkRetryCreateRequestQueryBodyOne(e.EventBulkRetryCreateRequestQueryBodyOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type EventBulkRetryCreateRequestQueryBodyOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationPostmark) GetConfigs() *TypePostmarkConfig { + if v == nil { + return nil + } + return v.Configs } -func (e *EventBulkRetryCreateRequestQueryBodyOne) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (v *VerificationPostmark) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryBodyOne) UnmarshalJSON(data []byte) error { - type unmarshaler EventBulkRetryCreateRequestQueryBodyOne +func (v *VerificationPostmark) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPostmark var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventBulkRetryCreateRequestQueryBodyOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *v = VerificationPostmark(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (e *EventBulkRetryCreateRequestQueryBodyOne) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (v *VerificationPostmark) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", e) -} - -type EventBulkRetryCreateRequestQueryBulkRetryId struct { - String string - StringList []string + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryBulkRetryIdFromString(value string) *EventBulkRetryCreateRequestQueryBulkRetryId { - return &EventBulkRetryCreateRequestQueryBulkRetryId{String: value} -} +type VerificationPraxis struct { + Configs *TypePraxisConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryBulkRetryIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryBulkRetryId { - return &EventBulkRetryCreateRequestQueryBulkRetryId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationPraxis) GetConfigs() *TypePraxisConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryBulkRetryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationPraxis) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryBulkRetryId) Accept(visitor EventBulkRetryCreateRequestQueryBulkRetryIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationPraxis) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPraxis + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationPraxis(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} - -// Filter by CLI IDs. `?[any]=true` operator for any CLI. -type EventBulkRetryCreateRequestQueryCliId struct { - String string - EventBulkRetryCreateRequestQueryCliIdAll *EventBulkRetryCreateRequestQueryCliIdAll - StringList []string -} - -func NewEventBulkRetryCreateRequestQueryCliIdFromString(value string) *EventBulkRetryCreateRequestQueryCliId { - return &EventBulkRetryCreateRequestQueryCliId{String: value} -} - -func NewEventBulkRetryCreateRequestQueryCliIdFromEventBulkRetryCreateRequestQueryCliIdAll(value *EventBulkRetryCreateRequestQueryCliIdAll) *EventBulkRetryCreateRequestQueryCliId { - return &EventBulkRetryCreateRequestQueryCliId{EventBulkRetryCreateRequestQueryCliIdAll: value} -} - -func NewEventBulkRetryCreateRequestQueryCliIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryCliId { - return &EventBulkRetryCreateRequestQueryCliId{StringList: value} + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e *EventBulkRetryCreateRequestQueryCliId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - valueEventBulkRetryCreateRequestQueryCliIdAll := new(EventBulkRetryCreateRequestQueryCliIdAll) - if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryCliIdAll); err == nil { - e.EventBulkRetryCreateRequestQueryCliIdAll = valueEventBulkRetryCreateRequestQueryCliIdAll - return nil +func (v *VerificationPraxis) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList - return nil + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + return fmt.Sprintf("%#v", v) } -func (e EventBulkRetryCreateRequestQueryCliId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.EventBulkRetryCreateRequestQueryCliIdAll != nil { - return json.Marshal(e.EventBulkRetryCreateRequestQueryCliIdAll) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) -} +type VerificationPropertyFinder struct { + Configs *TypePropertyFinderConfig `json:"configs,omitempty" url:"configs,omitempty"` -type EventBulkRetryCreateRequestQueryCliIdVisitor interface { - VisitString(string) error - VisitEventBulkRetryCreateRequestQueryCliIdAll(*EventBulkRetryCreateRequestQueryCliIdAll) error - VisitStringList([]string) error + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryCliId) Accept(visitor EventBulkRetryCreateRequestQueryCliIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) - } - if e.EventBulkRetryCreateRequestQueryCliIdAll != nil { - return visitor.VisitEventBulkRetryCreateRequestQueryCliIdAll(e.EventBulkRetryCreateRequestQueryCliIdAll) - } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) +func (v *VerificationPropertyFinder) GetConfigs() *TypePropertyFinderConfig { + if v == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} - -type EventBulkRetryCreateRequestQueryCliIdAll struct { - Any *bool `json:"any,omitempty" url:"any,omitempty"` - All *bool `json:"all,omitempty" url:"all,omitempty"` - - extraProperties map[string]interface{} - _rawJSON json.RawMessage + return v.Configs } -func (e *EventBulkRetryCreateRequestQueryCliIdAll) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (v *VerificationPropertyFinder) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryCliIdAll) UnmarshalJSON(data []byte) error { - type unmarshaler EventBulkRetryCreateRequestQueryCliIdAll +func (v *VerificationPropertyFinder) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPropertyFinder var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventBulkRetryCreateRequestQueryCliIdAll(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *v = VerificationPropertyFinder(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (e *EventBulkRetryCreateRequestQueryCliIdAll) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (v *VerificationPropertyFinder) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", e) -} - -type EventBulkRetryCreateRequestQueryCliUserId struct { - String string - StringList []string + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryCliUserIdFromString(value string) *EventBulkRetryCreateRequestQueryCliUserId { - return &EventBulkRetryCreateRequestQueryCliUserId{String: value} -} +type VerificationPylon struct { + Configs *TypePylonConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryCliUserIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryCliUserId { - return &EventBulkRetryCreateRequestQueryCliUserId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryCliUserId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationPylon) GetConfigs() *TypePylonConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryCliUserId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryCliUserIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationPylon) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryCliUserId) Accept(visitor EventBulkRetryCreateRequestQueryCliUserIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationPylon) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationPylon + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationPylon(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by `created_at` date using a date operator -type EventBulkRetryCreateRequestQueryCreatedAt struct { - DateTime time.Time - Operators *Operators +func (v *VerificationPylon) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryCreatedAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQueryCreatedAt { - return &EventBulkRetryCreateRequestQueryCreatedAt{DateTime: value} -} +type VerificationRazorpay struct { + Configs *TypeRazorpayConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryCreatedAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryCreatedAt { - return &EventBulkRetryCreateRequestQueryCreatedAt{Operators: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryCreatedAt) UnmarshalJSON(data []byte) error { - var valueDateTime *core.DateTime - if err := json.Unmarshal(data, &valueDateTime); err == nil { - e.DateTime = valueDateTime.Time() - return nil - } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - e.Operators = valueOperators +func (v *VerificationRazorpay) GetConfigs() *TypeRazorpayConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryCreatedAt) MarshalJSON() ([]byte, error) { - if !e.DateTime.IsZero() { - return json.Marshal(core.NewDateTime(e.DateTime)) - } - if e.Operators != nil { - return json.Marshal(e.Operators) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryCreatedAtVisitor interface { - VisitDateTime(time.Time) error - VisitOperators(*Operators) error +func (v *VerificationRazorpay) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryCreatedAt) Accept(visitor EventBulkRetryCreateRequestQueryCreatedAtVisitor) error { - if !e.DateTime.IsZero() { - return visitor.VisitDateTime(e.DateTime) +func (v *VerificationRazorpay) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationRazorpay + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.Operators != nil { - return visitor.VisitOperators(e.Operators) + *v = VerificationRazorpay(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by destination IDs -type EventBulkRetryCreateRequestQueryDestinationId struct { - // Destination ID - String string - StringList []string +func (v *VerificationRazorpay) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryDestinationIdFromString(value string) *EventBulkRetryCreateRequestQueryDestinationId { - return &EventBulkRetryCreateRequestQueryDestinationId{String: value} -} +type VerificationRecharge struct { + Configs *TypeRechargeConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryDestinationIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryDestinationId { - return &EventBulkRetryCreateRequestQueryDestinationId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryDestinationId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationRecharge) GetConfigs() *TypeRechargeConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryDestinationId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryDestinationIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationRecharge) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryDestinationId) Accept(visitor EventBulkRetryCreateRequestQueryDestinationIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationRecharge) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationRecharge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationRecharge(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by error code code -type EventBulkRetryCreateRequestQueryErrorCode struct { - AttemptErrorCodes AttemptErrorCodes - AttemptErrorCodesList []AttemptErrorCodes +func (v *VerificationRecharge) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryErrorCodeFromAttemptErrorCodes(value AttemptErrorCodes) *EventBulkRetryCreateRequestQueryErrorCode { - return &EventBulkRetryCreateRequestQueryErrorCode{AttemptErrorCodes: value} -} +type VerificationRepay struct { + Configs *TypeRepayConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryErrorCodeFromAttemptErrorCodesList(value []AttemptErrorCodes) *EventBulkRetryCreateRequestQueryErrorCode { - return &EventBulkRetryCreateRequestQueryErrorCode{AttemptErrorCodesList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryErrorCode) UnmarshalJSON(data []byte) error { - var valueAttemptErrorCodes AttemptErrorCodes - if err := json.Unmarshal(data, &valueAttemptErrorCodes); err == nil { - e.AttemptErrorCodes = valueAttemptErrorCodes - return nil - } - var valueAttemptErrorCodesList []AttemptErrorCodes - if err := json.Unmarshal(data, &valueAttemptErrorCodesList); err == nil { - e.AttemptErrorCodesList = valueAttemptErrorCodesList +func (v *VerificationRepay) GetConfigs() *TypeRepayConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryErrorCode) MarshalJSON() ([]byte, error) { - if e.AttemptErrorCodes != "" { - return json.Marshal(e.AttemptErrorCodes) - } - if e.AttemptErrorCodesList != nil { - return json.Marshal(e.AttemptErrorCodesList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryErrorCodeVisitor interface { - VisitAttemptErrorCodes(AttemptErrorCodes) error - VisitAttemptErrorCodesList([]AttemptErrorCodes) error +func (v *VerificationRepay) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryErrorCode) Accept(visitor EventBulkRetryCreateRequestQueryErrorCodeVisitor) error { - if e.AttemptErrorCodes != "" { - return visitor.VisitAttemptErrorCodes(e.AttemptErrorCodes) +func (v *VerificationRepay) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationRepay + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.AttemptErrorCodesList != nil { - return visitor.VisitAttemptErrorCodesList(e.AttemptErrorCodesList) + *v = VerificationRepay(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -type EventBulkRetryCreateRequestQueryEventDataId struct { - String string - StringList []string +func (v *VerificationRepay) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryEventDataIdFromString(value string) *EventBulkRetryCreateRequestQueryEventDataId { - return &EventBulkRetryCreateRequestQueryEventDataId{String: value} -} +type VerificationReplicate struct { + Configs *TypeReplicateConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryEventDataIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryEventDataId { - return &EventBulkRetryCreateRequestQueryEventDataId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryEventDataId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationReplicate) GetConfigs() *TypeReplicateConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + return v.Configs } -func (e EventBulkRetryCreateRequestQueryEventDataId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +func (v *VerificationReplicate) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -type EventBulkRetryCreateRequestQueryEventDataIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationReplicate) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationReplicate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationReplicate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e *EventBulkRetryCreateRequestQueryEventDataId) Accept(visitor EventBulkRetryCreateRequestQueryEventDataIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationReplicate) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -// URL Encoded string of the JSON to match to the data headers -type EventBulkRetryCreateRequestQueryHeaders struct { - String string - EventBulkRetryCreateRequestQueryHeadersOne *EventBulkRetryCreateRequestQueryHeadersOne +type VerificationSanity struct { + Configs *TypeSanityConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQueryHeadersFromString(value string) *EventBulkRetryCreateRequestQueryHeaders { - return &EventBulkRetryCreateRequestQueryHeaders{String: value} +func (v *VerificationSanity) GetConfigs() *TypeSanityConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryHeadersFromEventBulkRetryCreateRequestQueryHeadersOne(value *EventBulkRetryCreateRequestQueryHeadersOne) *EventBulkRetryCreateRequestQueryHeaders { - return &EventBulkRetryCreateRequestQueryHeaders{EventBulkRetryCreateRequestQueryHeadersOne: value} +func (v *VerificationSanity) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil +func (v *VerificationSanity) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSanity + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueEventBulkRetryCreateRequestQueryHeadersOne := new(EventBulkRetryCreateRequestQueryHeadersOne) - if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryHeadersOne); err == nil { - e.EventBulkRetryCreateRequestQueryHeadersOne = valueEventBulkRetryCreateRequestQueryHeadersOne - return nil + *v = VerificationSanity(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryHeaders) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) +func (v *VerificationSanity) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.EventBulkRetryCreateRequestQueryHeadersOne != nil { - return json.Marshal(e.EventBulkRetryCreateRequestQueryHeadersOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -type EventBulkRetryCreateRequestQueryHeadersVisitor interface { - VisitString(string) error - VisitEventBulkRetryCreateRequestQueryHeadersOne(*EventBulkRetryCreateRequestQueryHeadersOne) error -} +type VerificationSendgrid struct { + Configs *TypeSendgridConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (e *EventBulkRetryCreateRequestQueryHeaders) Accept(visitor EventBulkRetryCreateRequestQueryHeadersVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) - } - if e.EventBulkRetryCreateRequestQueryHeadersOne != nil { - return visitor.VisitEventBulkRetryCreateRequestQueryHeadersOne(e.EventBulkRetryCreateRequestQueryHeadersOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type EventBulkRetryCreateRequestQueryHeadersOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationSendgrid) GetConfigs() *TypeSendgridConfig { + if v == nil { + return nil + } + return v.Configs } -func (e *EventBulkRetryCreateRequestQueryHeadersOne) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (v *VerificationSendgrid) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryHeadersOne) UnmarshalJSON(data []byte) error { - type unmarshaler EventBulkRetryCreateRequestQueryHeadersOne +func (v *VerificationSendgrid) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSendgrid var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventBulkRetryCreateRequestQueryHeadersOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *v = VerificationSendgrid(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (e *EventBulkRetryCreateRequestQueryHeadersOne) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (v *VerificationSendgrid) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", e) -} - -// Filter by event IDs -type EventBulkRetryCreateRequestQueryId struct { - // Event ID - String string - StringList []string + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryIdFromString(value string) *EventBulkRetryCreateRequestQueryId { - return &EventBulkRetryCreateRequestQueryId{String: value} -} +type VerificationShopify struct { + Configs *TypeShopifyConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryId { - return &EventBulkRetryCreateRequestQueryId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationShopify) GetConfigs() *TypeShopifyConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationShopify) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryId) Accept(visitor EventBulkRetryCreateRequestQueryIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationShopify) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationShopify + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationShopify(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -type EventBulkRetryCreateRequestQueryIssueId struct { - String string - StringList []string +func (v *VerificationShopify) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryIssueIdFromString(value string) *EventBulkRetryCreateRequestQueryIssueId { - return &EventBulkRetryCreateRequestQueryIssueId{String: value} -} +type VerificationShopline struct { + Configs *TypeShoplineConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryIssueIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryIssueId { - return &EventBulkRetryCreateRequestQueryIssueId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryIssueId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList +func (v *VerificationShopline) GetConfigs() *TypeShoplineConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventBulkRetryCreateRequestQueryIssueId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryIssueIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationShopline) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryIssueId) Accept(visitor EventBulkRetryCreateRequestQueryIssueIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationShopline) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationShopline + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationShopline(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by `last_attempt_at` date using a date operator -type EventBulkRetryCreateRequestQueryLastAttemptAt struct { - DateTime time.Time - Operators *Operators +func (v *VerificationShopline) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewEventBulkRetryCreateRequestQueryLastAttemptAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQueryLastAttemptAt { - return &EventBulkRetryCreateRequestQueryLastAttemptAt{DateTime: value} -} +type VerificationSlack struct { + Configs *TypeSlackConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryLastAttemptAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryLastAttemptAt { - return &EventBulkRetryCreateRequestQueryLastAttemptAt{Operators: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) UnmarshalJSON(data []byte) error { - var valueDateTime *core.DateTime - if err := json.Unmarshal(data, &valueDateTime); err == nil { - e.DateTime = valueDateTime.Time() - return nil - } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - e.Operators = valueOperators +func (v *VerificationSlack) GetConfigs() *TypeSlackConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + return v.Configs } -func (e EventBulkRetryCreateRequestQueryLastAttemptAt) MarshalJSON() ([]byte, error) { - if !e.DateTime.IsZero() { - return json.Marshal(core.NewDateTime(e.DateTime)) - } - if e.Operators != nil { - return json.Marshal(e.Operators) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +func (v *VerificationSlack) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -type EventBulkRetryCreateRequestQueryLastAttemptAtVisitor interface { - VisitDateTime(time.Time) error - VisitOperators(*Operators) error +func (v *VerificationSlack) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSlack + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationSlack(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e *EventBulkRetryCreateRequestQueryLastAttemptAt) Accept(visitor EventBulkRetryCreateRequestQueryLastAttemptAtVisitor) error { - if !e.DateTime.IsZero() { - return visitor.VisitDateTime(e.DateTime) +func (v *VerificationSlack) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.Operators != nil { - return visitor.VisitOperators(e.Operators) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) -type EventBulkRetryCreateRequestQueryParsedQuery struct { - String string - EventBulkRetryCreateRequestQueryParsedQueryOne *EventBulkRetryCreateRequestQueryParsedQueryOne +type VerificationSolidgate struct { + Configs *TypeSolidgateConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQueryParsedQueryFromString(value string) *EventBulkRetryCreateRequestQueryParsedQuery { - return &EventBulkRetryCreateRequestQueryParsedQuery{String: value} +func (v *VerificationSolidgate) GetConfigs() *TypeSolidgateConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryParsedQueryFromEventBulkRetryCreateRequestQueryParsedQueryOne(value *EventBulkRetryCreateRequestQueryParsedQueryOne) *EventBulkRetryCreateRequestQueryParsedQuery { - return &EventBulkRetryCreateRequestQueryParsedQuery{EventBulkRetryCreateRequestQueryParsedQueryOne: value} +func (v *VerificationSolidgate) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil +func (v *VerificationSolidgate) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSolidgate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueEventBulkRetryCreateRequestQueryParsedQueryOne := new(EventBulkRetryCreateRequestQueryParsedQueryOne) - if err := json.Unmarshal(data, &valueEventBulkRetryCreateRequestQueryParsedQueryOne); err == nil { - e.EventBulkRetryCreateRequestQueryParsedQueryOne = valueEventBulkRetryCreateRequestQueryParsedQueryOne - return nil + *v = VerificationSolidgate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) +func (v *VerificationSolidgate) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.EventBulkRetryCreateRequestQueryParsedQueryOne != nil { - return json.Marshal(e.EventBulkRetryCreateRequestQueryParsedQueryOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -type EventBulkRetryCreateRequestQueryParsedQueryVisitor interface { - VisitString(string) error - VisitEventBulkRetryCreateRequestQueryParsedQueryOne(*EventBulkRetryCreateRequestQueryParsedQueryOne) error -} +type VerificationSquare struct { + Configs *TypeSquareConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (e *EventBulkRetryCreateRequestQueryParsedQuery) Accept(visitor EventBulkRetryCreateRequestQueryParsedQueryVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) - } - if e.EventBulkRetryCreateRequestQueryParsedQueryOne != nil { - return visitor.VisitEventBulkRetryCreateRequestQueryParsedQueryOne(e.EventBulkRetryCreateRequestQueryParsedQueryOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type EventBulkRetryCreateRequestQueryParsedQueryOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationSquare) GetConfigs() *TypeSquareConfig { + if v == nil { + return nil + } + return v.Configs } -func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) GetExtraProperties() map[string]interface{} { - return e.extraProperties +func (v *VerificationSquare) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) UnmarshalJSON(data []byte) error { - type unmarshaler EventBulkRetryCreateRequestQueryParsedQueryOne +func (v *VerificationSquare) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSquare var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *e = EventBulkRetryCreateRequestQueryParsedQueryOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *e) + *v = VerificationSquare(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - e.extraProperties = extraProperties - - e._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (e *EventBulkRetryCreateRequestQueryParsedQueryOne) String() string { - if len(e._rawJSON) > 0 { - if value, err := core.StringifyJSON(e._rawJSON); err == nil { +func (v *VerificationSquare) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(e); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", e) + return fmt.Sprintf("%#v", v) } -// Filter by HTTP response status code -type EventBulkRetryCreateRequestQueryResponseStatus struct { - Integer int - Operators *Operators - IntegerList []int -} +type VerificationStripe struct { + Configs *TypeStripeConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewEventBulkRetryCreateRequestQueryResponseStatusFromInteger(value int) *EventBulkRetryCreateRequestQueryResponseStatus { - return &EventBulkRetryCreateRequestQueryResponseStatus{Integer: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQueryResponseStatusFromOperators(value *Operators) *EventBulkRetryCreateRequestQueryResponseStatus { - return &EventBulkRetryCreateRequestQueryResponseStatus{Operators: value} +func (v *VerificationStripe) GetConfigs() *TypeStripeConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryResponseStatusFromIntegerList(value []int) *EventBulkRetryCreateRequestQueryResponseStatus { - return &EventBulkRetryCreateRequestQueryResponseStatus{IntegerList: value} +func (v *VerificationStripe) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryResponseStatus) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - e.Integer = valueInteger - return nil - } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - e.Operators = valueOperators - return nil +func (v *VerificationStripe) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationStripe + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - e.IntegerList = valueIntegerList - return nil + *v = VerificationStripe(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryResponseStatus) MarshalJSON() ([]byte, error) { - if e.Integer != 0 { - return json.Marshal(e.Integer) - } - if e.Operators != nil { - return json.Marshal(e.Operators) +func (v *VerificationStripe) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.IntegerList != nil { - return json.Marshal(e.IntegerList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) -} - -type EventBulkRetryCreateRequestQueryResponseStatusVisitor interface { - VisitInteger(int) error - VisitOperators(*Operators) error - VisitIntegerList([]int) error + return fmt.Sprintf("%#v", v) } -func (e *EventBulkRetryCreateRequestQueryResponseStatus) Accept(visitor EventBulkRetryCreateRequestQueryResponseStatusVisitor) error { - if e.Integer != 0 { - return visitor.VisitInteger(e.Integer) - } - if e.Operators != nil { - return visitor.VisitOperators(e.Operators) - } - if e.IntegerList != nil { - return visitor.VisitIntegerList(e.IntegerList) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} +type VerificationSvix struct { + Configs *TypeSvixConfig `json:"configs,omitempty" url:"configs,omitempty"` -// Filter by source IDs -type EventBulkRetryCreateRequestQuerySourceId struct { - // Source ID - String string - StringList []string + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQuerySourceIdFromString(value string) *EventBulkRetryCreateRequestQuerySourceId { - return &EventBulkRetryCreateRequestQuerySourceId{String: value} +func (v *VerificationSvix) GetConfigs() *TypeSvixConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQuerySourceIdFromStringList(value []string) *EventBulkRetryCreateRequestQuerySourceId { - return &EventBulkRetryCreateRequestQuerySourceId{StringList: value} +func (v *VerificationSvix) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQuerySourceId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil +func (v *VerificationSvix) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSvix + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList - return nil + *v = VerificationSvix(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQuerySourceId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) +func (v *VerificationSvix) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.StringList != nil { - return json.Marshal(e.StringList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) -} - -type EventBulkRetryCreateRequestQuerySourceIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error + return fmt.Sprintf("%#v", v) } -func (e *EventBulkRetryCreateRequestQuerySourceId) Accept(visitor EventBulkRetryCreateRequestQuerySourceIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) - } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} +type VerificationSynctera struct { + Configs *TypeSyncteraConfig `json:"configs,omitempty" url:"configs,omitempty"` -// Lifecyle status of the event -type EventBulkRetryCreateRequestQueryStatus struct { - EventStatus EventStatus - EventStatusList []EventStatus + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQueryStatusFromEventStatus(value EventStatus) *EventBulkRetryCreateRequestQueryStatus { - return &EventBulkRetryCreateRequestQueryStatus{EventStatus: value} +func (v *VerificationSynctera) GetConfigs() *TypeSyncteraConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryStatusFromEventStatusList(value []EventStatus) *EventBulkRetryCreateRequestQueryStatus { - return &EventBulkRetryCreateRequestQueryStatus{EventStatusList: value} +func (v *VerificationSynctera) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryStatus) UnmarshalJSON(data []byte) error { - var valueEventStatus EventStatus - if err := json.Unmarshal(data, &valueEventStatus); err == nil { - e.EventStatus = valueEventStatus - return nil +func (v *VerificationSynctera) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationSynctera + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueEventStatusList []EventStatus - if err := json.Unmarshal(data, &valueEventStatusList); err == nil { - e.EventStatusList = valueEventStatusList - return nil + *v = VerificationSynctera(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQueryStatus) MarshalJSON() ([]byte, error) { - if e.EventStatus != "" { - return json.Marshal(e.EventStatus) +func (v *VerificationSynctera) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.EventStatusList != nil { - return json.Marshal(e.EventStatusList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) -} - -type EventBulkRetryCreateRequestQueryStatusVisitor interface { - VisitEventStatus(EventStatus) error - VisitEventStatusList([]EventStatus) error + return fmt.Sprintf("%#v", v) } -func (e *EventBulkRetryCreateRequestQueryStatus) Accept(visitor EventBulkRetryCreateRequestQueryStatusVisitor) error { - if e.EventStatus != "" { - return visitor.VisitEventStatus(e.EventStatus) - } - if e.EventStatusList != nil { - return visitor.VisitEventStatusList(e.EventStatusList) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) -} +type VerificationTebex struct { + Configs *TypeTebexConfig `json:"configs,omitempty" url:"configs,omitempty"` -// Filter by `successful_at` date using a date operator -type EventBulkRetryCreateRequestQuerySuccessfulAt struct { - DateTime time.Time - Operators *Operators + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewEventBulkRetryCreateRequestQuerySuccessfulAtFromDateTime(value time.Time) *EventBulkRetryCreateRequestQuerySuccessfulAt { - return &EventBulkRetryCreateRequestQuerySuccessfulAt{DateTime: value} +func (v *VerificationTebex) GetConfigs() *TypeTebexConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQuerySuccessfulAtFromOperators(value *Operators) *EventBulkRetryCreateRequestQuerySuccessfulAt { - return &EventBulkRetryCreateRequestQuerySuccessfulAt{Operators: value} +func (v *VerificationTebex) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) UnmarshalJSON(data []byte) error { - var valueDateTime *core.DateTime - if err := json.Unmarshal(data, &valueDateTime); err == nil { - e.DateTime = valueDateTime.Time() - return nil +func (v *VerificationTebex) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTebex + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - e.Operators = valueOperators - return nil + *v = VerificationTebex(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e EventBulkRetryCreateRequestQuerySuccessfulAt) MarshalJSON() ([]byte, error) { - if !e.DateTime.IsZero() { - return json.Marshal(core.NewDateTime(e.DateTime)) +func (v *VerificationTebex) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if e.Operators != nil { - return json.Marshal(e.Operators) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return fmt.Sprintf("%#v", v) } -type EventBulkRetryCreateRequestQuerySuccessfulAtVisitor interface { - VisitDateTime(time.Time) error - VisitOperators(*Operators) error -} +type VerificationTelnyx struct { + Configs *TypeTelnyxConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (e *EventBulkRetryCreateRequestQuerySuccessfulAt) Accept(visitor EventBulkRetryCreateRequestQuerySuccessfulAtVisitor) error { - if !e.DateTime.IsZero() { - return visitor.VisitDateTime(e.DateTime) - } - if e.Operators != nil { - return visitor.VisitOperators(e.Operators) - } - return fmt.Errorf("type %T does not include a non-empty union type", e) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -// Filter by webhook connection IDs -type EventBulkRetryCreateRequestQueryWebhookId struct { - // Webhook ID - String string - StringList []string +func (v *VerificationTelnyx) GetConfigs() *TypeTelnyxConfig { + if v == nil { + return nil + } + return v.Configs } -func NewEventBulkRetryCreateRequestQueryWebhookIdFromString(value string) *EventBulkRetryCreateRequestQueryWebhookId { - return &EventBulkRetryCreateRequestQueryWebhookId{String: value} +func (v *VerificationTelnyx) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func NewEventBulkRetryCreateRequestQueryWebhookIdFromStringList(value []string) *EventBulkRetryCreateRequestQueryWebhookId { - return &EventBulkRetryCreateRequestQueryWebhookId{StringList: value} +func (v *VerificationTelnyx) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTelnyx + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationTelnyx(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (e *EventBulkRetryCreateRequestQueryWebhookId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.String = valueString - return nil +func (v *VerificationTelnyx) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - e.StringList = valueStringList - return nil + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) + return fmt.Sprintf("%#v", v) } -func (e EventBulkRetryCreateRequestQueryWebhookId) MarshalJSON() ([]byte, error) { - if e.String != "" { - return json.Marshal(e.String) - } - if e.StringList != nil { - return json.Marshal(e.StringList) +type VerificationTikTok struct { + Configs *TypeTikTokConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VerificationTikTok) GetConfigs() *TypeTikTokConfig { + if v == nil { + return nil } - return nil, fmt.Errorf("type %T does not include a non-empty union type", e) + return v.Configs } -type EventBulkRetryCreateRequestQueryWebhookIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationTikTok) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (e *EventBulkRetryCreateRequestQueryWebhookId) Accept(visitor EventBulkRetryCreateRequestQueryWebhookIdVisitor) error { - if e.String != "" { - return visitor.VisitString(e.String) +func (v *VerificationTikTok) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTikTok + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if e.StringList != nil { - return visitor.VisitStringList(e.StringList) + *v = VerificationTikTok(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", e) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// The cause of the ignored event -type IgnoredEventBulkRetryCreateRequestQueryCause struct { - String string - StringList []string +func (v *VerificationTikTok) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewIgnoredEventBulkRetryCreateRequestQueryCauseFromString(value string) *IgnoredEventBulkRetryCreateRequestQueryCause { - return &IgnoredEventBulkRetryCreateRequestQueryCause{String: value} -} +type VerificationTokenIo struct { + Configs *TypeTokenIoConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewIgnoredEventBulkRetryCreateRequestQueryCauseFromStringList(value []string) *IgnoredEventBulkRetryCreateRequestQueryCause { - return &IgnoredEventBulkRetryCreateRequestQueryCause{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IgnoredEventBulkRetryCreateRequestQueryCause) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.StringList = valueStringList +func (v *VerificationTokenIo) GetConfigs() *TypeTokenIoConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IgnoredEventBulkRetryCreateRequestQueryCause) MarshalJSON() ([]byte, error) { - if i.String != "" { - return json.Marshal(i.String) - } - if i.StringList != nil { - return json.Marshal(i.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) + return v.Configs } -type IgnoredEventBulkRetryCreateRequestQueryCauseVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationTokenIo) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (i *IgnoredEventBulkRetryCreateRequestQueryCause) Accept(visitor IgnoredEventBulkRetryCreateRequestQueryCauseVisitor) error { - if i.String != "" { - return visitor.VisitString(i.String) +func (v *VerificationTokenIo) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTokenIo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if i.StringList != nil { - return visitor.VisitStringList(i.StringList) + *v = VerificationTokenIo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", i) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Connection ID of the ignored event -type IgnoredEventBulkRetryCreateRequestQueryWebhookId struct { - String string - StringList []string +func (v *VerificationTokenIo) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewIgnoredEventBulkRetryCreateRequestQueryWebhookIdFromString(value string) *IgnoredEventBulkRetryCreateRequestQueryWebhookId { - return &IgnoredEventBulkRetryCreateRequestQueryWebhookId{String: value} -} +type VerificationTreezor struct { + Configs *TypeTreezorConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewIgnoredEventBulkRetryCreateRequestQueryWebhookIdFromStringList(value []string) *IgnoredEventBulkRetryCreateRequestQueryWebhookId { - return &IgnoredEventBulkRetryCreateRequestQueryWebhookId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.StringList = valueStringList +func (v *VerificationTreezor) GetConfigs() *TypeTreezorConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) + return v.Configs } -func (i IgnoredEventBulkRetryCreateRequestQueryWebhookId) MarshalJSON() ([]byte, error) { - if i.String != "" { - return json.Marshal(i.String) - } - if i.StringList != nil { - return json.Marshal(i.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", i) +func (v *VerificationTreezor) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -type IgnoredEventBulkRetryCreateRequestQueryWebhookIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationTreezor) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTreezor + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationTreezor(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (i *IgnoredEventBulkRetryCreateRequestQueryWebhookId) Accept(visitor IgnoredEventBulkRetryCreateRequestQueryWebhookIdVisitor) error { - if i.String != "" { - return visitor.VisitString(i.String) +func (v *VerificationTreezor) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if i.StringList != nil { - return visitor.VisitStringList(i.StringList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", i) + return fmt.Sprintf("%#v", v) } -// URL Encoded string of the JSON to match to the data body -type RequestBulkRetryCreateRequestQueryBody struct { - String string - RequestBulkRetryCreateRequestQueryBodyOne *RequestBulkRetryCreateRequestQueryBodyOne +type VerificationTrello struct { + Configs *TypeTrelloConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewRequestBulkRetryCreateRequestQueryBodyFromString(value string) *RequestBulkRetryCreateRequestQueryBody { - return &RequestBulkRetryCreateRequestQueryBody{String: value} +func (v *VerificationTrello) GetConfigs() *TypeTrelloConfig { + if v == nil { + return nil + } + return v.Configs } -func NewRequestBulkRetryCreateRequestQueryBodyFromRequestBulkRetryCreateRequestQueryBodyOne(value *RequestBulkRetryCreateRequestQueryBodyOne) *RequestBulkRetryCreateRequestQueryBody { - return &RequestBulkRetryCreateRequestQueryBody{RequestBulkRetryCreateRequestQueryBodyOne: value} +func (v *VerificationTrello) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString - return nil +func (v *VerificationTrello) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTrello + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueRequestBulkRetryCreateRequestQueryBodyOne := new(RequestBulkRetryCreateRequestQueryBodyOne) - if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryBodyOne); err == nil { - r.RequestBulkRetryCreateRequestQueryBodyOne = valueRequestBulkRetryCreateRequestQueryBodyOne - return nil + *v = VerificationTrello(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r RequestBulkRetryCreateRequestQueryBody) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) +func (v *VerificationTrello) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.RequestBulkRetryCreateRequestQueryBodyOne != nil { - return json.Marshal(r.RequestBulkRetryCreateRequestQueryBodyOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return fmt.Sprintf("%#v", v) } -type RequestBulkRetryCreateRequestQueryBodyVisitor interface { - VisitString(string) error - VisitRequestBulkRetryCreateRequestQueryBodyOne(*RequestBulkRetryCreateRequestQueryBodyOne) error -} +type VerificationTwilio struct { + Configs *TypeTwilioConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (r *RequestBulkRetryCreateRequestQueryBody) Accept(visitor RequestBulkRetryCreateRequestQueryBodyVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) - } - if r.RequestBulkRetryCreateRequestQueryBodyOne != nil { - return visitor.VisitRequestBulkRetryCreateRequestQueryBodyOne(r.RequestBulkRetryCreateRequestQueryBodyOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", r) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type RequestBulkRetryCreateRequestQueryBodyOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationTwilio) GetConfigs() *TypeTwilioConfig { + if v == nil { + return nil + } + return v.Configs } -func (r *RequestBulkRetryCreateRequestQueryBodyOne) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (v *VerificationTwilio) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryBodyOne) UnmarshalJSON(data []byte) error { - type unmarshaler RequestBulkRetryCreateRequestQueryBodyOne +func (v *VerificationTwilio) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTwilio var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RequestBulkRetryCreateRequestQueryBodyOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *v = VerificationTwilio(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (r *RequestBulkRetryCreateRequestQueryBodyOne) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (v *VerificationTwilio) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", r) + return fmt.Sprintf("%#v", v) } -type RequestBulkRetryCreateRequestQueryBulkRetryId struct { - String string - StringList []string +type VerificationTwitch struct { + Configs *TypeTwitchConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewRequestBulkRetryCreateRequestQueryBulkRetryIdFromString(value string) *RequestBulkRetryCreateRequestQueryBulkRetryId { - return &RequestBulkRetryCreateRequestQueryBulkRetryId{String: value} +func (v *VerificationTwitch) GetConfigs() *TypeTwitchConfig { + if v == nil { + return nil + } + return v.Configs } -func NewRequestBulkRetryCreateRequestQueryBulkRetryIdFromStringList(value []string) *RequestBulkRetryCreateRequestQueryBulkRetryId { - return &RequestBulkRetryCreateRequestQueryBulkRetryId{StringList: value} +func (v *VerificationTwitch) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString - return nil +func (v *VerificationTwitch) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTwitch + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - r.StringList = valueStringList - return nil + *v = VerificationTwitch(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r RequestBulkRetryCreateRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) +func (v *VerificationTwitch) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.StringList != nil { - return json.Marshal(r.StringList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return fmt.Sprintf("%#v", v) } -type RequestBulkRetryCreateRequestQueryBulkRetryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +type VerificationTwitter struct { + Configs *TypeTwitterConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQueryBulkRetryId) Accept(visitor RequestBulkRetryCreateRequestQueryBulkRetryIdVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) - } - if r.StringList != nil { - return visitor.VisitStringList(r.StringList) +func (v *VerificationTwitter) GetConfigs() *TypeTwitterConfig { + if v == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", r) + return v.Configs } -// Filter by count of events -type RequestBulkRetryCreateRequestQueryEventsCount struct { - Integer int - Operators *Operators - IntegerList []int +func (v *VerificationTwitter) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func NewRequestBulkRetryCreateRequestQueryEventsCountFromInteger(value int) *RequestBulkRetryCreateRequestQueryEventsCount { - return &RequestBulkRetryCreateRequestQueryEventsCount{Integer: value} +func (v *VerificationTwitter) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTwitter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationTwitter(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func NewRequestBulkRetryCreateRequestQueryEventsCountFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryEventsCount { - return &RequestBulkRetryCreateRequestQueryEventsCount{Operators: value} +func (v *VerificationTwitter) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewRequestBulkRetryCreateRequestQueryEventsCountFromIntegerList(value []int) *RequestBulkRetryCreateRequestQueryEventsCount { - return &RequestBulkRetryCreateRequestQueryEventsCount{IntegerList: value} +type VerificationTypeform struct { + Configs *TypeTypeformConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQueryEventsCount) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - r.Integer = valueInteger - return nil - } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - r.Operators = valueOperators - return nil - } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - r.IntegerList = valueIntegerList +func (v *VerificationTypeform) GetConfigs() *TypeTypeformConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + return v.Configs } -func (r RequestBulkRetryCreateRequestQueryEventsCount) MarshalJSON() ([]byte, error) { - if r.Integer != 0 { - return json.Marshal(r.Integer) - } - if r.Operators != nil { - return json.Marshal(r.Operators) - } - if r.IntegerList != nil { - return json.Marshal(r.IntegerList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) +func (v *VerificationTypeform) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -type RequestBulkRetryCreateRequestQueryEventsCountVisitor interface { - VisitInteger(int) error - VisitOperators(*Operators) error - VisitIntegerList([]int) error +func (v *VerificationTypeform) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationTypeform + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VerificationTypeform(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r *RequestBulkRetryCreateRequestQueryEventsCount) Accept(visitor RequestBulkRetryCreateRequestQueryEventsCountVisitor) error { - if r.Integer != 0 { - return visitor.VisitInteger(r.Integer) - } - if r.Operators != nil { - return visitor.VisitOperators(r.Operators) +func (v *VerificationTypeform) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.IntegerList != nil { - return visitor.VisitIntegerList(r.IntegerList) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", r) + return fmt.Sprintf("%#v", v) } -// URL Encoded string of the JSON to match to the data headers -type RequestBulkRetryCreateRequestQueryHeaders struct { - String string - RequestBulkRetryCreateRequestQueryHeadersOne *RequestBulkRetryCreateRequestQueryHeadersOne +type VerificationUpollo struct { + Configs *TypeUpolloConfig `json:"configs,omitempty" url:"configs,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewRequestBulkRetryCreateRequestQueryHeadersFromString(value string) *RequestBulkRetryCreateRequestQueryHeaders { - return &RequestBulkRetryCreateRequestQueryHeaders{String: value} +func (v *VerificationUpollo) GetConfigs() *TypeUpolloConfig { + if v == nil { + return nil + } + return v.Configs } -func NewRequestBulkRetryCreateRequestQueryHeadersFromRequestBulkRetryCreateRequestQueryHeadersOne(value *RequestBulkRetryCreateRequestQueryHeadersOne) *RequestBulkRetryCreateRequestQueryHeaders { - return &RequestBulkRetryCreateRequestQueryHeaders{RequestBulkRetryCreateRequestQueryHeadersOne: value} +func (v *VerificationUpollo) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString - return nil +func (v *VerificationUpollo) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationUpollo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueRequestBulkRetryCreateRequestQueryHeadersOne := new(RequestBulkRetryCreateRequestQueryHeadersOne) - if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryHeadersOne); err == nil { - r.RequestBulkRetryCreateRequestQueryHeadersOne = valueRequestBulkRetryCreateRequestQueryHeadersOne - return nil + *v = VerificationUpollo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r RequestBulkRetryCreateRequestQueryHeaders) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) +func (v *VerificationUpollo) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.RequestBulkRetryCreateRequestQueryHeadersOne != nil { - return json.Marshal(r.RequestBulkRetryCreateRequestQueryHeadersOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return fmt.Sprintf("%#v", v) } -type RequestBulkRetryCreateRequestQueryHeadersVisitor interface { - VisitString(string) error - VisitRequestBulkRetryCreateRequestQueryHeadersOne(*RequestBulkRetryCreateRequestQueryHeadersOne) error -} +type VerificationVercelLogDrains struct { + Configs *TypeVercelLogDrainsConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (r *RequestBulkRetryCreateRequestQueryHeaders) Accept(visitor RequestBulkRetryCreateRequestQueryHeadersVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) - } - if r.RequestBulkRetryCreateRequestQueryHeadersOne != nil { - return visitor.VisitRequestBulkRetryCreateRequestQueryHeadersOne(r.RequestBulkRetryCreateRequestQueryHeadersOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", r) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type RequestBulkRetryCreateRequestQueryHeadersOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationVercelLogDrains) GetConfigs() *TypeVercelLogDrainsConfig { + if v == nil { + return nil + } + return v.Configs } -func (r *RequestBulkRetryCreateRequestQueryHeadersOne) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (v *VerificationVercelLogDrains) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryHeadersOne) UnmarshalJSON(data []byte) error { - type unmarshaler RequestBulkRetryCreateRequestQueryHeadersOne +func (v *VerificationVercelLogDrains) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationVercelLogDrains var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RequestBulkRetryCreateRequestQueryHeadersOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *v = VerificationVercelLogDrains(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (r *RequestBulkRetryCreateRequestQueryHeadersOne) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (v *VerificationVercelLogDrains) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", r) -} - -// Filter by requests IDs -type RequestBulkRetryCreateRequestQueryId struct { - // Request ID - String string - StringList []string + return fmt.Sprintf("%#v", v) } -func NewRequestBulkRetryCreateRequestQueryIdFromString(value string) *RequestBulkRetryCreateRequestQueryId { - return &RequestBulkRetryCreateRequestQueryId{String: value} -} +type VerificationVercelWebhooks struct { + Configs *TypeVercelWebhooksConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewRequestBulkRetryCreateRequestQueryIdFromStringList(value []string) *RequestBulkRetryCreateRequestQueryId { - return &RequestBulkRetryCreateRequestQueryId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQueryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - r.StringList = valueStringList +func (v *VerificationVercelWebhooks) GetConfigs() *TypeVercelWebhooksConfig { + if v == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestBulkRetryCreateRequestQueryId) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) - } - if r.StringList != nil { - return json.Marshal(r.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return v.Configs } -type RequestBulkRetryCreateRequestQueryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationVercelWebhooks) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryId) Accept(visitor RequestBulkRetryCreateRequestQueryIdVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) +func (v *VerificationVercelWebhooks) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationVercelWebhooks + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if r.StringList != nil { - return visitor.VisitStringList(r.StringList) + *v = VerificationVercelWebhooks(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", r) -} - -// Filter by count of ignored events -type RequestBulkRetryCreateRequestQueryIgnoredCount struct { - Integer int - Operators *Operators - IntegerList []int -} - -func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromInteger(value int) *RequestBulkRetryCreateRequestQueryIgnoredCount { - return &RequestBulkRetryCreateRequestQueryIgnoredCount{Integer: value} -} - -func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryIgnoredCount { - return &RequestBulkRetryCreateRequestQueryIgnoredCount{Operators: value} -} - -func NewRequestBulkRetryCreateRequestQueryIgnoredCountFromIntegerList(value []int) *RequestBulkRetryCreateRequestQueryIgnoredCount { - return &RequestBulkRetryCreateRequestQueryIgnoredCount{IntegerList: value} + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - r.Integer = valueInteger - return nil - } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - r.Operators = valueOperators - return nil +func (v *VerificationVercelWebhooks) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - r.IntegerList = valueIntegerList - return nil + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + return fmt.Sprintf("%#v", v) } -func (r RequestBulkRetryCreateRequestQueryIgnoredCount) MarshalJSON() ([]byte, error) { - if r.Integer != 0 { - return json.Marshal(r.Integer) - } - if r.Operators != nil { - return json.Marshal(r.Operators) - } - if r.IntegerList != nil { - return json.Marshal(r.IntegerList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) -} +type VerificationWebhook struct { + Configs *TypeWebhookConfig `json:"configs,omitempty" url:"configs,omitempty"` -type RequestBulkRetryCreateRequestQueryIgnoredCountVisitor interface { - VisitInteger(int) error - VisitOperators(*Operators) error - VisitIntegerList([]int) error + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQueryIgnoredCount) Accept(visitor RequestBulkRetryCreateRequestQueryIgnoredCountVisitor) error { - if r.Integer != 0 { - return visitor.VisitInteger(r.Integer) - } - if r.Operators != nil { - return visitor.VisitOperators(r.Operators) - } - if r.IntegerList != nil { - return visitor.VisitIntegerList(r.IntegerList) +func (v *VerificationWebhook) GetConfigs() *TypeWebhookConfig { + if v == nil { + return nil } - return fmt.Errorf("type %T does not include a non-empty union type", r) -} - -// Filter by event ingested date -type RequestBulkRetryCreateRequestQueryIngestedAt struct { - DateTime time.Time - Operators *Operators -} - -func NewRequestBulkRetryCreateRequestQueryIngestedAtFromDateTime(value time.Time) *RequestBulkRetryCreateRequestQueryIngestedAt { - return &RequestBulkRetryCreateRequestQueryIngestedAt{DateTime: value} + return v.Configs } -func NewRequestBulkRetryCreateRequestQueryIngestedAtFromOperators(value *Operators) *RequestBulkRetryCreateRequestQueryIngestedAt { - return &RequestBulkRetryCreateRequestQueryIngestedAt{Operators: value} +func (v *VerificationWebhook) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryIngestedAt) UnmarshalJSON(data []byte) error { - var valueDateTime *core.DateTime - if err := json.Unmarshal(data, &valueDateTime); err == nil { - r.DateTime = valueDateTime.Time() - return nil +func (v *VerificationWebhook) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationWebhook + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueOperators := new(Operators) - if err := json.Unmarshal(data, &valueOperators); err == nil { - r.Operators = valueOperators - return nil + *v = VerificationWebhook(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r RequestBulkRetryCreateRequestQueryIngestedAt) MarshalJSON() ([]byte, error) { - if !r.DateTime.IsZero() { - return json.Marshal(core.NewDateTime(r.DateTime)) +func (v *VerificationWebhook) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.Operators != nil { - return json.Marshal(r.Operators) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) -} - -type RequestBulkRetryCreateRequestQueryIngestedAtVisitor interface { - VisitDateTime(time.Time) error - VisitOperators(*Operators) error + return fmt.Sprintf("%#v", v) } -func (r *RequestBulkRetryCreateRequestQueryIngestedAt) Accept(visitor RequestBulkRetryCreateRequestQueryIngestedAtVisitor) error { - if !r.DateTime.IsZero() { - return visitor.VisitDateTime(r.DateTime) - } - if r.Operators != nil { - return visitor.VisitOperators(r.Operators) - } - return fmt.Errorf("type %T does not include a non-empty union type", r) -} +type VerificationWhatsApp struct { + Configs *TypeWhatsAppConfig `json:"configs,omitempty" url:"configs,omitempty"` -// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) -type RequestBulkRetryCreateRequestQueryParsedQuery struct { - String string - RequestBulkRetryCreateRequestQueryParsedQueryOne *RequestBulkRetryCreateRequestQueryParsedQueryOne + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewRequestBulkRetryCreateRequestQueryParsedQueryFromString(value string) *RequestBulkRetryCreateRequestQueryParsedQuery { - return &RequestBulkRetryCreateRequestQueryParsedQuery{String: value} +func (v *VerificationWhatsApp) GetConfigs() *TypeWhatsAppConfig { + if v == nil { + return nil + } + return v.Configs } -func NewRequestBulkRetryCreateRequestQueryParsedQueryFromRequestBulkRetryCreateRequestQueryParsedQueryOne(value *RequestBulkRetryCreateRequestQueryParsedQueryOne) *RequestBulkRetryCreateRequestQueryParsedQuery { - return &RequestBulkRetryCreateRequestQueryParsedQuery{RequestBulkRetryCreateRequestQueryParsedQueryOne: value} +func (v *VerificationWhatsApp) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString - return nil +func (v *VerificationWhatsApp) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationWhatsApp + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - valueRequestBulkRetryCreateRequestQueryParsedQueryOne := new(RequestBulkRetryCreateRequestQueryParsedQueryOne) - if err := json.Unmarshal(data, &valueRequestBulkRetryCreateRequestQueryParsedQueryOne); err == nil { - r.RequestBulkRetryCreateRequestQueryParsedQueryOne = valueRequestBulkRetryCreateRequestQueryParsedQueryOne - return nil + *v = VerificationWhatsApp(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (r RequestBulkRetryCreateRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) +func (v *VerificationWhatsApp) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if r.RequestBulkRetryCreateRequestQueryParsedQueryOne != nil { - return json.Marshal(r.RequestBulkRetryCreateRequestQueryParsedQueryOne) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return fmt.Sprintf("%#v", v) } -type RequestBulkRetryCreateRequestQueryParsedQueryVisitor interface { - VisitString(string) error - VisitRequestBulkRetryCreateRequestQueryParsedQueryOne(*RequestBulkRetryCreateRequestQueryParsedQueryOne) error -} +type VerificationWix struct { + Configs *TypeWixConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (r *RequestBulkRetryCreateRequestQueryParsedQuery) Accept(visitor RequestBulkRetryCreateRequestQueryParsedQueryVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) - } - if r.RequestBulkRetryCreateRequestQueryParsedQueryOne != nil { - return visitor.VisitRequestBulkRetryCreateRequestQueryParsedQueryOne(r.RequestBulkRetryCreateRequestQueryParsedQueryOne) - } - return fmt.Errorf("type %T does not include a non-empty union type", r) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type RequestBulkRetryCreateRequestQueryParsedQueryOne struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationWix) GetConfigs() *TypeWixConfig { + if v == nil { + return nil + } + return v.Configs } -func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) GetExtraProperties() map[string]interface{} { - return r.extraProperties +func (v *VerificationWix) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) UnmarshalJSON(data []byte) error { - type unmarshaler RequestBulkRetryCreateRequestQueryParsedQueryOne +func (v *VerificationWix) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationWix var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *r = RequestBulkRetryCreateRequestQueryParsedQueryOne(value) - - extraProperties, err := core.ExtractExtraProperties(data, *r) + *v = VerificationWix(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - r.extraProperties = extraProperties - - r._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (r *RequestBulkRetryCreateRequestQueryParsedQueryOne) String() string { - if len(r._rawJSON) > 0 { - if value, err := core.StringifyJSON(r._rawJSON); err == nil { +func (v *VerificationWix) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(r); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", r) -} - -// Filter by rejection cause -type RequestBulkRetryCreateRequestQueryRejectionCause struct { - RequestRejectionCause RequestRejectionCause - RequestRejectionCauseList []RequestRejectionCause + return fmt.Sprintf("%#v", v) } -func NewRequestBulkRetryCreateRequestQueryRejectionCauseFromRequestRejectionCause(value RequestRejectionCause) *RequestBulkRetryCreateRequestQueryRejectionCause { - return &RequestBulkRetryCreateRequestQueryRejectionCause{RequestRejectionCause: value} -} +type VerificationWooCommerce struct { + Configs *TypeWooCommerceConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewRequestBulkRetryCreateRequestQueryRejectionCauseFromRequestRejectionCauseList(value []RequestRejectionCause) *RequestBulkRetryCreateRequestQueryRejectionCause { - return &RequestBulkRetryCreateRequestQueryRejectionCause{RequestRejectionCauseList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQueryRejectionCause) UnmarshalJSON(data []byte) error { - var valueRequestRejectionCause RequestRejectionCause - if err := json.Unmarshal(data, &valueRequestRejectionCause); err == nil { - r.RequestRejectionCause = valueRequestRejectionCause +func (v *VerificationWooCommerce) GetConfigs() *TypeWooCommerceConfig { + if v == nil { return nil } - var valueRequestRejectionCauseList []RequestRejectionCause - if err := json.Unmarshal(data, &valueRequestRejectionCauseList); err == nil { - r.RequestRejectionCauseList = valueRequestRejectionCauseList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestBulkRetryCreateRequestQueryRejectionCause) MarshalJSON() ([]byte, error) { - if r.RequestRejectionCause != "" { - return json.Marshal(r.RequestRejectionCause) - } - if r.RequestRejectionCauseList != nil { - return json.Marshal(r.RequestRejectionCauseList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return v.Configs } -type RequestBulkRetryCreateRequestQueryRejectionCauseVisitor interface { - VisitRequestRejectionCause(RequestRejectionCause) error - VisitRequestRejectionCauseList([]RequestRejectionCause) error +func (v *VerificationWooCommerce) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQueryRejectionCause) Accept(visitor RequestBulkRetryCreateRequestQueryRejectionCauseVisitor) error { - if r.RequestRejectionCause != "" { - return visitor.VisitRequestRejectionCause(r.RequestRejectionCause) +func (v *VerificationWooCommerce) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationWooCommerce + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if r.RequestRejectionCauseList != nil { - return visitor.VisitRequestRejectionCauseList(r.RequestRejectionCauseList) + *v = VerificationWooCommerce(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by source IDs -type RequestBulkRetryCreateRequestQuerySourceId struct { - // Source ID - String string - StringList []string +func (v *VerificationWooCommerce) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func NewRequestBulkRetryCreateRequestQuerySourceIdFromString(value string) *RequestBulkRetryCreateRequestQuerySourceId { - return &RequestBulkRetryCreateRequestQuerySourceId{String: value} -} +type VerificationWorkOs struct { + Configs *TypeWorkOsConfig `json:"configs,omitempty" url:"configs,omitempty"` -func NewRequestBulkRetryCreateRequestQuerySourceIdFromStringList(value []string) *RequestBulkRetryCreateRequestQuerySourceId { - return &RequestBulkRetryCreateRequestQuerySourceId{StringList: value} + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (r *RequestBulkRetryCreateRequestQuerySourceId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.String = valueString +func (v *VerificationWorkOs) GetConfigs() *TypeWorkOsConfig { + if v == nil { return nil } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - r.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestBulkRetryCreateRequestQuerySourceId) MarshalJSON() ([]byte, error) { - if r.String != "" { - return json.Marshal(r.String) - } - if r.StringList != nil { - return json.Marshal(r.StringList) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", r) + return v.Configs } -type RequestBulkRetryCreateRequestQuerySourceIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error +func (v *VerificationWorkOs) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (r *RequestBulkRetryCreateRequestQuerySourceId) Accept(visitor RequestBulkRetryCreateRequestQuerySourceIdVisitor) error { - if r.String != "" { - return visitor.VisitString(r.String) +func (v *VerificationWorkOs) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationWorkOs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - if r.StringList != nil { - return visitor.VisitStringList(r.StringList) + *v = VerificationWorkOs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("type %T does not include a non-empty union type", r) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -// Filter by status -type RequestBulkRetryCreateRequestQueryStatus string - -const ( - RequestBulkRetryCreateRequestQueryStatusAccepted RequestBulkRetryCreateRequestQueryStatus = "accepted" - RequestBulkRetryCreateRequestQueryStatusRejected RequestBulkRetryCreateRequestQueryStatus = "rejected" -) - -func NewRequestBulkRetryCreateRequestQueryStatusFromString(s string) (RequestBulkRetryCreateRequestQueryStatus, error) { - switch s { - case "accepted": - return RequestBulkRetryCreateRequestQueryStatusAccepted, nil - case "rejected": - return RequestBulkRetryCreateRequestQueryStatusRejected, nil +func (v *VerificationWorkOs) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - var t RequestBulkRetryCreateRequestQueryStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) } -func (r RequestBulkRetryCreateRequestQueryStatus) Ptr() *RequestBulkRetryCreateRequestQueryStatus { - return &r -} +type VerificationXero struct { + Configs *TypeXeroConfig `json:"configs,omitempty" url:"configs,omitempty"` -// Body of the request -type TransformationRunRequestRequestBody struct { - TransformationRunRequestRequestBodyZero *TransformationRunRequestRequestBodyZero - String string + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func NewTransformationRunRequestRequestBodyFromTransformationRunRequestRequestBodyZero(value *TransformationRunRequestRequestBodyZero) *TransformationRunRequestRequestBody { - return &TransformationRunRequestRequestBody{TransformationRunRequestRequestBodyZero: value} +func (v *VerificationXero) GetConfigs() *TypeXeroConfig { + if v == nil { + return nil + } + return v.Configs } -func NewTransformationRunRequestRequestBodyFromString(value string) *TransformationRunRequestRequestBody { - return &TransformationRunRequestRequestBody{String: value} +func (v *VerificationXero) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (t *TransformationRunRequestRequestBody) UnmarshalJSON(data []byte) error { - valueTransformationRunRequestRequestBodyZero := new(TransformationRunRequestRequestBodyZero) - if err := json.Unmarshal(data, &valueTransformationRunRequestRequestBodyZero); err == nil { - t.TransformationRunRequestRequestBodyZero = valueTransformationRunRequestRequestBodyZero - return nil +func (v *VerificationXero) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationXero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - t.String = valueString - return nil + *v = VerificationXero(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil } -func (t TransformationRunRequestRequestBody) MarshalJSON() ([]byte, error) { - if t.TransformationRunRequestRequestBodyZero != nil { - return json.Marshal(t.TransformationRunRequestRequestBodyZero) +func (v *VerificationXero) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } } - if t.String != "" { - return json.Marshal(t.String) + if value, err := internal.StringifyJSON(v); err == nil { + return value } - return nil, fmt.Errorf("type %T does not include a non-empty union type", t) + return fmt.Sprintf("%#v", v) } -type TransformationRunRequestRequestBodyVisitor interface { - VisitTransformationRunRequestRequestBodyZero(*TransformationRunRequestRequestBodyZero) error - VisitString(string) error -} +type VerificationZendesk struct { + Configs *TypeZendeskConfig `json:"configs,omitempty" url:"configs,omitempty"` -func (t *TransformationRunRequestRequestBody) Accept(visitor TransformationRunRequestRequestBodyVisitor) error { - if t.TransformationRunRequestRequestBodyZero != nil { - return visitor.VisitTransformationRunRequestRequestBodyZero(t.TransformationRunRequestRequestBodyZero) - } - if t.String != "" { - return visitor.VisitString(t.String) - } - return fmt.Errorf("type %T does not include a non-empty union type", t) + extraProperties map[string]interface{} + rawJSON json.RawMessage } -type TransformationRunRequestRequestBodyZero struct { - extraProperties map[string]interface{} - _rawJSON json.RawMessage +func (v *VerificationZendesk) GetConfigs() *TypeZendeskConfig { + if v == nil { + return nil + } + return v.Configs } -func (t *TransformationRunRequestRequestBodyZero) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (v *VerificationZendesk) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (t *TransformationRunRequestRequestBodyZero) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationRunRequestRequestBodyZero +func (v *VerificationZendesk) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationZendesk var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationRunRequestRequestBodyZero(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *v = VerificationZendesk(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationRunRequestRequestBodyZero) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (v *VerificationZendesk) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", v) } -// JSON representation of the query params -type TransformationRunRequestRequestParsedQuery struct { +type VerificationZoom struct { + Configs *TypeZoomConfig `json:"configs,omitempty" url:"configs,omitempty"` + extraProperties map[string]interface{} - _rawJSON json.RawMessage + rawJSON json.RawMessage } -func (t *TransformationRunRequestRequestParsedQuery) GetExtraProperties() map[string]interface{} { - return t.extraProperties +func (v *VerificationZoom) GetConfigs() *TypeZoomConfig { + if v == nil { + return nil + } + return v.Configs +} + +func (v *VerificationZoom) GetExtraProperties() map[string]interface{} { + return v.extraProperties } -func (t *TransformationRunRequestRequestParsedQuery) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationRunRequestRequestParsedQuery +func (v *VerificationZoom) UnmarshalJSON(data []byte) error { + type unmarshaler VerificationZoom var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TransformationRunRequestRequestParsedQuery(value) - - extraProperties, err := core.ExtractExtraProperties(data, *t) + *v = VerificationZoom(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) if err != nil { return err } - t.extraProperties = extraProperties - - t._rawJSON = json.RawMessage(data) + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) return nil } -func (t *TransformationRunRequestRequestParsedQuery) String() string { - if len(t._rawJSON) > 0 { - if value, err := core.StringifyJSON(t._rawJSON); err == nil { +func (v *VerificationZoom) String() string { + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { return value } } - if value, err := core.StringifyJSON(t); err == nil { + if value, err := internal.StringifyJSON(v); err == nil { return value } - return fmt.Sprintf("%#v", t) + return fmt.Sprintf("%#v", v) } From 3de9c1a64202a10e287c603f4a032c49e2b4df72 Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Wed, 29 Jan 2025 21:43:45 +0700 Subject: [PATCH 2/2] fix: Generation issue with issue_trigger --- issue_trigger.go | 5 +++-- optional.go | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/issue_trigger.go b/issue_trigger.go index 3b39035..e2989cd 100644 --- a/issue_trigger.go +++ b/issue_trigger.go @@ -5,9 +5,10 @@ package api import ( json "encoding/json" fmt "fmt" + time "time" + core "github.com/hookdeck/hookdeck-go-sdk/core" internal "github.com/hookdeck/hookdeck-go-sdk/internal" - time "time" ) type IssueTriggerCreateRequest struct { @@ -1376,7 +1377,7 @@ func (i *IssueTriggerUpdateRequest) MarshalJSON() ([]byte, error) { DisabledAt *internal.DateTime `json:"disabled_at,omitempty"` }{ embed: embed(*i), - DisabledAt: internal.NewOptionalDateTime(i.DisabledAt), + DisabledAt: NewDateTimeFromOptional(i.DisabledAt), } return json.Marshal(marshaler) } diff --git a/optional.go b/optional.go index f2a7b6e..e485f5f 100644 --- a/optional.go +++ b/optional.go @@ -3,7 +3,10 @@ package api import ( + time "time" + core "github.com/hookdeck/hookdeck-go-sdk/core" + internal "github.com/hookdeck/hookdeck-go-sdk/internal" ) // Optional initializes an optional field. @@ -20,3 +23,20 @@ func Null[T any]() *core.Optional[T] { Null: true, } } + +// NewDateTimeFromOptional returns a new *DateTime from the given optional. +func NewDateTimeFromOptional(optional *core.Optional[time.Time]) *internal.DateTime { + if optional == nil { + return nil + } + return internal.NewDateTime(optional.Value) +} + +// OptionalOrNull initializes an optional field, setting the value +// to an explicit null if the value is nil. +func OptionalOrNull[T any](value *T) *core.Optional[T] { + if value == nil { + return Null[T]() + } + return Optional(*value) +}