new global funcs, email endponts

v0.4.8 v0.4.8
Vernon Keenan 2023-04-17 22:11:43 +00:00
parent 225db2d70e
commit f9df7a0644
17 changed files with 3138 additions and 1 deletions

View File

@ -0,0 +1,129 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new emails API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for emails API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error)
PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetEmailMessages gets email messages from data store
Retrieves email messages from workflow storage
*/
func (a *Client) GetEmailMessages(params *GetEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetEmailMessagesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetEmailMessagesParams()
}
op := &runtime.ClientOperation{
ID: "getEmailMessages",
Method: "GET",
PathPattern: "/emails",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
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)
}
/*
PostOutgoingEmailMessages adds new email messages to the outgoing queue
Insert new email messages into workflow storage
*/
func (a *Client) PostOutgoingEmailMessages(params *PostOutgoingEmailMessagesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostOutgoingEmailMessagesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostOutgoingEmailMessagesParams()
}
op := &runtime.ClientOperation{
ID: "postOutgoingEmailMessages",
Method: "POST",
PathPattern: "/emails",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostOutgoingEmailMessagesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PostOutgoingEmailMessagesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
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.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,240 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetEmailMessagesParams creates a new GetEmailMessagesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetEmailMessagesParams() *GetEmailMessagesParams {
return &GetEmailMessagesParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetEmailMessagesParamsWithTimeout creates a new GetEmailMessagesParams object
// with the ability to set a timeout on a request.
func NewGetEmailMessagesParamsWithTimeout(timeout time.Duration) *GetEmailMessagesParams {
return &GetEmailMessagesParams{
timeout: timeout,
}
}
// NewGetEmailMessagesParamsWithContext creates a new GetEmailMessagesParams object
// with the ability to set a context for a request.
func NewGetEmailMessagesParamsWithContext(ctx context.Context) *GetEmailMessagesParams {
return &GetEmailMessagesParams{
Context: ctx,
}
}
// NewGetEmailMessagesParamsWithHTTPClient creates a new GetEmailMessagesParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetEmailMessagesParamsWithHTTPClient(client *http.Client) *GetEmailMessagesParams {
return &GetEmailMessagesParams{
HTTPClient: client,
}
}
/*
GetEmailMessagesParams contains all the parameters to send to the API endpoint
for the get email messages operation.
Typically these are written to a http.Request.
*/
type GetEmailMessagesParams struct {
/* EmailMessageID.
Email Message ID
*/
EmailMessageID *string
/* Limit.
How many objects to return at one time
Format: int64
*/
Limit *int64
/* Offset.
How many objects to skip?
Format: int64
*/
Offset *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetEmailMessagesParams) WithDefaults() *GetEmailMessagesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetEmailMessagesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get email messages params
func (o *GetEmailMessagesParams) WithTimeout(timeout time.Duration) *GetEmailMessagesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get email messages params
func (o *GetEmailMessagesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get email messages params
func (o *GetEmailMessagesParams) WithContext(ctx context.Context) *GetEmailMessagesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get email messages params
func (o *GetEmailMessagesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get email messages params
func (o *GetEmailMessagesParams) WithHTTPClient(client *http.Client) *GetEmailMessagesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get email messages params
func (o *GetEmailMessagesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEmailMessageID adds the emailMessageID to the get email messages params
func (o *GetEmailMessagesParams) WithEmailMessageID(emailMessageID *string) *GetEmailMessagesParams {
o.SetEmailMessageID(emailMessageID)
return o
}
// SetEmailMessageID adds the emailMessageId to the get email messages params
func (o *GetEmailMessagesParams) SetEmailMessageID(emailMessageID *string) {
o.EmailMessageID = emailMessageID
}
// WithLimit adds the limit to the get email messages params
func (o *GetEmailMessagesParams) WithLimit(limit *int64) *GetEmailMessagesParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the get email messages params
func (o *GetEmailMessagesParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithOffset adds the offset to the get email messages params
func (o *GetEmailMessagesParams) WithOffset(offset *int64) *GetEmailMessagesParams {
o.SetOffset(offset)
return o
}
// SetOffset adds the offset to the get email messages params
func (o *GetEmailMessagesParams) SetOffset(offset *int64) {
o.Offset = offset
}
// WriteToRequest writes these params to a swagger request
func (o *GetEmailMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.EmailMessageID != nil {
// query param emailMessageId
var qrEmailMessageID string
if o.EmailMessageID != nil {
qrEmailMessageID = *o.EmailMessageID
}
qEmailMessageID := qrEmailMessageID
if qEmailMessageID != "" {
if err := r.SetQueryParam("emailMessageId", qEmailMessageID); err != nil {
return err
}
}
}
if o.Limit != nil {
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
}
}
if o.Offset != nil {
// query param offset
var qrOffset int64
if o.Offset != nil {
qrOffset = *o.Offset
}
qOffset := swag.FormatInt64(qrOffset)
if qOffset != "" {
if err := r.SetQueryParam("offset", qOffset); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,513 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// GetEmailMessagesReader is a Reader for the GetEmailMessages structure.
type GetEmailMessagesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetEmailMessagesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetEmailMessagesUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetEmailMessagesForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetEmailMessagesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetEmailMessagesUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetEmailMessagesInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetEmailMessagesOK creates a GetEmailMessagesOK with default headers values
func NewGetEmailMessagesOK() *GetEmailMessagesOK {
return &GetEmailMessagesOK{}
}
/*
GetEmailMessagesOK describes a response with status code 200, with default header values.
Array of Email Messages
*/
type GetEmailMessagesOK struct {
AccessControlAllowOrigin string
Payload *members_models.EmailMessagesResponse
}
// IsSuccess returns true when this get email messages o k response has a 2xx status code
func (o *GetEmailMessagesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get email messages o k response has a 3xx status code
func (o *GetEmailMessagesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages o k response has a 4xx status code
func (o *GetEmailMessagesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get email messages o k response has a 5xx status code
func (o *GetEmailMessagesOK) IsServerError() bool {
return false
}
// IsCode returns true when this get email messages o k response a status code equal to that given
func (o *GetEmailMessagesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get email messages o k response
func (o *GetEmailMessagesOK) Code() int {
return 200
}
func (o *GetEmailMessagesOK) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesOK %+v", 200, o.Payload)
}
func (o *GetEmailMessagesOK) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesOK %+v", 200, o.Payload)
}
func (o *GetEmailMessagesOK) GetPayload() *members_models.EmailMessagesResponse {
return o.Payload
}
func (o *GetEmailMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.EmailMessagesResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetEmailMessagesUnauthorized creates a GetEmailMessagesUnauthorized with default headers values
func NewGetEmailMessagesUnauthorized() *GetEmailMessagesUnauthorized {
return &GetEmailMessagesUnauthorized{}
}
/*
GetEmailMessagesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetEmailMessagesUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get email messages unauthorized response has a 2xx status code
func (o *GetEmailMessagesUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get email messages unauthorized response has a 3xx status code
func (o *GetEmailMessagesUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages unauthorized response has a 4xx status code
func (o *GetEmailMessagesUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get email messages unauthorized response has a 5xx status code
func (o *GetEmailMessagesUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get email messages unauthorized response a status code equal to that given
func (o *GetEmailMessagesUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get email messages unauthorized response
func (o *GetEmailMessagesUnauthorized) Code() int {
return 401
}
func (o *GetEmailMessagesUnauthorized) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesUnauthorized %+v", 401, o.Payload)
}
func (o *GetEmailMessagesUnauthorized) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesUnauthorized %+v", 401, o.Payload)
}
func (o *GetEmailMessagesUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetEmailMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetEmailMessagesForbidden creates a GetEmailMessagesForbidden with default headers values
func NewGetEmailMessagesForbidden() *GetEmailMessagesForbidden {
return &GetEmailMessagesForbidden{}
}
/*
GetEmailMessagesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetEmailMessagesForbidden struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this get email messages forbidden response has a 2xx status code
func (o *GetEmailMessagesForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get email messages forbidden response has a 3xx status code
func (o *GetEmailMessagesForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages forbidden response has a 4xx status code
func (o *GetEmailMessagesForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this get email messages forbidden response has a 5xx status code
func (o *GetEmailMessagesForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this get email messages forbidden response a status code equal to that given
func (o *GetEmailMessagesForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the get email messages forbidden response
func (o *GetEmailMessagesForbidden) Code() int {
return 403
}
func (o *GetEmailMessagesForbidden) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesForbidden %+v", 403, o.Payload)
}
func (o *GetEmailMessagesForbidden) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesForbidden %+v", 403, o.Payload)
}
func (o *GetEmailMessagesForbidden) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetEmailMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetEmailMessagesNotFound creates a GetEmailMessagesNotFound with default headers values
func NewGetEmailMessagesNotFound() *GetEmailMessagesNotFound {
return &GetEmailMessagesNotFound{}
}
/*
GetEmailMessagesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetEmailMessagesNotFound struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this get email messages not found response has a 2xx status code
func (o *GetEmailMessagesNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get email messages not found response has a 3xx status code
func (o *GetEmailMessagesNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages not found response has a 4xx status code
func (o *GetEmailMessagesNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get email messages not found response has a 5xx status code
func (o *GetEmailMessagesNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get email messages not found response a status code equal to that given
func (o *GetEmailMessagesNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get email messages not found response
func (o *GetEmailMessagesNotFound) Code() int {
return 404
}
func (o *GetEmailMessagesNotFound) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesNotFound %+v", 404, o.Payload)
}
func (o *GetEmailMessagesNotFound) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesNotFound %+v", 404, o.Payload)
}
func (o *GetEmailMessagesNotFound) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetEmailMessagesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetEmailMessagesUnprocessableEntity creates a GetEmailMessagesUnprocessableEntity with default headers values
func NewGetEmailMessagesUnprocessableEntity() *GetEmailMessagesUnprocessableEntity {
return &GetEmailMessagesUnprocessableEntity{}
}
/*
GetEmailMessagesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetEmailMessagesUnprocessableEntity struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get email messages unprocessable entity response has a 2xx status code
func (o *GetEmailMessagesUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get email messages unprocessable entity response has a 3xx status code
func (o *GetEmailMessagesUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages unprocessable entity response has a 4xx status code
func (o *GetEmailMessagesUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this get email messages unprocessable entity response has a 5xx status code
func (o *GetEmailMessagesUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this get email messages unprocessable entity response a status code equal to that given
func (o *GetEmailMessagesUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the get email messages unprocessable entity response
func (o *GetEmailMessagesUnprocessableEntity) Code() int {
return 422
}
func (o *GetEmailMessagesUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetEmailMessagesUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetEmailMessagesUnprocessableEntity) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetEmailMessagesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetEmailMessagesInternalServerError creates a GetEmailMessagesInternalServerError with default headers values
func NewGetEmailMessagesInternalServerError() *GetEmailMessagesInternalServerError {
return &GetEmailMessagesInternalServerError{}
}
/*
GetEmailMessagesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetEmailMessagesInternalServerError struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this get email messages internal server error response has a 2xx status code
func (o *GetEmailMessagesInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get email messages internal server error response has a 3xx status code
func (o *GetEmailMessagesInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this get email messages internal server error response has a 4xx status code
func (o *GetEmailMessagesInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this get email messages internal server error response has a 5xx status code
func (o *GetEmailMessagesInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this get email messages internal server error response a status code equal to that given
func (o *GetEmailMessagesInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the get email messages internal server error response
func (o *GetEmailMessagesInternalServerError) Code() int {
return 500
}
func (o *GetEmailMessagesInternalServerError) Error() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesInternalServerError %+v", 500, o.Payload)
}
func (o *GetEmailMessagesInternalServerError) String() string {
return fmt.Sprintf("[GET /emails][%d] getEmailMessagesInternalServerError %+v", 500, o.Payload)
}
func (o *GetEmailMessagesInternalServerError) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetEmailMessagesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,157 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// NewPostOutgoingEmailMessagesParams creates a new PostOutgoingEmailMessagesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostOutgoingEmailMessagesParams() *PostOutgoingEmailMessagesParams {
return &PostOutgoingEmailMessagesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostOutgoingEmailMessagesParamsWithTimeout creates a new PostOutgoingEmailMessagesParams object
// with the ability to set a timeout on a request.
func NewPostOutgoingEmailMessagesParamsWithTimeout(timeout time.Duration) *PostOutgoingEmailMessagesParams {
return &PostOutgoingEmailMessagesParams{
timeout: timeout,
}
}
// NewPostOutgoingEmailMessagesParamsWithContext creates a new PostOutgoingEmailMessagesParams object
// with the ability to set a context for a request.
func NewPostOutgoingEmailMessagesParamsWithContext(ctx context.Context) *PostOutgoingEmailMessagesParams {
return &PostOutgoingEmailMessagesParams{
Context: ctx,
}
}
// NewPostOutgoingEmailMessagesParamsWithHTTPClient creates a new PostOutgoingEmailMessagesParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostOutgoingEmailMessagesParamsWithHTTPClient(client *http.Client) *PostOutgoingEmailMessagesParams {
return &PostOutgoingEmailMessagesParams{
HTTPClient: client,
}
}
/*
PostOutgoingEmailMessagesParams contains all the parameters to send to the API endpoint
for the post outgoing email messages operation.
Typically these are written to a http.Request.
*/
type PostOutgoingEmailMessagesParams struct {
/* OutgoingEmailMessageRequest.
An array of new Outgoing Email Message records
*/
OutgoingEmailMessageRequest *members_models.OutgoingEmailMessageRequest
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post outgoing email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostOutgoingEmailMessagesParams) WithDefaults() *PostOutgoingEmailMessagesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post outgoing email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostOutgoingEmailMessagesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) WithTimeout(timeout time.Duration) *PostOutgoingEmailMessagesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) WithContext(ctx context.Context) *PostOutgoingEmailMessagesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) WithHTTPClient(client *http.Client) *PostOutgoingEmailMessagesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOutgoingEmailMessageRequest adds the outgoingEmailMessageRequest to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) WithOutgoingEmailMessageRequest(outgoingEmailMessageRequest *members_models.OutgoingEmailMessageRequest) *PostOutgoingEmailMessagesParams {
o.SetOutgoingEmailMessageRequest(outgoingEmailMessageRequest)
return o
}
// SetOutgoingEmailMessageRequest adds the outgoingEmailMessageRequest to the post outgoing email messages params
func (o *PostOutgoingEmailMessagesParams) SetOutgoingEmailMessageRequest(outgoingEmailMessageRequest *members_models.OutgoingEmailMessageRequest) {
o.OutgoingEmailMessageRequest = outgoingEmailMessageRequest
}
// WriteToRequest writes these params to a swagger request
func (o *PostOutgoingEmailMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.OutgoingEmailMessageRequest != nil {
if err := r.SetBodyParam(o.OutgoingEmailMessageRequest); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,513 @@
// 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
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
)
// PostOutgoingEmailMessagesReader is a Reader for the PostOutgoingEmailMessages structure.
type PostOutgoingEmailMessagesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostOutgoingEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostOutgoingEmailMessagesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPostOutgoingEmailMessagesUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewPostOutgoingEmailMessagesForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewPostOutgoingEmailMessagesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewPostOutgoingEmailMessagesUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPostOutgoingEmailMessagesInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPostOutgoingEmailMessagesOK creates a PostOutgoingEmailMessagesOK with default headers values
func NewPostOutgoingEmailMessagesOK() *PostOutgoingEmailMessagesOK {
return &PostOutgoingEmailMessagesOK{}
}
/*
PostOutgoingEmailMessagesOK describes a response with status code 200, with default header values.
Array of Email Messages
*/
type PostOutgoingEmailMessagesOK struct {
AccessControlAllowOrigin string
Payload *members_models.EmailMessagesResponse
}
// IsSuccess returns true when this post outgoing email messages o k response has a 2xx status code
func (o *PostOutgoingEmailMessagesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post outgoing email messages o k response has a 3xx status code
func (o *PostOutgoingEmailMessagesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages o k response has a 4xx status code
func (o *PostOutgoingEmailMessagesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post outgoing email messages o k response has a 5xx status code
func (o *PostOutgoingEmailMessagesOK) IsServerError() bool {
return false
}
// IsCode returns true when this post outgoing email messages o k response a status code equal to that given
func (o *PostOutgoingEmailMessagesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the post outgoing email messages o k response
func (o *PostOutgoingEmailMessagesOK) Code() int {
return 200
}
func (o *PostOutgoingEmailMessagesOK) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesOK %+v", 200, o.Payload)
}
func (o *PostOutgoingEmailMessagesOK) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesOK %+v", 200, o.Payload)
}
func (o *PostOutgoingEmailMessagesOK) GetPayload() *members_models.EmailMessagesResponse {
return o.Payload
}
func (o *PostOutgoingEmailMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.EmailMessagesResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostOutgoingEmailMessagesUnauthorized creates a PostOutgoingEmailMessagesUnauthorized with default headers values
func NewPostOutgoingEmailMessagesUnauthorized() *PostOutgoingEmailMessagesUnauthorized {
return &PostOutgoingEmailMessagesUnauthorized{}
}
/*
PostOutgoingEmailMessagesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type PostOutgoingEmailMessagesUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this post outgoing email messages unauthorized response has a 2xx status code
func (o *PostOutgoingEmailMessagesUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post outgoing email messages unauthorized response has a 3xx status code
func (o *PostOutgoingEmailMessagesUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages unauthorized response has a 4xx status code
func (o *PostOutgoingEmailMessagesUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this post outgoing email messages unauthorized response has a 5xx status code
func (o *PostOutgoingEmailMessagesUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this post outgoing email messages unauthorized response a status code equal to that given
func (o *PostOutgoingEmailMessagesUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the post outgoing email messages unauthorized response
func (o *PostOutgoingEmailMessagesUnauthorized) Code() int {
return 401
}
func (o *PostOutgoingEmailMessagesUnauthorized) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesUnauthorized %+v", 401, o.Payload)
}
func (o *PostOutgoingEmailMessagesUnauthorized) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesUnauthorized %+v", 401, o.Payload)
}
func (o *PostOutgoingEmailMessagesUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *PostOutgoingEmailMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostOutgoingEmailMessagesForbidden creates a PostOutgoingEmailMessagesForbidden with default headers values
func NewPostOutgoingEmailMessagesForbidden() *PostOutgoingEmailMessagesForbidden {
return &PostOutgoingEmailMessagesForbidden{}
}
/*
PostOutgoingEmailMessagesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type PostOutgoingEmailMessagesForbidden struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this post outgoing email messages forbidden response has a 2xx status code
func (o *PostOutgoingEmailMessagesForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post outgoing email messages forbidden response has a 3xx status code
func (o *PostOutgoingEmailMessagesForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages forbidden response has a 4xx status code
func (o *PostOutgoingEmailMessagesForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this post outgoing email messages forbidden response has a 5xx status code
func (o *PostOutgoingEmailMessagesForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this post outgoing email messages forbidden response a status code equal to that given
func (o *PostOutgoingEmailMessagesForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the post outgoing email messages forbidden response
func (o *PostOutgoingEmailMessagesForbidden) Code() int {
return 403
}
func (o *PostOutgoingEmailMessagesForbidden) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesForbidden %+v", 403, o.Payload)
}
func (o *PostOutgoingEmailMessagesForbidden) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesForbidden %+v", 403, o.Payload)
}
func (o *PostOutgoingEmailMessagesForbidden) GetPayload() *members_models.Error {
return o.Payload
}
func (o *PostOutgoingEmailMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostOutgoingEmailMessagesNotFound creates a PostOutgoingEmailMessagesNotFound with default headers values
func NewPostOutgoingEmailMessagesNotFound() *PostOutgoingEmailMessagesNotFound {
return &PostOutgoingEmailMessagesNotFound{}
}
/*
PostOutgoingEmailMessagesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type PostOutgoingEmailMessagesNotFound struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this post outgoing email messages not found response has a 2xx status code
func (o *PostOutgoingEmailMessagesNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post outgoing email messages not found response has a 3xx status code
func (o *PostOutgoingEmailMessagesNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages not found response has a 4xx status code
func (o *PostOutgoingEmailMessagesNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this post outgoing email messages not found response has a 5xx status code
func (o *PostOutgoingEmailMessagesNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this post outgoing email messages not found response a status code equal to that given
func (o *PostOutgoingEmailMessagesNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the post outgoing email messages not found response
func (o *PostOutgoingEmailMessagesNotFound) Code() int {
return 404
}
func (o *PostOutgoingEmailMessagesNotFound) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesNotFound %+v", 404, o.Payload)
}
func (o *PostOutgoingEmailMessagesNotFound) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesNotFound %+v", 404, o.Payload)
}
func (o *PostOutgoingEmailMessagesNotFound) GetPayload() *members_models.Error {
return o.Payload
}
func (o *PostOutgoingEmailMessagesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostOutgoingEmailMessagesUnprocessableEntity creates a PostOutgoingEmailMessagesUnprocessableEntity with default headers values
func NewPostOutgoingEmailMessagesUnprocessableEntity() *PostOutgoingEmailMessagesUnprocessableEntity {
return &PostOutgoingEmailMessagesUnprocessableEntity{}
}
/*
PostOutgoingEmailMessagesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type PostOutgoingEmailMessagesUnprocessableEntity struct {
Payload *members_models.Error
}
// IsSuccess returns true when this post outgoing email messages unprocessable entity response has a 2xx status code
func (o *PostOutgoingEmailMessagesUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post outgoing email messages unprocessable entity response has a 3xx status code
func (o *PostOutgoingEmailMessagesUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages unprocessable entity response has a 4xx status code
func (o *PostOutgoingEmailMessagesUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this post outgoing email messages unprocessable entity response has a 5xx status code
func (o *PostOutgoingEmailMessagesUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this post outgoing email messages unprocessable entity response a status code equal to that given
func (o *PostOutgoingEmailMessagesUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the post outgoing email messages unprocessable entity response
func (o *PostOutgoingEmailMessagesUnprocessableEntity) Code() int {
return 422
}
func (o *PostOutgoingEmailMessagesUnprocessableEntity) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostOutgoingEmailMessagesUnprocessableEntity) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *PostOutgoingEmailMessagesUnprocessableEntity) GetPayload() *members_models.Error {
return o.Payload
}
func (o *PostOutgoingEmailMessagesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPostOutgoingEmailMessagesInternalServerError creates a PostOutgoingEmailMessagesInternalServerError with default headers values
func NewPostOutgoingEmailMessagesInternalServerError() *PostOutgoingEmailMessagesInternalServerError {
return &PostOutgoingEmailMessagesInternalServerError{}
}
/*
PostOutgoingEmailMessagesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type PostOutgoingEmailMessagesInternalServerError struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this post outgoing email messages internal server error response has a 2xx status code
func (o *PostOutgoingEmailMessagesInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this post outgoing email messages internal server error response has a 3xx status code
func (o *PostOutgoingEmailMessagesInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this post outgoing email messages internal server error response has a 4xx status code
func (o *PostOutgoingEmailMessagesInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this post outgoing email messages internal server error response has a 5xx status code
func (o *PostOutgoingEmailMessagesInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this post outgoing email messages internal server error response a status code equal to that given
func (o *PostOutgoingEmailMessagesInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the post outgoing email messages internal server error response
func (o *PostOutgoingEmailMessagesInternalServerError) Code() int {
return 500
}
func (o *PostOutgoingEmailMessagesInternalServerError) Error() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesInternalServerError %+v", 500, o.Payload)
}
func (o *PostOutgoingEmailMessagesInternalServerError) String() string {
return fmt.Sprintf("[POST /emails][%d] postOutgoingEmailMessagesInternalServerError %+v", 500, o.Payload)
}
func (o *PostOutgoingEmailMessagesInternalServerError) GetPayload() *members_models.Error {
return o.Payload
}
func (o *PostOutgoingEmailMessagesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Access-Control-Allow-Origin
hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")
if hdrAccessControlAllowOrigin != "" {
o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
}
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -21,6 +21,7 @@ import (
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/course_sections"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/courses"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/databases"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/emails"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/enrollments"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/event_categories"
"code.tnxs.net/vernonkeenan/lib/api/members/members_client/event_category_assignments"
@ -91,6 +92,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Members {
cli.CourseSections = course_sections.New(transport, formats)
cli.Courses = courses.New(transport, formats)
cli.Databases = databases.New(transport, formats)
cli.Emails = emails.New(transport, formats)
cli.Enrollments = enrollments.New(transport, formats)
cli.EventCategories = event_categories.New(transport, formats)
cli.EventCategoryAssignments = event_category_assignments.New(transport, formats)
@ -168,6 +170,8 @@ type Members struct {
Databases databases.ClientService
Emails emails.ClientService
Enrollments enrollments.ClientService
EventCategories event_categories.ClientService
@ -219,6 +223,7 @@ func (c *Members) SetTransport(transport runtime.ClientTransport) {
c.CourseSections.SetTransport(transport)
c.Courses.SetTransport(transport)
c.Databases.SetTransport(transport)
c.Emails.SetTransport(transport)
c.Enrollments.SetTransport(transport)
c.EventCategories.SetTransport(transport)
c.EventCategoryAssignments.SetTransport(transport)

View File

@ -0,0 +1,203 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// EmailMessage email message
//
// swagger:model EmailMessage
type EmailMessage struct {
// activity ID
ActivityID *string `json:"ActivityID,omitempty"`
// b c c address
BCCAddress *string `json:"BCCAddress,omitempty"`
// c c address
CCAddress *string `json:"CCAddress,omitempty"`
// created by ID
CreatedByID *string `json:"CreatedByID,omitempty"`
// created date
CreatedDate *string `json:"CreatedDate,omitempty"`
// email message ID
EmailMessageID *string `json:"EmailMessageID,omitempty"`
// from address
FromAddress *string `json:"FromAddress,omitempty"`
// from name
FromName *string `json:"FromName,omitempty"`
// HTML
// Format: byte
HTML *strfmt.Base64 `json:"HTML,omitempty"`
// has attachment
HasAttachment *bool `json:"HasAttachment,omitempty"`
// headers
Headers *Headers `json:"Headers,omitempty"`
// ID
ID string `json:"ID,omitempty"`
// incoming
Incoming *bool `json:"Incoming,omitempty"`
// is client managed
IsClientManaged *bool `json:"IsClientManaged,omitempty"`
// is externally managed
IsExternallyManaged *bool `json:"IsExternallyManaged,omitempty"`
// last modified by ID
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
// last modified date
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
// message date
MessageDate *string `json:"MessageDate,omitempty"`
// message identifier
MessageIdentifier *string `json:"MessageIdentifier,omitempty"`
// parent ID
ParentID *string `json:"ParentID,omitempty"`
// related to ID
RelatedToID *string `json:"RelatedToID,omitempty"`
// relation address
RelationAddress *string `json:"RelationAddress,omitempty"`
// relation ID
RelationID *string `json:"RelationID,omitempty"`
// relation object type
RelationObjectType *string `json:"RelationObjectType,omitempty"`
// relation type
RelationType *string `json:"RelationType,omitempty"`
// reply to email message ID
ReplyToEmailMessageID *string `json:"ReplyToEmailMessageID,omitempty"`
// status
Status *string `json:"Status,omitempty"`
// subject
Subject *string `json:"Subject,omitempty"`
// text
// Format: byte
Text *strfmt.Base64 `json:"Text,omitempty"`
// thread identifier
ThreadIdentifier *string `json:"ThreadIdentifier,omitempty"`
// to address
ToAddress *string `json:"ToAddress,omitempty"`
// validated from address
ValidatedFromAddress *string `json:"ValidatedFromAddress,omitempty"`
}
// Validate validates this email message
func (m *EmailMessage) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateHeaders(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessage) validateHeaders(formats strfmt.Registry) error {
if swag.IsZero(m.Headers) { // not required
return nil
}
if m.Headers != nil {
if err := m.Headers.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Headers")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Headers")
}
return err
}
}
return nil
}
// ContextValidate validate this email message based on the context it is used
func (m *EmailMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateHeaders(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessage) contextValidateHeaders(ctx context.Context, formats strfmt.Registry) error {
if m.Headers != nil {
if err := m.Headers.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Headers")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Headers")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *EmailMessage) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EmailMessage) UnmarshalBinary(b []byte) error {
var res EmailMessage
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,166 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// EmailMessageRequest An array Taxnexus Send Email Message objects
//
// swagger:model EmailMessageRequest
type EmailMessageRequest struct {
// data
Data []*EmailMessage `json:"data"`
// meta
Meta *RequestMeta `json:"meta,omitempty"`
}
// Validate validates this email message request
func (m *EmailMessageRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessageRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *EmailMessageRequest) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// ContextValidate validate this email message request based on the context it is used
func (m *EmailMessageRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMeta(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Data); i++ {
if m.Data[i] != nil {
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *EmailMessageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
if m.Meta != nil {
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *EmailMessageRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EmailMessageRequest) UnmarshalBinary(b []byte) error {
var res EmailMessageRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,166 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// EmailMessagesResponse An array Taxnexus user objects
//
// swagger:model EmailMessagesResponse
type EmailMessagesResponse struct {
// data
Data []*EmailMessage `json:"data"`
// meta
Meta *ResponseMeta `json:"meta,omitempty"`
}
// Validate validates this email messages response
func (m *EmailMessagesResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessagesResponse) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *EmailMessagesResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// ContextValidate validate this email messages response based on the context it is used
func (m *EmailMessagesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMeta(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EmailMessagesResponse) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Data); i++ {
if m.Data[i] != nil {
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *EmailMessagesResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
if m.Meta != nil {
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *EmailMessagesResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EmailMessagesResponse) UnmarshalBinary(b []byte) error {
var res EmailMessagesResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -22,7 +22,7 @@ import (
type Enrollment struct {
// completed
Completed int64 `json:"Completed,omitempty"`
Completed *int64 `json:"Completed,omitempty"`
// course ID
CourseID *string `json:"CourseID,omitempty"`

View File

@ -0,0 +1,57 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Headers headers
//
// swagger:model Headers
type Headers struct {
// key
Key string `json:"Key,omitempty"`
// values
Values [][]string `json:"Values"`
}
// Validate validates this headers
func (m *Headers) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this headers based on context it is used
func (m *Headers) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Headers) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Headers) UnmarshalBinary(b []byte) error {
var res Headers
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,153 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// OutgoingEmailMessage A new email message to be sent
//
// swagger:model OutgoingEmailMessage
type OutgoingEmailMessage struct {
// b c c address
BCCAddress *string `json:"BCCAddress,omitempty"`
// c c address
CCAddress *string `json:"CCAddress,omitempty"`
// email message ID
EmailMessageID *string `json:"EmailMessageID,omitempty"`
// email template ID
EmailTemplateID *string `json:"EmailTemplateID,omitempty"`
// external ID
ExternalID *string `json:"ExternalID,omitempty"`
// from contact ID
FromContactID *string `json:"FromContactID,omitempty"`
// from name
FromName *string `json:"FromName,omitempty"`
// HTML
HTML *string `json:"HTML,omitempty"`
// headers
Headers *Headers `json:"Headers,omitempty"`
// ID
ID string `json:"ID,omitempty"`
// subject
Subject *string `json:"Subject,omitempty"`
// text
Text *string `json:"Text,omitempty"`
// to address
ToAddress *string `json:"ToAddress,omitempty"`
// to name
ToName *string `json:"ToName,omitempty"`
// validated from address
ValidatedFromAddress *string `json:"ValidatedFromAddress,omitempty"`
// who ID
WhoID *string `json:"WhoID,omitempty"`
}
// Validate validates this outgoing email message
func (m *OutgoingEmailMessage) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateHeaders(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OutgoingEmailMessage) validateHeaders(formats strfmt.Registry) error {
if swag.IsZero(m.Headers) { // not required
return nil
}
if m.Headers != nil {
if err := m.Headers.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Headers")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Headers")
}
return err
}
}
return nil
}
// ContextValidate validate this outgoing email message based on the context it is used
func (m *OutgoingEmailMessage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateHeaders(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OutgoingEmailMessage) contextValidateHeaders(ctx context.Context, formats strfmt.Registry) error {
if m.Headers != nil {
if err := m.Headers.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Headers")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Headers")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *OutgoingEmailMessage) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *OutgoingEmailMessage) UnmarshalBinary(b []byte) error {
var res OutgoingEmailMessage
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,166 @@
// 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 members_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// OutgoingEmailMessageRequest An array Taxnexus New Email Message objects
//
// swagger:model OutgoingEmailMessageRequest
type OutgoingEmailMessageRequest struct {
// data
Data []*OutgoingEmailMessage `json:"data"`
// meta
Meta *RequestMeta `json:"meta,omitempty"`
}
// Validate validates this outgoing email message request
func (m *OutgoingEmailMessageRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateData(formats); err != nil {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OutgoingEmailMessageRequest) validateData(formats strfmt.Registry) error {
if swag.IsZero(m.Data) { // not required
return nil
}
for i := 0; i < len(m.Data); i++ {
if swag.IsZero(m.Data[i]) { // not required
continue
}
if m.Data[i] != nil {
if err := m.Data[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *OutgoingEmailMessageRequest) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// ContextValidate validate this outgoing email message request based on the context it is used
func (m *OutgoingEmailMessageRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateData(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMeta(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OutgoingEmailMessageRequest) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Data); i++ {
if m.Data[i] != nil {
if err := m.Data[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("data" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("data" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *OutgoingEmailMessageRequest) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
if m.Meta != nil {
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *OutgoingEmailMessageRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *OutgoingEmailMessageRequest) UnmarshalBinary(b []byte) error {
var res OutgoingEmailMessageRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -31,6 +31,16 @@ type Endpoint struct {
Scheme string `mapstructure:"scheme,omitempty"`
}
type Email struct {
FromAddress string `mapstructure:"from_address,omitempty"`
FromName string `mapstructure:"from_name,omitempty"`
ServiceProvider string `mapstructure:"service_provider,omitempty"`
SMTPHost string `mapstructure:"smtp_host,omitempty"`
SMTPPort string `mapstructure:"smtp_port,omitempty"`
SMTPPassword string `mapstructure:"smtp_password,omitempty"`
SMTPUsername string `mapstructure:"smtp_username,omitempty"`
}
// Chunk defines cache chunk size
type Chunk struct {
size int32 `mapstructure:"size,omitempty"`
@ -70,6 +80,7 @@ type Configuration struct {
DBMSPassword string `mapstructure:"dbms_password,omitempty"`
DBMSUsername string `mapstructure:"dbms_username,omitempty"`
DSN string `mapstructure:"dsn,omitempty"`
Email map[string]Email `mapstructure:"email,omitempty"`
Endpoint Endpoint `mapstructure:"endpoint,omitempty"`
Environment string `mapstructure:"environment,omitempty"`
GelfURI string `mapstructure:"gelf_uri,omitempty"`
@ -138,6 +149,15 @@ func GetWorker(name string) *Worker {
return nil
}
// GetEmail returns the named email record
func GetEmail(name string) *Email {
email, ok := config.Email[name]
if ok {
return &email
}
return nil
}
// GetServiceAccount returns the named service account struct
func GetServiceAccount(name string) *ServiceAccount {
serviceaccount, ok := config.ServiceAccounts[name]

127
app/service-helpers.go Normal file
View File

@ -0,0 +1,127 @@
package app
import (
"database/sql"
"fmt"
"reflect"
"time"
)
const dateFormat = "2006-01-02"
const dateTimeFormat = "2006-01-02T15:04:05-0800"
// FieldsAndValues is a struct that holds field names and corresponding values for an object.
type FieldsAndValues struct {
fieldNames []string
fieldValues []interface{}
}
// GetFieldsAndValues takes an object and returns a pointer to a FieldsAndValues struct
// containing the field names and corresponding values for each non-zero field,
// excluding the "ID" field.
func GetFieldsAndValues(obj interface{}) *FieldsAndValues {
result := &FieldsAndValues{
fieldNames: []string{},
fieldValues: []interface{}{},
}
v := reflect.ValueOf(obj).Elem()
t := v.Type()
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
fieldValue := v.Field(i)
if field.Name != "ID" {
if !IsZero(fieldValue) {
fmt.Printf("DEBUG: Adding field %s with value %v\n", field.Name, fieldValue.Interface())
result.fieldNames = append(result.fieldNames, field.Name)
result.fieldValues = append(result.fieldValues, fieldValue.Interface())
}
}
}
return result
}
// IsZero checks if a value is zero or considered zero-like (e.g., empty arrays or slices, nil pointers).
// Note that strings, including empty strings, are treated as non-zero values.
func IsZero(v reflect.Value) bool {
switch v.Kind() {
case reflect.String:
return false // Treat strings, including empty strings, as non-zero values
case reflect.Struct:
for i := 0; i < v.NumField(); i++ {
if !IsZero(v.Field(i)) {
return false
}
}
return true
case reflect.Ptr, reflect.Interface:
if v.IsNil() {
return true
}
return IsZero(v.Elem())
case reflect.Array, reflect.Slice:
return v.Len() == 0
default:
z := reflect.Zero(v.Type())
return v.Interface() == z.Interface()
}
}
// SqlDateToString takes a pointer to a sql.NullTime object and returns a pointer to a string
// representing the date in dateTimeFormat if the sql.NullTime object is valid, otherwise returns nil.
func SqlDateToString(d *sql.NullTime) *string {
if d == nil || !d.Valid {
return nil
}
dateStr := d.Time.Format(dateTimeFormat)
return &dateStr
}
// StringToSqlDate takes a pointer to a string representing a date and returns a pointer to
// a sql.NullTime object containing the parsed date if the string is not nil, otherwise returns nil.
func StringToSqlDate(s *string) *sql.NullTime {
if s == nil {
return nil
}
parsedTime, err := ParseDateTime(s)
if err != nil {
return nil
}
return &sql.NullTime{
Time: *parsedTime,
Valid: true,
}
}
// ParseDateTime takes a pointer to a string representing a date and returns a pointer to
// a time.Time object containing the parsed date if the string is in one of the supported formats.
// If the string is nil or not in a supported format, returns an error.
func ParseDateTime(dateStr *string) (*time.Time, error) {
if dateStr == nil {
return nil, fmt.Errorf("✋members.parseDateTime: dateStr is null")
}
loc, _ := time.LoadLocation("Local")
//
formats := []string{dateFormat, dateTimeFormat, time.RFC1123, time.RFC3339}
var parsedTime *time.Time
for _, format := range formats {
tm, err := time.ParseInLocation(format, *dateStr, loc)
if err == nil {
parsedTime = &tm
break
}
}
if parsedTime == nil {
return nil, fmt.Errorf("✋parseDateTime: input string doesn't match any of the expected formats")
}
return parsedTime, nil
}

View File

@ -70,6 +70,13 @@ parameters:
required: true
schema:
$ref: "#/definitions/CourseSectionRequest"
OutgoingEmailMessageRequest:
description: An array of new Outgoing Email Message records
in: body
name: OutgoingEmailMessageRequest
required: true
schema:
$ref: "#/definitions/OutgoingEmailMessageRequest"
EnrollmentRequest:
description: An array of new Enrollment records
in: body
@ -251,6 +258,11 @@ parameters:
required: true
schema:
$ref: "#/definitions/DatabaseRequest"
emailMessageIdQuery:
description: Email Message ID
in: query
name: emailMessageId
type: string
emailQuery:
description: Email address
in: query
@ -328,6 +340,13 @@ responses:
description: Response with Database objects
schema:
$ref: "#/definitions/DatabaseResponse"
EmailMessagesResponse:
description: "Array of Email Messages"
headers:
Access-Control-Allow-Origin:
type: string
schema:
$ref: "#/definitions/EmailMessagesResponse"
EnrollmentResponse:
description: Enrollment Response Object
schema:
@ -792,6 +811,55 @@ paths:
summary: Update Databases
tags:
- Databases
/emails:
get:
security:
- ApiKeyAuth: []
summary: "Get email messages from data store"
operationId: getEmailMessages
description: "Retrieves email messages from workflow storage"
parameters:
- $ref: "#/parameters/emailMessageIdQuery"
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
tags:
- Emails
responses:
"200":
$ref: "#/responses/EmailMessagesResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
post:
security:
- ApiKeyAuth: []
summary: Add new email messages to the outgoing queue
operationId: postOutgoingEmailMessages
description: Insert new email messages into workflow storage
parameters:
- $ref: "#/parameters/OutgoingEmailMessageRequest"
responses:
"200":
$ref: "#/responses/EmailMessagesResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
tags:
- Emails
/enrollments:
delete:
operationId: deleteEnrollment
@ -2091,10 +2159,131 @@ definitions:
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
EmailMessage:
properties:
ActivityID:
type: string
x-nullable: true
BCCAddress:
type: string
x-nullable: true
CCAddress:
type: string
x-nullable: true
CreatedByID:
type: string
x-nullable: true
CreatedDate:
type: string
x-nullable: true
EmailMessageID:
type: string
x-nullable: true
FromAddress:
type: string
x-nullable: true
FromName:
type: string
x-nullable: true
HTML:
format: byte
type: string
x-nullable: true
HasAttachment:
type: boolean
x-nullable: true
Headers:
$ref: "#/definitions/Headers"
x-nullable: true
ID:
type: string
Incoming:
type: boolean
x-nullable: true
IsClientManaged:
type: boolean
x-nullable: true
IsExternallyManaged:
type: boolean
x-nullable: true
LastModifiedByID:
type: string
x-nullable: true
LastModifiedDate:
type: string
x-nullable: true
MessageDate:
type: string
x-nullable: true
MessageIdentifier:
type: string
x-nullable: true
ParentID:
type: string
x-nullable: true
RelatedToID:
type: string
x-nullable: true
RelationAddress:
type: string
x-nullable: true
RelationID:
type: string
x-nullable: true
RelationObjectType:
type: string
x-nullable: true
RelationType:
type: string
x-nullable: true
ReplyToEmailMessageID:
type: string
x-nullable: true
Status:
type: string
x-nullable: true
Subject:
type: string
x-nullable: true
Text:
format: byte
x-nullable: true
type: string
ThreadIdentifier:
type: string
x-nullable: true
ToAddress:
type: string
x-nullable: true
ValidatedFromAddress:
type: string
x-nullable: true
type: object
EmailMessageRequest:
description: An array Taxnexus Send Email Message objects
properties:
data:
items:
$ref: "#/definitions/EmailMessage"
type: array
meta:
$ref: "#/definitions/RequestMeta"
type: object
EmailMessagesResponse:
description: An array Taxnexus user objects
properties:
data:
items:
$ref: "#/definitions/EmailMessage"
type: array
meta:
$ref: "#/definitions/ResponseMeta"
type: object
Enrollment:
properties:
Completed:
type: integer
x-nullable: true
CourseID:
type: string
x-nullable: true
@ -2475,6 +2664,78 @@ definitions:
Status:
type: integer
type: object
Headers:
type: object
properties:
Key:
type: string
Values:
items:
items:
type: string
type: array
type: array
OutgoingEmailMessage:
description: A new email message to be sent
properties:
BCCAddress:
type: string
x-nullable: true
CCAddress:
type: string
x-nullable: true
EmailMessageID:
type: string
x-nullable: true
EmailTemplateID:
type: string
x-nullable: true
ExternalID:
type: string
x-nullable: true
FromContactID:
type: string
x-nullable: true
FromName:
type: string
x-nullable: true
Headers:
$ref: "#/definitions/Headers"
x-nullable: true
HTML:
type: string
x-nullable: true
ID:
type: string
Subject:
type: string
x-nullable: true
Text:
type: string
x-nullable: true
ToAddress:
type: string
x-nullable: true
ToName:
type: string
x-nullable: true
ValidatedFromAddress:
type: string
x-nullable: true
WhoID:
type: string
x-nullable: true
type: object
OutgoingEmailMessageRequest:
description: An array Taxnexus New Email Message objects
properties:
data:
items:
$ref: "#/definitions/OutgoingEmailMessage"
type: array
meta:
$ref: "#/definitions/RequestMeta"
type: object
Order:
properties:
AmountpaID:

View File

@ -70,6 +70,13 @@ parameters:
required: true
schema:
$ref: "#/definitions/CourseSectionRequest"
OutgoingEmailMessageRequest:
description: An array of new Outgoing Email Message records
in: body
name: OutgoingEmailMessageRequest
required: true
schema:
$ref: "#/definitions/OutgoingEmailMessageRequest"
EnrollmentRequest:
description: An array of new Enrollment records
in: body
@ -251,6 +258,11 @@ parameters:
required: true
schema:
$ref: "#/definitions/DatabaseRequest"
emailMessageIdQuery:
description: Email Message ID
in: query
name: emailMessageId
type: string
emailQuery:
description: Email address
in: query
@ -328,6 +340,13 @@ responses:
description: Response with Database objects
schema:
$ref: "#/definitions/DatabaseResponse"
EmailMessagesResponse:
description: "Array of Email Messages"
headers:
Access-Control-Allow-Origin:
type: string
schema:
$ref: "#/definitions/EmailMessagesResponse"
EnrollmentResponse:
description: Enrollment Response Object
schema:
@ -792,6 +811,55 @@ paths:
summary: Update Databases
tags:
- Databases
/emails:
get:
security:
- ApiKeyAuth: []
summary: "Get email messages from data store"
operationId: getEmailMessages
description: "Retrieves email messages from workflow storage"
parameters:
- $ref: "#/parameters/emailMessageIdQuery"
- $ref: "#/parameters/limitQuery"
- $ref: "#/parameters/offsetQuery"
tags:
- Emails
responses:
"200":
$ref: "#/responses/EmailMessagesResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
post:
security:
- ApiKeyAuth: []
summary: Add new email messages to the outgoing queue
operationId: postOutgoingEmailMessages
description: Insert new email messages into workflow storage
parameters:
- $ref: "#/parameters/OutgoingEmailMessageRequest"
responses:
"200":
$ref: "#/responses/EmailMessagesResponse"
"401":
$ref: "#/responses/Unauthorized"
"403":
$ref: "#/responses/AccessForbidden"
"404":
$ref: "#/responses/NotFound"
"422":
$ref: "#/responses/UnprocessableEntity"
"500":
$ref: "#/responses/ServerError"
tags:
- Emails
/enrollments:
delete:
operationId: deleteEnrollment
@ -2091,10 +2159,131 @@ definitions:
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
EmailMessage:
properties:
ActivityID:
type: string
x-nullable: true
BCCAddress:
type: string
x-nullable: true
CCAddress:
type: string
x-nullable: true
CreatedByID:
type: string
x-nullable: true
CreatedDate:
type: string
x-nullable: true
EmailMessageID:
type: string
x-nullable: true
FromAddress:
type: string
x-nullable: true
FromName:
type: string
x-nullable: true
HTML:
format: byte
type: string
x-nullable: true
HasAttachment:
type: boolean
x-nullable: true
Headers:
$ref: "#/definitions/Headers"
x-nullable: true
ID:
type: string
Incoming:
type: boolean
x-nullable: true
IsClientManaged:
type: boolean
x-nullable: true
IsExternallyManaged:
type: boolean
x-nullable: true
LastModifiedByID:
type: string
x-nullable: true
LastModifiedDate:
type: string
x-nullable: true
MessageDate:
type: string
x-nullable: true
MessageIdentifier:
type: string
x-nullable: true
ParentID:
type: string
x-nullable: true
RelatedToID:
type: string
x-nullable: true
RelationAddress:
type: string
x-nullable: true
RelationID:
type: string
x-nullable: true
RelationObjectType:
type: string
x-nullable: true
RelationType:
type: string
x-nullable: true
ReplyToEmailMessageID:
type: string
x-nullable: true
Status:
type: string
x-nullable: true
Subject:
type: string
x-nullable: true
Text:
format: byte
x-nullable: true
type: string
ThreadIdentifier:
type: string
x-nullable: true
ToAddress:
type: string
x-nullable: true
ValidatedFromAddress:
type: string
x-nullable: true
type: object
EmailMessageRequest:
description: An array Taxnexus Send Email Message objects
properties:
data:
items:
$ref: "#/definitions/EmailMessage"
type: array
meta:
$ref: "#/definitions/RequestMeta"
type: object
EmailMessagesResponse:
description: An array Taxnexus user objects
properties:
data:
items:
$ref: "#/definitions/EmailMessage"
type: array
meta:
$ref: "#/definitions/ResponseMeta"
type: object
Enrollment:
properties:
Completed:
type: integer
x-nullable: true
CourseID:
type: string
x-nullable: true
@ -2475,6 +2664,78 @@ definitions:
Status:
type: integer
type: object
Headers:
type: object
properties:
Key:
type: string
Values:
items:
items:
type: string
type: array
type: array
OutgoingEmailMessage:
description: A new email message to be sent
properties:
BCCAddress:
type: string
x-nullable: true
CCAddress:
type: string
x-nullable: true
EmailMessageID:
type: string
x-nullable: true
EmailTemplateID:
type: string
x-nullable: true
ExternalID:
type: string
x-nullable: true
FromContactID:
type: string
x-nullable: true
FromName:
type: string
x-nullable: true
Headers:
$ref: "#/definitions/Headers"
x-nullable: true
HTML:
type: string
x-nullable: true
ID:
type: string
Subject:
type: string
x-nullable: true
Text:
type: string
x-nullable: true
ToAddress:
type: string
x-nullable: true
ToName:
type: string
x-nullable: true
ValidatedFromAddress:
type: string
x-nullable: true
WhoID:
type: string
x-nullable: true
type: object
OutgoingEmailMessageRequest:
description: An array Taxnexus New Email Message objects
properties:
data:
items:
$ref: "#/definitions/OutgoingEmailMessage"
type: array
meta:
$ref: "#/definitions/RequestMeta"
type: object
Order:
properties:
AmountpaID: