// Package adminclient provides primitives to interact with the openapi HTTP API. // // Code generated by unknown module path version unknown version DO NOT EDIT. package adminclient import ( "bytes" "context" "encoding/json" "fmt" "io" "net/http" "net/url" "strings" "time" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" ) // Defines values for AuditLogTypes. const ( AuditLogTypesPasscodeLoginFinalFailed AuditLogTypes = "passcode_login_final_failed" AuditLogTypesPasscodeLoginFinalSucceeded AuditLogTypes = "passcode_login_final_succeeded" AuditLogTypesPasscodeLoginInitFailed AuditLogTypes = "passcode_login_init_failed" AuditLogTypesPasscodeLoginInitSucceeded AuditLogTypes = "passcode_login_init_succeeded" AuditLogTypesPasswordLoginFailed AuditLogTypes = "password_login_failed" AuditLogTypesPasswordLoginSucceeded AuditLogTypes = "password_login_succeeded" AuditLogTypesPasswordSetFailed AuditLogTypes = "password_set_failed" AuditLogTypesPasswordSetSucceeded AuditLogTypes = "password_set_succeeded" AuditLogTypesThirdpartySigninSucceeded AuditLogTypes = "thirdparty_signin_succeeded" AuditLogTypesThirdpartySignupSucceeded AuditLogTypes = "thirdparty_signup_succeeded" AuditLogTypesUserCreated AuditLogTypes = "user_created" AuditLogTypesWebauthnAuthenticationFinalFailed AuditLogTypes = "webauthn_authentication_final_failed" AuditLogTypesWebauthnAuthenticationFinalSucceeded AuditLogTypes = "webauthn_authentication_final_succeeded" AuditLogTypesWebauthnAuthenticationInitFailed AuditLogTypes = "webauthn_authentication_init_failed" AuditLogTypesWebauthnAuthenticationInitSucceeded AuditLogTypes = "webauthn_authentication_init_succeeded" AuditLogTypesWebauthnRegistrationFinalFailed AuditLogTypes = "webauthn_registration_final_failed" AuditLogTypesWebauthnRegistrationFinalSucceeded AuditLogTypes = "webauthn_registration_final_succeeded" AuditLogTypesWebauthnRegistrationInitFailed AuditLogTypes = "webauthn_registration_init_failed" AuditLogTypesWebauthnRegistrationInitSucceeded AuditLogTypes = "webauthn_registration_init_succeeded" ) // Defines values for DatabaseWebhookEventEvent. const ( DatabaseWebhookEventEventUser DatabaseWebhookEventEvent = "user" DatabaseWebhookEventEventUserCreate DatabaseWebhookEventEvent = "user.create" DatabaseWebhookEventEventUserDelete DatabaseWebhookEventEvent = "user.delete" DatabaseWebhookEventEventUserUpdate DatabaseWebhookEventEvent = "user.update" DatabaseWebhookEventEventUserUpdateEmail DatabaseWebhookEventEvent = "user.update.email" DatabaseWebhookEventEventUserUpdateEmailCreate DatabaseWebhookEventEvent = "user.update.email.create" DatabaseWebhookEventEventUserUpdateEmailDelete DatabaseWebhookEventEvent = "user.update.email.delete" DatabaseWebhookEventEventUserUpdateEmailPrimary DatabaseWebhookEventEvent = "user.update.email.primary" ) // Defines values for WebhookEvents. const ( WebhookEventsUser WebhookEvents = "user" WebhookEventsUserCreate WebhookEvents = "user.create" WebhookEventsUserDelete WebhookEvents = "user.delete" WebhookEventsUserUpdate WebhookEvents = "user.update" WebhookEventsUserUpdateEmail WebhookEvents = "user.update.email" WebhookEventsUserUpdateEmailCreate WebhookEvents = "user.update.email.create" WebhookEventsUserUpdateEmailDelete WebhookEvents = "user.update.email.delete" WebhookEventsUserUpdateEmailPrimary WebhookEvents = "user.update.email.primary" ) // Defines values for ListUsersParamsSortDirection. const ( ListUsersParamsSortDirectionAsc ListUsersParamsSortDirection = "asc" ListUsersParamsSortDirectionDesc ListUsersParamsSortDirection = "desc" ) // Defines values for PutWebhooksIdJSONBodyEvents. const ( PutWebhooksIdJSONBodyEventsUser PutWebhooksIdJSONBodyEvents = "user" PutWebhooksIdJSONBodyEventsUserCreate PutWebhooksIdJSONBodyEvents = "user.create" PutWebhooksIdJSONBodyEventsUserDelete PutWebhooksIdJSONBodyEvents = "user.delete" PutWebhooksIdJSONBodyEventsUserUpdate PutWebhooksIdJSONBodyEvents = "user.update" PutWebhooksIdJSONBodyEventsUserUpdateEmail PutWebhooksIdJSONBodyEvents = "user.update.email" PutWebhooksIdJSONBodyEventsUserUpdateEmailCreate PutWebhooksIdJSONBodyEvents = "user.update.email.create" PutWebhooksIdJSONBodyEventsUserUpdateEmailDelete PutWebhooksIdJSONBodyEvents = "user.update.email.delete" PutWebhooksIdJSONBodyEventsUserUpdateEmailPrimary PutWebhooksIdJSONBodyEvents = "user.update.email.primary" ) // AuditLog defines model for AuditLog. type AuditLog struct { // ActorEmail The email from the actor ActorEmail *openapi_types.Email `json:"actor_email,omitempty"` // ActorUserId The userID from the actor ActorUserId *UUID4 `json:"actor_user_id,omitempty"` // CreatedAt Time of creation of the audit log CreatedAt time.Time `json:"created_at"` // Error A more detailed message why something failed Error *string `json:"error,omitempty"` // Id The ID of the audit log Id UUID4 `json:"id"` // MetaHttpRequestId The ID of the corresponding http request MetaHttpRequestId string `json:"meta_http_request_id"` // MetaSourceIp The IP from where the http request came from MetaSourceIp string `json:"meta_source_ip"` // MetaUserAgent The user agent from where the http request came from MetaUserAgent string `json:"meta_user_agent"` Type AuditLogTypes `json:"type"` } // AuditLogTypes The type of the audit log type AuditLogTypes string // DatabaseWebhook defines model for DatabaseWebhook. type DatabaseWebhook struct { Callback *string `json:"callback,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Enabled *bool `json:"enabled,omitempty"` Events *[]DatabaseWebhookEvent `json:"events,omitempty"` ExpiresAt *time.Time `json:"expires_at,omitempty"` Failures *int `json:"failures,omitempty"` Id *openapi_types.UUID `json:"id,omitempty"` // UpdatedAt Time of last update of the audit log UpdatedAt *time.Time `json:"updated_at,omitempty"` } // DatabaseWebhookEvent defines model for DatabaseWebhookEvent. type DatabaseWebhookEvent struct { Event *DatabaseWebhookEventEvent `json:"event,omitempty"` Id *openapi_types.UUID `json:"id,omitempty"` } // DatabaseWebhookEventEvent defines model for DatabaseWebhookEvent.Event. type DatabaseWebhookEventEvent string // Email defines model for Email. type Email struct { // Address The email address Address openapi_types.Email `json:"address"` // CreatedAt Time of creation of the email CreatedAt time.Time `json:"created_at"` // Id The ID of the email Id UUID4 `json:"id"` // IsPrimary Indicates it's the primary email address. IsPrimary bool `json:"is_primary"` // IsVerified Indicated the email has been verified. IsVerified bool `json:"is_verified"` // UpdatedAt Time of last update of the email UpdatedAt time.Time `json:"updated_at"` } // Error defines model for Error. type Error struct { Code int32 `json:"code"` Message string `json:"message"` } // UUID4 defines model for UUID4. type UUID4 = string // User defines model for User. type User struct { // CreatedAt Time of creation of the user CreatedAt time.Time `json:"created_at"` // Emails List of emails associated to the user Emails *[]Email `json:"emails,omitempty"` // Id The ID of the user Id UUID4 `json:"id"` // UpdatedAt Time of last update of the user UpdatedAt time.Time `json:"updated_at"` // WebauthnCredentials List of registered Webauthn credentials WebauthnCredentials *[]WebAuthnCredential `json:"webauthn_credentials,omitempty"` } // WebAuthnCredential defines model for WebAuthnCredential. type WebAuthnCredential struct { // Aaguid The AAGUID of the authenticator the credentials was created on Aaguid string `json:"aaguid"` // AttestationType The attestation type the credential was registered with AttestationType string `json:"attestation_type"` // CreatedAt Time of creation of the credential CreatedAt time.Time `json:"created_at"` // Id The ID of the credential Id UUID4 `json:"id"` // Name A name that the user choose Name *string `json:"name,omitempty"` // PublicKey The public key of the credential PublicKey string `json:"public_key"` // Transports The ways the authenticator is connected Transports *[]string `json:"transports,omitempty"` } // Webhook defines model for Webhook. type Webhook struct { Callback string `json:"callback"` Events []WebhookEvents `json:"events"` } // WebhookEvents defines model for Webhook.Events. type WebhookEvents string // Id defines model for Id. type Id = openapi_types.UUID // BadRequest defines model for BadRequest. type BadRequest = Error // Conflict defines model for Conflict. type Conflict = Error // InternalServerError defines model for InternalServerError. type InternalServerError = Error // NotFound defines model for NotFound. type NotFound = Error // CreateEmail defines model for CreateEmail. type CreateEmail struct { Address openapi_types.Email `json:"address"` IsPrimary *bool `json:"is_primary,omitempty"` IsVerified *bool `json:"is_verified,omitempty"` } // ListAuditLogsParams defines parameters for ListAuditLogs. type ListAuditLogsParams struct { // Page The page which should be returned Page *int `form:"page,omitempty" json:"page,omitempty"` // PerPage The number of returned items PerPage *int `form:"per_page,omitempty" json:"per_page,omitempty"` // StartTime Date and time from which the logs are included StartTime *string `form:"start_time,omitempty" json:"start_time,omitempty"` // EndTime Date and time to which the logs are included EndTime *string `form:"end_time,omitempty" json:"end_time,omitempty"` // ActorUserId Only audit logs with the specified user_id are included ActorUserId *UUID4 `form:"actor_user_id,omitempty" json:"actor_user_id,omitempty"` // ActorEmail Only audit logs with the specified email are included ActorEmail *openapi_types.Email `form:"actor_email,omitempty" json:"actor_email,omitempty"` // Q Only audit logs are included when the search string matches values in meta_source_ip or actor_user_id or actor_email Q *string `form:"q,omitempty" json:"q,omitempty"` // Type Only audit logs with the specified type are included Type *[]AuditLogTypes `form:"type,omitempty" json:"type,omitempty"` } // ListUsersParams defines parameters for ListUsers. type ListUsersParams struct { // Page The page which should be returned Page *int `form:"page,omitempty" json:"page,omitempty"` // PerPage The number of returned items PerPage *int `form:"per_page,omitempty" json:"per_page,omitempty"` // UserId Only users with the specified user_id are included UserId *UUID4 `form:"user_id,omitempty" json:"user_id,omitempty"` // Email Only users with the specified email are included Email *openapi_types.Email `form:"email,omitempty" json:"email,omitempty"` // SortDirection The sort direction of the returned list (always sorted by created_at) SortDirection *ListUsersParamsSortDirection `form:"sort_direction,omitempty" json:"sort_direction,omitempty"` } // ListUsersParamsSortDirection defines parameters for ListUsers. type ListUsersParamsSortDirection string // CreateUserJSONBody defines parameters for CreateUser. type CreateUserJSONBody struct { // CreatedAt Time of creation of the user CreatedAt *time.Time `json:"created_at,omitempty"` // Emails The email addresses of the new user Emails []struct { Address string `json:"address"` IsPrimary bool `json:"is_primary"` IsVerified *bool `json:"is_verified,omitempty"` } `json:"emails"` // Id The ID of the new user Id *UUID4 `json:"id,omitempty"` } // PostUsersIdEmailsJSONBody defines parameters for PostUsersIdEmails. type PostUsersIdEmailsJSONBody struct { Address openapi_types.Email `json:"address"` IsPrimary *bool `json:"is_primary,omitempty"` IsVerified *bool `json:"is_verified,omitempty"` } // PutWebhooksIdJSONBody defines parameters for PutWebhooksId. type PutWebhooksIdJSONBody struct { Callback string `json:"callback"` Enabled bool `json:"enabled"` Events []PutWebhooksIdJSONBodyEvents `json:"events"` } // PutWebhooksIdJSONBodyEvents defines parameters for PutWebhooksId. type PutWebhooksIdJSONBodyEvents string // CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType. type CreateUserJSONRequestBody CreateUserJSONBody // PostUsersIdEmailsJSONRequestBody defines body for PostUsersIdEmails for application/json ContentType. type PostUsersIdEmailsJSONRequestBody PostUsersIdEmailsJSONBody // CreateDbWebhooksJSONRequestBody defines body for CreateDbWebhooks for application/json ContentType. type CreateDbWebhooksJSONRequestBody = Webhook // PutWebhooksIdJSONRequestBody defines body for PutWebhooksId for application/json ContentType. type PutWebhooksIdJSONRequestBody PutWebhooksIdJSONBody // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error // Doer performs HTTP requests. // // The standard http.Client implements this interface. type HttpRequestDoer interface { Do(req *http.Request) (*http.Response, error) } // Client which conforms to the OpenAPI3 specification for this service. type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn } // ClientOption allows setting custom parameters during construction type ClientOption func(*Client) error // Creates a new Client, with reasonable defaults func NewClient(server string, opts ...ClientOption) (*Client, error) { // create a client with sane default values client := Client{ Server: server, } // mutate client and add all optional params for _, o := range opts { if err := o(&client); err != nil { return nil, err } } // ensure the server URL always has a trailing slash if !strings.HasSuffix(client.Server, "/") { client.Server += "/" } // create httpClient, if not already present if client.Client == nil { client.Client = &http.Client{} } return &client, nil } // WithHTTPClient allows overriding the default Doer, which is // automatically created using http.Client. This is useful for tests. func WithHTTPClient(doer HttpRequestDoer) ClientOption { return func(c *Client) error { c.Client = doer return nil } } // WithRequestEditorFn allows setting up a callback function, which will be // called right before sending the request. This can be used to mutate the request. func WithRequestEditorFn(fn RequestEditorFn) ClientOption { return func(c *Client) error { c.RequestEditors = append(c.RequestEditors, fn) return nil } } // The interface specification for the client above. type ClientInterface interface { // Status request Status(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListAuditLogs request ListAuditLogs(ctx context.Context, params *ListAuditLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetMetrics request GetMetrics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListUsers request ListUsers(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateUserWithBody request with any body CreateUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateUser(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteUser request DeleteUser(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*http.Response, error) // GetUser request GetUser(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*http.Response, error) // GetUsersIdEmails request GetUsersIdEmails(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) // PostUsersIdEmailsWithBody request with any body PostUsersIdEmailsWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostUsersIdEmails(ctx context.Context, id Id, body PostUsersIdEmailsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteUsersEmailsEmailId request DeleteUsersEmailsEmailId(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetUsersIdEmailsEmailId request GetUsersIdEmailsEmailId(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) // PostUsersEmailsEmailIdSetPrimary request PostUsersEmailsEmailIdSetPrimary(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) // ListWebhooks request ListWebhooks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateDbWebhooksWithBody request with any body CreateDbWebhooksWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateDbWebhooks(ctx context.Context, body CreateDbWebhooksJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteWebhooksId request DeleteWebhooksId(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) // GetWebhooksId request GetWebhooksId(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) // PutWebhooksIdWithBody request with any body PutWebhooksIdWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PutWebhooksId(ctx context.Context, id Id, body PutWebhooksIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) Status(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewStatusRequest(c.Server) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) ListAuditLogs(ctx context.Context, params *ListAuditLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListAuditLogsRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) GetMetrics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetMetricsRequest(c.Server) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) ListUsers(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListUsersRequest(c.Server, params) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) CreateUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateUserRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) CreateUser(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateUserRequest(c.Server, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) DeleteUser(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteUserRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) GetUser(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetUserRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) GetUsersIdEmails(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetUsersIdEmailsRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) PostUsersIdEmailsWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostUsersIdEmailsRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) PostUsersIdEmails(ctx context.Context, id Id, body PostUsersIdEmailsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostUsersIdEmailsRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) DeleteUsersEmailsEmailId(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteUsersEmailsEmailIdRequest(c.Server, id, emailId) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) GetUsersIdEmailsEmailId(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetUsersIdEmailsEmailIdRequest(c.Server, id, emailId) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) PostUsersEmailsEmailIdSetPrimary(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostUsersEmailsEmailIdSetPrimaryRequest(c.Server, id, emailId) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) ListWebhooks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListWebhooksRequest(c.Server) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) CreateDbWebhooksWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateDbWebhooksRequestWithBody(c.Server, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) CreateDbWebhooks(ctx context.Context, body CreateDbWebhooksJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateDbWebhooksRequest(c.Server, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) DeleteWebhooksId(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteWebhooksIdRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) GetWebhooksId(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetWebhooksIdRequest(c.Server, id) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) PutWebhooksIdWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPutWebhooksIdRequestWithBody(c.Server, id, contentType, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } func (c *Client) PutWebhooksId(ctx context.Context, id Id, body PutWebhooksIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPutWebhooksIdRequest(c.Server, id, body) if err != nil { return nil, err } req = req.WithContext(ctx) if err := c.applyEditors(ctx, req, reqEditors); err != nil { return nil, err } return c.Client.Do(req) } // NewStatusRequest generates requests for Status func NewStatusRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewListAuditLogsRequest generates requests for ListAuditLogs func NewListAuditLogsRequest(server string, params *ListAuditLogsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/audit_logs") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if params.Page != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PerPage != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.StartTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "start_time", runtime.ParamLocationQuery, *params.StartTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.EndTime != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "end_time", runtime.ParamLocationQuery, *params.EndTime); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ActorUserId != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "actor_user_id", runtime.ParamLocationQuery, *params.ActorUserId); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.ActorEmail != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "actor_email", runtime.ParamLocationQuery, *params.ActorEmail); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Q != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "q", runtime.ParamLocationQuery, *params.Q); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Type != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetMetricsRequest generates requests for GetMetrics func NewGetMetricsRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/metrics") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewListUsersRequest generates requests for ListUsers func NewListUsersRequest(server string, params *ListUsersParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } if params != nil { queryValues := queryURL.Query() if params.Page != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.PerPage != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.UserId != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user_id", runtime.ParamLocationQuery, *params.UserId); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.Email != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "email", runtime.ParamLocationQuery, *params.Email); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } if params.SortDirection != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sort_direction", runtime.ParamLocationQuery, *params.SortDirection); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err } else { for k, v := range parsed { for _, v2 := range v { queryValues.Add(k, v2) } } } } queryURL.RawQuery = queryValues.Encode() } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewCreateUserRequest calls the generic CreateUser builder with application/json body func NewCreateUserRequest(server string, body CreateUserJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateUserRequestWithBody(server, "application/json", bodyReader) } // NewCreateUserRequestWithBody generates requests for CreateUser with any type of body func NewCreateUserRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewDeleteUserRequest generates requests for DeleteUser func NewDeleteUserRequest(server string, id UUID4) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetUserRequest generates requests for GetUser func NewGetUserRequest(server string, id UUID4) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetUsersIdEmailsRequest generates requests for GetUsersIdEmails func NewGetUsersIdEmailsRequest(server string, id Id) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s/emails", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewPostUsersIdEmailsRequest calls the generic PostUsersIdEmails builder with application/json body func NewPostUsersIdEmailsRequest(server string, id Id, body PostUsersIdEmailsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPostUsersIdEmailsRequestWithBody(server, id, "application/json", bodyReader) } // NewPostUsersIdEmailsRequestWithBody generates requests for PostUsersIdEmails with any type of body func NewPostUsersIdEmailsRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s/emails", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewDeleteUsersEmailsEmailIdRequest generates requests for DeleteUsersEmailsEmailId func NewDeleteUsersEmailsEmailIdRequest(server string, id Id, emailId string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } var pathParam1 string pathParam1, err = runtime.StyleParamWithLocation("simple", false, "email_id", runtime.ParamLocationPath, emailId) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s/emails/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetUsersIdEmailsEmailIdRequest generates requests for GetUsersIdEmailsEmailId func NewGetUsersIdEmailsEmailIdRequest(server string, id Id, emailId string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } var pathParam1 string pathParam1, err = runtime.StyleParamWithLocation("simple", false, "email_id", runtime.ParamLocationPath, emailId) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s/emails/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewPostUsersEmailsEmailIdSetPrimaryRequest generates requests for PostUsersEmailsEmailIdSetPrimary func NewPostUsersEmailsEmailIdSetPrimaryRequest(server string, id Id, emailId string) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } var pathParam1 string pathParam1, err = runtime.StyleParamWithLocation("simple", false, "email_id", runtime.ParamLocationPath, emailId) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/users/%s/emails/%s/set_primary", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewListWebhooksRequest generates requests for ListWebhooks func NewListWebhooksRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/webhooks") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewCreateDbWebhooksRequest calls the generic CreateDbWebhooks builder with application/json body func NewCreateDbWebhooksRequest(server string, body CreateDbWebhooksJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateDbWebhooksRequestWithBody(server, "application/json", bodyReader) } // NewCreateDbWebhooksRequestWithBody generates requests for CreateDbWebhooks with any type of body func NewCreateDbWebhooksRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/webhooks") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewDeleteWebhooksIdRequest generates requests for DeleteWebhooksId func NewDeleteWebhooksIdRequest(server string, id Id) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/webhooks/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetWebhooksIdRequest generates requests for GetWebhooksId func NewGetWebhooksIdRequest(server string, id Id) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/webhooks/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewPutWebhooksIdRequest calls the generic PutWebhooksId builder with application/json body func NewPutWebhooksIdRequest(server string, id Id, body PutWebhooksIdJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPutWebhooksIdRequestWithBody(server, id, "application/json", bodyReader) } // NewPutWebhooksIdRequestWithBody generates requests for PutWebhooksId with any type of body func NewPutWebhooksIdRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) if err != nil { return nil, err } serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/webhooks/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("PUT", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { for _, r := range c.RequestEditors { if err := r(ctx, req); err != nil { return err } } for _, r := range additionalEditors { if err := r(ctx, req); err != nil { return err } } return nil } // ClientWithResponses builds on ClientInterface to offer response payloads type ClientWithResponses struct { ClientInterface } // NewClientWithResponses creates a new ClientWithResponses, which wraps // Client with return type handling func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { client, err := NewClient(server, opts...) if err != nil { return nil, err } return &ClientWithResponses{client}, nil } // WithBaseURL overrides the baseURL. func WithBaseURL(baseURL string) ClientOption { return func(c *Client) error { newBaseURL, err := url.Parse(baseURL) if err != nil { return err } c.Server = newBaseURL.String() return nil } } // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { // StatusWithResponse request StatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*StatusResponse, error) // ListAuditLogsWithResponse request ListAuditLogsWithResponse(ctx context.Context, params *ListAuditLogsParams, reqEditors ...RequestEditorFn) (*ListAuditLogsResponse, error) // GetMetricsWithResponse request GetMetricsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetMetricsResponse, error) // ListUsersWithResponse request ListUsersWithResponse(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) // CreateUserWithBodyWithResponse request with any body CreateUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) CreateUserWithResponse(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) // DeleteUserWithResponse request DeleteUserWithResponse(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error) // GetUserWithResponse request GetUserWithResponse(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*GetUserResponse, error) // GetUsersIdEmailsWithResponse request GetUsersIdEmailsWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*GetUsersIdEmailsResponse, error) // PostUsersIdEmailsWithBodyWithResponse request with any body PostUsersIdEmailsWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUsersIdEmailsResponse, error) PostUsersIdEmailsWithResponse(ctx context.Context, id Id, body PostUsersIdEmailsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostUsersIdEmailsResponse, error) // DeleteUsersEmailsEmailIdWithResponse request DeleteUsersEmailsEmailIdWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*DeleteUsersEmailsEmailIdResponse, error) // GetUsersIdEmailsEmailIdWithResponse request GetUsersIdEmailsEmailIdWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*GetUsersIdEmailsEmailIdResponse, error) // PostUsersEmailsEmailIdSetPrimaryWithResponse request PostUsersEmailsEmailIdSetPrimaryWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*PostUsersEmailsEmailIdSetPrimaryResponse, error) // ListWebhooksWithResponse request ListWebhooksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListWebhooksResponse, error) // CreateDbWebhooksWithBodyWithResponse request with any body CreateDbWebhooksWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbWebhooksResponse, error) CreateDbWebhooksWithResponse(ctx context.Context, body CreateDbWebhooksJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbWebhooksResponse, error) // DeleteWebhooksIdWithResponse request DeleteWebhooksIdWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*DeleteWebhooksIdResponse, error) // GetWebhooksIdWithResponse request GetWebhooksIdWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*GetWebhooksIdResponse, error) // PutWebhooksIdWithBodyWithResponse request with any body PutWebhooksIdWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutWebhooksIdResponse, error) PutWebhooksIdWithResponse(ctx context.Context, id Id, body PutWebhooksIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutWebhooksIdResponse, error) } type StatusResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r StatusResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r StatusResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ListAuditLogsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]AuditLog JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r ListAuditLogsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListAuditLogsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetMetricsResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r GetMetricsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetMetricsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ListUsersResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]User JSON400 *BadRequest JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r ListUsersResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListUsersResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type CreateUserResponse struct { Body []byte HTTPResponse *http.Response JSON200 *User JSON400 *BadRequest JSON409 *Conflict JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r CreateUserResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateUserResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type DeleteUserResponse struct { Body []byte HTTPResponse *http.Response JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r DeleteUserResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r DeleteUserResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetUserResponse struct { Body []byte HTTPResponse *http.Response JSON200 *User JSON400 *BadRequest JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r GetUserResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetUserResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetUsersIdEmailsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Email JSON400 *BadRequest JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r GetUsersIdEmailsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetUsersIdEmailsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostUsersIdEmailsResponse struct { Body []byte HTTPResponse *http.Response JSON201 *Email JSON400 *BadRequest JSON404 *NotFound JSON409 *Conflict JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r PostUsersIdEmailsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostUsersIdEmailsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type DeleteUsersEmailsEmailIdResponse struct { Body []byte HTTPResponse *http.Response JSON400 *BadRequest JSON404 *NotFound JSON409 *Conflict JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r DeleteUsersEmailsEmailIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r DeleteUsersEmailsEmailIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetUsersIdEmailsEmailIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Email JSON400 *BadRequest JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r GetUsersIdEmailsEmailIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetUsersIdEmailsEmailIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostUsersEmailsEmailIdSetPrimaryResponse struct { Body []byte HTTPResponse *http.Response JSON400 *BadRequest JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r PostUsersEmailsEmailIdSetPrimaryResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostUsersEmailsEmailIdSetPrimaryResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ListWebhooksResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { Config *[]Webhook `json:"config,omitempty"` Database *[]DatabaseWebhook `json:"database,omitempty"` } JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r ListWebhooksResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListWebhooksResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type CreateDbWebhooksResponse struct { Body []byte HTTPResponse *http.Response JSON201 *DatabaseWebhook JSON400 *BadRequest JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r CreateDbWebhooksResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateDbWebhooksResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type DeleteWebhooksIdResponse struct { Body []byte HTTPResponse *http.Response JSON400 *BadRequest JSON404 *NotFound } // Status returns HTTPResponse.Status func (r DeleteWebhooksIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r DeleteWebhooksIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetWebhooksIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DatabaseWebhook JSON400 *BadRequest JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r GetWebhooksIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetWebhooksIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PutWebhooksIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DatabaseWebhook JSON400 *BadRequest JSON404 *NotFound JSON500 *InternalServerError } // Status returns HTTPResponse.Status func (r PutWebhooksIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PutWebhooksIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // StatusWithResponse request returning *StatusResponse func (c *ClientWithResponses) StatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*StatusResponse, error) { rsp, err := c.Status(ctx, reqEditors...) if err != nil { return nil, err } return ParseStatusResponse(rsp) } // ListAuditLogsWithResponse request returning *ListAuditLogsResponse func (c *ClientWithResponses) ListAuditLogsWithResponse(ctx context.Context, params *ListAuditLogsParams, reqEditors ...RequestEditorFn) (*ListAuditLogsResponse, error) { rsp, err := c.ListAuditLogs(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseListAuditLogsResponse(rsp) } // GetMetricsWithResponse request returning *GetMetricsResponse func (c *ClientWithResponses) GetMetricsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetMetricsResponse, error) { rsp, err := c.GetMetrics(ctx, reqEditors...) if err != nil { return nil, err } return ParseGetMetricsResponse(rsp) } // ListUsersWithResponse request returning *ListUsersResponse func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) { rsp, err := c.ListUsers(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseListUsersResponse(rsp) } // CreateUserWithBodyWithResponse request with arbitrary body returning *CreateUserResponse func (c *ClientWithResponses) CreateUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) { rsp, err := c.CreateUserWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateUserResponse(rsp) } func (c *ClientWithResponses) CreateUserWithResponse(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) { rsp, err := c.CreateUser(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseCreateUserResponse(rsp) } // DeleteUserWithResponse request returning *DeleteUserResponse func (c *ClientWithResponses) DeleteUserWithResponse(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error) { rsp, err := c.DeleteUser(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseDeleteUserResponse(rsp) } // GetUserWithResponse request returning *GetUserResponse func (c *ClientWithResponses) GetUserWithResponse(ctx context.Context, id UUID4, reqEditors ...RequestEditorFn) (*GetUserResponse, error) { rsp, err := c.GetUser(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetUserResponse(rsp) } // GetUsersIdEmailsWithResponse request returning *GetUsersIdEmailsResponse func (c *ClientWithResponses) GetUsersIdEmailsWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*GetUsersIdEmailsResponse, error) { rsp, err := c.GetUsersIdEmails(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetUsersIdEmailsResponse(rsp) } // PostUsersIdEmailsWithBodyWithResponse request with arbitrary body returning *PostUsersIdEmailsResponse func (c *ClientWithResponses) PostUsersIdEmailsWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostUsersIdEmailsResponse, error) { rsp, err := c.PostUsersIdEmailsWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostUsersIdEmailsResponse(rsp) } func (c *ClientWithResponses) PostUsersIdEmailsWithResponse(ctx context.Context, id Id, body PostUsersIdEmailsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostUsersIdEmailsResponse, error) { rsp, err := c.PostUsersIdEmails(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParsePostUsersIdEmailsResponse(rsp) } // DeleteUsersEmailsEmailIdWithResponse request returning *DeleteUsersEmailsEmailIdResponse func (c *ClientWithResponses) DeleteUsersEmailsEmailIdWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*DeleteUsersEmailsEmailIdResponse, error) { rsp, err := c.DeleteUsersEmailsEmailId(ctx, id, emailId, reqEditors...) if err != nil { return nil, err } return ParseDeleteUsersEmailsEmailIdResponse(rsp) } // GetUsersIdEmailsEmailIdWithResponse request returning *GetUsersIdEmailsEmailIdResponse func (c *ClientWithResponses) GetUsersIdEmailsEmailIdWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*GetUsersIdEmailsEmailIdResponse, error) { rsp, err := c.GetUsersIdEmailsEmailId(ctx, id, emailId, reqEditors...) if err != nil { return nil, err } return ParseGetUsersIdEmailsEmailIdResponse(rsp) } // PostUsersEmailsEmailIdSetPrimaryWithResponse request returning *PostUsersEmailsEmailIdSetPrimaryResponse func (c *ClientWithResponses) PostUsersEmailsEmailIdSetPrimaryWithResponse(ctx context.Context, id Id, emailId string, reqEditors ...RequestEditorFn) (*PostUsersEmailsEmailIdSetPrimaryResponse, error) { rsp, err := c.PostUsersEmailsEmailIdSetPrimary(ctx, id, emailId, reqEditors...) if err != nil { return nil, err } return ParsePostUsersEmailsEmailIdSetPrimaryResponse(rsp) } // ListWebhooksWithResponse request returning *ListWebhooksResponse func (c *ClientWithResponses) ListWebhooksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListWebhooksResponse, error) { rsp, err := c.ListWebhooks(ctx, reqEditors...) if err != nil { return nil, err } return ParseListWebhooksResponse(rsp) } // CreateDbWebhooksWithBodyWithResponse request with arbitrary body returning *CreateDbWebhooksResponse func (c *ClientWithResponses) CreateDbWebhooksWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbWebhooksResponse, error) { rsp, err := c.CreateDbWebhooksWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateDbWebhooksResponse(rsp) } func (c *ClientWithResponses) CreateDbWebhooksWithResponse(ctx context.Context, body CreateDbWebhooksJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbWebhooksResponse, error) { rsp, err := c.CreateDbWebhooks(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseCreateDbWebhooksResponse(rsp) } // DeleteWebhooksIdWithResponse request returning *DeleteWebhooksIdResponse func (c *ClientWithResponses) DeleteWebhooksIdWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*DeleteWebhooksIdResponse, error) { rsp, err := c.DeleteWebhooksId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseDeleteWebhooksIdResponse(rsp) } // GetWebhooksIdWithResponse request returning *GetWebhooksIdResponse func (c *ClientWithResponses) GetWebhooksIdWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*GetWebhooksIdResponse, error) { rsp, err := c.GetWebhooksId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetWebhooksIdResponse(rsp) } // PutWebhooksIdWithBodyWithResponse request with arbitrary body returning *PutWebhooksIdResponse func (c *ClientWithResponses) PutWebhooksIdWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutWebhooksIdResponse, error) { rsp, err := c.PutWebhooksIdWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePutWebhooksIdResponse(rsp) } func (c *ClientWithResponses) PutWebhooksIdWithResponse(ctx context.Context, id Id, body PutWebhooksIdJSONRequestBody, reqEditors ...RequestEditorFn) (*PutWebhooksIdResponse, error) { rsp, err := c.PutWebhooksId(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParsePutWebhooksIdResponse(rsp) } // ParseStatusResponse parses an HTTP response from a StatusWithResponse call func ParseStatusResponse(rsp *http.Response) (*StatusResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &StatusResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseListAuditLogsResponse parses an HTTP response from a ListAuditLogsWithResponse call func ParseListAuditLogsResponse(rsp *http.Response) (*ListAuditLogsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListAuditLogsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []AuditLog if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseGetMetricsResponse parses an HTTP response from a GetMetricsWithResponse call func ParseGetMetricsResponse(rsp *http.Response) (*GetMetricsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetMetricsResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseListUsersResponse parses an HTTP response from a ListUsersWithResponse call func ParseListUsersResponse(rsp *http.Response) (*ListUsersResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListUsersResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []User if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseCreateUserResponse parses an HTTP response from a CreateUserWithResponse call func ParseCreateUserResponse(rsp *http.Response) (*CreateUserResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateUserResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest User if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest Conflict if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON409 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseDeleteUserResponse parses an HTTP response from a DeleteUserWithResponse call func ParseDeleteUserResponse(rsp *http.Response) (*DeleteUserResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &DeleteUserResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseGetUserResponse parses an HTTP response from a GetUserWithResponse call func ParseGetUserResponse(rsp *http.Response) (*GetUserResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetUserResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest User if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseGetUsersIdEmailsResponse parses an HTTP response from a GetUsersIdEmailsWithResponse call func ParseGetUsersIdEmailsResponse(rsp *http.Response) (*GetUsersIdEmailsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetUsersIdEmailsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest []Email if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParsePostUsersIdEmailsResponse parses an HTTP response from a PostUsersIdEmailsWithResponse call func ParsePostUsersIdEmailsResponse(rsp *http.Response) (*PostUsersIdEmailsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostUsersIdEmailsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest Email if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest Conflict if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON409 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseDeleteUsersEmailsEmailIdResponse parses an HTTP response from a DeleteUsersEmailsEmailIdWithResponse call func ParseDeleteUsersEmailsEmailIdResponse(rsp *http.Response) (*DeleteUsersEmailsEmailIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &DeleteUsersEmailsEmailIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: var dest Conflict if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON409 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseGetUsersIdEmailsEmailIdResponse parses an HTTP response from a GetUsersIdEmailsEmailIdWithResponse call func ParseGetUsersIdEmailsEmailIdResponse(rsp *http.Response) (*GetUsersIdEmailsEmailIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetUsersIdEmailsEmailIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Email if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParsePostUsersEmailsEmailIdSetPrimaryResponse parses an HTTP response from a PostUsersEmailsEmailIdSetPrimaryWithResponse call func ParsePostUsersEmailsEmailIdSetPrimaryResponse(rsp *http.Response) (*PostUsersEmailsEmailIdSetPrimaryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostUsersEmailsEmailIdSetPrimaryResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseListWebhooksResponse parses an HTTP response from a ListWebhooksWithResponse call func ParseListWebhooksResponse(rsp *http.Response) (*ListWebhooksResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListWebhooksResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { Config *[]Webhook `json:"config,omitempty"` Database *[]DatabaseWebhook `json:"database,omitempty"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseCreateDbWebhooksResponse parses an HTTP response from a CreateDbWebhooksWithResponse call func ParseCreateDbWebhooksResponse(rsp *http.Response) (*CreateDbWebhooksResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateDbWebhooksResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest DatabaseWebhook if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON201 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParseDeleteWebhooksIdResponse parses an HTTP response from a DeleteWebhooksIdWithResponse call func ParseDeleteWebhooksIdResponse(rsp *http.Response) (*DeleteWebhooksIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &DeleteWebhooksIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest } return response, nil } // ParseGetWebhooksIdResponse parses an HTTP response from a GetWebhooksIdWithResponse call func ParseGetWebhooksIdResponse(rsp *http.Response) (*GetWebhooksIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetWebhooksIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DatabaseWebhook if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil } // ParsePutWebhooksIdResponse parses an HTTP response from a PutWebhooksIdWithResponse call func ParsePutWebhooksIdResponse(rsp *http.Response) (*PutWebhooksIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PutWebhooksIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DatabaseWebhook if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON400 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalServerError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON500 = &dest } return response, nil }