openapi: 3.0.1
info:
  title: Terms
  description: Manage terms and conditions presented to users of a Canto account.
  version: 1.0.0
servers:
  - url: "https://{tenantSubdomain}.{region}/api/v1"
    variables:
      tenantSubdomain:
        default: demo
      region:
        default: canto.com
        enum:
          - canto.com
          - canto.global
          - canto.de
          - au.canto.com
          - ca.canto.com
security:
  - cantoOAuth2: []
  - bearerAuth: []
tags:
  - name: Terms
    description: Manage terms and conditions.
paths:
  /termAndCondition:
    get:
      tags:
        - Terms
      summary: Get all Terms & Conditions
      operationId: get_v1_termAndCondition
      description: Returns every saved term and condition.
      responses:
        "200":
          description: The account's terms and conditions.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/term_and_condition"
              example:
                - id: <term-id>
                  fieldName: Term And Condition 1
                  description: Term And Condition Description
                  termDetail: Term And Condition Details
                - id: <term-id>
                  fieldName: Term And Condition 2
                  description: Term And Condition Description
                  termDetail: Term And Condition Details
    post:
      tags:
        - Terms
      summary: Create a Term & Condition
      operationId: post_v1_termAndCondition
      description: Creates a new term and condition.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [fieldName, description, termDetail]
              properties:
                fieldName:
                  type: string
                  description: Name for the term and condition.
                description:
                  type: string
                termDetail:
                  type: string
                  description: Details related to the term and condition.
      responses:
        "200":
          description: The literal text "success" on completion.
          content:
            text/plain:
              schema:
                type: string
              example: success
    put:
      tags:
        - Terms
      summary: Update a Term & Condition
      operationId: put_v1_termAndCondition
      description: Updates an existing term and condition.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [id, fieldName, description, termDetail]
              properties:
                id:
                  type: string
                  description: Id of the term and condition to update.
                fieldName:
                  type: string
                description:
                  type: string
                termDetail:
                  type: string
      responses:
        "200":
          description: The literal text "success" on completion.
          content:
            text/plain:
              schema:
                type: string
              example: success
  /termAndCondition/{id}:
    delete:
      tags:
        - Terms
      summary: Delete a Term & Condition
      operationId: delete_v1_termAndCondition_id
      description: Deletes a term and condition.
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the term and condition to delete.
          schema:
            type: string
      responses:
        "200":
          description: The literal text "success" on completion.
          content:
            text/plain:
              schema:
                type: string
              example: success
components:
  securitySchemes:
    cantoOAuth2:
      type: oauth2
      description: >
        Authorize against your own Canto account. Choose the tenant and its
        region in the portal first; the portal fills in the application
        identifier for that region and pre-fills your account name on
        Canto's sign-in page. This is a public-client PKCE flow: no client
        secret is used, and none is held by the portal.
      flows:
        authorizationCode:
          authorizationUrl: https://oauth.canto.com/oauth/api/oauth2/universal2/authorize
          tokenUrl: https://oauth.canto.com/oauth/api/oauth2/universal2/token
          scopes: {}
          x-usePkce: plain
          x-tokenName: accessToken
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: AccessToken
      description: >
        Paste a Target-API OAuth Token obtained out-of-band. Use the
        Authorize button instead to obtain one interactively.
  schemas:
    term_and_condition:
      type: object
      properties:
        id:
          type: string
        fieldName:
          type: string
        description:
          type: string
        termDetail:
          type: string
