---
openapi: 3.0.0
info:
  title: Session
  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
    Register:
      title: Register
      type: object
      properties:
        username:
          type: string
          format: email
          description: username of the user that wants to create a new register
        new_username:
          type: string
          format: email
          description: new username of the user that wants to modify its username
        password:
          type: string
          description: password of the user that wants to create a new register
        new_password:
          type: string
          description: new password of the user that wants to modify its password
        captcha:
          type: string
          description: captcha used to find if the user is not a bot
        language:
          type: string
          description: language used by the user
        meta:
          type: object
          description: Meta data of the object
      additionalProperties: false
      description: This service is used to manage creation and deletion of users,
        recovery password and change of email
    Session:
      title: Session
      type: object
      properties:
        username:
          type: string
          description: Username of the user that wants to create a new session
        password:
          type: string
          description: Password of the user that wants to create a new session
        remember_me:
          type: boolean
          description: If false the session will be alived for one hour, if true the
            session will be alived for 31 days
          example: false
        system:
          type: string
          description: System information about the login used
        captcha:
          type: string
          description: Captcha code that becomes mandatory if a session fails to be
            valid after three tentatives
        type:
          type: string
          description: Type of session
          example: user
        provider:
          type: string
          description: Provider used to login
          example: email
        firebase_token:
          type: string
          description: Firebase token that an user can use to login
        credentials:
          type: object
          additionalProperties: false
          properties:
            access_token:
              type: string
            id_token:
              type: string
            secret:
              type: string
          required:
          - access_token
          description: Credentials can be sent by Firebase for future connection with
            third party service
        upgrade:
          type: boolean
          description: If true, it can be used to upgrade the user
          example: true
        to_upgrade:
          type: boolean
          description: If true, it means that the user can be upgraded
          example: false
        meta:
          type: object
          description: Meta data of the object
          example:
            deprecated: true
            id: 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
            type: session
            version: '2.0'
      additionalProperties: false
      description: A Session is used to create and maintains a connection with the
        services connected with the User. The obtained session ID needs to be used
        in the X-session headers of each next HTTP requests
  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: Session
  description: A Session is used to create and maintains a connection with the services
    connected with the User. The obtained session ID needs to be used in the X-session
    headers of each next HTTP requests
- name: Register
  description: This service is used to manage creation and deletion of users, recovery
    password and change of email
paths:
  "/register":
    post:
      tags:
      - Register
      summary: Register user
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Register"
            example:
              username: test_noma_connelly@seluxit.com
              password: JTSshW2D3p6WkG
              captcha: 03AOmkcwKB1FraVcJF1NxxDSrfCyb88U4QNj8i8tnNqtOyVdbfLRce2FfrVYNUBcObTxFXalo_aN7er-ULF5JBnjmLMrxTfHUy9o-VXJz4yG5jIkfn_L1cNAtD6Ud-K5izTcjriVtqHwyXydjLyXeW5-HZCl2HyvWk0p0DHUgQlmBEXA3DKjdUh9Yzx82FAxNFw0mgD7ohxg18EYm7W-yIvBRH7FXysuK8Aut_vZWHnYJj9JXKSFt2Gws5-pm9VBVn_RtGU2_4g-wiTKAgn9gr6QIXOQjMW3xjSleOQ0HOr_wqYgFGdgwdiJDtJkne6Vk6Dy41-9_WDrInDTQpDeTSQsjZyG38gnkiV_GmdM5DuxxHmmuLdsBVHH9e-Qo3u3Zt8t4N20rdsspbYV86UMjA2g-YR0S_OJBZPndOnJFr3jqkzRnBOpEfZy0
      responses:
        '200':
          description: New user submitted. Access your email to verify your account
  "/register/confirm_registration/:token":
    get:
      tags:
      - Register
      summary: Confirm registration
      parameters:
      - "$ref": "#/components/parameters/url_hex"
      responses:
        '200':
          description: Registration completed. You can now login
  "/register/recovery_password":
    patch:
      tags:
      - Register
      summary: Recover password
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Register"
            example:
              username: test_noma_connelly@seluxit.com
      responses:
        '200':
          description: New recovery password email has been sent. The link will expire
            in 24h
  "/register/change_password/:token":
    patch:
      tags:
      - Register
      summary: Change password with recovery
      parameters:
      - "$ref": "#/components/parameters/url_hex"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Register"
            example:
              new_password: c3KBQeGEAz
      responses:
        '200':
          description: Password changed successfully
  "/register/:id":
    patch:
      tags:
      - Register
      summary: Change password
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Register"
            example:
              meta:
                id: af81f8af-48ec-47c0-ab0b-2995a9554691
              username: test_noma_connelly@seluxit.com
              new_username: test_quentin_doyle@seluxit.com
              password: c3KBQeGEAz
              new_password: 6PSqq9OmZQG
      responses:
        '200':
          description: New email submitted. The link will expire in 24h
  "/register/confirm_new_username/:token":
    get:
      tags:
      - Register
      summary: Confirm new username
      parameters:
      - "$ref": "#/components/parameters/url_hex"
      responses:
        '200':
          description: Email changed successfully
  "/register/delete_user":
    patch:
      tags:
      - Register
      summary: Ask deletion user
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Register"
            example:
              username: test_ada_lebsack@seluxit.com
      responses:
        '200':
          description: New delete email has been sent. The link will expire in 24h
  "/register/confirm_deletion_user/:token":
    delete:
      tags:
      - Register
      summary: Confirm deletion user
      parameters:
      - "$ref": "#/components/parameters/url_hex"
      responses:
        '200':
          description: User deleted successfully
  "/session":
    post:
      tags:
      - Session
      summary: Create a new session
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Session"
            example:
              username: test_jordan_heathcote@seluxit.com
              password: D6wUBI32VXPEh
              remember_me: true
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Session"
              example:
                remember_me: false
                type: user
                provider: email
                meta:
                  deprecated: true
                  id: 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                  type: session
                  version: '2.0'
                to_upgrade: false
                upgrade: true
    get:
      tags:
      - Session
      summary: Retrieve list of session
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Idlist"
              example:
                child:
                - type: session
                  version: '2.0'
                id:
                - 1d554a50-cac1-47d5-b758-24989886b72e
                - 441b9c00-b857-4131-b82c-864992afbae6
                - 455c0e7a-afba-4ccb-9054-8a12caf7aea0
                - 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                - 91ec82e7-2375-4d07-8e8f-cbe69f8954f9
                - 98f9bcc6-fdd0-4918-a785-8bbf9dbb7d90
                more: false
                limit: 1000
                count: 6
                meta:
                  type: idlist
                  version: '2.0'
    head:
      tags:
      - Session
      summary: Check if list of session is retrievable
      parameters: []
      responses:
        '200':
          description: OK
    delete:
      tags:
      - Session
      summary: Delete all session
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - 1d554a50-cac1-47d5-b758-24989886b72e
                - 441b9c00-b857-4131-b82c-864992afbae6
                - 455c0e7a-afba-4ccb-9054-8a12caf7aea0
                - 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                - 91ec82e7-2375-4d07-8e8f-cbe69f8954f9
                - 98f9bcc6-fdd0-4918-a785-8bbf9dbb7d90
                code: 105000004
                message: Cleared
                internal_code: documentstore_cleared
                meta:
                  type: deletelist
                  version: '2.0'
  "/session/:id":
    get:
      tags:
      - Session
      summary: Retrieve session by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Session"
              example:
                remember_me: false
                type: user
                provider: email
                meta:
                  deprecated: true
                  id: 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                  type: session
                  version: '2.0'
                to_upgrade: false
                upgrade: true
    head:
      tags:
      - Session
      summary: Check if session by ID is retrievable
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
    patch:
      tags:
      - Session
      summary: Update an session by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Session"
            example:
              remember_me: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Session"
              example:
                remember_me: true
                type: user
                provider: email
                meta:
                  deprecated: true
                  id: 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                  type: session
                  version: '2.0'
                to_upgrade: false
                upgrade: true
    put:
      tags:
      - Session
      summary: Replace an session by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Session"
            example:
              remember_me: false
              username: test_jordan_heathcote@seluxit.com
              password: D6wUBI32VXPEh
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Session"
              example:
                remember_me: false
                type: user
                provider: email
                meta:
                  deprecated: true
                  id: 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                  type: session
                  version: '2.0'
                to_upgrade: false
                upgrade: true
    delete:
      tags:
      - Session
      summary: Delete an session by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - 8c0fb2dd-8f68-4748-b5bd-e9f4581036b6
                code: 105000003
                message: Deleted
                internal_code: documentstore_deleted
                meta:
                  type: deletelist
                  version: '2.0'
