openapi: 3.0.3
info:
  title: 0xGraph API
  version: 1.0.0
  description: API for managing subgraph tags and deployments
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: https://api.subgraph.ormilabs.com
    description: data controllers
paths:
  /public_api/v1/0xGraph/tags/query-tag:
    post:
      summary: Query tag
      operationId: queryTag
      description: Retrieve information about a specific tag for a subgraph
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subgraph_name:
                  type: string
                  description: Subgraph name
                version:
                  type: string
                  description: Version
              required:
                - subgraph_name
                - version
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/queryTag"
      security:
        - BearerAuth: []
  /public_api/v1/0xGraph/tags/create-tag:
    post:
      summary: Create tag
      operationId: createTag
      description: Create a new tag for a subgraph version
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subgraph_name:
                  type: string
                  description: Subgraph name
                version:
                  type: string
                  description: Version
                tag:
                  type: string
                  description: Tag
              required:
                - subgraph_name
                - version
                - tag
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/createTag"
      security:
        - BearerAuth: []
  /public_api/v1/0xGraph/tags/delete-tag:
    post:
      summary: Delete tag
      operationId: deleteTag
      description: Delete an existing tag from a subgraph
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subgraph_name:
                  type: string
                  description: Subgraph name
                version:
                  type: string
                  description: Version
                tag:
                  type: string
                  description: Tag
              required:
                - subgraph_name
                - version
                - tag
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/deleteTag"
      security:
        - BearerAuth: []
  /public_api/v1/0xGraph/subgraph/remove-subgraph:
    post:
      summary: Remove subgraph
      operationId: removeSubgraph
      description: Remove a subgraph deployment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Subgraph name
                version:
                  type: string
                  description: Version
              required:
                - name
                - version
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/removeSubgraph"
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    queryTag:
      type: object
      properties:
        code:
          type: integer
          description: Response status code
        msg:
          type: string
          description: Response message
        data:
          type: object
          properties:
            tags:
              type: array
              items:
                $ref: "#/components/schemas/tagItem"
              description: Array of tag items
          required:
            - tags
          description: Response data containing tags
      required:
        - code
        - data
      description: Query response object
    tagItem:
      type: object
      properties:
        tag:
          type: string
          description: Tag value
        create_time:
          type: integer
          format: int64
          description: Unix timestamp of creation time
      required:
        - tag
        - create_time
      description: Tag item object
    createTag:
      type: object
      properties:
        code:
          type: integer
          description: Response status code
        msg:
          type: string
          description: Response message
        data:
          type: object
          description: Response data
      required:
        - code
        - data
      description: Query response object
    deleteTag:
      type: object
      properties:
        code:
          type: integer
          description: Response status code
        msg:
          type: string
          description: Response message
        data:
          type: object
          description: Response data
      required:
        - code
        - data
      description: Query response object
    removeSubgraph:
      type: object
      properties:
        code:
          type: integer
          description: Response status code
        msg:
          type: string
          description: Response message
        data:
          type: object
          description: Response data
      required:
        - code
        - data
      description: Query response object