async CreateABRMezzanine({libraryId, name, description, metadata={}, masterVersionHash, variant="default"}) {
    const abrMezType = await this.ContentType({name: "ABR Master"});

    if(!abrMezType) {
      throw Error("Unable to access ABR Mezzanine content type in library with ID=" + libraryId);
    }

    if(!masterVersionHash) {
      throw Error("Master version hash not specified");
    }

    const masterMetadata = (await this.ContentObjectMetadata({
      versionHash: masterVersionHash
    }));

    // ** temporary workaround for server permissions issue **
    const production_master = masterMetadata["production_master"];
    const masterName = masterMetadata.public.name;

    // ** temporary workaround for server permissions issue **
    // get target library metadata
    const targetLib = (await this.ContentLibrary({libraryId}));
    const abr_profile = (await this.ContentObjectMetadata(
      {
        libraryId,
        objectId: targetLib.qid,
        metadataSubtree: "abr_profile"
      }
    ));

    const {id, write_token} = await this.CreateContentObject({
      libraryId,
      options: {
        type: abrMezType.hash
      }
    });

    // Include authorization for library, master, and mezzanine
    let authorizationTokens = [];
    authorizationTokens.push(await this.authClient.AuthorizationToken({libraryId, objectId: id, update: true}));
    authorizationTokens.push(await this.authClient.AuthorizationToken({libraryId}));
    authorizationTokens.push(await this.authClient.AuthorizationToken({versionHash: masterVersionHash}));

    const headers = {
      Authorization: authorizationTokens.map(token => `Bearer ${token}`).join(",")
    };

    const {logs, errors, warnings} = await this.CallBitcodeMethod({
      libraryId,
      objectId: id,
      writeToken: write_token,
      method: UrlJoin("media", "abr_mezzanine", "init"),
      headers,
      body: {
        "offering_key": variant,
        "variant_key": variant,
        "prod_master_hash": masterVersionHash,
        production_master, // ** temporary workaround for server permissions issue **
        abr_profile // ** temporary workaround for server permissions issue **
      },
      constant: false
    });

    await this.MergeMetadata({
      libraryId,
      objectId: id,
      writeToken: write_token,
      metadata: {
        master: {
          name: masterName,
          id: this.utils.DecodeVersionHash(masterVersionHash).objectId,
          hash: masterVersionHash,
          variant
        },
        name: name || `${masterName} Mezzanine`,
        description,
        public: {
          name: name || `${masterName} Mezzanine`,
          description: description || ""
        },
        elv_created_at: new Date().getTime(),
        ...(metadata || {})
      }
    });

    const finalizeResponse = await this.FinalizeContentObject({
      libraryId,
      objectId: id,
      writeToken: write_token
    });

    return {
      logs: logs || [],
      warnings: warnings || [],
      errors: errors || [],
      ...finalizeResponse
    };
  }
/**
   * Create a mezzanine of the given master content object
   *
   * @methodGroup Media
   * @namedParams
   * @param {string} libraryId - ID of the mezzanine library
   * @param {string} name - Name for mezzanine content object
   * @param {string=} description - Description for mezzanine content object
   * @param {Object=} metadata - Additional metadata for mezzanine content object
   * @param {string} masterVersionHash - The version hash of the production master content object
   * @param {string=} variant - What variant of the master content object to use
   *
   * @return {Object} - The finalize response for the object, as well as logs, warnings and errors from the mezzanine initialization
   */


@return {Object} - The finalize response for the object, as well as logs, warnings and errors from the mezzanine initialization
@return { Object } - The finalize response for the object as well as logs warnings and errors from the mezzanine initialization
async CreateABRMezzanine({libraryId, name, description, metadata={}, masterVersionHash, variant="default"}) {
    const abrMezType = await this.ContentType({name: "ABR Master"});
    if(!abrMezType) {
      throw Error("Unable to access ABR Mezzanine content type in library with ID=" + libraryId);
    }
    if(!masterVersionHash) {
      throw Error("Master version hash not specified");
    }
    const masterMetadata = (await this.ContentObjectMetadata({
      versionHash: masterVersionHash
    }));
    const production_master = masterMetadata["production_master"];
    const masterName = masterMetadata.public.name;
    const targetLib = (await this.ContentLibrary({libraryId}));
    const abr_profile = (await this.ContentObjectMetadata(
      {
        libraryId,
        objectId: targetLib.qid,
        metadataSubtree: "abr_profile"
      }
    ));
    const {id, write_token} = await this.CreateContentObject({
      libraryId,
      options: {
        type: abrMezType.hash
      }
    });
    let authorizationTokens = [];
    authorizationTokens.push(await this.authClient.AuthorizationToken({libraryId, objectId: id, update: true}));
    authorizationTokens.push(await this.authClient.AuthorizationToken({libraryId}));
    authorizationTokens.push(await this.authClient.AuthorizationToken({versionHash: masterVersionHash}));
    const headers = {
      Authorization: authorizationTokens.map(token => `Bearer ${token}`).join(",")
    };
    const {logs, errors, warnings} = await this.CallBitcodeMethod({
      libraryId,
      objectId: id,
      writeToken: write_token,
      method: UrlJoin("media", "abr_mezzanine", "init"),
      headers,
      body: {
        "offering_key": variant,
        "variant_key": variant,
        "prod_master_hash": masterVersionHash,
        production_master, 
        abr_profile 
      },
      constant: false
    });
    await this.MergeMetadata({
      libraryId,
      objectId: id,
      writeToken: write_token,
      metadata: {
        master: {
          name: masterName,
          id: this.utils.DecodeVersionHash(masterVersionHash).objectId,
          hash: masterVersionHash,
          variant
        },
        name: name || `${masterName} Mezzanine`,
        description,
        public: {
          name: name || `${masterName} Mezzanine`,
          description: description || ""
        },
        elv_created_at: new Date().getTime(),
        ...(metadata || {})
      }
    });
    const finalizeResponse = await this.FinalizeContentObject({
      libraryId,
      objectId: id,
      writeToken: write_token
    });
    return {
      logs: logs || [],
      warnings: warnings || [],
      errors: errors || [],
      ...finalizeResponse
    };
  }
async CreateABRMezzanine ( { libraryId , name , description , metadata = { } , masterVersionHash , variant = "default" } ) { const abrMezType = await this . ContentType ( { name : "ABR Master" } ) ; if ( ! abrMezType ) { throw Error ( "Unable to access ABR Mezzanine content type in library with ID=" + libraryId ) ; } if ( ! masterVersionHash ) { throw Error ( "Master version hash not specified" ) ; } const masterMetadata = ( await this . ContentObjectMetadata ( { versionHash : masterVersionHash } ) ) ; const production_master = masterMetadata [ "production_master" ] ; const masterName = masterMetadata . public . name ; const targetLib = ( await this . ContentLibrary ( { libraryId } ) ) ; const abr_profile = ( await this . ContentObjectMetadata ( { libraryId , objectId : targetLib . qid , metadataSubtree : "abr_profile" } ) ) ; const { id , write_token } = await this . CreateContentObject ( { libraryId , options : { type : abrMezType . hash } } ) ; let authorizationTokens = [ ] ; authorizationTokens . push ( await this . authClient . AuthorizationToken ( { libraryId , objectId : id , update : true } ) ) ; authorizationTokens . push ( await this . authClient . AuthorizationToken ( { libraryId } ) ) ; authorizationTokens . push ( await this . authClient . AuthorizationToken ( { versionHash : masterVersionHash } ) ) ; const headers = { Authorization : authorizationTokens . map ( token => ` ${ token } ` ) . join ( "," ) } ; const { logs , errors , warnings } = await this . CallBitcodeMethod ( { libraryId , objectId : id , writeToken : write_token , method : UrlJoin ( "media" , "abr_mezzanine" , "init" ) , headers , body : { "offering_key" : variant , "variant_key" : variant , "prod_master_hash" : masterVersionHash , production_master , abr_profile } , constant : false } ) ; await this . MergeMetadata ( { libraryId , objectId : id , writeToken : write_token , metadata : { master : { name : masterName , id : this . utils . DecodeVersionHash ( masterVersionHash ) . objectId , hash : masterVersionHash , variant } , name : name || ` ${ masterName } ` , description , public : { name : name || ` ${ masterName } ` , description : description || "" } , elv_created_at : new Date ( ) . getTime ( ) , ... ( metadata || { } ) } } ) ; const finalizeResponse = await this . FinalizeContentObject ( { libraryId , objectId : id , writeToken : write_token } ) ; return { logs : logs || [ ] , warnings : warnings || [ ] , errors : errors || [ ] , ... finalizeResponse } ; }
Create a mezzanine of the given master content object
 @methodGroup Media
 @namedParams
 @param {string} libraryId - ID of the mezzanine library
 @param {string} name - Name for mezzanine content object
 @param {string=} description - Description for mezzanine content object
 @param {Object=} metadata - Additional metadata for mezzanine content object
 @param {string} masterVersionHash - The version hash of the production master content object
 @param {string=} variant - What variant of the master content object to use
Create a mezzanine of the given master content object @methodGroup Media @namedParams @param { string } libraryId - ID of the mezzanine library @param { string } name - Name for mezzanine content object @param { string = } description - Description for mezzanine content object @param { Object = } metadata - Additional metadata for mezzanine content object @param { string } masterVersionHash - The version hash of the production master content object @param { string = } variant - What variant of the master content object to use
// ** temporary workaround for server permissions issue ** // ** temporary workaround for server permissions issue ** // get target library metadata // Include authorization for library, master, and mezzanine // ** temporary workaround for server permissions issue ** // ** temporary workaround for server permissions issue **