swagger: '2.0'
info:
  title: Ows-features API specifications
  version: 0.0.1
host: ows-features.theorchard.io
basePath: /
schemes:
  - https
paths:
  /hello:
    get:
      tags: ['Health']
      description: Health check
      responses:
        '200':
          description: 200 OK
          schema:
            type: object
            example:
              status: ok
  /features:
    get:
      tags: ['Global']
      description: If grass headers exist, then get data for the user or profile context.
      parameters:
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: header
          name: Orchard-User-Id
          required: false
          type: string
        - in: header
          name: Grass-Account-Id
          required: false
          type: integer
        - in: header
          name: Grass-Account-Type
          required: false
          type: string
        - name: Orchard-Profile-Type
          in: header
          type: string
        - name: Orchard-Profile-Id
          in: header
          type: string
        - in: header
          name: Orchard-Identity-Id
          description: Auth0 User Id
          required: false
          type: string
      responses:
        200:
          description: 200 OK
          schema:
            type: object
            example:
              {
                "label_store_creds": "control",
                "remove_mobile_analytics": "control",
                "track_builder_version_one_dot_one": "enabled",
                "all_time_accounting": "enabled",
                "assets_processing_v2": "control",
                "digital_product_primary_artists_separable": "enabled",
                "apple_music_api": "enabled",
                "small_pagination": "control",
                "sales_goals_canada": "control",
                "mena_approval": "control"
            }
  /features/vendor/{vendor_id}/user/{orchard_user_id}:
    get:
      tags: ['Vendor']
      description: Get variants for all features in a vendor context.
      parameters:
        - in: path
          name: vendor_id
          required: true
          type: string
        - in: path
          name: orchard_user_id
          required: true
          description: It can be empty string, in which case it will return active variants for vendor level.
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: header
          name: Orchard-User-Id
          required: false
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: object
            example:
              {
                "label_store_creds": "control",
                "remove_mobile_analytics": "control",
                "track_builder_version_one_dot_one": "enabled",
                "all_time_accounting": "enabled",
                "assets_processing_v2": "control",
                "digital_product_primary_artists_separable": "enabled",
                "apple_music_api": "enabled",
                "small_pagination": "control",
                "sales_goals_canada": "control",
                "mena_approval": "control"
            }
  /features/user/{orchard_user_id}:
    get:
      tags: ['Orchard User']
      description: Get variants for all features in a user context. If grass headers exist, then validate and confirm that the user is correct.
      parameters:
        - in: path
          name: orchard_user_id
          required: true
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - name: Grass-Account-Type
          description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          type: string
        - name: Grass-Account-Id
          description: Grass account id.
          in: header
          pattern: ^\d+$
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: object
            example:
              {
                "label_store_creds": "control",
                "remove_mobile_analytics": "control",
                "track_builder_version_one_dot_one": "enabled",
                "all_time_accounting": "enabled",
                "assets_processing_v2": "control",
                "digital_product_primary_artists_separable": "enabled",
                "apple_music_api": "enabled",
                "small_pagination": "control",
                "sales_goals_canada": "control",
                "mena_approval": "control"
            }
  /features/{feature_name}:
    get:
      tags: ['Global']
      description: Get variants for a single feature. If grass headers exist, then get data in the user context.
      parameters:
        - in: path
          name: feature_name
          required: true
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: header
          name: Orchard-User-Id
          required: false
          type: string
        - in: header
          name: Grass-Account-Id
          required: false
          type: integer
        - in: header
          name: Grass-Account-Type
          required: false
          type: string
        - name: Orchard-Profile-Type
          in: header
          type: string
        - name: Orchard-Profile-Id
          in: header
          type: string
        - in: header
          name: Orchard-Identity-Id
          description: Auth0 User Id
          required: false
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: string
            example: enabled
    put:
      tags: ['Global']
      description: Set the active variant for an existing feature. Not accessible on the production environment.
      parameters:
        - in: path
          name: feature_name
          required: true
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: body
          name: body
          schema:
            additionalProperties: false
            properties:
              variant_name:
                type: string
                description: Name of field that changed. Generally 'control' or 'enabled'
                example: 'enabled'
            required:
              - variant_name
            type: object
      responses:
        '200':
          description: 200 OK
          schema:
            type: string
            example:
              physical_product_carveins: enabled
  /features/{feature_name}/user/{orchard_user_id}:
    get:
      tags: ['Orchard User']
      description: Get variants for a single feature. If grass headers exist, then get data in the user context.
      parameters:
        - in: path
          name: feature_name
          required: true
          type: string
        - in: path
          name: orchard_user_id
          required: true
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - name: Grass-Account-Type
          description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          type: string
        - name: Grass-Account-Id
          description: Grass account id.
          in: header
          pattern: ^\d+$
          type: string
        - in: header
          name: Orchard-User-Id
          required: false
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: string
            example: enabled
    put:
      tags: ['Orchard User']
      description: Set the active variant for an existing feature. Not accessible on the production environment.
      parameters:
        - in: path
          name: feature_name
          required: true
          type: string
        - in: path
          name: orchard_user_id
          required: true
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: body
          name: body
          schema:
            additionalProperties: false
            properties:
              variant_name:
                type: string
                description: Name of field that changed. Generally 'control' or 'enabled'
                example: 'enabled'
            required:
              - variant_name
            type: object
      responses:
        '200':
          description: 200 OK
          schema:
            type: string
            example:
              physical_product_carveins: enabled
  /features/vendor/{vendor_id}/user_type/{user_type}/user_id/{user_id}:
    get:
      tags: ['Vendor']
      description: Get variants for all features in a vendor context.
      parameters:
        - in: path
          name: vendor_id
          required: true
          type: string
        - in: path
          name: user_id
          required: true
          description: It can be empty string, in which case it will return active variants for vendor level.
          type: string
        - in: path
          name: user_type
          required: true
          description: It can be either oa or alw.
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: object
            example:
              {
                "label_store_creds": "control",
                "remove_mobile_analytics": "control",
                "track_builder_version_one_dot_one": "enabled",
                "all_time_accounting": "enabled",
                "assets_processing_v2": "control",
                "digital_product_primary_artists_separable": "enabled",
                "apple_music_api": "enabled",
                "small_pagination": "control",
                "migration_default_product_pricing": "enabled",
                "sales_goals_canada": "control",
                "mena_approval": "control"
              }
  /features/user_type/{user_type}/user_id/{user_id}:
    get:
      tags: ['Orchard User']
      description: Get variants for all features in a user context. If grass headers exist, then validate and confirm that the user is correct.
      parameters:
        - in: path
          name: user_id
          required: true
          type: string
        - in: path
          name: user_type
          required: true
          description: It can be either oa or alw.
          type: string
        - in: header
          name: Correlation-Id
          required: false
          type: string
      responses:
        '200':
          description: 200 OK
          schema:
            type: object
            example:
              {
                "label_store_creds": "control",
                "remove_mobile_analytics": "control",
                "track_builder_version_one_dot_one": "enabled",
                "all_time_accounting": "enabled",
                "assets_processing_v2": "control",
                "digital_product_primary_artists_separable": "enabled",
                "apple_music_api": "enabled",
                "small_pagination": "control",
                "migration_default_product_pricing": "enabled",
                "sales_goals_canada": "control",
                "mena_approval": "control"
              }
definitions: {}
securityDefinitions: {}
