lib/api/members/members_client/emails/emails_client.go

370 lines
14 KiB
Go
Raw Normal View History

2023-04-17 22:11:43 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package emails
import (
"context"
2023-04-17 22:11:43 +00:00
"fmt"
"time"
2023-04-17 22:11:43 +00:00
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
2023-04-17 22:11:43 +00:00
"github.com/go-openapi/strfmt"
)
// New creates a new emails API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
2023-04-17 22:11:43 +00:00
return &Client{transport: transport, formats: formats}
}
// New creates a new emails API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
return &Client{transport: transport, formats: strfmt.Default}
}
// New creates a new emails API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
transport := httptransport.New(host, basePath, []string{scheme})
transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
return &Client{transport: transport, formats: strfmt.Default}
}
// Client for emails API.
2023-04-17 22:11:43 +00:00
type Client struct {
transport runtime.ContextualTransport
2023-04-17 22:11:43 +00:00
formats strfmt.Registry
}
// ClientOption may be used to customize the behavior of Client methods.
2023-04-17 22:11:43 +00:00
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods.
2023-04-17 22:11:43 +00:00
type ClientService interface {
// GetEmailMessages get email messages from data store.
2023-04-17 22:11:43 +00:00
GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error)
// GetEmailMessagesContext get email messages from data store.
GetEmailMessagesContext(ctx context.Context, params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error)
// GetOutgoingEmailMessages get email messages from data store.
2023-04-30 02:07:31 +00:00
GetOutgoingEmailMessages(params *GetOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOutgoingEmailMessagesOK, error)
// GetOutgoingEmailMessagesContext get email messages from data store.
GetOutgoingEmailMessagesContext(ctx context.Context, params *GetOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOutgoingEmailMessagesOK, error)
// PostEmailMessages add new email messages to the outgoing queue.
2023-04-30 02:07:31 +00:00
PostEmailMessages(params *PostEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEmailMessagesOK, error)
// PostEmailMessagesContext add new email messages to the outgoing queue.
PostEmailMessagesContext(ctx context.Context, params *PostEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEmailMessagesOK, error)
// PostOutgoingEmailMessages add new email messages to the outgoing queue.
2023-04-17 22:11:43 +00:00
PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error)
// PostOutgoingEmailMessagesContext add new email messages to the outgoing queue.
PostOutgoingEmailMessagesContext(ctx context.Context, params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error)
2023-04-17 22:11:43 +00:00
SetTransport(transport runtime.ContextualTransport)
}
2023-04-17 22:11:43 +00:00
// GetEmailMessages gets email messages from data store.
//
// Retrieves email messages from workflow storage.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetEmailMessagesContext] instead.
2023-04-17 22:11:43 +00:00
func (a *Client) GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetEmailMessagesContext(ctx, params, authInfo, opts...)
}
// GetEmailMessagesContext gets email messages from data store.
//
// Retrieves email messages from workflow storage.
//
// Do not use the deprecated [GetEmailMessagesParams.Context] with this method: it would be ignored.
func (a *Client) GetEmailMessagesContext(ctx context.Context, params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error) {
// NOTE: parameters are not validated before sending
2023-04-17 22:11:43 +00:00
if params == nil {
params = NewGetEmailMessagesParams()
}
2023-04-17 22:11:43 +00:00
op := &runtime.ClientOperation{
ID: "getEmailMessages",
Method: "GET",
2023-04-30 02:07:31 +00:00
PathPattern: "/emailmessages",
2023-04-17 22:11:43 +00:00
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2023-04-17 22:11:43 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2023-04-17 22:11:43 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2023-04-17 22:11:43 +00:00
success, ok := result.(*GetEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
2023-04-17 22:11:43 +00:00
msg := fmt.Sprintf("unexpected success response for getEmailMessages: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// GetOutgoingEmailMessages gets email messages from data store.
//
// Retrieves email messages from workflow storage.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetOutgoingEmailMessagesContext] instead.
2023-04-30 02:07:31 +00:00
func (a *Client) GetOutgoingEmailMessages(params *GetOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOutgoingEmailMessagesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.GetOutgoingEmailMessagesContext(ctx, params, authInfo, opts...)
}
// GetOutgoingEmailMessagesContext gets email messages from data store.
//
// Retrieves email messages from workflow storage.
//
// Do not use the deprecated [GetOutgoingEmailMessagesParams.Context] with this method: it would be ignored.
func (a *Client) GetOutgoingEmailMessagesContext(ctx context.Context, params *GetOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOutgoingEmailMessagesOK, error) {
// NOTE: parameters are not validated before sending
2023-04-30 02:07:31 +00:00
if params == nil {
params = NewGetOutgoingEmailMessagesParams()
}
2023-04-30 02:07:31 +00:00
op := &runtime.ClientOperation{
ID: "getOutgoingEmailMessages",
Method: "GET",
PathPattern: "/outgoingemailmessages",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetOutgoingEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2023-04-30 02:07:31 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2023-04-30 02:07:31 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2023-04-30 02:07:31 +00:00
success, ok := result.(*GetOutgoingEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
2023-04-30 02:07:31 +00:00
msg := fmt.Sprintf("unexpected success response for getOutgoingEmailMessages: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostEmailMessages adds new email messages to the outgoing queue.
//
// Insert new email messages into workflow storage.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostEmailMessagesContext] instead.
2023-04-30 02:07:31 +00:00
func (a *Client) PostEmailMessages(params *PostEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEmailMessagesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostEmailMessagesContext(ctx, params, authInfo, opts...)
}
// PostEmailMessagesContext adds new email messages to the outgoing queue.
//
// Insert new email messages into workflow storage.
//
// Do not use the deprecated [PostEmailMessagesParams.Context] with this method: it would be ignored.
func (a *Client) PostEmailMessagesContext(ctx context.Context, params *PostEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostEmailMessagesOK, error) {
// NOTE: parameters are not validated before sending
2023-04-30 02:07:31 +00:00
if params == nil {
params = NewPostEmailMessagesParams()
}
2023-04-30 02:07:31 +00:00
op := &runtime.ClientOperation{
ID: "postEmailMessages",
Method: "POST",
PathPattern: "/emailmessages",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2023-04-30 02:07:31 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2023-04-30 02:07:31 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2023-04-30 02:07:31 +00:00
success, ok := result.(*PostEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
2023-04-30 02:07:31 +00:00
msg := fmt.Sprintf("unexpected success response for postEmailMessages: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// PostOutgoingEmailMessages adds new email messages to the outgoing queue.
//
// Insert new email messages into workflow storage.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PostOutgoingEmailMessagesContext] instead.
2023-04-17 22:11:43 +00:00
func (a *Client) PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error) {
var ctx context.Context
if params.inner.ctx != nil {
ctx = params.inner.ctx
} else {
ctx = context.Background()
}
return a.PostOutgoingEmailMessagesContext(ctx, params, authInfo, opts...)
}
// PostOutgoingEmailMessagesContext adds new email messages to the outgoing queue.
//
// Insert new email messages into workflow storage.
//
// Do not use the deprecated [PostOutgoingEmailMessagesParams.Context] with this method: it would be ignored.
func (a *Client) PostOutgoingEmailMessagesContext(ctx context.Context, params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error) {
// NOTE: parameters are not validated before sending
2023-04-17 22:11:43 +00:00
if params == nil {
params = NewPostOutgoingEmailMessagesParams()
}
2023-04-17 22:11:43 +00:00
op := &runtime.ClientOperation{
ID: "postOutgoingEmailMessages",
Method: "POST",
2023-04-30 02:07:31 +00:00
PathPattern: "/outgoingemailmessages",
2023-04-17 22:11:43 +00:00
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostOutgoingEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Client: params.HTTPClient,
}
2023-04-17 22:11:43 +00:00
for _, opt := range opts {
opt(op)
}
result, err := a.transport.SubmitContext(ctx, op)
2023-04-17 22:11:43 +00:00
if err != nil {
return nil, err
}
// only one success response has to be checked
2023-04-17 22:11:43 +00:00
success, ok := result.(*PostOutgoingEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response.
// no default response is defined.
//
// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
2023-04-17 22:11:43 +00:00
msg := fmt.Sprintf("unexpected success response for postOutgoingEmailMessages: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
2023-04-17 22:11:43 +00:00
a.transport = transport
}
// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
timeout time.Duration
// Deprecated: use the operation call with context to pass the context instead of [EmailsParams].
ctx context.Context
}