tread.io ResourceScopes API

The ResourceScopes API from tread.io — 4 operation(s) for resourcescopes.

OpenAPI Specification

treadio-resourcescopes-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Horizon API V1 AccountExternalTruckIdentifier ResourceScopes API
  version: '1.0'
  contact:
    name: Tread
    url: https://tread.io
    email: developers@tread.io
  description: 'This is the Version 1 implementation.


    When in doubt we default to the practices outlined [here](https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries)'
  license:
    name: Private
    url: https://tread.io
servers:
- description: production
  url: https://api.tread-horizon.com
security:
- bearerAuth: []
tags:
- name: ResourceScopes
paths:
  /v1/companies/{company-id}/managed_companies/{managed-company-id}/resource_scopes/{id}:
    parameters:
    - schema:
        type: string
        format: uuid
      name: company-id
      in: path
      required: true
      description: Managing Company ID
    - schema:
        type: string
        format: uuid
      name: managed-company-id
      in: path
      required: true
      description: Managed Company ID
    - schema:
        type: string
        format: uuid
      name: id
      in: path
      required: true
      description: ResourceScope ID
    - $ref: '#/components/parameters/Accept-Language'
    delete:
      summary: Delete a ResourceScope for a Managed Company
      tags:
      - ResourceScopes
      responses:
        '204':
          description: No Content
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
      operationId: delete-v1-companies-company-id-managed_companies-managed-company-id-resource_scopes-id
      x-stoplight:
        id: rs9yl4no5t1rb
      description: 'Delete a `ResourceScope` for a user in a managed company.


        This endpoint requires the `delete_resource_scope` permission.'
  /v1/companies/{company-id}/managed_companies/{managed-company-id}/users/{user-id}/resource_scopes:
    parameters:
    - schema:
        type: string
        format: uuid
      name: company-id
      in: path
      required: true
      description: Managing Company ID
    - schema:
        type: string
        format: uuid
      name: managed-company-id
      in: path
      required: true
      description: Managed Company ID
    - schema:
        type: string
        format: uuid
      name: user-id
      in: path
      required: true
      description: User ID
    - $ref: '#/components/parameters/Accept-Language'
    post:
      summary: Create a ResourceScope for a User in a Managed Company
      tags:
      - ResourceScopes
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                required:
                - data
                properties:
                  data:
                    $ref: '#/components/schemas/ResourceScope-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/ModelError'
      operationId: post-v1-companies-company-id-managed_companies-managed-company-id-users-user-id-resource_scopes
      x-stoplight:
        id: rs8xk3mn4s0qa
      description: 'Create a `ResourceScope` for a `User` in a managed company.


        This endpoint requires the `create_resource_scope` permission.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourceScope-Create'
    get:
      summary: Retrieve ResourceScopes for a User in a Managed Company
      tags:
      - ResourceScopes
      responses:
        '200':
          description: OK
          headers:
            Link:
              schema:
                type: string
              description: Contains prev and next links for pagination
          content:
            application/json:
              schema:
                type: object
                required:
                - data
                properties:
                  data:
                    type: array
                    x-stoplight:
                      id: rs7xk2mn3r9pz
                    items:
                      $ref: '#/components/schemas/ResourceScope-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
      operationId: get-v1-companies-company-id-managed_companies-managed-company-id-users-user-id-resource_scopes
      x-stoplight:
        id: rsght5kp8w2nr
      description: Retrieve `ResourceScopes` for a `User` in a managed company.
      parameters:
      - $ref: '#/components/parameters/page-limit'
      - $ref: '#/components/parameters/page-after'
      - $ref: '#/components/parameters/page-before'
      - $ref: '#/components/parameters/filter-resource_type'
  /v1/resource_scopes/{id}:
    parameters:
    - schema:
        type: string
        format: uuid
      name: id
      in: path
      required: true
      description: ResourceScope ID
    - $ref: '#/components/parameters/Accept-Language'
    delete:
      summary: Delete a ResourceScope
      tags:
      - ResourceScopes
      responses:
        '204':
          description: No Content
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
      operationId: delete-v1-resource_scopes-id
      x-stoplight:
        id: re1nudb6vqw52
      description: 'Delete a `ResourceScope`.


        This endpoint requires the `delete_resource_scope` permission.'
  /v1/users/{user-id}/resource_scopes:
    parameters:
    - schema:
        type: string
      name: user-id
      in: path
      required: true
      description: User ID
    - $ref: '#/components/parameters/Accept-Language'
    post:
      summary: Create a ResourceScope
      tags:
      - ResourceScopes
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                required:
                - data
                properties:
                  data:
                    $ref: '#/components/schemas/ResourceScope-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/ModelError'
      operationId: post-v1-users-user-id-resource_scopes
      x-stoplight:
        id: zn35yvtq7u0wa
      description: 'Create a `ResourceScope`.


        This endpoint requires the `create_resource_scope` permission.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourceScope-Create'
    get:
      summary: Retrieve ResourceScopes for a User
      tags:
      - ResourceScopes
      responses:
        '200':
          description: OK
          headers:
            Link:
              schema:
                type: string
              description: Contains prev and next links for pagination
          content:
            application/json:
              schema:
                type: object
                required:
                - data
                properties:
                  data:
                    type: array
                    x-stoplight:
                      id: eip7tkhv50170
                    items:
                      $ref: '#/components/schemas/ResourceScope-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
      operationId: get-v1-users-user-id-resource_scopes
      x-stoplight:
        id: qm98v9vg3cc6g
      description: Retrieve `ResourceScopes` for a `User`.
      parameters:
      - $ref: '#/components/parameters/page-limit'
      - $ref: '#/components/parameters/page-after'
      - $ref: '#/components/parameters/page-before'
      - $ref: '#/components/parameters/filter-resource_type'
components:
  responses:
    ModelError:
      description: ''
      content:
        application/json:
          schema:
            type: object
            $ref: '#/components/schemas/ModelError-Response'
    Error:
      description: Error response
      content:
        application/json:
          schema:
            type: object
            $ref: '#/components/schemas/Error-Response'
    UnauthenticatedError:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            $ref: '#/components/schemas/UnauthenticatedError-Response'
  parameters:
    Accept-Language:
      name: Accept-Language
      in: header
      schema:
        type: string
        default: en
        example: en
      description: 'The Accept-Language request HTTP header indicates the natural language and locale that the client prefers. '
    filter-resource_type:
      name: filter[resource_type]
      in: query
      required: false
      schema:
        type: string
        enum:
        - Site
      description: Resource Type
    page-limit:
      name: page[limit]
      in: query
      schema:
        type: integer
        format: int32
        default: 25
        maximum: 100
      description: The maximum number of paginated results to return
    page-before:
      name: page[before]
      in: query
      required: false
      schema:
        type: string
      description: The cursor to stop paginating at
    page-after:
      name: page[after]
      in: query
      required: false
      schema:
        type: string
      description: The cursor to start paginating after
  schemas:
    Error-Response:
      title: Error-Response
      x-stoplight:
        id: 52cydhphee3qe
      type: object
      required:
      - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
      additionalProperties: false
    ResourceScope-Read:
      title: ResourceScope-Read
      x-stoplight:
        id: oov968gb7f2jh
      allOf:
      - $ref: '#/components/schemas/Identifier'
      - type: object
        properties:
          id:
            type: string
            x-stoplight:
              id: 4yvrj9wav30v2
          user:
            $ref: '#/components/schemas/User-Read-Nested'
          resource:
            $ref: '#/components/schemas/Resource-Read-Nested'
      - $ref: '#/components/schemas/Timestamps'
    ResourceScope-Create:
      title: ResourceScope-Create
      x-stoplight:
        id: 41ox6ewfjpo0r
      type: object
      required:
      - resource_id
      - resource_type
      properties:
        resource_id:
          type: string
          x-stoplight:
            id: rxl9bwb4ol3s8
          format: uuid
        resource_type:
          $ref: '#/components/schemas/ResourceType'
      additionalProperties: false
    Resource-Read-Nested:
      title: Resource-Read-Nested
      x-stoplight:
        id: zsxrcvafomwu1
      allOf:
      - $ref: '#/components/schemas/Identifier'
      - type: object
        required:
        - name
        - type
        properties:
          name:
            type: string
            x-stoplight:
              id: lz8ri4iufqzwq
          type:
            $ref: '#/components/schemas/ResourceType'
    Discardable:
      title: Discardable
      x-stoplight:
        id: 46axlb8u5wjay
      type: object
      required:
      - discarded_at
      properties:
        discarded_at:
          type: string
          x-stoplight:
            id: cy8t6fecoyxbo
          format: date-time
          nullable: true
      additionalProperties: false
    Error:
      title: Error
      x-stoplight:
        id: 3g57kkik3l464
      type: object
      description: An Error.
      required:
      - code
      properties:
        code:
          type: string
          x-stoplight:
            id: 7o9x1t8v0bgfo
      additionalProperties: false
    ModelError-Item:
      title: ModelError-Item
      x-stoplight:
        id: b93chwval2t8d
      type: object
      required:
      - model
      - field
      - message
      properties:
        model:
          type: string
          x-stoplight:
            id: 30myfyjkno8ao
          description: The Model associated with this Error
        field:
          type: string
          x-stoplight:
            id: 8gl4ed3uxhdws
          description: The field associated with this Error
        message:
          type: string
          x-stoplight:
            id: bmgbrtmw17qsj
          description: The Error message
      additionalProperties: false
    UnauthenticatedError:
      title: UnauthenticatedError
      x-stoplight:
        id: 202o69l0fs40h
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        x-stoplight:
          id: tg10dt7s0l6bw
        properties:
          error_type:
            type: string
            x-stoplight:
              id: wvq8c0qsym4hz
        required:
        - error_type
    ModelError:
      title: ModelError
      x-stoplight:
        id: nhp6714o4j1qt
      description: A Model-specific error
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        required:
        - errors
        properties:
          errors:
            type: array
            x-stoplight:
              id: m4ul9vcq2deh6
            items:
              $ref: '#/components/schemas/ModelError-Item'
    Timestamps:
      title: Timestamps
      x-stoplight:
        id: t82ecgfu0oj00
      type: object
      required:
      - created_at
      - updated_at
      properties:
        created_at:
          type: string
          x-stoplight:
            id: gjj950jpq0ga9
          format: date-time
          description: ISO8601 timestamp with local timezone
        updated_at:
          type: string
          x-stoplight:
            id: bwcuyfwc7aj0e
          format: date-time
          description: ISO8601 timestamp with local timezone
      additionalProperties: false
    Identifier:
      title: Identifier
      x-stoplight:
        id: gnd39lue5v7ol
      type: object
      required:
      - id
      properties:
        id:
          type: string
          x-stoplight:
            id: 2e38hjk4zd58m
          format: uuid
      additionalProperties: false
    ResourceType:
      title: ResourceType
      x-stoplight:
        id: 20tmbtxmlreh3
      enum:
      - Site
    UnauthenticatedError-Response:
      title: UnauthenticatedError-Response
      x-stoplight:
        id: o477eph7ttbzt
      type: object
      required:
      - error
      properties:
        error:
          $ref: '#/components/schemas/UnauthenticatedError'
      additionalProperties: false
    User-Read-Typeahead:
      title: User-Read-Typeahead
      x-stoplight:
        id: ttbbss5b5k66f
      allOf:
      - $ref: '#/components/schemas/Identifier'
      - type: object
        required:
        - first_name
        - last_name
        properties:
          first_name:
            type: string
            description: First name
            x-stoplight:
              id: gwo999rcdahmg
          last_name:
            type: string
            description: Last name
            x-stoplight:
              id: l9omnnsq644bh
      description: ''
    ModelError-Response:
      title: ModelError-Response
      x-stoplight:
        id: payf9ndh3l6np
      type: object
      required:
      - error
      properties:
        error:
          $ref: '#/components/schemas/ModelError'
      additionalProperties: false
    User-Read-Nested:
      title: User-Read-Nested
      x-stoplight:
        id: llvhpyfas0ekp
      allOf:
      - $ref: '#/components/schemas/User-Read-Typeahead'
      - $ref: '#/components/schemas/Discardable'
      - type: object
        x-stoplight:
          id: 6i4ku1oj5jnjs
        required:
        - email
        - phone
        - external_id
        - schedule_on
        properties:
          email:
            type: string
            x-stoplight:
              id: lyetvi4zixhq9
            nullable: true
          phone:
            type: string
            x-stoplight:
              id: 5dyog3jwd9m72
            description: User's E.164 formatted phone number
            nullable: true
          external_id:
            type: string
            x-stoplight:
              id: nk3qk35smj1ej
            nullable: true
          schedule_on:
            type: boolean
            x-stoplight:
              id: 5l8bajmm29c31
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
x-stoplight:
  id: 75rfxjepk4523