async CreateContentType({name, metadata={}, bitcode}) {
    metadata.name = name;
    metadata.public = {
      name,
      ...(metadata.public || {})
    };

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

    const objectId = this.utils.AddressToObjectId(contractAddress);
    const path = UrlJoin("qlibs", this.contentSpaceLibraryId, "qid", objectId);

    /* Create object, upload bitcode and finalize */
    const createResponse = await ResponseToJson(
      this.HttpClient.Request({
        headers: await this.authClient.AuthorizationHeader({
          libraryId: this.contentSpaceLibraryId,
          objectId,
          update: true
        }),
        method: "POST",
        path: path,
        failover: false
      })
    );

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

    if(bitcode) {
      const uploadResponse = await this.UploadPart({
        libraryId: this.contentSpaceLibraryId,
        objectId,
        writeToken: createResponse.write_token,
        data: bitcode,
        encrypted: false
      });

      await this.ReplaceMetadata({
        libraryId: this.contentSpaceLibraryId,
        objectId,
        writeToken: createResponse.write_token,
        metadataSubtree: "bitcode_part",
        metadata: uploadResponse.part.hash
      });
    }

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

    return objectId;
  }
/**
   * Create a new content type.
   *
   * A new content type contract is deployed from
   * the content space, and that contract ID is used to determine the object ID to
   * create in the fabric. The content type object will be created in the special
   * content space library (ilib<content-space-hash>)
   *
   * @methodGroup Content Types
   * @namedParams
   * @param libraryId {string=} - ID of the library in which to create the content type. If not specified,
   * it will be created in the content space library
   * @param {string} name - Name of the content type
   * @param {object} metadata - Metadata for the new content type
   * @param {(Blob | Buffer)=} bitcode - Bitcode to be used for the content type
   *
   * @returns {Promise<string>} - Object ID of created content type
   */
Create a new content type.
A new content type contract is deployed from
the content space, and that contract ID is used to determine the object ID to
create in the fabric. The content type object will be created in the special
content space library (ilib)

@methodGroup Content Types
@namedParams
@param libraryId {string=} - ID of the library in which to create the content type. If not specified,
it will be created in the content space library
@param {string} name - Name of the content type
@param {object} metadata - Metadata for the new content type
@param {(Blob | Buffer)=} bitcode - Bitcode to be used for the content type

@returns {Promise} - Object ID of created content type
Create a new content type . A new content type contract is deployed from the content space and that contract ID is used to determine the object ID to create in the fabric . The content type object will be created in the special content space library ( ilib ) @methodGroup Content Types @namedParams @param libraryId { string = } - ID of the library in which to create the content type . If not specified it will be created in the content space library @param { string } name - Name of the content type @param { object } metadata - Metadata for the new content type @param { ( Blob | Buffer ) = } bitcode - Bitcode to be used for the content type @returns { Promise } - Object ID of created content type
async CreateContentType({name, metadata={}, bitcode}) {
    metadata.name = name;
    metadata.public = {
      name,
      ...(metadata.public || {})
    };
    const { contractAddress } = await this.authClient.CreateContentType();
    const objectId = this.utils.AddressToObjectId(contractAddress);
    const path = UrlJoin("qlibs", this.contentSpaceLibraryId, "qid", objectId);
    const createResponse = await ResponseToJson(
      this.HttpClient.Request({
        headers: await this.authClient.AuthorizationHeader({
          libraryId: this.contentSpaceLibraryId,
          objectId,
          update: true
        }),
        method: "POST",
        path: path,
        failover: false
      })
    );
    await this.ReplaceMetadata({
      libraryId: this.contentSpaceLibraryId,
      objectId,
      writeToken: createResponse.write_token,
      metadata
    });
    if(bitcode) {
      const uploadResponse = await this.UploadPart({
        libraryId: this.contentSpaceLibraryId,
        objectId,
        writeToken: createResponse.write_token,
        data: bitcode,
        encrypted: false
      });
      await this.ReplaceMetadata({
        libraryId: this.contentSpaceLibraryId,
        objectId,
        writeToken: createResponse.write_token,
        metadataSubtree: "bitcode_part",
        metadata: uploadResponse.part.hash
      });
    }
    await this.FinalizeContentObject({
      libraryId: this.contentSpaceLibraryId,
      objectId,
      writeToken: createResponse.write_token
    });
    return objectId;
  }
async CreateContentType ( { name , metadata = { } , bitcode } ) { metadata . name = name ; metadata . public = { name , ... ( metadata . public || { } ) } ; const { contractAddress } = await this . authClient . CreateContentType ( ) ; const objectId = this . utils . AddressToObjectId ( contractAddress ) ; const path = UrlJoin ( "qlibs" , this . contentSpaceLibraryId , "qid" , objectId ) ; const createResponse = await ResponseToJson ( this . HttpClient . Request ( { headers : await this . authClient . AuthorizationHeader ( { libraryId : this . contentSpaceLibraryId , objectId , update : true } ) , method : "POST" , path : path , failover : false } ) ) ; await this . ReplaceMetadata ( { libraryId : this . contentSpaceLibraryId , objectId , writeToken : createResponse . write_token , metadata } ) ; if ( bitcode ) { const uploadResponse = await this . UploadPart ( { libraryId : this . contentSpaceLibraryId , objectId , writeToken : createResponse . write_token , data : bitcode , encrypted : false } ) ; await this . ReplaceMetadata ( { libraryId : this . contentSpaceLibraryId , objectId , writeToken : createResponse . write_token , metadataSubtree : "bitcode_part" , metadata : uploadResponse . part . hash } ) ; } await this . FinalizeContentObject ( { libraryId : this . contentSpaceLibraryId , objectId , writeToken : createResponse . write_token } ) ; return objectId ; }
Create a new content type.
Create a new content type .
/* Create object, upload bitcode and finalize */