Reference·.NET · BIM.works_SDK.NET

AsyncTask

Class in BIM.works_SDK.

API catalogue · BIM.works_SDK · Class

.NET#
public class AsyncTask

A request executed in a background Task, with an optional progress subscription.

Create through BimWorksClient.CreateAsyncTask(request), then call Execute() once. Await GetTask() to observe transport faults before reading Get(); Get() alone blocks and does not rethrow stored server errors. This API has no cancellation-token or timed-wait overload.

Example#

AsyncTask pending = client.CreateAsyncTask(request);
pending.Execute();
await pending.GetTask();
if (pending.IsError()) throw pending.GetException();
Response result = pending.Get() ?? throw new InvalidOperationException("No successful response.");
JsonElement output = result.GetOutput();

Inheritance and interfaces#

  • System.Object

Members#

Member Kind Description
AsyncTask(BimWorksClient, Request) Constructor Creates an unstarted request. Prefer the client's CreateAsyncTask method, which also registers it for progress dispatch.
AddProgressListener(ProgressListener) Method Registers a listener locally and subscribes to progress updates for this request.
Execute() Method Starts the HTTP request on a background Task. Call once per instance. Server errors are stored for IsError()/GetException(); transport faults fault GetTask()…
Get() Method Blocks until the response latch is signalled, then reads the response. This method does not start execution or throw the stored server exception. Await GetTa…
GetException() Method Reads the server exception recorded by Execute().
GetId() Method Gets the request identifier used by the server's progress subscription.
GetTask() Method Gets the background operation started by Execute(). Awaiting this observes transport faults. Server error envelopes must also be checked with IsError() and G…
IsError() Method Checks whether a server error has been stored. Transport faults are reported by GetTask(), so await it before checking this method.
UpdateProgress(ProgressUpdate) Method Dispatches a received progress update to registered listeners. Called by the client when an update arrives; applications normally register listeners instead.

AsyncTask(BimWorksClient, Request)#

.NET#
public AsyncTask(BimWorksClient bimWorksClient, Request request)

Creates an unstarted request. Prefer the client's CreateAsyncTask method, which also registers it for progress dispatch.

Parameters#

Name Type Description
bimWorksClient BimWorksClient Client that supplies authentication and the HTTP transport.
request Request Request to execute; its id identifies the task.

AddProgressListener(ProgressListener)#

.NET#
public void AddProgressListener(ProgressListener progressListener)

Registers a listener locally and subscribes to progress updates for this request.

Parameters#

Name Type Description
progressListener ProgressListener Listener whose Progress(label, progress) method receives updates.

Exceptions#

  • BIM.works_SDK.BimWorksException — The server rejects the progress subscription.

Execute()#

.NET#
public AsyncTask Execute()

Starts the HTTP request on a background Task. Call once per instance.

Server errors are stored for IsError()/GetException(); transport faults fault GetTask(). A non-success HTTP status may leave Get() null.

Returns#

This AsyncTask, for chaining.

Get()#

.NET#
public Response Get()

Blocks until the response latch is signalled, then reads the response.

This method does not start execution or throw the stored server exception. Await GetTask() first: transport faults can occur before the latch is signalled. Then check IsError() and GetException().

Returns#

The response, or null when no successful HTTP response was stored.

GetException()#

.NET#
public Exception GetException()

Reads the server exception recorded by Execute().

Returns#

The stored exception, or null if no server error has been recorded.

GetId()#

.NET#
public Guid GetId()

Gets the request identifier used by the server's progress subscription.

Returns#

The request's UUID.

GetTask()#

.NET#
public Task GetTask()

Gets the background operation started by Execute().

Awaiting this observes transport faults. Server error envelopes must also be checked with IsError() and GetException().

Returns#

The awaitable Task, or null before Execute() has been called.

IsError()#

.NET#
public bool IsError()

Checks whether a server error has been stored.

Transport faults are reported by GetTask(), so await it before checking this method.

Returns#

True after an error envelope was received; false otherwise, including before completion.

UpdateProgress(ProgressUpdate)#

.NET#
public void UpdateProgress(ProgressUpdate progressUpdate)

Dispatches a received progress update to registered listeners.

Called by the client when an update arrives; applications normally register listeners instead.

Parameters#

Name Type Description
progressUpdate ProgressUpdate Progress label and value supplied by the server.

Inherited members#

  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object,System.Object)
  • System.Object.GetHashCode
  • System.Object.GetType
  • System.Object.MemberwiseClone
  • System.Object.ReferenceEquals(System.Object,System.Object)
  • System.Object.ToString