swagger: "2.0"
info:
  version: 1.3.0
  title: "stash"
  description: "PDF Storage 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"
security:
  - ApiKeyAuth: []
schemes:
  - "https"
basePath: "/v1"
host: "gw.tnxs.net/stash"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  X-API-Key:
    name: X-API-Key
    in: "header"
    required: true
    type: string
  PDFRequest:
    description: An array of new PDF records
    in: body
    name: PDFRequest
    required: true
    schema:
      $ref: "#/definitions/PDFRequest"
  pdfIdQueryRequired:
    description: PDF record ID
    in: query
    name: pdfId
    required: true
    type: string
responses:
  AccessForbidden:
    description: "Access forbidden, account lacks access"
    schema:
      $ref: "#/definitions/Error"
  NotFound:
    description: Resource was not found
    schema:
      $ref: "#/definitions/Error"
  PdfResponse:
    description: Taxnexus Response with an array of pdfs
    schema:
      $ref: "#/definitions/DocumentResponse"
  ServerError:
    description: Server Internal Error
    schema:
      $ref: "#/definitions/Error"
  Unauthorized:
    description: "Access Unauthorized, invalid API-KEY was used"
    schema:
      $ref: "#/definitions/Error"
  UnprocessableEntity:
    description: "Unprocessable Entity, likely a bad parameter"
    schema:
      $ref: "#/definitions/Error"
  DocumentResponse:
    description: Rendered documents response
    schema:
      $ref: "#/definitions/DocumentResponse"
paths:
  /pdfs:
    post:
      description: Store new PDFs
      operationId: postPdfs
      parameters:
        - $ref: "#/parameters/PDFRequest"
      responses:
        "200":
          $ref: "#/responses/DocumentResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      summary: Create new PDFs
      tags:
        - StashPdf
definitions:
  Document:
    properties:
      Filename:
        type: string
      ID:
        type: string
      SagaType:
        type: string
      ParentID:
        type: string
      Title:
        type: string
      URI:
        type: string
    type: object
  DocumentResponse:
    description: An array of rendered documents
    properties:
      Data:
        items:
          $ref: "#/definitions/Document"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  Error:
    properties:
      Code:
        format: int64
        type: number
      Fields:
        type: string
      Message:
        type: string
    type: object
  NewPDF:
    properties:
      Description:
        description: Description
        type: string
      Filename:
        description: Filename only
        type: string
      HTML:
        description: The HTML data in text format
        type: string
      LastAccessedByID:
        description: Last Accessed By
        type: string
      ObjectType:
        description: This document's financial object origination
        type: string
      OwnerID:
        description: User who created the PDF
        type: string
      ParentID:
        description: ID of the record that owns this PDF
        type: string
      Ref:
        description: External reference if any
        type: string
      Title:
        description: Document descriptive title
        type: string
    type: object
  PDFRequest:
    properties:
      Data:
        items:
          $ref: "#/definitions/NewPDF"
        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
