---
openapi: 3.1.0
components:
  schemas:
    Actor:
      type: object
      properties:
        '@context':
          type: string
        role:
          type: array
          items:
            type: string
        name:
          type: string
        id:
          type: string
    Agent:
      type: object
      properties:
        roles:
          type: array
          items:
            type: string
        name:
          type: string
        id:
          type: string
        sameAs:
          type: array
          items:
            type: string
        textapiType:
          type: string
    Collection:
      type: object
      properties:
        '@context':
          type: string
        textapi:
          type: string
        id:
          type: string
        title:
          type: array
          items:
            $ref: "#/components/schemas/Title"
        collector:
          type: array
          items:
            $ref: "#/components/schemas/Actor"
        description:
          type: string
        sequence:
          type: array
          items:
            $ref: "#/components/schemas/SequenceItem"
    Collection1:
      type: object
      properties:
        '@context':
          type: string
        textapiVersion:
          type: string
        id:
          type: string
        textapiType:
          type: string
        revision:
          type: string
        created:
          type: string
        modified:
          type: string
        titles:
          type: array
          items:
            type: string
        collectors:
          type: array
          items:
            $ref: "#/components/schemas/Agent"
        editors:
          type: array
          items:
            $ref: "#/components/schemas/Agent"
        funders:
          type: array
          items:
            $ref: "#/components/schemas/Agent"
        description:
          type: string
        total:
          type: integer
          format: int32
        manifests:
          type: array
          items: {}
        collections:
          type: array
          items:
            type: string
        partOf:
          type: array
          items:
            type: string
        prevRevision:
          type: string
    Content:
      type: object
      properties:
        id:
          type: string
        contentType:
          type: string
    ContentItem:
      type: object
      properties:
        '@context':
          type: string
        url:
          type: string
        type:
          type: string
    Item:
      type: object
      properties:
        '@context':
          type: string
        textapi:
          type: string
        id:
          type: string
        type:
          type: string
        "n":
          type: string
        lang:
          type: array
          items:
            type: string
        content:
          type: array
          items:
            $ref: "#/components/schemas/ContentItem"
    Item1:
      type: object
      properties:
        '@context':
          type: string
        textapiVersion:
          type: string
        id:
          type: string
        textapiType:
          type: string
        revision:
          type: string
        created:
          type: string
        modified:
          type: string
        titles:
          type: array
          items:
            type: string
        division:
          type: string
        textItemType:
          type: string
        languages:
          type: array
          items:
            type: string
        contents:
          type: array
          items:
            $ref: "#/components/schemas/Content"
    License:
      type: object
      properties:
        '@context':
          type: string
        id:
          type: string
    Manifest:
      type: object
      properties:
        '@context':
          type: string
        textapi:
          type: string
        id:
          type: string
        label:
          type: string
        repository:
          type: array
          items:
            $ref: "#/components/schemas/Repository"
        license:
          type: array
          items:
            $ref: "#/components/schemas/License"
        sequence:
          type: array
          items:
            $ref: "#/components/schemas/SequenceItem"
    Manifest1:
      type: object
      properties:
        '@context':
          type: string
        textapiVersion:
          type: string
        id:
          type: string
        textapiType:
          type: string
        revision:
          type: string
        created:
          type: string
        modified:
          type: string
        titles:
          type: array
          items:
            type: string
        agents:
          type: array
          items:
            $ref: "#/components/schemas/Agent"
        license:
          type: string
        total:
          type: integer
          format: int32
        items:
          type: array
          items:
            $ref: "#/components/schemas/Item1"
    Repository:
      type: object
      properties:
        '@context':
          type: string
        label:
          type: string
        url:
          type: string
        baseUrl:
          type: string
        id:
          type: string
    SequenceItem:
      type: object
      properties:
        '@context':
          type: string
        id:
          type: string
        type:
          type: string
        label:
          type: string
    Title:
      type: object
      properties:
        '@context':
          type: string
        title:
          type: string
        type:
          type: string
paths:
  /textapi/info:
    get:
      summary: Build info & config of this service
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
      tags:
      - Text Api Resource
  /textapi/search/collection.json:
    get:
      parameters:
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Collection"
      summary: Search
      tags:
      - Text Api Resource
  /textapi/search/{q}/collection.json:
    get:
      parameters:
      - name: q
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Collection"
      summary: Search Path
      tags:
      - Text Api Resource
  /textapi/v1/info:
    get:
      summary: Build info & config of this service
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
      tags:
      - Text Api V 1 Resource
  /textapi/v1/search/collection.json:
    get:
      parameters:
      - name: q
        in: query
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Collection"
      summary: Search
      tags:
      - Text Api V 1 Resource
  /textapi/v1/search/{q}/collection.json:
    get:
      parameters:
      - name: q
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Collection"
      summary: Search Path
      tags:
      - Text Api V 1 Resource
  /textapi/v1/{id}/item.json:
    get:
      summary: Generate a TextAPI item
      description: Get aggregator URL for given TextGridUri for TEI -> HTML transformation
      parameters:
      - description: textgridUri of a single item (normally listed inside a manifest)
        example: textgrid:wmd3.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Item"
      tags:
      - Text Api V 1 Resource
  /textapi/v1/{id}/manifest.json:
    get:
      summary: Generate a TextAPI manifest
      description: "Use TextGridURI to list all items of an aggregation as TextAPI\
        \ Items, utilizing the aggregator for TEI->HTML transformation"
      parameters:
      - description: the TextGridURI to generate a manifest for
        example: textgrid:wp1j.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Manifest"
      tags:
      - Text Api V 1 Resource
  /textapi/v2/collections/{slug}:
    options:
      summary: Get options for collection endpoint
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
    head:
      summary: Check if collection exists
      parameters:
      - description: the TextGrid aggregation URI to check
        example: textgrid:3r84g.0
        name: slug
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
    get:
      summary: Retrieve a Collection
      description: Retrieve a TextAPI v2 Collection from a TextGrid aggregation URI
      parameters:
      - description: the TextGrid aggregation URI to generate a collection for
        example: textgrid:3r84g.0
        name: slug
        in: path
        required: true
        schema:
          type: string
      - description: "embed full resources instead of references (default: false)"
        example: false
        name: embedded
        in: query
        schema:
          type: boolean
      responses:
        "200":
          description: The requested Collection
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Collection1"
        "404":
          description: Not Found
        "400":
          description: Bad Request - URI is not an aggregation
        "500":
          description: Internal Server Error
      tags:
      - Text Api V 2 Resource
  /textapi/v2/info:
    get:
      summary: Build info & config of this service
      responses:
        "200":
          description: OK
          content:
            text/plain:
              schema:
                type: string
      tags:
      - Text Api V 2 Resource
  /textapi/v2/items/{id}:
    options:
      summary: Get options for item endpoint
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
    get:
      summary: Generate a TextAPI v2 item
      description: Get aggregator URL for given TextGridUri for TEI -> HTML transformation
      parameters:
      - description: textgridUri of a single item
        example: textgrid:wmd3.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: The requested Item
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Item1"
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      tags:
      - Text Api V 2 Resource
    head:
      summary: Check if item exists
      parameters:
      - description: textgridUri to check
        example: textgrid:wmd3.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
  /textapi/v2/manifests/{id}:
    options:
      summary: Get options for manifest endpoint
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
    get:
      summary: Generate a TextAPI v2 manifest
      description: Use TextGridURI to list all items of an aggregation as TextAPI
        v2 Items
      parameters:
      - description: the TextGridURI to generate a manifest for
        example: textgrid:wp1j.0
        name: id
        in: path
        required: true
        schema:
          type: string
      - description: "embed full resources instead of references (default: false)"
        example: false
        name: embedded
        in: query
        schema:
          type: boolean
      responses:
        "200":
          description: The requested Manifest
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Manifest1"
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      tags:
      - Text Api V 2 Resource
    head:
      summary: Check if manifest exists
      parameters:
      - description: the TextGridURI to check
        example: textgrid:wp1j.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
      tags:
      - Text Api V 2 Resource
  /textapi/{id}/item.json:
    get:
      summary: Generate a TextAPI item
      description: Get aggregator URL for given TextGridUri for TEI -> HTML transformation
      parameters:
      - description: textgridUri of a single item (normally listed inside a manifest)
        example: textgrid:wmd3.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Item"
      tags:
      - Text Api Resource
  /textapi/{id}/manifest.json:
    get:
      summary: Generate a TextAPI manifest
      description: "Use TextGridURI to list all items of an aggregation as TextAPI\
        \ Items, utilizing the aggregator for TEI->HTML transformation"
      parameters:
      - description: the TextGridURI to generate a manifest for
        example: textgrid:wp1j.0
        name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Manifest"
      tags:
      - Text Api Resource
info:
  title: TextGrid TextAPI Service
  version: 0.1.48
  description: "[TextAPI](https://textapi.sub.uni-goettingen.de/page/specs/) metadata\
    \ service for TextGrid resources"
  contact:
    name: Contact
    email: anfragen@textgrid.de
    url: https://textgrid.de/en/kontakt/
  license:
    name: LGPL 3.0
    url: https://www.gnu.org/licenses/lgpl-3.0.html
