DressMeUp Composition Invoker

Context

This function is required for use case 2. It is invoked by the DressMeUp mobile app when a user tries on a garment, and is the interface between eTryOn systems and the the Metail Composition Service.

Invocation

This function is invoked by the DressMeUp mobile app when a user selects a photo and garment for composition.

Input

The input is a JSON payload with the following fields.

Field Description
group_id Reference to a Browzwear file in the DressMeUp Asset Store
colorway Garment colorway option (must exist in the Browzwear file)
garment_size Garment size option (must exist in the Browzwear file)
warp_region Warp region (determined by garment type), one of upper/lower/full
avatar_id ID of the user avatar
avatar_gender Gender of the user avatar
user_media Reference to a user submitted photo in the DressMeUp Asset Store

Input Function JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "description": "The root schema comprises the entire JSON document.",
  "examples": [
    {
      "group_id": "7611366000042",
      "garment_size": "MXS",
      "warp_region": "full",
      "colorway": "red",
      "avatar_id": "1657706423",
      "avatar_gender": "male",
      "user_media": "user-media-1658314959.jpg"
    }
  ],
  "required": [
    "group_id",
    "garment_size",
    "colorway",
    "warp_region",
    "avatar_id",
    "avatar_gender",
    "user_media"
  ],
  "title": "The root schema",
  "type": "object",
  "properties": {
    "group_id": {
      "$id": "#/properties/group_id",
      "default": "",
      "description": "ODLO group id",
      "examples": [
        "7611366000042"
      ],
      "title": "The garment_id property",
      "type": "string"
    },
    "garment_size": {
      "$id": "#/properties/garment_size",
      "default": "",
      "description": "The garment size (must exist in the Browzwear file)",
      "examples": [
        "MXS"
      ],
      "title": "The garment_size property",
      "type": "string"
    },
    "colorway": {
      "$id": "#/properties/colorway",
      "default": "",
      "description": "The garment colorway (must exist in the Browzwear file)",
      "examples": [

      ],
      "title": "The garment colorway property",
      "type": "string"
    },
    "warp_region": {
      "$id": "#/properties/warp_region",
      "default": "",
      "description": "Warp region for this garment type",
      "examples": [
        "upper",
        "lower",
        "full"
      ],
      "title": "The warp region",
      "type": "string"
    },
    "avatar_gender": {
      "$id": "#/properties/avatar_gender",
      "default": "",
      "description": "User set avatar gender, set when creating the avatar",
      "examples": [
        "male",
        "female"
      ],
      "title": "The avatar gender property",
      "type": "string"
    },
    "avatar_id": {
      "$id": "#/properties/avatar_id",
      "default": "",
      "description": "The avatar id. 11 digits.",
      "examples": [
        "1657706423"
      ],
      "title": "The avatar id property",
      "type": "string"
    },
    "user_media": {
      "$id": "#/properties/user_media",
      "default": "",
      "description": "Path in Google Cloud Storage relative to /collection/user/<user_id>/",
      "examples": [
        "user-media-1658314959.jpg"
      ],
      "title": "The user_media property",
      "type": "string"
    }
  }
}

Actions

  1. Retrieve the user id of the caller from the authentication context
  2. Locate the user’s avatar in the DressMeUp Asset Store: /avatar/user/<user_id>/avatar-file-<avatar_id>.bin
  3. Locate the Browzwear file in the DressMeUp Asset Store: /garment/internal/garment-file-<garment_id>.bw
  4. Locate the user media in the DressMeUp Asset Store: /collection/user/<user_id>/<user_media>
  5. Construct a presigned GET URL for the avatar file
  6. Construct a presigned GET URL for the garment Browzwear file
  7. Construct a presigned GET URL for the user media
  8. Construct a presigned PUT URL for the output image
  9. Invoke the Metail Composition Service step function.

Output

On success, returns null. On error throws a functions.https.HttpsError which will be returned to the client.

Implementation notes

This function should be implemented as an HTTPS callable function and called by the client using the Firebase SDK. This ensures that authentication tokens are automatically included in the request and validated by the server. The request body is also automatically deserialized.

The composition service currently involves some manual processing and is not guaranteed to return a result within 12 hours. This means the signed URL cannot be generated using the IAM signBlob method, as these URLs are only valid for a maximum of 12 hours.