---
openapi: 3.0.0
info:
  title: User
  version: '2.0'
servers:
- url: https://wappsto.com/services/2.0
  description: Server to connect to the API
components:
  schemas:
    Deletelist:
      title: Deletelist
      type: object
      properties:
        deleted:
          type: array
          items:
            type: string
          description: List of deleted objects
        child_deleted:
          type: array
          items:
            type: string
          description: List of deleted children object related to the chosen objects
            to delete
        shared_deleted:
          type: array
          items:
            type: string
          description: List of removed objects previosly shared and accepted by the
            user
        shared_child_deleted:
          type: array
          items:
            type: string
          description: List of removed children objects previosly shared and accepted
            by the user related to the chosen objects to delete
        not_deleted:
          type: array
          items:
            type: string
          description: List of not deleted objects
        child_not_deleted:
          type: array
          items:
            type: string
          description: List of not deleted children object related to the chosen objects
            to delete
        shared_not_deleted:
          type: array
          items:
            type: string
          description: List of not removed objects previosly shared and accepted by
            the user
        shared_child_not_deleted:
          type: array
          items:
            type: string
          description: List of not removed children objects previosly shared and accepted
            by the user related to the chosen objects to delete
        pending:
          type: array
          items:
            type: string
          description: List of objects that will be deleted eventually
        child_pending:
          type: array
          items:
            type: string
          description: List of children objects that will be deleted eventually
        owned_not_deleted_because_it_has_parent:
          type: array
          items:
            type: string
          description: List of owned object not deleted since they have a parent
        shared_not_deleted_because_it_has_parent:
          type: array
          items:
            type: string
          description: List of shared object not deleted since they have a parent
        code:
          type: integer
          description: Code of the deletion
        message:
          type: string
          description: Final status of the deletion
        error:
          type: string
          description: Possible incurred errors
        meta:
          type: object
          description: Meta data of the object
        unsuccessful:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              message:
                type: string
              data:
                type: object
          description: An array that includes a more deep description about the reason
            of unsuccessful deletions
      additionalProperties: false
      description: Output obtained when one or multiple objects are deleted with a
        DELETE request
    Httpresponse:
      title: Httpresponse
      type: object
      properties:
        message:
          type: string
          description: Message of the error
        data:
          type: object
          description: More information about the error
        code:
          type: integer
          description: Identifier code of the error
        service:
          type: string
          description: Service that sent the error
        meta:
          type: object
          description: Meta data of the object
      additionalProperties: false
      description: Output obtain when a fast communication is returned (usually an
        error)
    Idlist:
      title: Idlist
      type: object
      properties:
        id:
          items:
            type: string
            pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          type: array
          description: Ids found
        more:
          type: boolean
          description: If true, it means that using offset it is possible to retrieve
            other values
        limit:
          type: integer
          multipleOf: 1
          minimum: 1
          description: Limit used to retrieve the ids
        count:
          type: integer
          multipleOf: 1
          minimum: 0
          description: Number of ids returned
        data:
          type: object
          description: Further information in relation of the service
        child:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              version:
                type: string
                pattern: "(\\d+)\\.(\\d+)"
          description: It is an array that gives a brief description of the type and
            the version of the retrieved objects
        meta:
          type: object
      additionalProperties: false
      description: Output obtain when a list is returned
    Fetch:
      title: Fetch
      type: object
      properties:
        filter:
          type: object
        return:
          type: string
          description: A graphQL string that describes the format it needs to be returned
        table:
          type: boolean
          description: If true, use iot table to fetch the data
        data:
          type: object
          description: The output obtained after filtering and parsing the results
            with the GraphQL request
        meta:
          type: object
          description: Meta data of the object
      additionalProperties: false
      description: Output obtained when the input is a fetch request
    User:
      title: User
      type: object
      properties:
        first_name:
          type: string
          description: First name of the user
          example: William
        last_name:
          type: string
          description: Last name of the user
          example: Shakespeare
        email:
          type: string
          format: email
          description: Email of the user
          example: test_minta_greenfelder@seluxit.com
        phone:
          type: string
          description: Phone of the user
        name:
          type: string
          description: Name of the user
          example: test_minta_greenfelder@seluxit.com
        role:
          type: string
          description: Role of the user
          example: writer
        nickname:
          type: string
          description: Nickname of the user
        language:
          type: string
          description: Language chosen by the user
          example: en
        friend:
          type: boolean
          description: Returns if the user is a friend or not
          example: false
        blocked:
          type: boolean
          description: Returns if the user is blocked or not
          example: false
        oem:
          type: string
          description: Oem used by the user
        provider:
          items:
            type: object
            additionalProperties: false
            properties:
              name:
                type: string
              picture:
                type: string
              type:
                type: string
            required:
            - name
            - type
          type: array
          description: Providers connected with the usre
          example: []
        card:
          type: object
          additionalProperties: false
          properties:
            active:
              type: boolean
            status:
              type: string
              enum:
              - pending
            last4:
              type: string
            brand:
              type: string
            gateway:
              type: string
              enum:
              - stripe
            stripe:
              type: object
              additionalProperties: false
              properties:
                token:
                  type: string
          description: Card saved under the user
        subscription:
          type: object
          additionalProperties: false
          properties:
            plan_id:
              type: string
              pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            new_plan_id:
              type: string
              pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            created:
              type: string
              format: date-time
            last_update:
              type: string
              format: date-time
            next_update:
              type: string
              format: date-time
            renew:
              type: boolean
            status:
              type: string
              enum:
              - pending
            gateway:
              type: string
          description: Payment plan chose by the user
        public:
          items:
            type: string
            enum:
            - nickname
            - first_name
            - last_name
            - email
            - phone
            - role
          type: array
          description: List of attributes hat are available publicly
          example:
          - first_name
          - last_name
          - role
        meta:
          type: object
          description: Meta data of the object
          example:
            deprecated: true
            id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
            type: user
            version: '2.0'
      additionalProperties: false
      description: A user is the avatar of a real human user or an installation. It
        is used to manage the different services that an user can manage. Each object
        that an user owns will be assigned to the user by an unique ownership.
  parameters:
    url_id:
      name: :id
      in: path
      required: true
      description: Id of the given object
      schema:
        type: string
        pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    url_hex:
      name: :token
      in: path
      required: true
      description: Token used for some operation
      schema:
        type: string
        pattern: "^[0-9a-fA-F]{64}$"
tags:
- name: User
  description: A user is the avatar of a real human user or an installation. It is
    used to manage the different services that an user can manage. Each object that
    an user owns will be assigned to the user by an unique ownership.
paths:
  "/user/me":
    get:
      tags:
      - User
      summary: Retrieve itself
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/User"
              example:
                first_name: William
                last_name: Shakespeare
                email: test_minta_greenfelder@seluxit.com
                name: test_minta_greenfelder@seluxit.com
                role: writer
                language: en
                friend: false
                blocked: false
                provider: []
                public:
                - first_name
                - last_name
                - role
                meta:
                  deprecated: true
                  id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
                  type: user
                  version: '2.0'
  "/user/:id":
    get:
      tags:
      - User
      summary: Retrieve user by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/User"
              example:
                first_name: William
                last_name: Shakespeare
                email: test_minta_greenfelder@seluxit.com
                name: test_minta_greenfelder@seluxit.com
                role: writer
                language: en
                friend: false
                blocked: false
                provider: []
                public:
                - first_name
                - last_name
                - role
                meta:
                  deprecated: true
                  id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
                  type: user
                  version: '2.0'
    head:
      tags:
      - User
      summary: Check if user by ID is retrievable
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
    patch:
      tags:
      - User
      summary: Update an user by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/User"
            example:
              first_name: KCB Gel Air Adapter
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/User"
              example:
                first_name: KCB Gel Air Adapter
                last_name: Shakespeare
                email: test_minta_greenfelder@seluxit.com
                name: test_minta_greenfelder@seluxit.com
                role: writer
                language: en
                friend: false
                blocked: false
                provider: []
                public:
                - first_name
                - last_name
                - role
                meta:
                  deprecated: true
                  id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
                  type: user
                  version: '2.0'
    put:
      tags:
      - User
      summary: Replace an user by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/User"
            example:
              first_name: Subsync Input Amplifier
              last_name: Shakespeare
              email: test_minta_greenfelder@seluxit.com
              name: test_minta_greenfelder@seluxit.com
              role: writer
              language: en
              friend: false
              blocked: false
              provider: []
              public:
              - first_name
              - last_name
              - role
              meta:
                deprecated: true
                id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
                type: user
                version: '2.0'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/User"
              example:
                first_name: Subsync Input Amplifier
                last_name: Shakespeare
                email: test_minta_greenfelder@seluxit.com
                name: test_minta_greenfelder@seluxit.com
                role: writer
                language: en
                friend: false
                blocked: false
                provider: []
                public:
                - first_name
                - last_name
                - role
                meta:
                  deprecated: true
                  id: 76bbe41e-bda3-466c-83c1-aecd47040ad8
                  type: user
                  version: '2.0'
    post:
      tags:
      - User
      summary: Accept shared user
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/User"
            example: {}
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/User"
              example:
                first_name: Luigi
                name: test_christene_rice@seluxit.com
                role: writer
                language: en
                friend: false
                blocked: false
                public:
                - first_name
                - role
                meta:
                  deprecated: true
                  id: e75390a5-4f51-4f95-a705-520b6cdcc02f
                  type: user
                  version: '2.0'
  "/user":
    get:
      tags:
      - User
      summary: Retrieve list of user
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Idlist"
              example:
                child:
                - type: user
                  version: '2.0'
                id:
                - 76bbe41e-bda3-466c-83c1-aecd47040ad8
                - 2f0741ff-7871-47d8-82eb-b7781cd5729e
                - 86bd9ab9-1143-4db6-8e35-60c4be5ba01b
                more: false
                limit: 1000
                count: 3
                meta:
                  type: idlist
                  version: '2.0'
    head:
      tags:
      - User
      summary: Check if list of user is retrievable
      parameters: []
      responses:
        '200':
          description: OK
