openapi: 3.1.0
info:
  title: Aggregator API
  description: '* Endpoints for Aggregator Partners'
servers:
  - url: https://open-api-demo.open-api.perfectgym.com
    description: Demo tenant
security:
  - ApiKeyAuth: []
tags:
  - name: Aggregator API
    description: Endpoints for Aggregator Partners
paths:
  /v1/aggregators/member:
    post:
      tags:
        - Aggregator API
      summary: Create aggregator member
      description: |-
        Required Scopes: `AGGREGATOR_MEMBER_WRITE`

        Returns id of new aggregator member
      operationId: createAggregatorMember
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterAggregatorMemberRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegisterAggregatorMemberResponse'
        '400':
          description: Validation of the request failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Authentication failed. No api-key, wrong api-key or wrong header
            name.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Authorization failed. The caller has no privilege to the given
            resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Entity does not exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Access denied - rate limit is exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected system error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      properties:
        errorMessage:
          type: string
          description: Resolved message in the context-specific default locale
        errorCode:
          type: string
          description: Key for translation files
        traceId:
          type: string
          description: Datadog trace id
        args:
          type: array
          description: >-
            Arguments referenced by format specifiers while resolving the
            message from translation files
          items: {}
        typedArgs:
          type: array
          description: Same as `args` but with type information
          items:
            $ref: '#/components/schemas/TypedArgumentDto'
      required:
        - errorMessage
    TypedArgumentDto:
      properties:
        value: {}
        type:
          type: string
          enum:
            - TIMESTAMP
            - BOOLEAN
            - DATE
            - MONTH_DAY
            - TIME
            - TERM
            - TERM_LIST
            - INTEGER
            - DECIMAL
            - STRING
            - MONEY
            - LIMITABLE_CONFIG_PROPERTY
            - I18N_KEY
            - I18N_KEY_LIST
            - PERMISSION_LIST
            - ENUM
            - AVAILABILITY_LIST
    RegisterAggregatorMemberRequest:
      description: Aggregator member data
      properties:
        aggregatorId:
          type: string
          description: Customer aggregator id
          example: fc336b0b-409c-4c66-a26d-ab25b87dcb8f
        firstName:
          type: string
          description: First name of the customer
          example: Edgar
        lastName:
          type: string
          description: Last name of the customer
          example: Bullock
        email:
          type: string
          description: Customer email
          example: example@email.com
        dateOfBirth:
          type: string
          format: date
          description: Birthday of the customer
          example: '1952-05-04'
        gender:
          type: string
          description: Gender of the customer
          enum:
            - MALE
            - FEMALE
            - UNISEX
          example: MALE
          x-enumDescriptions:
            MALE: Male gender of the customer
            FEMALE: Female gender of the customer
            UNISEX: Unisex gender of the customer
        phonePrivate:
          type: string
          description: Private phone number of the customer
          example: +49 30901820
        phonePrivateMobile:
          type: string
          description: Private mobile phone number of the customer
          example: +49 15223433333
        phoneBusiness:
          type: string
          description: Business phone number of the customer
          example: +49 30901820
        phoneBusinessMobile:
          type: string
          description: Business mobile phone number of the customer
          example: +49 15223433333
        street:
          type: string
          description: Street of the customer
          example: Am Bahnhof
        houseNumber:
          type: string
          description: Number of the customer's house
          example: 89a
        zipCode:
          type: string
          description: Zip code of the customer
          example: '12133'
        city:
          type: string
          description: City of the customer
          example: Munich
        country:
          type: string
          format: ISO 3166-1
          description: Country code of the customer
          example: DE
      required:
        - aggregatorId
        - firstName
        - lastName
    RegisterAggregatorMemberResponse:
      description: Aggregator member's creation response
      properties:
        customerId:
          type: integer
          format: int64
          description: Id of created customer
          example: 20322323
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: API key received from our team
      name: X-API-KEY
      in: header
