swagger: "2.0"
info:
  version: 0.3.4
  title: "crm"
  description: "Customer Information 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:
  - "https"
basePath: "/vk/crm/v1"
host: "gw.tnxs.net"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  accountIdQuery:
    description: Record Id of an Account
    in: query
    name: accountId
    required: false
    type: string
  assetIdQuery:
    description: Record Id of an Asset
    in: query
    name: assetId
    required: false
    type: string
  accountRequest:
    description: An array of new Account records
    in: body
    name: accountRequest
    required: true
    schema:
      $ref: "#/definitions/AccountRequest"
  assetRequest:
    description: An array of new Asset records
    in: body
    name: assetRequest
    required: true
    schema:
      $ref: "#/definitions/AssetRequest"
  activeQuery:
    description: Only retrieve active records?
    in: query
    name: active
    required: false
    type: boolean
  companyIdQuery:
    description: Company record ID
    in: query
    name: companyId
    required: false
    type: string
  leadIdQuery:
    description: Lead record ID
    in: query
    name: leadId
    required: false
    type: string
  contactIdQuery:
    description: Contact record ID
    in: query
    name: contactId
    required: false
    type: string
  contractIdQuery:
    description: Contact record ID
    in: query
    name: contractId
    required: false
    type: string
  emailQuery:
    description: Email address used for identity lookup
    in: query
    name: email
    required: false
    type: string
  contactRequest:
    description: An array of new Contact records
    in: body
    name: contactsRequest
    required: true
    schema:
      $ref: "#/definitions/ContactRequest"
  contractRequest:
    description: An array of new Contract records
    in: body
    name: contractsRequest
    required: true
    schema:
      $ref: "#/definitions/ContractRequest"
  leadRequest:
    description: An array of new Lead records
    in: body
    name: leadRequest
    required: true
    schema:
      $ref: "#/definitions/LeadRequest"
  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
  slugQuery:
    description: The Slug of this Object
    in: query
    name: slug
    required: false
    type: string
  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"
  AccountResponse:
    description: Response with Account objects with Contacts
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      $ref: "#/definitions/AccountResponse"
  AssetResponse:
    description: Response with Asset objects with Contacts
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      $ref: "#/definitions/AssetResponse"
  Conflict:
    description: Conflict
    headers:
      Access-Control-Allow-Origin:
        type: string
    schema:
      $ref: "#/definitions/Error"
  ContactResponse:
    description: Response with an array of Contact objects
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      $ref: "#/definitions/ContactResponse"
  ContractResponse:
    description: Response with an array of Contract objects
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      $ref: "#/definitions/ContractResponse"
  LeadResponse:
    description: Response with an array of Lead objects
    headers:
      Access-Control-Allow-Origin:
        type: string
      Cache-Control:
        type: string
    schema:
      $ref: "#/definitions/LeadResponse"
  DeleteResponse:
    description: 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"
paths:
  /accounts:
    delete:
      description: Delete SalesforceDevops.net Account record
      operationId: deleteAccount
      parameters:
        - $ref: "#/parameters/accountIdQuery"
      responses:
        "200":
          $ref: "#/responses/DeleteResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Delete An Account
      tags:
        - Accounts
    get:
      description: Return a list of all available Accounts
      operationId: getAccounts
      parameters:
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/nameQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/activeQuery"
        - $ref: "#/parameters/accountIdQuery"
        - $ref: "#/parameters/slugQuery"
      responses:
        "200":
          $ref: "#/responses/AccountResponse"
        "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 accounts
      tags:
        - Accounts
    post:
      description: Account record to be added
      operationId: postAccounts
      parameters:
        - $ref: "#/parameters/accountRequest"
      responses:
        "200":
          $ref: "#/responses/AccountResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Add a new account to SalesforceDevops.net
      tags:
        - Accounts
    put:
      description: Update one or more accounts
      operationId: putAccounts
      parameters:
        - $ref: "#/parameters/accountRequest"
      responses:
        "200":
          $ref: "#/responses/AccountResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Update a single account
      tags:
        - Accounts
  /assets:
    delete:
      description: Delete SalesforceDevops.net Asset record
      operationId: deleteAsset
      parameters:
        - $ref: "#/parameters/assetIdQuery"
      responses:
        "200":
          $ref: "#/responses/DeleteResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Delete An Asset
      tags:
        - Assets
    get:
      description: Return a list of all available Assets
      operationId: getAssets
      parameters:
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/accountIdQuery"
        - $ref: "#/parameters/assetIdQuery"
      responses:
        "200":
          $ref: "#/responses/AssetResponse"
        "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 assets
      tags:
        - Assets
    post:
      description: Asset record to be added
      operationId: postAssets
      parameters:
        - $ref: "#/parameters/assetRequest"
      responses:
        "200":
          $ref: "#/responses/AssetResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Add a new asset to SalesforceDevops.net
      tags:
        - Assets
    put:
      description: Update a single asset specified by assetId
      operationId: putAsset
      parameters:
        - $ref: "#/parameters/assetRequest"
      responses:
        "200":
          $ref: "#/responses/AssetResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Update a single asset
      tags:
        - Assets
  /contracts:
    delete:
      description: Delete SalesforceDevops.net Contract record
      operationId: deleteContract
      parameters:
        - $ref: "#/parameters/contractIdQuery"
      responses:
        "200":
          $ref: "#/responses/DeleteResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Delete An Contract
      tags:
        - Contracts
    get:
      description: Return a list of all available Contracts
      operationId: getContracts
      parameters:
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/activeQuery"
        - $ref: "#/parameters/contractIdQuery"
      responses:
        "200":
          $ref: "#/responses/ContractResponse"
        "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 contracts
      tags:
        - Contracts
    post:
      description: Contract record to be added
      operationId: postContracts
      parameters:
        - $ref: "#/parameters/contractRequest"
      responses:
        "200":
          $ref: "#/responses/ContractResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Add a new contract to SalesforceDevops.net
      tags:
        - Contracts
    put:
      description: Update a single contract specified by contractId
      operationId: putContract
      parameters:
        - $ref: "#/parameters/contractRequest"
      responses:
        "200":
          $ref: "#/responses/ContractResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Update a single contract
      tags:
        - Contracts
  /contacts:
    delete:
      description: Delete SalesforceDevops.net Contact record
      operationId: deleteContact
      parameters:
        - $ref: "#/parameters/contactIdQuery"
      responses:
        "200":
          $ref: "#/responses/DeleteResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Delete a Contact
      tags:
        - Contacts
    get:
      description: Return a list of all available Contacts
      operationId: getContacts
      parameters:
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/contactIdQuery"
        - $ref: "#/parameters/activeQuery"
        - $ref: "#/parameters/slugQuery"
        - $ref: "#/parameters/emailQuery"
      responses:
        "200":
          $ref: "#/responses/ContactResponse"
        "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 contacts
      tags:
        - Contacts
    post:
      description: Contact record to be added
      operationId: postContacts
      parameters:
        - $ref: "#/parameters/contactRequest"
      responses:
        "200":
          $ref: "#/responses/ContactResponse"
        "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 contacts
      tags:
        - Contacts
    put:
      description: Update Contact records
      operationId: putContacts
      parameters:
        - $ref: "#/parameters/contactRequest"
      responses:
        "200":
          $ref: "#/responses/ContactResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Update Contact
      tags:
        - Contacts
  /leads:
    delete:
      description: Delete SalesforceDevops.net Lead record
      operationId: deleteLead
      parameters:
        - $ref: "#/parameters/leadIdQuery"
      responses:
        "200":
          $ref: "#/responses/DeleteResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Delete a Contact
      tags:
        - Leads
    get:
      description: Return a list of all available Leads
      operationId: getLeads
      parameters:
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/leadIdQuery"
        - $ref: "#/parameters/emailQuery"
        - $ref: "#/parameters/nameQuery"
      responses:
        "200":
          $ref: "#/responses/LeadResponse"
        "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 contacts
      tags:
        - Leads
    post:
      description: Lead records to be added
      operationId: postLeads
      parameters:
        - $ref: "#/parameters/leadRequest"
      responses:
        "200":
          $ref: "#/responses/LeadResponse"
        "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 Leads
      tags:
        - Leads
    put:
      description: Update Lead records
      operationId: putLeads
      parameters:
        - $ref: "#/parameters/leadRequest"
      responses:
        "200":
          $ref: "#/responses/LeadResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      security:
        - ApiKeyAuth: []
      summary: Update Leads
      tags:
        - Leads
definitions:
  AccountRequest:
    description: An array of Account objects with Contacts
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/account.yaml#/Account"
        type: array
    type: object
  AccountResponse:
    description: An array of Account objects with Contacts
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/account.yaml#/Account"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  AssetRequest:
    description: An array of Asset objects with Contacts
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/asset.yaml#/Asset"
        type: array
    type: object
  AssetResponse:
    description: An array of Asset objects with Contacts
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/asset.yaml#/Asset"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  ContactRequest:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/contact.yaml#/Contact"
        type: array
    type: object
  ContactResponse:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/contact.yaml#/Contact"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  ContractRequest:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/contract.yaml#/Contract"
        type: array
    type: object
  ContractResponse:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/contract.yaml#/Contract"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  DeleteResponse:
    $ref: "../../lib/swagger/defs/delete-response.yaml#/DeleteResponse"
  Error:
    $ref: "../../lib/swagger/defs/error.yaml#/Error"
  InvalidError:
    $ref: "../../lib/swagger/defs/invalid-error.yaml#/InvalidError"
  LeadRequest:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/lead.yaml#/Lead"
        type: array
    type: object
  LeadResponse:
    properties:
      Data:
        items:
          $ref: "../../lib/swagger/defs/lead.yaml#/Lead"
        type: array
      Meta:
        $ref: "../../lib/swagger/defs/response-meta.yaml#/ResponseMeta"
    type: object
  Message:
    $ref: "../../lib/swagger/defs/message.yaml#/Message"
  RequestMeta:
    $ref: "../../lib/swagger/defs/request-meta.yaml#/RequestMeta"
