---
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
    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"
    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"
    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"
    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/{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.39
  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
