request Method

Try to acquire locks and/or reserve codes from iModelHub. This function may fulfill some requests and fail to fulfill others. This function returns a rejection of type IModelHubError if some or all requests could not be fulfilled. The error object will identify the locks and/or codes that are unavailable.

Example: ``` ts // Now acquire all locks and reserve all codes needed. // This is a *perquisite* to saving local changes. try { await iModel.concurrencyControl.request(authorizedRequestContext); } catch (err) { // If we can't get *all* of the locks and codes that are needed, // then we can't go on with this transaction as is. // We could possibly make additional changes to remove the need // for the resources that are unavailable. In this case, // we will just bail out and print a message. iModel.abandonChanges(); // report error ... } // Now we can commit the local changes to a local transaction in the // IModelDb. ``` Note that this function will request resources even in bulk mode.

request(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<void>

throws IModelHubError if some or all of the request could not be fulfilled by iModelHub.

throws IModelError if the IModelDb is not open or is not connected to an iModel. See CodeHandler and LockHandler for details on what errors may be thrown. See ConcurrencyControl.requestResources for a convenience method that builds and makes a request in one step.

Parameter Type Description
requestContext AuthorizedClientRequestContext The client request context
req ConcurrencyControl.Request The requests to be sent to iModelHub. If undefined, all pending requests are sent to iModelHub.

Returns - Promise<void>

Defined in

Last Updated: 13 June, 2024