swagger: "2.0"
info:
  version: 0.3.4
  title: "plex"
  description: "Cross-Schema Retrieval Microservice"
  termsOfService: "https://salesforcedevops.net/terms/"
  contact:
    email: "vern@vernonkeenan.com"
  license:
    name: "Proprietary - Copyright (c) 2018-2024 by Vernon Keenan"
securityDefinitions:
  ApiKeyAuth:
    type: "apiKey"
    in: "header"
    name: "X-API-Key"
schemes:
  - "http"
basePath: "/v1"
host: "plex.vernonkeenan.com:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  slugQuery:
    description: The slug of the item to retrieve
    in: query
    name: slug
    required: false
    type: string
  CompanyIdQuery:
    description: Record Id of an Company
    in: query
    name: companyId
    required: false
    type: string
  limitQuery:
    description: "How many objects to return at one time"
    format: int64
    in: query
    name: limit
    required: false
    type: integer
  offsetQuery:
    description: How many objects to skip?
    format: int64
    in: query
    name: offset
    required: false
    type: integer
responses:
  AccessForbidden:
    description: "Access forbidden, Company lacks access"
    schema:
      $ref: "#/definitions/Error"
  InvalidDataError:
    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"
    schema:
      $ref: "#/definitions/Error"
  UnprocessableEntity:
    description: "Unprocessable Entity, likely a bad parameter"
    schema:
      $ref: "#/definitions/Error"
  CompanyResponse:
    description: The SalesforceDevops.net Company Object
    schema:
      $ref: "#/definitions/CompanyResponse"
paths:
  /companies:
    get:
      description: Return all or a single company fully hydrated object
      operationId: getCompanies
      parameters:
        - $ref: "#/parameters/CompanyIdQuery"
        - $ref: "#/parameters/slugQuery"
      responses:
        "200":
          $ref: "#/responses/CompanyResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Get a list of companies
      tags:
        - Companies
definitions:
  Address:
    properties:
      City:
        description: City
        type: string
        x-nullable: true
      Country:
        description: Country full name
        type: string
        x-nullable: true
      CountryCode:
        description: Country Code
        type: string
        x-nullable: true
      PostalCode:
        description: Postal Code
        type: string
        x-nullable: true
      State:
        description: State full name
        type: string
        x-nullable: true
      StateCode:
        description: State Code
        type: string
        x-nullable: true
      Street:
        description: Street number and name
        type: string
        x-nullable: true
    type: object
  Company:
    properties:
      ID:
        description: Company Id
        type: string
      AccountID:
        description: Account Id
        type: string
        x-nullable: true
      AccountNumber:
        description: Company Number
        type: string
        x-nullable: true
      AccountSource:
        description: The marketing origin of this Company
        type: string
        x-nullable: true
      Active:
        type: boolean
        x-nullable: true
      AnnualRevenue:
        x-nullable: true
        description: Annual Revenue Estimate
        format: double
        type: number
      AppExchange:
        x-nullable: true
        description: Salesforce AppExchange URL
        type: string
      CloudRevenueTotal:
        x-nullable: true
        type: number
      CloudType:
        x-nullable: true
        description: The type of cloud company
        type: string
      CloudYear:
        description: The year company started cloud revenue
        type: string
        x-nullable: true
      CrunchbaseURL:
        description: Company Crunchbase URL
        type: string
        x-nullable: true
      Description:
        description: Description of the Company
        type: string
        x-nullable: true
      EarningsCall:
        description: Earnings Call Date
        type: string
        x-nullable: true
      Email:
        description: Main Company Email
        type: string
        x-nullable: true
      EquityFunding:
        description: The amount of equity EquityFunding
        type: number
        x-nullable: true
      Facebook:
        description: Company Facebook URL
        type: string
        x-nullable: true
      Fax:
        description: Fax number
        type: string
        x-nullable: true
      FoundedDate:
        description: Date company founded
        type: string
        x-nullable: true
      FullDescription:
        description: Full Description of the Company
        type: string
        x-nullable: true
      IPODate:
        description: IPO Date
        type: string
        x-nullable: true
      ImageAltText:
        type: string
        x-nullable: true
      ImageURL:
        x-nullable: true
        type: string
      Industries:
        x-nullable: true
        description: Industries
        type: string
      Industry:
        x-nullable: true
        description: Industry
        type: string
      LinkedIn:
        x-nullable: true
        description: Company LinkedIn URL
        type: string
      ListingAddress:
        x-nullable: true
        $ref: "#/definitions/Address"
      Location:
        x-nullable: true
        description: Headquarters Location Description
        type: string
      Logo:
        x-nullable: true
        description: Company Logo URL
        type: string
      MarketCapitalization:
        x-nullable: true
        description: Market Capitalization
        type: number
      Name:
        x-nullable: true
        description: Company Name
        type: string
      NumberInvestments:
        x-nullable: true
        description: Number of Investments
        type: number
      NumberOfEmployees:
        x-nullable: true
        description: Employee Count Estimate
        format: int64
        type: number
      Ownership:
        x-nullable: true
        description: Ownership
        type: string
      ParentID:
        x-nullable: true
        description: Parent Company
        type: string
      Phone:
        x-nullable: true
        description: Phone
        type: string
      Publish:
        x-nullable: true
        description: Publish this record?
        type: boolean
      SalesforceFirst:
        x-nullable: true
        description: A Salesforce-First company?
        type: boolean
      Slug:
        x-nullable: true
        description: Slug
        type: string
      TagLine:
        x-nullable: true
        description: Company tagline
        type: string
      TickerSymbol:
        x-nullable: true
        description: Ticker Symbol
        type: string
      Twitter:
        x-nullable: true
        description: Twitter URL
        type: string
      Type:
        x-nullable: true
        description: Type
        type: string
      Website:
        x-nullable: true
        description: Website
        type: string
      YearStarted:
        x-nullable: true
        description: Year Started
        type: string
      CompanyProducts:
        description: Company Products
        x-nullable: true
        type: array
        items:
          $ref: "#/definitions/CompanyProduct"
      CompanyServices:
        description: Company Services
        x-nullable: true
        type: array
        items:
          $ref: "#/definitions/CompanyService"
      FinancialStatements:
        description: Financial Statements
        x-nullable: true
        type: array
        items:
          $ref: "#/definitions/FinancialStatement"
      IndustryCompanies:
        description: Similar Companies
        x-nullable: true
        type: array
        items:
          $ref: "#/definitions/IndustryCompany"
    type: object
  FinancialStatement:
    type: object
    description: A financial statement for a company
    properties:
      ID:
        description: Record Id
        type: string
      AccessNumber:
        description: EDGAR Access Number
        type: string
      AccountID:
        description: Account ID
        type: string
      CloudRevenue:
        description: Cloud Revenue
        type: number
      CreatedByID:
        description: Created By User ID
        type: string
      CreatedDate:
        description: Created Date
        type: string
      Description:
        description: Description
        type: string
      EdgarURL:
        description: EDGAR URL
        type: string
      FilingType:
        description: Filing Type
        type: string
      GrossProfit:
        description: Gross Profit
        type: number
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      NetIncome:
        description: Net Income
        type: number
      PeriodEndDate:
        description: Period End Date
        type: string
      TotalRevenue:
        description: Total Revenue
        type: number
      Year:
        description: Year
        type: string
  CompanyProduct:
    description: A software product or service vended by a Company
    properties:
      ID:
        description: Record Id
        type: string
      AccountID:
        description: ID of the Company that owns this Product
        type: string
        x-nullable: true
      AppExchange:
        description: Salesforce AppExchange URL
        type: string
        x-nullable: true
      CreatedByID:
        description: Created By User ID
        type: string
        x-nullable: true
      CreatedDate:
        description: Created Date
        type: string
        x-nullable: true
      Description:
        description: Description of product
        type: string
        x-nullable: true
      FullDescription:
        description: Full Description of product
        type: string
        x-nullable: true
      ImageAltText:
        description: Image Alt Text
        type: string
        x-nullable: true
      ImageURL:
        description: Image URL
        type: string
        x-nullable: true
      Industries:
        x-nullable: true
        description: Industries
        type: array
        items:
          $ref: "#/definitions/Industry"
      LastModifiedByID:
        x-nullable: true
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        x-nullable: true
        description: Last Modified Date
        type: string
      Logo:
        x-nullable: true
        description: Logo
        type: string
      Name:
        x-nullable: true
        description: Product Name
        type: string
      ProductVideoID:
        x-nullable: true
        description: Product Video ID
        type: string
      Published:
        x-nullable: true
        description: Published
        type: boolean
      SalesforceSpecific:
        x-nullable: true
        description: Salesforce Specific
        type: boolean
      Slug:
        x-nullable: true
        description: Slug
        type: string
      TagLine:
        x-nullable: true
        description: TagLine
        type: string
      URL:
        x-nullable: true
        description: Website
        type: string
    type: object
  CompanyService:
    description: A service performed by a Company
    properties:
      ID:
        description: Record Id
        type: string
      AccountID:
        description: ID of the Company that owns this Service
        type: string
        x-nullable: true
      AppExchange:
        description: Salesforce AppExchange URL
        type: string
        x-nullable: true
      CreatedByID:
        description: Created By User ID
        type: string
        x-nullable: true
      CreatedDate:
        description: Created Date
        type: string
        x-nullable: true
      Description:
        description: Description of service
        type: string
        x-nullable: true
      FullDescription:
        description: Full Description of service
        type: string
        x-nullable: true
      ImageAltText:
        description: Image Alt Text
        type: string
        x-nullable: true
      ImageURL:
        description: Image URL
        type: string
        x-nullable: true
      Industries:
        x-nullable: true
        description: Industries
        type: array
        items:
          $ref: "#/definitions/Industry"
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
        x-nullable: true
      LastModifiedDate:
        description: Last Modified Date
        type: string
        x-nullable: true
      Logo:
        description: Logo
        type: string
        x-nullable: true
      Name:
        description: Service Name
        type: string
        x-nullable: true
      Published:
        description: Published
        type: boolean
        x-nullable: true
      SalesforceSpecific:
        description: Salesforce Specific
        type: boolean
        x-nullable: true
      ServiceVideoID:
        description: Service Video ID
        type: string
        x-nullable: true
      Slug:
        description: Slug
        type: string
        x-nullable: true
      TagLine:
        description: Tag Line
        type: string
        x-nullable: true
      URL:
        description: URL
        type: string
        x-nullable: true
    type: object

  Industry:
    description: An industry that is being researched
    properties:
      ID:
        description: Record Id
        type: string
      Companies:
        x-nullable: true
        description: The AccountIDs of the Companies in this Industry
        type: array
        items:
          type: string
      CompanyProducts:
        x-nullable: true
        description: The list of Products in this industry
        type: array
        items:
          $ref: "#/definitions/CompanyProduct"
      CreatedByID:
        x-nullable: true
        description: Created By User ID
        type: string
      CreatedDate:
        x-nullable: true
        description: Created Date
        type: string
      Description:
        x-nullable: true
        description: Industry Description
        type: string
      ImageAltText:
        x-nullable: true
        description: Image Alt Text
        type: string
      ImageURL:
        x-nullable: true
        description: Image URL
        type: string
      LastModifiedByID:
        x-nullable: true
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        x-nullable: true
        description: Last Modified Date
        type: string
      Level:
        x-nullable: true
        description: The hierarchical level of this Industry
        type: string
      Logo:
        x-nullable: true
        description: Logo
        type: string
      Name:
        x-nullable: true
        description: Industry Name
        type: string
      ParentIndustryID:
        x-nullable: true
        description: The ID of the Parent Industry
        type: string
      Path:
        x-nullable: true
        description: The full path of this industry, including Parent
        type: string
      Slug:
        x-nullable: true
        description: The CMS Slug for this Industry
        type: string
      TagLine:
        x-nullable: true
        description: TagLine
        type: string
    type: object
  IndustryCompany:
    description: Junction object between Industry and Company
    properties:
      ID:
        description: Record Id
        type: string
      CompanyID:
        type: string
      CompanyName:
        type: string
      CompanySlug:
        type: string
      CompanyWebsite:
        type: string
      IndustryID:
        type: string
      IndustryName:
        type: string
      IndustrySlug:
        type: string
      IndustryTagLine:
        type: string
      LastModifiedByID:
        description: Last Modified By User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      Path:
        type: string
    type: object
  CompanyRequest:
    description: An array of Company objects with Contacts
    properties:
      Data:
        items:
          $ref: "#/definitions/Company"
        type: array
    type: object
  CompanyResponse:
    description: An array of Company objects with Contacts
    properties:
      Data:
        items:
          $ref: "#/definitions/Company"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  Error:
    $ref: "../../lib/swagger/defs/error.yaml#/Error"
  InvalidError:
    allOf:
      - $ref: "#/definitions/Error"
      - properties:
          details:
            items:
              type: string
            type: array
        type: object
