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
Photo Reference to a user submitted photo in the DressMeUp Asset Store
Garment Reference to a garment 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": [
    {
      "src": {
        "garment_id": "7611366000042",
        "user_media": "https://firebasestorage.googleapis.com/v0/b/etryon-h2020.appspot.com/o/photo%user%enK0PQ8YY0hXDICJm1MKfjYTTvu1%filename.jpg"
      }
    }
  ],
  "required": [
    "src"
  ],
  "title": "The root schema",
  "type": "object",
  "properties": {
    "src": {
      "$id": "#/properties/src",
      "default": {},
      "description": "The source object features a garment unique id (EAN code) and the url to Firebast Storage where a user submitted media item resides.",
      "examples": [
        {
          "garment_id": "7611366000042",
          "user_media": "https://firebasestorage.googleapis.com/v0/b/etryon-h2020.appspot.com/o/photo%user%enK0PQ8YY0hXDICJm1MKfjYTTvu1%filename.jpg"
        }
      ],
      "required": [
        "garment_id",
        "user_media"
      ],
      "title": "The src object",
      "type": "object",
      "properties": {
        "garment_id": {
          "$id": "#/properties/src/properties/garment_id",
          "default": "",
          "description": "ODLO unique garment id (EAN code)",
          "examples": [
            "7611366000042"
          ],
          "title": "The garment_id property",
          "type": "string"
        },
        "user_media": {
          "$id": "#/properties/src/properties/user_media",
          "default": "",
          "description": "A url that points to Google Firebase Storage, where a media item submitted by the user is stored",
          "examples": [
            "https://firebasestorage.googleapis.com/v0/b/etryon-h2020.appspot.com/o/photo%user%enK0PQ8YY0hXDICJm1MKfjYTTvu1%filename.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
  3. Construct a presigned GET URL for the avatar
  4. Construct a presigned GET URL for the photo
  5. Construct a presigned GET URL for the garment browzwear file
  6. Construct a presigned PUT URL for the output image
  7. 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.