swagger: "2.0"
info:
  version: 1.2.7
  title: "workflow"
  description: "Workflow Microservice"
  termsOfService: "http://taxnexus.net/terms/"
  contact:
    email: "noc@taxnexus.net"
  license:
    name: "Proprietary - Copyright (c) 2018-2021 by Taxnexus, Inc."
securityDefinitions:
  ApiKeyAuth:
    type: "apiKey"
    in: "header"
    name: "X-API-Key"
schemes:
  - "http"
basePath: "/v1"
host: "workflow.fabric.tnxs.net:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  emailMessageIdQuery:
    description: Email Message ID
    in: query
    name: emailMessageId
    type: string
  OutgoingEmailMessageRequest:
    description: An array of new Outgoing Email Message records
    in: body
    name: OutgoingEmailMessageRequest
    required: true
    schema:
      $ref: "#/definitions/OutgoingEmailMessageRequest"
  AppLogRequest:
    description: An array of new AppLog records
    in: body
    name: AppLogRequest
    required: true
    schema:
      $ref: "#/definitions/AppLogRequest"
responses:
  AppLogResponse:
    description: "Array of AppLogs"
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/AppLogResponse"
  EmailMessagesResponse:
    description: "Array of Email Messages"
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/EmailMessagesResponse"
  AccessForbidden:
    description: "Access forbidden, account lacks access"
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  NotFound:
    description: Resource was not found
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  ServerError:
    headers:
      Access-Control-Allow-Origin:
        type: string
    description: Server Internal Error
    schema:
      $ref: "#/definitions/Error"
  Unauthorized:
    headers:
      Access-Control-Allow-Origin:
        type: string
    description: "Access Unauthorized, invalid API-KEY was used"
    schema:
      $ref: "#/definitions/Error"
  UnprocessableEntity:
    headers:
      Access-Control-Allow-Origin:
        type: string
    description: "Unprocessable Entity, likely a bad parameter"
    schema:
      $ref: "#/definitions/Error"
  CORSResponse:
    description: CORS OPTIONS response
    headers:
      Access-Control-Allow-Origin:
        type: string
      Access-Control-Allow-Headers:
        type: string
      Access-Control-Allow-Methods:
        type: string
      Access-Control-Expose-Headers:
        type: string
      Access-Control-Max-Age:
        type: string
      Access-Control-Allow-Credentials:
        type: string
      Cache-Control:
        type: string
paths:
  /applogs:
    options:
      operationId: appLogOptions
      description: CORS support
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    post:
      security:
        - ApiKeyAuth: []
      summary: Post app log messages
      operationId: postAppLogs
      description: Insert app log messages into workflow storage
      parameters:
        - $ref: "#/parameters/AppLogRequest"
      responses:
        "200":
          $ref: "#/responses/AppLogResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      tags:
        - AppLog
  /emailmessages:
    options:
      operationId: emailMessageOptions
      description: CORS support
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    get:
      security:
        - ApiKeyAuth: []
      summary: "Get email messages from data store"
      operationId: getEmailMessages
      description: "Retrieves email messages from workflow storage"
      parameters:
        - $ref: "#/parameters/emailMessageIdQuery"
      tags:
        - "EmailMessage"
      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"
  /outgoingemailmessages:
    options:
      operationId: outgoingEmailMessageOptions
      description: CORS support
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    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:
        - OutgoingEmailMessage
definitions:
  AppLog:
    description: Application Log for human consumption
    properties:
      AccountID:
        type: string
      CompanyID:
        type: string
      CreatedByID:
        type: string
      CreatedDate:
        type: string
      ID:
        type: string
      Message:
        type: string
      ObjectID:
        type: string
      ObjectType:
        type: string
      Severity:
        type: string
      Source:
        type: string
      SourceTimestamp:
        type: string
    type: object
  AppLogRequest:
    description: An array Taxnexus Application Log objects
    properties:
      data:
        items:
          $ref: "#/definitions/AppLog"
        type: array
      meta:
        $ref: "#/definitions/RequestMeta"
    type: object
  AppLogResponse:
    description: An array Taxnexus Application Log objects
    properties:
      data:
        items:
          $ref: "#/definitions/AppLog"
        type: array
      meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  Document:
    description: Taxnexus Document
    properties:
      ArchivedByID:
        type: string
      ArchivedDate:
        type: string
      AuthorID:
        type: string
      Body:
        format: byte
        type: string
      BodyLength:
        format: int64
        type: number
      CommentCount:
        format: int64
        type: number
      ConnectionID:
        type: string
      ContentAssetID:
        type: string
      ContentModificationDate:
        type: string
      ContentSize:
        format: int64
        type: number
      ContentType:
        type: string
      ContentVersionDocumentID:
        type: string
      ContnetDocumentID:
        type: string
      CreatedByID:
        type: string
      CreatedDate:
        type: string
      DDate:
        type: string
      Description:
        type: string
      DeveloperName:
        type: string
      Discount:
        type: number
      Document:
        format: byte
        type: string
      DocumentID:
        type: string
      DocumentSequence:
        format: int64
        type: number
      Field:
        type: string
      FileExtension:
        type: string
      FileType:
        type: string
      FolderID:
        type: string
      GrandTotal:
        type: string
      ID:
        type: string
      InsertedByID:
        type: string
      IsArchived:
        type: boolean
      IsBodySearchable:
        type: boolean
      IsCommentSub:
        type: boolean
      IsDocumentSub:
        type: boolean
      IsInternalUseOnly:
        type: boolean
      IsPublic:
        type: boolean
      IsRichText:
        type: boolean
      Keywords:
        type: string
      LastModifiedByID:
        type: string
      LastModifiedDate:
        type: string
      LastViewedDate:
        type: string
      LatstPublishedVersionID:
        type: string
      LikeCount:
        format: int64
        type: number
      LinkURL:
        type: string
      LinkedEntityID:
        type: string
      Name:
        type: string
      NamespacePrefix:
        type: string
      NetworkScope:
        type: string
      OwnerID:
        type: string
      ParentID:
        type: string
      Publishstatus:
        type: string
      QuoteID:
        type: string
      RelatedRecordID:
        type: string
      ShareType:
        type: string
      SharingOption:
        type: string
      SharingPrivacy:
        type: string
      Title:
        type: string
      Type:
        type: string
      URL:
        type: string
      UserID:
        type: string
      Visibility:
        type: string
    type: object
  EmailMessage:
    properties:
      ActivityID:
        type: string
      BCCAddress:
        type: string
      CCAddress:
        type: string
      CreatedByID:
        type: string
      CreatedDate:
        type: string
      EmailMessageID:
        type: string
      FromAddress:
        type: string
      FromName:
        type: string
      HTML:
        format: byte
        type: string
      HasAttachment:
        type: boolean
      Headers:
        $ref: "#/definitions/Headers"
      ID:
        type: string
      Incoming:
        type: boolean
      IsClientManaged:
        type: boolean
      IsExternallyManaged:
        type: boolean
      LastModifiedByID:
        type: string
      LastModifiedDate:
        type: string
      MessageDate:
        type: string
      MessageIdentifier:
        type: string
      ParentID:
        type: string
      RelatedToID:
        type: string
      RelationAddress:
        type: string
      RelationID:
        type: string
      RelationObjectType:
        type: string
      RelationType:
        type: string
      ReplyToEmailMessageID:
        type: string
      Status:
        type: string
      Subject:
        type: string
      Text:
        format: byte
        type: string
      ThreadIdentifier:
        type: string
      ToAddress:
        type: string
      ValidatedFromAddress:
        type: string
    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
  Error:
    properties:
      Code:
        format: int32
        type: integer
      Fields:
        type: string
      Message:
        type: string
    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
      CCAddress:
        type: string
      EmailMessageID:
        type: string
      EmailTemplateID:
        type: string
      ExternalID:
        type: string
      FromContactID:
        type: string
      FromName:
        type: string
      Headers:
        $ref: "#/definitions/Headers"
      HTML:
        type: string
      ID:
        type: string
      Subject:
        type: string
      Text:
        type: string
      ToAddress:
        type: string
      ToName:
        type: string
      ValidatedFromAddress:
        type: string
      WhoID:
        type: string
    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
  RequestMeta:
    properties:
      TaxnexusAccount:
        description: Taxnexus Account Number of the Reseller or OEM
        type: string
    required:
      - TaxnexusAccount
    type: object
  ResponseMeta:
    properties:
      Contact:
        description: Microservice Contact Info
        type: string
      Copyright:
        description: Copyright Info
        type: string
      License:
        description: License Information and Restrictions
        type: string
      OperationID:
        description: Operation ID
        type: string
      RequestIP:
        description: Request IP Address
        type: string
      RequestType:
        description: Request Type
        type: string
      RequestURL:
        description: Request URL
        type: string
      ServerInfo:
        description: Data Server Info
        type: string
      ServerResponseTime:
        description: Data Server Response Time (ms)
        type: string
      ServerTimestamp:
        description: Backend Server Timestamp
        type: string
      TaxnexusAccount:
        description:
          Taxnexus Account Number used for recording transactions
        type: string
    type: object
