openapi: 3.0.1
info:
  title: Customer Partner Relationship Service
  description: Customer Partner Relationship service is for storing information specific to a customer/partner relationship
  version: '2.0'
tags:
  - name: CustomerPartnerRelationshipService
security:
  - Authorization: []
paths:
  /tenants/relationships:
    get:
      summary: |-
        Return a list of relationships based on either the customer or partner, or all relationships.
        Permission Level: Read
      operationId: CustomerPartnerRelationshipService_ListRelationships
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ListRelationshipsResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
      parameters:
        - name: customerTenantId
          description: Optional - if you want to list all relationships for a particular customer.
          in: query
          required: false
          schema:
            type: string
        - name: partnerTenantId
          description: Optional - if you want to list all relationships for a particular partner.
          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: pageToken
          description: 'MongoDB Field, describes the encoded page token for page traversal, Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: sortField
          description: 'Sort field, valid values: relationshipId, customerTenantId or partnerTenantId, Default: relationshipId, Required: false'
          in: query
          required: false
          schema:
            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:
        - CustomerPartnerRelationshipService
    post:
      summary: |-
        Creates a relationship
        Permission Level: Read-Write
      operationId: CustomerPartnerRelationshipService_CreateRelationship
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2RelationshipResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2CreateRelationshipRequest'
        required: true
      tags:
        - CustomerPartnerRelationshipService
  /tenants/relationships/{identifier}:
    get:
      summary: |-
        Returns one relationship based on either its unique ID or the customer/partner combination.
        Permission Level: Read
      operationId: CustomerPartnerRelationshipService_GetRelationship
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2RelationshipResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
      parameters:
        - name: identifier
          description: The unique identifier of the relationship (id or concat cust-part id)
          in: path
          required: true
          schema:
            type: string
      tags:
        - CustomerPartnerRelationshipService
    delete:
      summary: |-
        Deletes a relationship, either the unique ID or the customer/partner ID combination
        Permission Level: Read-Write
      operationId: CustomerPartnerRelationshipService_DeleteRelationship
      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/rpcStatus'
      parameters:
        - name: identifier
          description: The unique identifier of the relationship (id or concat cust-part id)
          in: path
          required: true
          schema:
            type: string
      tags:
        - CustomerPartnerRelationshipService
    put:
      summary: |-
        Update a relationship, either the unique ID or the customer/partner ID combination
        Permission Level: Read-Write
      operationId: CustomerPartnerRelationshipService_UpdateRelationship
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2RelationshipResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
      parameters:
        - name: identifier
          description: The unique identifier of the relationship (id or concat cust-part id)
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerPartnerRelationshipServiceUpdateRelationshipBody'
        required: true
      tags:
        - CustomerPartnerRelationshipService
servers:
  - url: https://prod-ui-zwseuprod01p.pp.zebra.com/api
    description: EU Server
  - url: https://prod-ui-zwsusprod01p.pp.zebra.com/api
    description: NA Server
components:
  schemas:
    CustomerPartnerRelationshipServiceUpdateRelationshipBody:
      type: object
      properties:
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2RelationshipAttributeProto'
          description: The attributes associated with the relationship.
    commonsSortType:
      type: string
      enum:
        - NONE
        - ASC
        - DESC
      default: NONE
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    v2CreateRelationshipRequest:
      type: object
      properties:
        relationship:
          $ref: '#/components/schemas/v2RelationshipProto'
    v2ListRelationshipsResponse:
      type: object
      properties:
        relationship:
          type: array
          items:
            $ref: '#/components/schemas/v2RelationshipProto'
          title: List of relationships
        nextPageToken:
          type: string
          description: The token of the next page of results.
    v2RelationshipAttributeProto:
      type: object
      properties:
        scope:
          type: string
          title: 'General scoping for user attribute, Required: true'
        fieldName:
          type: string
          title: 'Name of the attribute, Required: true'
        value:
          type: string
          title: 'Value of the attribute, Required: false'
        domain:
          type: string
          title: 'Domain of the attribute, Required: false'
    v2RelationshipProto:
      type: object
      properties:
        relationshipId:
          type: string
          description: A server-side generated unique Id. It cannot be provided.
        customerTenantId:
          type: string
          description: 'The platform tenantId of the customer in the relationship. Required: true.'
        partnerTenantId:
          type: string
          description: 'The platform tenantId of the partner in the relationship.  Required: true.'
        concatCustPartId:
          type: string
          description: A concatenated Id of the customerTenantId_partnerTenantId.  Unique because there can only be one relationship per customer/partner combination.
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2RelationshipAttributeProto'
          description: The attributes associated with the relationship.
    v2RelationshipResponse:
      type: object
      properties:
        relationship:
          $ref: '#/components/schemas/v2RelationshipProto'
  securitySchemes:
    Authorization:
      type: apiKey
      description: Bearer token
      name: Authorization
      in: header
