swagger: "2.0"
info:
  version: 0.3.0
  title: "auth"
  description: "Authentication Microservice"
  termsOfService: "https://salesforcedevops.net/terms/"
  contact:
    email: "vern@vernonkeenan.com"
  license:
    name: "Proprietary - Copyright (c) 2018-2023 by Vernon Keenan"
securityDefinitions:
  ApiKeyAuth:
    type: "apiKey"
    in: "header"
    name: "X-API-Key"
security:
  - ApiKeyAuth: []
schemes:
  - "http"
basePath: "/v1"
host: "auth.vernonkeenan.com:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  apiKeyQuery:
    description: Service account or developer API key
    in: query
    name: apikey
    type: string
responses:
  AccessForbidden:
    description: "Access forbidden, account lacks access"
    schema:
      $ref: "#/definitions/Error"
  NotFound:
    description: Resource was not found
    schema:
      $ref: "#/definitions/Error"
  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"
  UserResponse:
    description: Response with User objects
    schema:
      $ref: "#/definitions/UserResponse"
paths:
  /users:
    get:
      summary: "Check API Key"
      operationId: "getUsers"
      description: "Checks for a valid API key, and returns full user record"
      parameters:
        - $ref: "#/parameters/apiKeyQuery"
      tags:
        - "User"
      responses:
        "200":
          $ref: "#/responses/UserResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
definitions:
  Address:
    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
    type: object
  Error:
    properties:
      Code:
        format: int32
        type: integer
      Fields:
        type: string
      Message:
        type: string
    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: Account Number used for recording transactions
        type: string
    type: object
  User:
    properties:
      AboutMe:
        description: About Me
        type: string
      AccountID:
        description: Account ID
        type: string
      Address:
        $ref: "#/definitions/Address"
      Alias:
        description: Alias
        type: string
      APIKey:
        description: API Key
        type: string
      Auth0UserID:
        description: Auth0 User Id
        type: string
      CommunityNickname:
        description: Nickname
        type: string
      CompanyName:
        description: Company Name
        type: string
      ContactID:
        description: Contact
        type: string
      CreatedByID:
        description: Created User ID
        type: string
      CreatedDate:
        description: Date Created
        type: string
      DelegatedApproverID:
        description: Delegated Approver
        type: string
      Department:
        description: Department
        type: string
      Division:
        description: Division
        type: string
      Email:
        description: Email address
        type: string
      EmployeeNumber:
        description: Employee Number
        type: string
      EndOfDay:
        description: Time day ends
        type: string
      Environment:
        description: Environment
        type: string
      Extension:
        description: Extension
        type: string
      FabricAPIKey:
        description: Fabric API Key
        type: string
      Fax:
        description: Fax
        type: string
      FirstName:
        description: The first name
        type: string
      ForecastEnabled:
        description: Allow Forecasting
        type: boolean
      FullPhotoURL:
        description: Full Photo URL
        type: string
      ID:
        description: ID
        type: string
      IsActive:
        description: Active
        type: boolean
      IsPortalEnabled:
        description: Is the user enabled for Communities?
        type: boolean
      IsProphilePhotoActive:
        description: Has Profile Photo
        type: boolean
      IsSystemControlled:
        type: boolean
      LastModifiedByID:
        description: Last Modified User ID
        type: string
      LastModifiedDate:
        description: Last Modified Date
        type: string
      LastLogin:
        description: Last login time
        type: string
      LastIP:
        description: IP address of last login
        type: string
      LoginCount:
        description: Number of times user has logged in
        type: number
        format: int64
      LastName:
        description: The Last Name
        type: string
      ManagerID:
        description: Manager
        type: string
      MobilePhone:
        description: Mobile
        type: string
      Name:
        description: Name
        type: string
      OutOfOfficeMessage:
        description: Out of office message
        type: string
      Phone:
        description: Phone
        type: string
      PortalRole:
        description: Portal Role Level
        type: string
      ProfileID:
        description: Profile
        type: string
      ReceivesAdminInfoEmails:
        description: Admin Info Emails
        type: boolean
      ReceivesAdminEmails:
        description: Info Emails
        type: boolean
      SenderEmail:
        description: Email Sender Address
        type: string
      SenderName:
        description: Email Sender Name
        type: string
      Signature:
        description: Email Signature
        type: string
      SmallPhotoURL:
        description: Small Photo URL
        type: string
      StartOfDay:
        description: The time day starts
        type: string
      TaxnexusAccount:
        description: Account
        type: string
      TenantID:
        description: Tenant ID associated with this user
        type: string
      TimeZone:
        description: Time Zone
        type: string
      Title:
        description: Title
        type: string
      Username:
        description: Username
        type: string
      UserRoleID:
        description: Role
        type: string
      UserType:
        description: User Type
        type: string
      UserRoles:
        items:
          $ref: "#/definitions/UserRole"
        type: array
      TenantUsers:
        items:
          $ref: "#/definitions/TenantUser"
        type: array
    type: object
  UserResponse:
    description: An array Taxnexus user objects
    properties:
      Data:
        items:
          $ref: "#/definitions/User"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  UserRole:
    description: Relationship object that connects user to a role
    type: object
    properties:
      AccountID:
        description: Account Id
        type: string
      Auth0RoleID:
        description: Linked role ID
        type: string
      Auth0UserID:
        description: Auth0 User ID
        type: string
      CompanyName:
        description: Company Name
        type: string
      ContactID:
        description: Contact ID
        type: string
      RoleDescription:
        description: Role description
        type: string
      RoleID:
        description: The Role ID
        type: string
      RoleName:
        description: Role Name
        type: string
      TaxnexusAccount:
        description: Account Number
        type: string
      UserEmail:
        description: User Email Address
        type: string
      UserFullName:
        description: User Full Name
        type: string
      UserID:
        description: The User ID
        type: string
      Username:
        description: Username
        type: string
  TenantUser:
    description: Relationship object that connects users to a tenant
    type: object
    properties:
      AccessLevel:
        description: The makeTenantUser access level for this User
        type: string
      Auth0UserID:
        description: Auth0 User ID
        type: string
      AccountID:
        description: Account ID
        type: string
      ContactID:
        description: Contact ID
        type: string
      CompanyName:
        description: Account Name
        type: string
      TaxnexusAccount:
        description: Account
        type: string
      TenantActive:
        description: Tenant active?
        type: boolean
      TenantID:
        description: The Tenant ID
        type: string
      TenantName:
        description: Tenant Name
        type: string
      TenantStatus:
        description: Tenant Status
        type: string
      TenantType:
        description: Tenant type
        type: string
      TenantVersion:
        description: Tenant Version
        type: string
      Username:
        description: Username
        type: string
      UserEmail:
        description: User Email Address
        type: string
      UserFullName:
        description: User Full Name
        type: string
      UserID:
        description: The User ID
        type: string
