email

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 20 Imported by: 0

README

Go API client for email

Saviynt Email API

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import email "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value email.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), email.ContextServerIndex, 1)
Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value email.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), email.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using email.ContextOperationServerIndices and email.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), email.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), email.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:3000

Class Method HTTP request Description
EmailAPI SendEmail Post /ECM/api/v5/sendEmail Send Email

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

https://github.com/saviynt

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`)
	XmlCheck  = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`)
)
View Source
var (
	// ContextServerIndex uses a server configuration from the index.
	ContextServerIndex = contextKey("serverIndex")

	// ContextOperationServerIndices uses a server configuration from the index mapping.
	ContextOperationServerIndices = contextKey("serverOperationIndices")

	// ContextServerVariables overrides a server configuration variables.
	ContextServerVariables = contextKey("serverVariables")

	// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
	ContextOperationServerVariables = contextKey("serverOperationVariables")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

func IsNil

func IsNil(i interface{}) bool

IsNil checks if an input is nil

func PtrBool

func PtrBool(v bool) *bool

PtrBool is a helper routine that returns a pointer to given boolean value.

func PtrFloat32

func PtrFloat32(v float32) *float32

PtrFloat32 is a helper routine that returns a pointer to given float value.

func PtrFloat64

func PtrFloat64(v float64) *float64

PtrFloat64 is a helper routine that returns a pointer to given float value.

func PtrInt

func PtrInt(v int) *int

PtrInt is a helper routine that returns a pointer to given integer value.

func PtrInt32

func PtrInt32(v int32) *int32

PtrInt32 is a helper routine that returns a pointer to given integer value.

func PtrInt64

func PtrInt64(v int64) *int64

PtrInt64 is a helper routine that returns a pointer to given integer value.

func PtrString

func PtrString(v string) *string

PtrString is a helper routine that returns a pointer to given string value.

func PtrTime

func PtrTime(v time.Time) *time.Time

PtrTime is helper routine that returns a pointer to given Time value.

Types

type APIClient

type APIClient struct {
	EmailAPI *EmailAPIService
	// contains filtered or unexported fields
}

APIClient manages communication with the Saviynt Email API API v1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResponse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type ApiSendEmailRequest

type ApiSendEmailRequest struct {
	ApiService *EmailAPIService
	// contains filtered or unexported fields
}

func (ApiSendEmailRequest) Execute

func (ApiSendEmailRequest) SendEmailRequest

func (r ApiSendEmailRequest) SendEmailRequest(sendEmailRequest SendEmailRequest) ApiSendEmailRequest

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	Host             string            `json:"host,omitempty"`
	Scheme           string            `json:"scheme,omitempty"`
	DefaultHeader    map[string]string `json:"defaultHeader,omitempty"`
	UserAgent        string            `json:"userAgent,omitempty"`
	Debug            bool              `json:"debug,omitempty"`
	Servers          ServerConfigurations
	OperationServers map[string]ServerConfigurations
	HTTPClient       *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerURL

func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error)

ServerURL returns URL based on server settings

func (*Configuration) ServerURLWithContext

func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error)

ServerURLWithContext returns a new server URL given an endpoint

type EmailAPIService

type EmailAPIService service

EmailAPIService EmailAPI service

func (*EmailAPIService) SendEmail

SendEmail Send Email

This API can be used send an email from Saviynt.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiSendEmailRequest

func (*EmailAPIService) SendEmailExecute

Execute executes the request

@return SendEmailResponse

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type MappedNullable

type MappedNullable interface {
	ToMap() (map[string]interface{}, error)
}

type NullableBool

type NullableBool struct {
	// contains filtered or unexported fields
}

func NewNullableBool

func NewNullableBool(val *bool) *NullableBool

func (NullableBool) Get

func (v NullableBool) Get() *bool

func (NullableBool) IsSet

func (v NullableBool) IsSet() bool

func (NullableBool) MarshalJSON

func (v NullableBool) MarshalJSON() ([]byte, error)

func (*NullableBool) Set

func (v *NullableBool) Set(val *bool)

func (*NullableBool) UnmarshalJSON

func (v *NullableBool) UnmarshalJSON(src []byte) error

func (*NullableBool) Unset

func (v *NullableBool) Unset()

type NullableFloat32

type NullableFloat32 struct {
	// contains filtered or unexported fields
}

func NewNullableFloat32

func NewNullableFloat32(val *float32) *NullableFloat32

func (NullableFloat32) Get

func (v NullableFloat32) Get() *float32

func (NullableFloat32) IsSet

func (v NullableFloat32) IsSet() bool

func (NullableFloat32) MarshalJSON

func (v NullableFloat32) MarshalJSON() ([]byte, error)

func (*NullableFloat32) Set

func (v *NullableFloat32) Set(val *float32)

func (*NullableFloat32) UnmarshalJSON

func (v *NullableFloat32) UnmarshalJSON(src []byte) error

func (*NullableFloat32) Unset

func (v *NullableFloat32) Unset()

type NullableFloat64

type NullableFloat64 struct {
	// contains filtered or unexported fields
}

func NewNullableFloat64

func NewNullableFloat64(val *float64) *NullableFloat64

func (NullableFloat64) Get

func (v NullableFloat64) Get() *float64

func (NullableFloat64) IsSet

func (v NullableFloat64) IsSet() bool

func (NullableFloat64) MarshalJSON

func (v NullableFloat64) MarshalJSON() ([]byte, error)

func (*NullableFloat64) Set

func (v *NullableFloat64) Set(val *float64)

func (*NullableFloat64) UnmarshalJSON

func (v *NullableFloat64) UnmarshalJSON(src []byte) error

func (*NullableFloat64) Unset

func (v *NullableFloat64) Unset()

type NullableInt

type NullableInt struct {
	// contains filtered or unexported fields
}

func NewNullableInt

func NewNullableInt(val *int) *NullableInt

func (NullableInt) Get

func (v NullableInt) Get() *int

func (NullableInt) IsSet

func (v NullableInt) IsSet() bool

func (NullableInt) MarshalJSON

func (v NullableInt) MarshalJSON() ([]byte, error)

func (*NullableInt) Set

func (v *NullableInt) Set(val *int)

func (*NullableInt) UnmarshalJSON

func (v *NullableInt) UnmarshalJSON(src []byte) error

func (*NullableInt) Unset

func (v *NullableInt) Unset()

type NullableInt32

type NullableInt32 struct {
	// contains filtered or unexported fields
}

func NewNullableInt32

func NewNullableInt32(val *int32) *NullableInt32

func (NullableInt32) Get

func (v NullableInt32) Get() *int32

func (NullableInt32) IsSet

func (v NullableInt32) IsSet() bool

func (NullableInt32) MarshalJSON

func (v NullableInt32) MarshalJSON() ([]byte, error)

func (*NullableInt32) Set

func (v *NullableInt32) Set(val *int32)

func (*NullableInt32) UnmarshalJSON

func (v *NullableInt32) UnmarshalJSON(src []byte) error

func (*NullableInt32) Unset

func (v *NullableInt32) Unset()

type NullableInt64

type NullableInt64 struct {
	// contains filtered or unexported fields
}

func NewNullableInt64

func NewNullableInt64(val *int64) *NullableInt64

func (NullableInt64) Get

func (v NullableInt64) Get() *int64

func (NullableInt64) IsSet

func (v NullableInt64) IsSet() bool

func (NullableInt64) MarshalJSON

func (v NullableInt64) MarshalJSON() ([]byte, error)

func (*NullableInt64) Set

func (v *NullableInt64) Set(val *int64)

func (*NullableInt64) UnmarshalJSON

func (v *NullableInt64) UnmarshalJSON(src []byte) error

func (*NullableInt64) Unset

func (v *NullableInt64) Unset()

type NullableSendEmailRequest

type NullableSendEmailRequest struct {
	// contains filtered or unexported fields
}

func NewNullableSendEmailRequest

func NewNullableSendEmailRequest(val *SendEmailRequest) *NullableSendEmailRequest

func (NullableSendEmailRequest) Get

func (NullableSendEmailRequest) IsSet

func (v NullableSendEmailRequest) IsSet() bool

func (NullableSendEmailRequest) MarshalJSON

func (v NullableSendEmailRequest) MarshalJSON() ([]byte, error)

func (*NullableSendEmailRequest) Set

func (*NullableSendEmailRequest) UnmarshalJSON

func (v *NullableSendEmailRequest) UnmarshalJSON(src []byte) error

func (*NullableSendEmailRequest) Unset

func (v *NullableSendEmailRequest) Unset()

type NullableSendEmailResponse

type NullableSendEmailResponse struct {
	// contains filtered or unexported fields
}

func NewNullableSendEmailResponse

func NewNullableSendEmailResponse(val *SendEmailResponse) *NullableSendEmailResponse

func (NullableSendEmailResponse) Get

func (NullableSendEmailResponse) IsSet

func (v NullableSendEmailResponse) IsSet() bool

func (NullableSendEmailResponse) MarshalJSON

func (v NullableSendEmailResponse) MarshalJSON() ([]byte, error)

func (*NullableSendEmailResponse) Set

func (*NullableSendEmailResponse) UnmarshalJSON

func (v *NullableSendEmailResponse) UnmarshalJSON(src []byte) error

func (*NullableSendEmailResponse) Unset

func (v *NullableSendEmailResponse) Unset()

type NullableString

type NullableString struct {
	// contains filtered or unexported fields
}

func NewNullableString

func NewNullableString(val *string) *NullableString

func (NullableString) Get

func (v NullableString) Get() *string

func (NullableString) IsSet

func (v NullableString) IsSet() bool

func (NullableString) MarshalJSON

func (v NullableString) MarshalJSON() ([]byte, error)

func (*NullableString) Set

func (v *NullableString) Set(val *string)

func (*NullableString) UnmarshalJSON

func (v *NullableString) UnmarshalJSON(src []byte) error

func (*NullableString) Unset

func (v *NullableString) Unset()

type NullableTime

type NullableTime struct {
	// contains filtered or unexported fields
}

func NewNullableTime

func NewNullableTime(val *time.Time) *NullableTime

func (NullableTime) Get

func (v NullableTime) Get() *time.Time

func (NullableTime) IsSet

func (v NullableTime) IsSet() bool

func (NullableTime) MarshalJSON

func (v NullableTime) MarshalJSON() ([]byte, error)

func (*NullableTime) Set

func (v *NullableTime) Set(val *time.Time)

func (*NullableTime) UnmarshalJSON

func (v *NullableTime) UnmarshalJSON(src []byte) error

func (*NullableTime) Unset

func (v *NullableTime) Unset()

type SendEmailRequest

type SendEmailRequest struct {
	To      string  `json:"to"`
	From    string  `json:"from"`
	Subject string  `json:"subject"`
	Body    string  `json:"body"`
	Cc      *string `json:"cc,omitempty"`
	Bcc     *string `json:"bcc,omitempty"`
}

SendEmailRequest struct for SendEmailRequest

func NewSendEmailRequest

func NewSendEmailRequest(to string, from string, subject string, body string) *SendEmailRequest

NewSendEmailRequest instantiates a new SendEmailRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewSendEmailRequestWithDefaults

func NewSendEmailRequestWithDefaults() *SendEmailRequest

NewSendEmailRequestWithDefaults instantiates a new SendEmailRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*SendEmailRequest) GetBcc

func (o *SendEmailRequest) GetBcc() string

GetBcc returns the Bcc field value if set, zero value otherwise.

func (*SendEmailRequest) GetBccOk

func (o *SendEmailRequest) GetBccOk() (*string, bool)

GetBccOk returns a tuple with the Bcc field value if set, nil otherwise and a boolean to check if the value has been set.

func (*SendEmailRequest) GetBody

func (o *SendEmailRequest) GetBody() string

GetBody returns the Body field value

func (*SendEmailRequest) GetBodyOk

func (o *SendEmailRequest) GetBodyOk() (*string, bool)

GetBodyOk returns a tuple with the Body field value and a boolean to check if the value has been set.

func (*SendEmailRequest) GetCc

func (o *SendEmailRequest) GetCc() string

GetCc returns the Cc field value if set, zero value otherwise.

func (*SendEmailRequest) GetCcOk

func (o *SendEmailRequest) GetCcOk() (*string, bool)

GetCcOk returns a tuple with the Cc field value if set, nil otherwise and a boolean to check if the value has been set.

func (*SendEmailRequest) GetFrom

func (o *SendEmailRequest) GetFrom() string

GetFrom returns the From field value

func (*SendEmailRequest) GetFromOk

func (o *SendEmailRequest) GetFromOk() (*string, bool)

GetFromOk returns a tuple with the From field value and a boolean to check if the value has been set.

func (*SendEmailRequest) GetSubject

func (o *SendEmailRequest) GetSubject() string

GetSubject returns the Subject field value

func (*SendEmailRequest) GetSubjectOk

func (o *SendEmailRequest) GetSubjectOk() (*string, bool)

GetSubjectOk returns a tuple with the Subject field value and a boolean to check if the value has been set.

func (*SendEmailRequest) GetTo

func (o *SendEmailRequest) GetTo() string

GetTo returns the To field value

func (*SendEmailRequest) GetToOk

func (o *SendEmailRequest) GetToOk() (*string, bool)

GetToOk returns a tuple with the To field value and a boolean to check if the value has been set.

func (*SendEmailRequest) HasBcc

func (o *SendEmailRequest) HasBcc() bool

HasBcc returns a boolean if a field has been set.

func (*SendEmailRequest) HasCc

func (o *SendEmailRequest) HasCc() bool

HasCc returns a boolean if a field has been set.

func (SendEmailRequest) MarshalJSON

func (o SendEmailRequest) MarshalJSON() ([]byte, error)

func (*SendEmailRequest) SetBcc

func (o *SendEmailRequest) SetBcc(v string)

SetBcc gets a reference to the given string and assigns it to the Bcc field.

func (*SendEmailRequest) SetBody

func (o *SendEmailRequest) SetBody(v string)

SetBody sets field value

func (*SendEmailRequest) SetCc

func (o *SendEmailRequest) SetCc(v string)

SetCc gets a reference to the given string and assigns it to the Cc field.

func (*SendEmailRequest) SetFrom

func (o *SendEmailRequest) SetFrom(v string)

SetFrom sets field value

func (*SendEmailRequest) SetSubject

func (o *SendEmailRequest) SetSubject(v string)

SetSubject sets field value

func (*SendEmailRequest) SetTo

func (o *SendEmailRequest) SetTo(v string)

SetTo sets field value

func (SendEmailRequest) ToMap

func (o SendEmailRequest) ToMap() (map[string]interface{}, error)

func (*SendEmailRequest) UnmarshalJSON

func (o *SendEmailRequest) UnmarshalJSON(data []byte) (err error)

type SendEmailResponse

type SendEmailResponse struct {
	// `\"0\"` indicates success. Other values indicate failure.
	ErrorCode string `json:"errorCode"`
	Msg       string `json:"msg"`
}

SendEmailResponse struct for SendEmailResponse

func NewSendEmailResponse

func NewSendEmailResponse(errorCode string, msg string) *SendEmailResponse

NewSendEmailResponse instantiates a new SendEmailResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewSendEmailResponseWithDefaults

func NewSendEmailResponseWithDefaults() *SendEmailResponse

NewSendEmailResponseWithDefaults instantiates a new SendEmailResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*SendEmailResponse) GetErrorCode

func (o *SendEmailResponse) GetErrorCode() string

GetErrorCode returns the ErrorCode field value

func (*SendEmailResponse) GetErrorCodeOk

func (o *SendEmailResponse) GetErrorCodeOk() (*string, bool)

GetErrorCodeOk returns a tuple with the ErrorCode field value and a boolean to check if the value has been set.

func (*SendEmailResponse) GetMsg

func (o *SendEmailResponse) GetMsg() string

GetMsg returns the Msg field value

func (*SendEmailResponse) GetMsgOk

func (o *SendEmailResponse) GetMsgOk() (*string, bool)

GetMsgOk returns a tuple with the Msg field value and a boolean to check if the value has been set.

func (SendEmailResponse) MarshalJSON

func (o SendEmailResponse) MarshalJSON() ([]byte, error)

func (*SendEmailResponse) SetErrorCode

func (o *SendEmailResponse) SetErrorCode(v string)

SetErrorCode sets field value

func (*SendEmailResponse) SetMsg

func (o *SendEmailResponse) SetMsg(v string)

SetMsg sets field value

func (SendEmailResponse) ToMap

func (o SendEmailResponse) ToMap() (map[string]interface{}, error)

func (*SendEmailResponse) UnmarshalJSON

func (o *SendEmailResponse) UnmarshalJSON(data []byte) (err error)

type ServerConfiguration

type ServerConfiguration struct {
	URL         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerConfigurations

type ServerConfigurations []ServerConfiguration

ServerConfigurations stores multiple ServerConfiguration items

func (ServerConfigurations) URL

func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error)

URL formats template on a index using given variables

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL