openapi: 3.0.1
info:
  title: services/user/v2/accesspoint.proto
  version: version not set
tags:
  - name: AccesspointService
security:
  - Authorization: []
paths:
  /users/accesspoints:
    get:
      summary: List all the accesspoints (Paginated and w/ Filter)
      description: 'Permission Level: Read'
      operationId: AccesspointService_ListAccesspoints
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AccesspointsResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: tenantId
          in: query
          required: false
          schema:
            type: string
      tags:
        - AccesspointService
    delete:
      summary: |-
        Deletes a list of accesspoints of a tenant.
        This method will try to delete all accesspoints in the list, even if an error happens.
      description: 'Permission Level: Read Write'
      operationId: AccesspointService_DeleteAccesspoints
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: tenantId
          description: tenant ID of the accesspoints to delete
          in: query
          required: false
          schema:
            type: string
      tags:
        - AccesspointService
    post:
      summary: Creates a new accesspoint. bssid and tenant are required.
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_CreateAccesspoint
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AccesspointResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2CreateAccesspointRequest'
        required: true
      tags:
        - AccesspointService
  /users/accesspoints/batches/{batchId}/changelog:
    get:
      summary: Get change log info by batch_id for bulk CSV uploaded accesspoints. batch_id and tenant required.
      description: 'Permission Level: Read'
      operationId: AccesspointService_GetTemplatedChangeLog
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2GetChangeLogResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: batchId
          description: 'batch_id of the batch for change log, Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'tenant_id of the accesspoints in batch, Required: false'
          in: query
          required: false
          schema:
            type: string
      tags:
        - AccesspointService
  /users/accesspoints/bulk:
    post:
      summary: Create multiple accesspoints. Any invalid format accesspoints return a list of errors.
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_CreateAccesspoints
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2CreateAccesspointsRequest'
        required: true
      tags:
        - AccesspointService
    put:
      summary: Bulk update that updates all the accesspoints with valid update field values and return a list of errors
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_UpdateAccesspoints
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2UpdateAccesspointsRequest'
        required: true
      tags:
        - AccesspointService
  /users/accesspoints/csv:
    post:
      summary: Upload accesspoints via a CSV file.
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_CreateAccesspointsFromCsv
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2CreateAccesspointsFromCsvResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2CreateAccesspointsFromCsvRequest'
        description: ' (streaming inputs)'
        required: true
      tags:
        - AccesspointService
  /users/accesspoints/{bssid}:
    get:
      summary: Get a Accesspoint by a bssid and tenant_id
      description: 'Permission Level: Read'
      operationId: AccesspointService_GetAccesspoint
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AccesspointResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: bssid
          description: 'bssid of the accesspoint to get details, Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'tenant of the accesspoint, Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: siteId
          description: 'ID for the site (such as a store) in which the access point is located, Required: true'
          in: query
          required: false
          schema:
            type: string
      tags:
        - AccesspointService
    delete:
      summary: Deletes a accesspoint by bssid and tenant
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_DeleteAccesspoint
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: bssid
          description: 'BSSID of the accesspoint to delete, Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: tenant ID of the accesspoint to delete
          in: query
          required: false
          schema:
            type: string
        - name: siteId
          description: 'ID for the site (such as a store) in which the access point is located, Required: true'
          in: query
          required: false
          schema:
            type: string
      tags:
        - AccesspointService
    put:
      summary: Updates a accesspoint. bssid, tenant and accesspoint fields to update are required.
      description: 'Permission Level: Read-Write'
      operationId: AccesspointService_UpdateAccesspoint
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AccesspointResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: bssid
          description: 'Unique ID of the accesspoint to update, Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccesspointServiceUpdateAccesspointBody'
        required: true
      tags:
        - AccesspointService
  /users/batches/{batchId}/accesspoints:
    get:
      summary: List CSV-uploaded accesspoints by the batchID of their upload (Paginated and w/ Filter)
      description: 'Permission Level: Read'
      operationId: AccesspointService_ListAccesspointsFromCsv
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AccesspointsResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: batchId
          description: 'batch_id of all the accesspoints, Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'Tenant of the accesspoints, Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: pageSize
          description: 'Page Size, Default: 10, Required: false'
          in: query
          required: false
          schema:
            type: integer
            format: int32
        - name: pageNumber
          description: 'Page number of the search results, Default: 0, Required: false'
          in: query
          required: false
          schema:
            type: integer
            format: int32
        - name: sortField
          description: 'List of sort fields, Default: accesspointId, Required: false'
          in: query
          required: false
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: sortType
          description: 'Sort Type for the results, Default: ASC, Required: false'
          in: query
          required: false
          schema:
            type: string
            enum:
              - NONE
              - ASC
              - DESC
            default: NONE
      tags:
        - AccesspointService
  /users/batches/{batchId}/accesspoints/file:
    post:
      summary: Creates a CSV file download for accesspoints based on the batchID of the initial CSV file upload
      description: 'Permission Level: Read'
      operationId: AccesspointService_GetAccesspointsFromCsvToFile
      responses:
        '200':
          description: A successful response.(streaming responses)
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    $ref: '#/components/schemas/v2GetAccesspointsFromCsvToFileResponse'
                  error:
                    $ref: '#/components/schemas/googleRpcStatus'
                title: Stream result of v2GetAccesspointsFromCsvToFileResponse
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: batchId
          description: 'batch_id of the accesspoints to be downloaded, Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccesspointServiceGetAccesspointsFromCsvToFileBody'
        required: true
      tags:
        - AccesspointService
components:
  schemas:
    AccesspointServiceGetAccesspointsFromCsvToFileBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'tenant_id of the accesspoints, Required: false'
      title: Get Accesspoints uploaded as a CSV, returned again as CSV request
    AccesspointServiceUpdateAccesspointBody:
      type: object
      properties:
        tenantId:
          type: string
          title: tenant of the accesspoint to update
        siteId:
          type: string
          title: 'ID for the site (such as a store) in which the access point is located, Required: true'
        accesspoint:
          $ref: '#/components/schemas/v2UpdateAccesspointProto'
    commonsSortType:
      type: string
      enum:
        - NONE
        - ASC
        - DESC
      default: NONE
    googleRpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    userV2Status:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - SUCCESS
        - FAILED
        - SUCCESS_WITH_ERRORS
      default: PENDING
      description: |-
        - PENDING: The file upload is pending. Default option.
         - IN_PROGRESS: The file is being uploaded.
         - SUCCESS: The file was successfully uploaded.
         - FAILED: The file upload failed.
         - SUCCESS_WITH_ERRORS: At least one user was successfully uploaded, but others had errors
      title: This enum represents the current status of a template bulk user upload
    v2AccesspointResponse:
      type: object
      properties:
        tenantId:
          type: string
          title: ID of the tenant to which access point belongs
        siteId:
          type: string
          title: 'ID for the site (such as a store) in which the access point is located, Required: true'
        bssid:
          type: string
          title: 'Basic Service Set Identifier which provides the physical location of an access point, Required: true, Unique: true'
        assetName:
          type: string
          title: 'System-defined name, Required: false'
        displayName:
          type: string
          title: A display name, typically used to identify a location such as a department or area in a store
        batchId:
          type: string
          description: ID of the batch if the Accesspoint was loaded in the system via templated bulk import. Randomly generated UUID string.
      title: Main Accesspoint data model
    v2AccesspointsResponse:
      type: object
      properties:
        accesspoints:
          type: array
          items:
            $ref: '#/components/schemas/v2AccesspointResponse'
          title: list of accesspoints for the given tenant
      title: Get many Accesspoints response
    v2CreateAccesspointProto:
      type: object
      properties:
        tenantId:
          type: string
          title: ID of the tenant to which access point belongs
        siteId:
          type: string
          title: 'ID for the site (such as a store) in which the access point is located, Required: true'
        bssid:
          type: string
          title: 'Basic Service Set Identifier which provides the physical location of an access point, Required: true, Unique: true'
        assetName:
          type: string
          title: 'System-defined name, Required: false'
        displayName:
          type: string
          title: A display name, typically used to identify a location such as a department or area in a store
      title: Protobuf model to create a accesspoint
    v2CreateAccesspointRequest:
      type: object
      properties:
        accesspoint:
          $ref: '#/components/schemas/v2CreateAccesspointProto'
      title: Create one accesspoint
    v2CreateAccesspointsFromCsvRequest:
      type: object
      properties:
        tenantId:
          type: string
          title: 'tenant_id of the bulk upload accesspoints, Required: false'
        file:
          $ref: '#/components/schemas/v2File'
        ignoreHeader:
          type: boolean
          description: Set if the header row of the CSV file I'm uploading can be ignored.
        replaceExisting:
          type: boolean
          title: |-
            A logical toggle to replace existing accesspoints. If false, existing accesspoints with no corresponding accesspoint in the new file
            remain as-is, and existing accesspoints with a corresponding accesspoint in the new file are upserted. If true, all existing accesspoints
            are deleted and replaced. Required: false, defaults to "false"
      title: Request to bulk upload Accesspoints via CSV file
    v2CreateAccesspointsFromCsvResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/userV2Status'
        batchId:
          type: string
          description: batch_id for all the accesspoints in the bulk CSV upload. Randomly generated UUID string.
      title: Response of CSV bulk accesspoint upload
    v2CreateAccesspointsProto:
      type: object
      properties:
        siteId:
          type: string
          title: 'ID for the site (such as a store) in which the access point is located, Required: true'
        bssid:
          type: string
          title: 'Basic Service Set Identifier which provides the physical location of an access point, Required: true, Unique: true'
        assetName:
          type: string
          title: 'System-defined name, Required: false'
        displayName:
          type: string
          title: A display name, typically used to identify a location such as a department or area in a store
      title: Like CreateAccesspointProto (singular), but no tenant_id as that's in the CreateAccesspointsRequest
    v2CreateAccesspointsRequest:
      type: object
      properties:
        tenantId:
          type: string
          title: 'tenant of the accesspoints for bulk upload, Required: false'
        accesspoints:
          type: array
          items:
            $ref: '#/components/schemas/v2CreateAccesspointsProto'
          title: 'list of accesspoints to upload, Required: true'
      title: Create many accesspoints
    v2File:
      type: object
      properties:
        content:
          type: string
          format: byte
      description: This protobuf message represents any file through an array of bytes.
    v2GetAccesspointsFromCsvToFileResponse:
      type: object
      properties:
        data:
          type: string
          format: byte
          title: Array of bytes representing a CSV file of bulk upload accesspoints
      title: Get Accesspoints uploaded as a CSV, returned again as CSV response
    v2GetChangeLogResponse:
      type: object
      properties:
        tenantId:
          type: string
          title: tenant_id of the accesspoints
        batchId:
          type: string
          title: batch_id of the accesspoints CSV upload
        created:
          type: array
          items:
            type: string
          title: 'list of accesspoint ids of the accesspoints created in the batch. (todo: determine which ID -- bssid?)'
        updated:
          type: array
          items:
            type: string
          title: 'list of accesspoint ids of the accesspoints updated in the batch. (todo: determine which ID -- bssid?)'
        creationTime:
          type: string
          format: date-time
          title: Changelog creation time
    v2UpdateAccesspointProto:
      type: object
      properties:
        assetName:
          type: string
          title: 'System-defined name, Required: false'
        displayName:
          type: string
          title: A display name, typically used to identify a location such as a department or area in a store
      title: Update one accesspoint (only fields which need to be updated should be provided)
    v2UpdateAccesspointsRequest:
      type: object
      properties:
        bssid:
          type: string
          title: 'Unique ID of the accesspoint to update, Required: true'
        tenantId:
          type: string
          title: tenant of the accesspoints for bulk update
        accesspoints:
          type: array
          items:
            $ref: '#/components/schemas/v2UpdateAccesspointProto'
          title: 'list of accesspoints to update (fields except bssid will be updated if different), Required: true'
      title: Update many accesspoints (only fields which need to be updated should be provided)
  securitySchemes:
    Authorization:
      type: apiKey
      description: Bearer token
      name: Authorization
      in: header
