swagger: "2.0"
info:
  version: 0.0.1
  title: "research"
  description: "Customer Information 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: "research.vernonkeenan.com:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  accountIdQuery:
    description: Taxnexus Record Id of an Account
    in: query
    name: accountId
    required: false
    type: string
  activeQuery:
    description: Only retrieve active records?
    in: query
    name: active
    required: false
    type: boolean
  companyProductIdQuery:
    description: Taxnexus CompanyProduct record ID
    in: query
    name: companyProductId
    required: false
    type: string
  industryIdQuery:
    description: Taxnexus Industry record ID
    in: query
    name: industryId
    required: false
    type: string
  topicIdQuery:
    description: Taxnexus Topic record ID
    in: query
    name: topicId
    required: false
    type: string
  leadIdQuery:
    description: Taxnexus Lead record ID
    in: query
    name: leadId
    required: false
    type: string
  contactIdQuery:
    description: Taxnexus Contact record ID
    in: query
    name: contactId
    required: false
    type: string
  emailQuery:
    description: Email address used for identity lookup
    in: query
    name: email
    required: false
    type: string
  industryRequest:
    description: An array of new Industry records
    in: body
    name: industryRequest
    required: true
    schema:
      $ref: "#/definitions/IndustryRequest"
  topicRequest:
    description: An array of new Topic records
    in: body
    name: topicRequest
    required: true
    schema:
      $ref: "#/definitions/TopicRequest"
  limitQuery:
    description: "How many objects to return at one time"
    format: int64
    in: query
    name: limit
    required: false
    type: integer
  nameQuery:
    description: The Name of this Object
    in: query
    name: name
    required: false
    type: string
  offsetQuery:
    description: How many objects to skip?
    format: int64
    in: query
    name: offset
    required: false
    type: integer
  typeQuery:
    description: The Type of this Object
    in: query
    name: type
    required: false
    type: string
responses:
  AccessForbidden:
    description: "Access forbidden, account lacks access"
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  TopicResponse:
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    description: Taxnexus Response with Topic objects
    schema:
      $ref: "#/definitions/TopicResponse"
  IndustryResponse:
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    description: Taxnexus Response with Industry objects
    schema:
      $ref: "#/definitions/IndustryResponse"
  TopicObservableResponse:
    description: Taxnexus Response with an array of Topic objects
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      items:
        $ref: "#/definitions/Topic"
      type: array
  IndustryObservableResponse:
    description: Taxnexus Response with an array of Industry objects
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      items:
        $ref: "#/definitions/Industry"
      type: array
  Conflict:
    description: Conflict
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  DeleteResponse:
    description: Taxnexus Response with Message Objects with Delete Status
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/DeleteResponse"
  InvalidDataError:
    headers:
      Access-Control-Allow-Origin:
        type: string
    description: Invalid data was sent
    schema:
      $ref: "#/definitions/InvalidError"
  NotFound:
    description: Resource was not found
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  ServerError:
    description: Server Internal Error
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  Unauthorized:
    description: "Access unauthorized, invalid API-KEY was used"
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  UnprocessableEntity:
    description: "Unprocessable Entity, likely a bad parameter"
    headers:
      Access-Control-Allow-Origin:
        type: string
    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:
  /topics:
    get:
      description: Retrieve Topic records from the datastore
      operationId: getTopics
      parameters:
        - $ref: "#/parameters/topicIdQuery"
      responses:
        "200":
          $ref: "#/responses/TopicResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Get Topic records
      tags:
        - Topic
    options:
      description: CORS support
      operationId: topicOptions
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    post:
      description: Add new companies
      operationId: postTopics
      parameters:
        - $ref: "#/parameters/topicRequest"
      responses:
        "200":
          $ref: "#/responses/TopicResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Add new companies
      tags:
        - Topic
  /topics/observable:
    get:
      description: A list of companies in a simple JSON array
      operationId: getTopicsObservable
      parameters:
        - $ref: "#/parameters/topicIdQuery"
      responses:
        "200":
          $ref: "#/responses/TopicObservableResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Get Taxnexus Companies in an observable array
      tags:
        - Topic
    options:
      description: CORS support
      operationId: topicObservableOptions
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
  /industries:
    get:
      description: Retrieve Industry records from the datastore
      operationId: getIndustries
      parameters:
        - $ref: "#/parameters/industryIdQuery"
      responses:
        "200":
          $ref: "#/responses/IndustryResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Get Industry records
      tags:
        - Industry
    options:
      description: CORS support
      operationId: industryOptions
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
    post:
      description: Add new companies
      operationId: postIndustries
      parameters:
        - $ref: "#/parameters/industryRequest"
      responses:
        "200":
          $ref: "#/responses/IndustryResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Add new companies
      tags:
        - Industry
  /industries/observable:
    get:
      description: A list of companies in a simple JSON array
      operationId: getIndustriesObservable
      parameters:
        - $ref: "#/parameters/industryIdQuery"
      responses:
        "200":
          $ref: "#/responses/IndustryObservableResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Get Taxnexus Companies in an observable array
      tags:
        - Industry
    options:
      description: CORS support
      operationId: industryObservableOptions
      responses:
        "200":
          $ref: "#/responses/CORSResponse"
      tags:
        - cors
definitions:
  Address:
    type: object
    properties:
      City:
        description: City
        type: string
      Country:
        description: Country full name
        type: string
      CountryCode:
        description: Country Code
        type: string
      PostalCode:
        description: Postal Code
        type: string
      State:
        description: State full name
        type: string
      StateCode:
        description: State Code
        type: string
      Street:
        description: Street number and name
        type: string
  Factor:
    description: A Factor of analysis within a research topic
    type: object
    properties:
      ID:
        description: Taxnexus Record Id
        type: string
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      Name:
        description: Factor Name
        type: string
      Description:
        description: Topic Description
        type: string
      SiteURL:
        description: The URL of the corresponding page on the CMS
        type: string
      TopicID:
        description: The ID of the Topic that owns this Factor
        type: string
      Observations:
        description: The list of Observations used to analyze this industry
        type: array
        items:
          $ref: "#/definitions/Observation"
  Observation:
    description: A data point collected while analyzing a Factor
    type: object
    properties:
      ID:
        description: Taxnexus Record Id
        type: string
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      FactorID:
        description: The ID of the Factor that owns this Observation
        type: string
      SubjectType:
        description: Is the subject a Company or a Product?
      AccountID:
        description: The ID of the Company being analyzed
        type: string
      companyProductID:
        description: The ID of the Product being analyzed
        type: string
      Description:
        description: Notes concerning data collection
        type: string
      Value:
        description: The data point collected
        type: string
  Topic:
    description: A research topic that collects data
    type: object
    properties:
      ID:
        description: Taxnexus Record Id
        type: string
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      Name:
        description: Topic Name
        type: string
      Description:
        description: Topic Description
        type: string
      SiteURL:
        description: The URL of the corresponding page on the CMS
        type: string
      ParentTopicID:
        description: The ID of the Parent Topic
        type: string
      Factors:
        description: The list of Factors used to analyze this industry
        type: array
        items:
          $ref: "#/definitions/Factor"
  Industry:
    description: An industry that is being researched
    type: object
    properties:
      ID:
        description: Taxnexus Record Id
        type: string
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      Name:
        description: Industry Name
        type: string
      Description:
        description: Industry Description
        type: string
      ParentIndustryID:
        description: The ID of the Parent Industry
        type: string
      Level:
        description: The hierarchical level of this Industry
        type: string
      Path:
        description: The full path of this industry, including Parent
        type: string
      Slug:
        description: The CMS Slug for this Industry
        type: string
      SiteURL:
        description: The URL of the corresponding page on the CMS
        type: string
      Companies:
        description: The AccountIDs of the Companies in this Industry
        type: array
        items:
          type: string
      CompanyProducts:
        description: The list of Products in this industry
        type: array
        items:
          $ref: "#/definitions/CompanyProduct"
  IndustryRequest:
    description: An array of Industry objects submitted for processing
    properties:
      Data:
        items:
          $ref: "#/definitions/Industry"
        type: array
    type: object
  IndustryResponse:
    description: An array of Industry objects produced in response to a request
    properties:
      Data:
        items:
          $ref: "#/definitions/Industry"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  TopicRequest:
    description: An array of Topic objects submitted for processing
    properties:
      Data:
        items:
          $ref: "#/definitions/Topic"
        type: array
    type: object
  TopicResponse:
    description: An array of Topic objects produced in response to a request
    properties:
      Data:
        items:
          $ref: "#/definitions/Topic"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  CompanyProduct:
    description: A software product or service vended by a Company
    type: object
    properties:
      ID:
        description: Taxnexus Record Id
        type: string
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      AccountID:
        description: Taxnexus ID of the Company that owns this Product
        type: string
      Description:
        description: Description of product
        type: string
      Name:
        description: Product Name
        type: string
      TagLine:
        description: TagLine
        type: string
      URL:
        description: Website
        type: string
  DeleteResponse:
    properties:
      Data:
        items:
          $ref: "#/definitions/Message"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  Error:
    properties:
      Code:
        format: int64
        type: integer
      Fields:
        type: string
      Message:
        type: string
    type: object
  InvalidError:
    allOf:
      - $ref: "#/definitions/Error"
      - properties:
          details:
            items:
              type: string
            type: array
        type: object
  Message:
    properties:
      message:
        type: string
      ref:
        type: string
      status:
        format: int64
        type: number
    type: object
  Pagination:
    properties:
      limit:
        format: int64
        type: number
      pagesize:
        format: int64
        type: number
      poffset:
        format: int64
        type: integer
      setsize:
        format: int64
        type: number
    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
      Pagination:
        $ref: "#/definitions/Pagination"
      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
