openapi: 3.0.1
info:
  description: ''
  title: WorkCloud Communication Services Admin — User Profile
  contact: {}
  version: 1.29.25101.021
paths:
  /api/v1/user/profile:
    post:
      security:
        - PhoenixToken-Authorization: []
      description: Takes a user_profile JSON and store in DB. Return saved JSON.
      tags:
        - UserProfile
      summary: creates user_profile
      parameters:
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/main.UserProfileDTO'
        description: UserProfile JSON
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/main.UserProfileDTO'
  /api/v1/user/profile/assign:
    post:
      security:
        - PhoenixToken-Authorization: []
      description: |-
        Assign existing user_profile to a customer, site or user. If empty "name" provided, existing profile assignment will be removed
        The tgt_type values are: -1 - customer, 0 - user - 2 site, 3 - region
        The tgt_name is not needed if tgt_type == -1 (customer)
      tags:
        - UserProfile
      summary: assigns user_profile
      parameters:
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/main.AssignProfile'
        description: AssignProfile JSON
        required: true
      responses:
        '200':
          description: OK
  /api/v1/user/profile/list/{id}:
    get:
      security:
        - PhoenixToken-Authorization: []
      description: Lists all UserProfileDTO from the user_profile table
      tags:
        - UserProfile
      summary: View  user_profile data
      parameters:
        - description: id of existing UserProfile record
          name: id
          in: path
          required: true
          schema:
            type: integer
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/main.GetUserProfileBYIDResponseBody'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
  /api/v1/user/profile/{id}:
    put:
      security:
        - PhoenixToken-Authorization: []
      description: Updates an existing UserProfileDTO record in the user_profile table
      tags:
        - UserProfile
      summary: Updates user_profile
      parameters:
        - description: id of existing UserProfile record
          name: id
          in: path
          required: true
          schema:
            type: integer
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/main.UserProfileDTO'
        description: Updated UserProfile Info
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.UserProfileDTOResp'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
    delete:
      security:
        - PhoenixToken-Authorization: []
      description: Deletes an existing UserProfileDTO record in the user_profile table
      tags:
        - UserProfile
      summary: Deletes user_profile
      parameters:
        - description: id of existing UserProfile record
          name: id
          in: path
          required: true
          schema:
            type: integer
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/main.deleteUserProfileResponseBody'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
  /api/v1/user/profiles:
    get:
      security:
        - PhoenixToken-Authorization: []
      description: Lists all UserProfileDTO from the user_profile table
      tags:
        - UserProfile
      summary: View All user_profile
      parameters:
        - description: page number for returned records
          name: page
          in: query
          schema:
            type: integer
            default: 0
        - description: number of records to return per page.
          name: page_size
          in: query
          schema:
            type: integer
            default: 100
        - description: record field to sort by
          name: sort_by
          in: query
          schema:
            type: string
            default: id
        - description: direction to sort records
          name: sort_order
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: asc
        - description: tenant ID
          name: tenant_id
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/main.GetUserProfileResponseBody'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.HTTPStatus'
components:
  securitySchemes:
    PhoenixToken-Authorization:
      description: PhoenixToken-Authorization
      type: apiKey
      name: Authorization
      in: header
  schemas:
    dto.CustomerAdminDTO:
      type: object
      properties:
        auth_data:
          type: array
          items:
            type: integer
        auth_type:
          type: string
        clsid:
          type: string
        country:
          type: string
        created_at:
          type: string
        deleted:
          type: boolean
        description:
          type: string
        extra:
          type: array
          items:
            type: integer
        id:
          type: integer
        jwks_uri:
          type: string
        name:
          type: string
        profile:
          type: string
        tenant_id:
          type: string
        token:
          type: string
        updated_at:
          type: string
    dto.ExternalAppResponseDTO:
      type: object
      properties:
        id:
          description: External App ID, ignored when new app/user added
          type: integer
          format: int64
        name:
          description: |-
            If TRUE, this will be base webhook for site/region. External application must provide list of targets in query parameters.
             'user' an userlogin from TgtName tree
             'group' a group name from TgtName tree
             'site' a site name from TgtName tree
             'region' a region name from TgtName tree
            Base bool `json:"base"`
            External App/User name - unique for a customer
          type: string
        regionName:
          type: string
        siteName:
          description: "UserLogin    *string `db:\"userlogin\" json:\"userName,omitempty\"`\n\tGroupName    *string `db:\"name\" json:\"grpName,omitempty\"`\n\tDepName      *string `db:\"name\" json:\"depName,omitempty\"`\n\tRoleName     *string `db:\"name\" json:\"roleName,omitempty\"`\n\tLocationName *string `db:\"name\" json:\"locName,omitempty\"`"
          type: string
        url:
          description: External URL to post message
          type: string
    dto.ExternalAppUrlDTO:
      type: object
      properties:
        forum_post_url:
          description: External URL to create forum posts
          type: string
        forum_url:
          description: External URL to create forum
          type: string
        message_url:
          description: External URL to post message
          type: string
    dto.ExternalPartnerAppResponseDTO:
      type: object
      properties:
        id:
          description: External App ID, ignored when new app/user added
          type: integer
          format: int64
        name:
          description: |-
            If TRUE, this will be base webhook for site/region. External application must provide list of targets in query parameters.
             'user' an userlogin from TgtName tree
             'group' a group name from TgtName tree
             'site' a site name from TgtName tree
             'region' a region name from TgtName tree
            Base bool `json:"base"`
            External App/User name - unique for a customer
          type: string
        regionName:
          type: string
        siteName:
          description: "UserLogin    *string `db:\"userlogin\" json:\"userName,omitempty\"`\n\tGroupName    *string `db:\"name\" json:\"grpName,omitempty\"`\n\tDepName      *string `db:\"name\" json:\"depName,omitempty\"`\n\tRoleName     *string `db:\"name\" json:\"roleName,omitempty\"`\n\tLocationName *string `db:\"name\" json:\"locName,omitempty\"`"
          type: string
        webhook_urls:
          $ref: '#/components/schemas/dto.ExternalAppUrlDTO'
    dto.HTTPStatus:
      type: object
      properties:
        code:
          type: integer
          example: 0
        message:
          type: string
          example: Success
    dto.HttpHeader:
      type: object
      properties:
        name:
          type: string
        value:
          type: string
    dto.NewExternalAppDTO:
      type: object
      properties:
        name:
          description: External App/User name - unique for a customer
          type: string
        regionName:
          type: string
        siteName:
          description: "UserLogin    *string `db:\"userlogin\" json:\"userName,omitempty\"`\n\tGroupName    *string `db:\"name\" json:\"grpName,omitempty\"`\n\tDepName      *string `db:\"name\" json:\"depName,omitempty\"`\n\tRoleName     *string `db:\"name\" json:\"roleName,omitempty\"`\n\tLocationName *string `db:\"name\" json:\"locName,omitempty\"`"
          type: string
    dto.NewWebhookDTO:
      type: object
      properties:
        body:
          description: Request body
          type: string
        description:
          description: Description
          type: string
        name:
          description: External App/User name - unique for a customer
          type: string
        options:
          description: Extra request options (optional)
          allOf:
            - $ref: '#/components/schemas/dto.WebhookOptions'
        site:
          description: A site/region where this webhook can be used
          type: string
        url:
          description: Webhook Request URL
          type: string
    dto.SipDidDTO:
      type: object
      properties:
        dialplan:
          type: string
        id:
          type: integer
        targets:
          type: array
          items:
            $ref: '#/components/schemas/dto.SipDidTarget'
        trunk_id:
          type: integer
        updated_at:
          type: string
    dto.SipDidTarget:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          type: integer
    dto.SipTrunkUpdatedDTO:
      type: object
      properties:
        customer_id:
          type: integer
        id:
          type: integer
        params:
          type: array
          items:
            type: integer
        sbc_name:
          type: string
        site_id:
          type: integer
        site_name:
          type: string
        trunk_name:
          type: string
        updated_at:
          type: string
    dto.UserProfileDTOResp:
      type: object
      properties:
        customer_id:
          type: integer
        id:
          type: integer
        name:
          type: string
        value:
          type: array
          items:
            type: integer
    dto.WebhookDTO:
      type: object
      properties:
        body:
          description: Request body
          type: string
        description:
          description: Description
          type: string
        id:
          description: ID
          type: integer
          format: int64
        name:
          description: External App name. It will be recognized if added in text message as @name
          type: string
        options:
          description: Extra request options (optional)
          allOf:
            - $ref: '#/components/schemas/dto.WebhookOptions'
        site:
          description: A site/region where this webhook can be used
          type: string
        url:
          description: Webhook Request URL
          type: string
    dto.WebhookOptions:
      type: object
      properties:
        headers:
          description: Optional list of http headers
          type: array
          items:
            $ref: '#/components/schemas/dto.HttpHeader'
        method:
          description: Request method
          type: string
    main.AssignProfile:
      type: object
      properties:
        profile_name:
          type: string
        tgt_name:
          type: string
        tgt_type:
          $ref: '#/components/schemas/model.TargetType'
    main.ErrorBody:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          example:
            - '[]'
        message:
          type: string
          example: query parameters are malformed in the URI
    main.GetUserProfileBYIDResponseBody:
      type: object
      properties:
        is_tenant:
          type: boolean
        regions:
          type: array
          items:
            $ref: '#/components/schemas/model.Site'
        sites:
          type: array
          items:
            $ref: '#/components/schemas/model.Site'
        user_profile:
          $ref: '#/components/schemas/dto.UserProfileDTOResp'
        users:
          type: array
          items:
            $ref: '#/components/schemas/model.Suser'
    main.GetUserProfileResponseBody:
      type: object
      properties:
        total_rows:
          type: integer
        user_profile:
          type: array
          items:
            $ref: '#/components/schemas/dto.UserProfileDTOResp'
    main.SipTrunkDTO:
      type: object
      properties:
        params:
          type: array
          items:
            type: integer
        site_name:
          type: string
        trunk_name:
          type: string
    main.SipTrunkStatusResponseBody:
      type: object
      properties:
        details:
          type: string
        sbc_name:
          type: string
        status:
          type: integer
        trunk_id:
          type: integer
        trunk_name:
          type: string
        updated_at:
          type: string
    main.UserProfileDTO:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        value:
          type: array
          items:
            type: integer
    main.createSipDialplanInput:
      type: object
      properties:
        dialplan:
          type: string
        trunk_id:
          type: integer
    main.deleteSipDialplanResponseBody:
      type: object
      properties:
        num_rows_deleted:
          type: integer
    main.deleteSipTrunkResponseBody:
      type: object
      properties:
        num_rows_deleted:
          type: integer
    main.deleteSiteResponseBody:
      type: object
      properties:
        num_rows_deleted:
          type: integer
    main.deleteUserProfileResponseBody:
      type: object
      properties:
        num_rows_deleted:
          type: integer
    main.getCustomerResponseBody:
      type: object
      properties:
        customers:
          type: array
          items:
            $ref: '#/components/schemas/dto.CustomerAdminDTO'
        total_rows:
          type: integer
    main.getDeviceResponseBody:
      type: object
      properties:
        devices:
          type: array
          items:
            $ref: '#/components/schemas/model.Device'
        total_rows:
          type: integer
    main.getGroupInfoResponseBody:
      type: object
      properties:
        group_info:
          type: array
          items:
            $ref: '#/components/schemas/model.GroupInfo'
        total_rows:
          type: integer
    main.getGroupTargetResponseBody:
      type: object
      properties:
        group_targets:
          type: array
          items:
            $ref: '#/components/schemas/model.GroupTarget'
        total_rows:
          type: integer
    main.getRegionResponseBody:
      type: object
      properties:
        region:
          $ref: '#/components/schemas/model.Site'
    main.getRegionsResponseBody:
      type: object
      properties:
        regions:
          type: array
          items:
            $ref: '#/components/schemas/model.Site'
        total_rows:
          type: integer
    main.getSBCResponseBody:
      type: object
      properties:
        sbc:
          type: array
          items:
            $ref: '#/components/schemas/model.Sbc'
        total_rows:
          type: integer
    main.getSIPTrunkResponseBody:
      type: object
      properties:
        sip_trunks:
          type: array
          items:
            $ref: '#/components/schemas/dto.SipTrunkUpdatedDTO'
        total_rows:
          type: integer
    main.getSipDialplanResponseBody:
      type: object
      properties:
        sip_dialplans:
          type: array
          items:
            $ref: '#/components/schemas/model.SipDialplan'
        total_rows:
          type: integer
    main.getSipDidResponseBody:
      type: object
      properties:
        sip_dids:
          type: array
          items:
            $ref: '#/components/schemas/dto.SipDidDTO'
        total_rows:
          type: integer
    main.getSiteResponseBody:
      type: object
      properties:
        sites:
          type: array
          items:
            $ref: '#/components/schemas/model.Site'
        total_rows:
          type: integer
    main.getSuserResponseBody:
      type: object
      properties:
        susers:
          type: array
          items:
            $ref: '#/components/schemas/model.Suser'
        total_rows:
          type: integer
    main.pbxType:
      type: object
      properties:
        display_name:
          type: string
        profile_type:
          type: string
    main.sipDidInput:
      type: object
      properties:
        dialplan:
          type: string
        targets:
          type: array
          items:
            $ref: '#/components/schemas/dto.SipDidTarget'
        trunk_id:
          type: integer
    main.sipDidUpdate:
      type: object
      properties:
        dialplan:
          type: string
        targets:
          type: array
          items:
            $ref: '#/components/schemas/dto.SipDidTarget'
    main.updateSipDialplanInput:
      type: object
      properties:
        dialplan:
          type: string
    model.ConfigParameter:
      type: object
      properties:
        category:
          type: string
        description:
          type: string
        domain:
          type: string
        groupname:
          type: string
        param_default:
          type: string
        param_key:
          type: string
        param_max:
          type: string
        param_min:
          type: string
        param_type:
          type: string
        param_values:
          type: string
        scope:
          type: string
        shown_on_client:
          type: boolean
        updated_at:
          type: string
    model.Customer:
      type: object
      properties:
        auth_data:
          type: string
        auth_type:
          type: string
        clsid:
          type: string
        country:
          type: string
        created_at:
          type: string
        deleted:
          type: boolean
        description:
          type: string
        extra:
          type: string
        id:
          type: integer
        jwks_uri:
          type: string
        name:
          type: string
        profile:
          type: string
        tenant_id:
          type: string
        token:
          type: string
        updated_at:
          type: string
    model.Device:
      type: object
      properties:
        created_at:
          type: string
        customer_id:
          type: integer
        deleted:
          type: boolean
        did:
          type: string
        id:
          type: integer
        model:
          type: string
        os:
          type: string
        site_id:
          type: integer
        state:
          type: integer
        updated_at:
          type: string
        version:
          type: string
    model.GroupInfo:
      type: object
      properties:
        created_at:
          type: string
        customer_id:
          type: integer
        deleted:
          type: boolean
        description:
          type: string
        group_type:
          type: integer
        id:
          type: integer
        logo:
          type: string
        name:
          type: string
        open:
          type: boolean
        pl_group_id:
          type: string
        site_id:
          type: integer
        updated_at:
          type: string
    model.GroupTarget:
      type: object
      properties:
        dep_id:
          type: integer
        extension:
          type: string
        group_id:
          type: integer
        grp_id:
          type: integer
        id:
          type: integer
        loc_id:
          type: integer
        region_id:
          type: integer
        role_id:
          type: integer
        site_id:
          type: integer
        tgt_perm:
          type: string
        user_id:
          type: integer
    model.Sbc:
      type: object
      properties:
        description:
          type: string
        name:
          type: string
        registered:
          type: integer
        total:
          type: integer
        updated_at:
          type: string
    model.SipDialplan:
      type: object
      properties:
        dialplan:
          type: string
        id:
          type: integer
        trunk_id:
          type: integer
        updated_at:
          type: string
    model.Site:
      type: object
      properties:
        created_at:
          type: string
        customer_id:
          type: integer
        deleted:
          type: boolean
        description:
          type: string
        display_name:
          type: string
        domain:
          type: string
        id:
          type: integer
        name:
          type: string
        parent:
          type: integer
        part:
          type: integer
        profile:
          type: string
        site_type:
          type: integer
        updated_at:
          type: string
    model.Suser:
      type: object
      properties:
        alias:
          type: string
        created_at:
          type: string
        customer_id:
          type: integer
        deleted:
          type: boolean
        email:
          type: string
        firstname:
          type: string
        id:
          type: integer
        language:
          type: string
        lastname:
          type: string
        oauthname:
          type: string
        phone:
          type: string
        photo:
          type: string
        platform_user_id:
          type: string
        profile:
          type: string
        shared_secret:
          type: string
        site_id:
          type: integer
        updated_at:
          type: string
        user_type:
          type: integer
        userlogin:
          type: string
    model.TargetType:
      type: integer
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 10
      x-enum-varnames:
        - TgtTypeUser
        - TgtTypeGroup
        - TgtTypeSite
        - TgtTypeRegion
        - TgtTypeLocation
        - TgtTypeAddHocLocation
        - TgtTypeDepartment
        - TgtTypeRole
        - TgtTypeSip
    model.TwilioAccount:
      type: object
      properties:
        created_at:
          type: string
        customer_id:
          type: integer
        deleted:
          type: boolean
        description:
          type: string
        id:
          type: integer
        name:
          type: string
        response:
          type: string
        sid:
          type: string
        token:
          type: string
        url:
          type: string
    rmq.SetLogLevelMessage:
      type: object
      properties:
        component:
          description: 'pod name or prefix: zac-zsfs-0, zac-zsfs,..., "all" - applies to all component'
          type: string
        level:
          description: 'log level string: trace, debug, ...'
          type: string
