openapi: 3.1.0
info:
  title: AbaNinja Members API - Groups
  version: 3.0.0
  x-domain-id: members
servers:
  - url: https://api.abaninja.ch
    description: The AbaNinja API server
tags:
  - name: member-groups
    description: Manage member groups
    x-displayName: Member Groups
security:
  - ApiToken: []
paths:
  /accounts/{accountUuid}/members/v2/member-groups:
    get:
      tags:
        - member-groups
      summary: Get member groups
      description: Get the member groups
      operationId: members_list_member_groups_2
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: page
          in: query
          schema:
            type:
              - integer
              - 'null'
            default: 1
            minimum: 1
        - name: perPage
          in: query
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    type: array
                    items:
                      title: Member Group Resource
                      properties:
                        uuid:
                          type: string
                          format: uuid
                        name:
                          type: string
                        color:
                          description: Hexadecimal color
                          type: string
                      type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    properties:
                      pagination:
                        properties:
                          currentPage:
                            type: integer
                            minimum: 1
                          firstPageUrl:
                            type:
                              - string
                              - 'null'
                            format: uri
                          from:
                            type:
                              - integer
                              - 'null'
                            example: 1
                          lastPage:
                            type: integer
                          lastPageUrl:
                            type: string
                            format: uri
                          nextPageUrl:
                            type:
                              - string
                              - 'null'
                            format: uri
                          perPage:
                            type: integer
                            example: 50
                          previousPageUrl:
                            type:
                              - string
                              - 'null'
                            format: uri
                          to:
                            type:
                              - integer
                              - 'null'
                            example: 50
                          totalItems:
                            type: integer
                        type: object
                    type: object
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/members
      x-legacy-operation-id: fe2192b12051a15a90cbc50aca18b65c
      x-required-scopes:
        - members
    post:
      tags:
        - member-groups
      summary: Create member group
      description: Create a new member group
      operationId: members_create_member_groups
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Create member group
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: https://api.abaninja.ch/schemas/2.0.0/member-group.create.schema.json
              description: A schema for creating a member group
              type: object
              additionalProperties: false
              properties:
                name:
                  type:
                    - string
                  minLength: 1
                  maxLength: 255
                color:
                  type:
                    - string
                  pattern: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
              required:
                - name
                - color
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Member Group Resource
                    properties:
                      uuid:
                        type: string
                        format: uuid
                      name:
                        type: string
                      color:
                        description: Hexadecimal color
                        type: string
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 201
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/members
      x-legacy-operation-id: 99b267372c8dc0c54f1d935c67ce72cb
      x-required-scopes:
        - members
  /accounts/{accountUuid}/members/v2/member-groups/{memberGroupUuid}:
    get:
      tags:
        - member-groups
      summary: Get member group
      description: Get a member group
      operationId: members_get_member_groups
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: memberGroupUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Member Group Resource
                    properties:
                      uuid:
                        type: string
                        format: uuid
                      name:
                        type: string
                      color:
                        description: Hexadecimal color
                        type: string
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/members
      x-legacy-operation-id: 767a0ce2721126d4ec2c33db103a10be
      x-required-scopes:
        - members
    patch:
      tags:
        - member-groups
      summary: Update member group
      description: Update a member group
      operationId: members_update_member_groups_2
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: memberGroupUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Update member group
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: https://api.abaninja.ch/schemas/2.0.0/member-group.update.schema.json
              description: A schema for updating a member group
              type: object
              minProperties: 1
              additionalProperties: false
              properties:
                name:
                  type:
                    - string
                  minLength: 1
                  maxLength: 255
                color:
                  type:
                    - string
                  pattern: ^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
              required: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    title: Member Group Resource
                    properties:
                      uuid:
                        type: string
                        format: uuid
                      name:
                        type: string
                      color:
                        description: Hexadecimal color
                        type: string
                    type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/members
      x-legacy-operation-id: ece9f2baec0452ee133163a7e893b5d6
      x-required-scopes:
        - members
    delete:
      tags:
        - member-groups
      summary: Delete member group
      description: Delete a member group
      operationId: members_delete_member_groups
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: memberGroupUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: Successful response
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/members
      x-legacy-operation-id: fb68e14cb896f5db19de8e62bfe8acc7
      x-required-scopes:
        - members
components:
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Create tokens in Settings > API Token.
