async CreateContentObject({libraryId, objectId, options={}}) {
    // Look up content type, if specified
    let typeId;
    if(options.type) {
      let type;
      if(!options.type.startsWith("hq__")) {
        // Type name specified
        type = await this.ContentType({name: options.type});
      } else {
        // Type hash specified
        type = await this.ContentType({versionHash: options.type});
      }

      typeId = type.id;
      options.type = type.hash;
    }

    if(!objectId) {
      const { contractAddress } = await this.authClient.CreateContentObject({libraryId, typeId});

      objectId = this.utils.AddressToObjectId(contractAddress);
    }

    if(options.visibility) {
      await this.CallContractMethod({
        abi: ContentContract.abi,
        contractAddress: this.utils.HashToAddress(objectId),
        methodName: "setVisibility",
        methodArgs: [options.visibility]
      });
    }

    const path = UrlJoin("qid", objectId);

    return await ResponseToJson(
      this.HttpClient.Request({
        headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
        method: "POST",
        path: path,
        body: options,
        failover: false
      })
    );
  }
/**
   * Create a new content object draft.
   *
   * A new content object contract is deployed from
   * the content library, and that contract ID is used to determine the object ID to
   * create in the fabric.
   *
   * @see PUT /qlibs/:qlibid/q/:objectid
   *
   * @methodGroup Content Objects
   * @namedParams
   * @param {string} libraryId - ID of the library
   * @param {objectId=} objectId - ID of the object (if contract already exists)
   * @param {Object=} options -
   * type: Version hash of the content type to associate with the object
   *
   * meta: Metadata to use for the new object
   *
   * @returns {Promise<Object>} - Response containing the object ID and write token of the draft
   */
Create a new content object draft.
A new content object contract is deployed from
the content library, and that contract ID is used to determine the object ID to
create in the fabric.

@see PUT /qlibs/:qlibid/q/:objectid



Metadata to use for the new object

@returns {Promise} - Response containing the object ID and write token of the draft
Create a new content object draft . A new content object contract is deployed from the content library and that contract ID is used to determine the object ID to create in the fabric . @see PUT / qlibs / : qlibid / q / : objectid Metadata to use for the new object @returns { Promise } - Response containing the object ID and write token of the draft
async CreateContentObject({libraryId, objectId, options={}}) {
    let typeId;
    if(options.type) {
      let type;
      if(!options.type.startsWith("hq__")) {
        type = await this.ContentType({name: options.type});
      } else {
        type = await this.ContentType({versionHash: options.type});
      }
      typeId = type.id;
      options.type = type.hash;
    }
    if(!objectId) {
      const { contractAddress } = await this.authClient.CreateContentObject({libraryId, typeId});
      objectId = this.utils.AddressToObjectId(contractAddress);
    }
    if(options.visibility) {
      await this.CallContractMethod({
        abi: ContentContract.abi,
        contractAddress: this.utils.HashToAddress(objectId),
        methodName: "setVisibility",
        methodArgs: [options.visibility]
      });
    }
    const path = UrlJoin("qid", objectId);
    return await ResponseToJson(
      this.HttpClient.Request({
        headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
        method: "POST",
        path: path,
        body: options,
        failover: false
      })
    );
  }
async CreateContentObject ( { libraryId , objectId , options = { } } ) { let typeId ; if ( options . type ) { let type ; if ( ! options . type . startsWith ( "hq__" ) ) { type = await this . ContentType ( { name : options . type } ) ; } else { type = await this . ContentType ( { versionHash : options . type } ) ; } typeId = type . id ; options . type = type . hash ; } if ( ! objectId ) { const { contractAddress } = await this . authClient . CreateContentObject ( { libraryId , typeId } ) ; objectId = this . utils . AddressToObjectId ( contractAddress ) ; } if ( options . visibility ) { await this . CallContractMethod ( { abi : ContentContract . abi , contractAddress : this . utils . HashToAddress ( objectId ) , methodName : "setVisibility" , methodArgs : [ options . visibility ] } ) ; } const path = UrlJoin ( "qid" , objectId ) ; return await ResponseToJson ( this . HttpClient . Request ( { headers : await this . authClient . AuthorizationHeader ( { libraryId , objectId , update : true } ) , method : "POST" , path : path , body : options , failover : false } ) ) ; }
Create a new content object draft.
Create a new content object draft .
// Look up content type, if specified // Type name specified // Type hash specified