async CreateContentLibrary({
    name,
    description,
    image,
    metadata={},
    kmsId,
  }) {
    if(!kmsId) {
      kmsId = `ikms${this.utils.AddressToHash(await this.DefaultKMSAddress())}`;
    }

    const { contractAddress } = await this.authClient.CreateContentLibrary({kmsId});

    metadata = {
      ...metadata,
      name,
      description,
      public: {
        name,
        description
      }
    };

    const libraryId = this.utils.AddressToLibraryId(contractAddress);

    // Set library content object type and metadata on automatically created library object
    const objectId = libraryId.replace("ilib", "iq__");

    const editResponse = await this.EditContentObject({
      libraryId,
      objectId,
      options: {
        type: "library"
      }
    });

    await this.ReplaceMetadata({
      libraryId,
      objectId,
      metadata,
      writeToken: editResponse.write_token
    });

    await this.FinalizeContentObject({
      libraryId,
      objectId,
      writeToken: editResponse.write_token
    });

    // Upload image if provided
    if(image) {
      await this.SetContentLibraryImage({
        libraryId,
        image
      });
    }

    return libraryId;
  }
/**
   * Create a new content library.
   *
   * A new content library contract is deployed from
   * the content space, and that contract ID is used to determine the library ID to
   * create in the fabric.
   *
   * @methodGroup Content Libraries
   * @see PUT /qlibs/:qlibid
   *
   * @namedParams
   * @param {string} name - Library name
   * @param {string=} description - Library description
   * @param {blob=} image - Image associated with the library
   * @param {Object=} metadata - Metadata of library object
   * @param {string=} kmsId - ID of the KMS to use for content in this library. If not specified,
   * the default KMS will be used.
   *
   * @returns {Promise<string>} - Library ID of created library
   */
Create a new content library.
A new content library contract is deployed from
the content space, and that contract ID is used to determine the library ID to
create in the fabric.

@methodGroup Content Libraries
@see PUT /qlibs/:qlibid



@returns {Promise} - Library ID of created library
Create a new content library . A new content library contract is deployed from the content space and that contract ID is used to determine the library ID to create in the fabric . @methodGroup Content Libraries @see PUT / qlibs / : qlibid @returns { Promise } - Library ID of created library
async CreateContentLibrary({
    name,
    description,
    image,
    metadata={},
    kmsId,
  }) {
    if(!kmsId) {
      kmsId = `ikms${this.utils.AddressToHash(await this.DefaultKMSAddress())}`;
    }
    const { contractAddress } = await this.authClient.CreateContentLibrary({kmsId});
    metadata = {
      ...metadata,
      name,
      description,
      public: {
        name,
        description
      }
    };
    const libraryId = this.utils.AddressToLibraryId(contractAddress);
    const objectId = libraryId.replace("ilib", "iq__");
    const editResponse = await this.EditContentObject({
      libraryId,
      objectId,
      options: {
        type: "library"
      }
    });
    await this.ReplaceMetadata({
      libraryId,
      objectId,
      metadata,
      writeToken: editResponse.write_token
    });
    await this.FinalizeContentObject({
      libraryId,
      objectId,
      writeToken: editResponse.write_token
    });
    if(image) {
      await this.SetContentLibraryImage({
        libraryId,
        image
      });
    }
    return libraryId;
  }
async CreateContentLibrary ( { name , description , image , metadata = { } , kmsId , } ) { if ( ! kmsId ) { kmsId = ` ${ this . utils . AddressToHash ( await this . DefaultKMSAddress ( ) ) } ` ; } const { contractAddress } = await this . authClient . CreateContentLibrary ( { kmsId } ) ; metadata = { ... metadata , name , description , public : { name , description } } ; const libraryId = this . utils . AddressToLibraryId ( contractAddress ) ; const objectId = libraryId . replace ( "ilib" , "iq__" ) ; const editResponse = await this . EditContentObject ( { libraryId , objectId , options : { type : "library" } } ) ; await this . ReplaceMetadata ( { libraryId , objectId , metadata , writeToken : editResponse . write_token } ) ; await this . FinalizeContentObject ( { libraryId , objectId , writeToken : editResponse . write_token } ) ; if ( image ) { await this . SetContentLibraryImage ( { libraryId , image } ) ; } return libraryId ; }
Create a new content library.
Create a new content library .
// Set library content object type and metadata on automatically created library object // Upload image if provided