openapi: 3.0.0
info:
  license:
    name: MIT
    url: https://github.com/aziontech/azionapi-openapi/blob/main/LICENSE.md
  title: Credentials API
  version: 2.0.0
servers:
- description: Production
  url: https://api.azionapi.net
security:
- tokenAuth: []
paths:
  /credentials:
    get:
      operationId: findAll
      parameters:
      - explode: true
        in: query
        name: filter
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: page
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: page_size
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: sort
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: order_by
        required: false
        schema:
          type: string
        style: form
      responses:
        "200":
          content:
            application/json; version=3:
              schema:
                $ref: '#/components/schemas/ResponseWithTotal'
          description: OK
        "400":
          description: Bad Request
        "500":
          description: Internal Server Error
      summary: Return all credentials
    post:
      operationId: createCredential
      requestBody:
        content:
          application/json; version=3:
            schema:
              $ref: '#/components/schemas/CreateCredentialRequest'
        required: true
      responses:
        "201":
          content:
            application/json; version=3:
              schema:
                $ref: '#/components/schemas/AuthToken'
          description: Created
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Create credential
  /credentials/{credentialId}:
    delete:
      operationId: deleteCredential
      parameters:
      - explode: false
        in: path
        name: credentialId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      responses:
        "204":
          description: No Content
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      summary: Delete the Credential
    get:
      operationId: loadCredential
      parameters:
      - explode: false
        in: path
        name: credentialId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      responses:
        "200":
          content:
            application/json; version=3:
              schema:
                $ref: '#/components/schemas/Response'
          description: OK
        "400":
          description: Bad Request
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      summary: Load the Credential
    patch:
      operationId: updateCredential
      parameters:
      - explode: false
        in: path
        name: credentialId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      requestBody:
        content:
          application/json; version=3:
            schema:
              $ref: '#/components/schemas/UpdateCredentialRequest'
        required: true
      responses:
        "200":
          content:
            application/json; version=3:
              schema:
                $ref: '#/components/schemas/Response'
          description: OK
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Update the Credential
components:
  schemas:
    AuthToken:
      additionalProperties: false
      example:
        is_active: true
        updated_at: 2000-01-23T04:56:07.000+00:00
        last_editor: last_editor
        name: name
        created_at: 2000-01-23T04:56:07.000+00:00
        description: description
        id: 0
        deleted_at: 2000-01-23T04:56:07.000+00:00
        client_id: client_id
        token: token
      properties:
        client_id:
          type: string
        created_at:
          format: date-time
          type: string
        deleted_at:
          format: date-time
          type: string
        description:
          type: string
        id:
          format: int64
          type: integer
        is_active:
          type: boolean
        last_editor:
          type: string
        name:
          type: string
        token:
          type: string
        updated_at:
          format: date-time
          type: string
      required:
      - client_id
      - created_at
      - id
      - is_active
      - last_editor
      - name
      - token
      - updated_at
      type: object
    CreateCredentialRequest:
      additionalProperties: false
      example:
        name: name
        description: description
        status: true
      properties:
        description:
          type: string
        name:
          type: string
        status:
          type: boolean
      required:
      - description
      - name
      - status
      type: object
    Response:
      additionalProperties: false
      example:
        last_editor: last_editor
        name: name
        description: description
        id: 0
        last_modified: 2000-01-23T04:56:07.000+00:00
        status: true
        token: token
      properties:
        description:
          type: string
        id:
          format: int64
          type: integer
        last_editor:
          type: string
        last_modified:
          format: date-time
          type: string
        name:
          type: string
        status:
          type: boolean
        token:
          type: string
      required:
      - description
      - id
      - last_editor
      - last_modified
      - name
      - status
      - token
      type: object
    ResponseWithTotal:
      additionalProperties: false
      example:
        total: 6
        credentials:
        - last_editor: last_editor
          name: name
          description: description
          id: 0
          last_modified: 2000-01-23T04:56:07.000+00:00
          status: true
          token: token
        - last_editor: last_editor
          name: name
          description: description
          id: 0
          last_modified: 2000-01-23T04:56:07.000+00:00
          status: true
          token: token
      properties:
        credentials:
          items:
            $ref: '#/components/schemas/Response'
          type: array
        total:
          format: int64
          type: integer
      required:
      - credentials
      - total
      type: object
    UpdateCredentialRequest:
      additionalProperties: false
      example:
        name: name
        description: description
        status: true
      properties:
        description:
          type: string
        name:
          type: string
        status:
          type: boolean
      required:
      - description
      - name
      - status
      type: object
  securitySchemes:
    tokenAuth:
      description: |-
        You must inform a token to auth.
        Usage format: `Token <TOKEN>`
      in: header
      name: Authorization
      type: apiKey
