swagger: "2.0"
info:
  version: 0.0.1
  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.vernonkeenan.com:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  emailMessageIdQuery:
    description: Email Message ID
    in: query
    name: emailMessageId
    type: string
  taskIdQuery:
    description: Email Message ID
    in: query
    name: taskId
    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"
  TaskRequest:
    description: An array of new Task records
    in: body
    name: TaskRequest
    required: true
    schema:
      $ref: "#/definitions/TaskRequest"
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"
  TaskResponse:
    description: Array of Tasks
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/TaskResponse"
  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
  /tasks:
    options:
      operationId: taskOptions
      description: CORS support
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    get:
      security:
        - ApiKeyAuth: []
      summary: "Get tasks from data store"
      operationId: getTasks
      description: "Retrieves tasks from workflow storage"
      parameters:
        - $ref: "#/parameters/taskIdQuery"
      tags:
        - Task
      responses:
        "200":
          $ref: "#/responses/TaskResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
    post:
      security:
        - ApiKeyAuth: []
      summary: Insert new tasks
      operationId: postTasks
      description: Insert new tasks into workflow storage
      parameters:
        - $ref: "#/parameters/TaskRequest"
      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:
        - Task
  /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
  Task:
    properties:
      ID:
        type: string
        description: Taxnexus Record Id
      AccountID:
        type: string
        description: Account ID
      APIName:
        type: string
        description: API Name
      ActivityDate:
        type: string
        description: Due Date
      Body:
        type: string
        description: Task description body
      CallDisposition:
        type: boolean
        description: Call Result
      CallDurationInSeconds:
        type: number
        description: Call Duration
      CallObject:
        type: string
        description: Call Object Identifier
      CallType:
        type: string
        description: Call Type
      CreatedByID:
        type: string
        description: Created By
      CreatedDate:
        type: string
        description: Created Date
      Description:
        type: string
        description: Comments
      InsertedByID:
        type: string
        description: Inserted User Id
      IsArchived:
        type: boolean
        description: Is Task Archived?
      IsClosed:
        type: boolean
        description: Is Task Closed?
      IsHighPriority:
        type: boolean
        description: Is Task a High Priority?
      IsRecurrence:
        type: boolean
        description: Create Recurring Series of Tasks
      IsReminderSet:
        type: boolean
        description: Reminder Set
      IsRichText:
        type: boolean
        description: Is Rich Text?
      IsVisibleInSelfService:
        type: boolean
        description: Public
      IsWhat:
        type: boolean
        description: Is What?
      LastModifiedByID:
        type: string
        description: Last Modified By
      LastModifiedDate:
        type: string
        description: Last Modified Date
      LikeCount:
        type: number
        description: Like Count
      LinkURL:
        type: string
        description: Link URL
      MasterLabel:
        type: string
        description: Master Label
      NetworkScope:
        type: string
        description: Network Scope
      OwnerID:
        type: string
        description: Task Owner
      ParentID:
        type: string
        description: Task Parent
      Priority:
        type: string
        description: Priority
      Status:
        type: string
        description: Status
      Subject:
        type: string
        description: Subject
      TaskSubtype:
        type: string
        description: Task Subtype
      Title:
        type: string
        description: Title
      Type:
        type: string
        description: Type
      Visibility:
        type: string
        description: Visibility
      WhatID:
        type: string
        description: Related To
      WhoID:
        type: string
        description: Name
  TaskRequest:
    description: An array Taxnexus Task objects
    properties:
      data:
        items:
          $ref: "#/definitions/Task"
        type: array
      meta:
        $ref: "#/definitions/RequestMeta"
    type: object
  TaskResponse:
    description: An array Taxnexus Task objects
    properties:
      data:
        items:
          $ref: "#/definitions/Task"
        type: array
      meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
