Table of Contents

Method CallVendorRequestAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

CallVendorRequestAsync(string, string, object?, CancellationToken)

Calls a request that a plugin or a script of OBS Studio registered (a vendor request), and returns what it answered.

public Task<CallVendorResponse> CallVendorRequestAsync(string vendor, string request, object? data = null, CancellationToken cancellationToken = default)

Parameters

vendor string

The name of the vendor: the plugin or script that registered the request.

request string

The type of the request, as the vendor names it.

data object

The data of the request, as the vendor wants it: an object, or a JsonElement, or null for none.

cancellationToken CancellationToken

A token that ends the wait. A request that was not sent yet is not sent.

Returns

Task<CallVendorResponse>

The answer: the vendor and the request that were called, and the data that the vendor answered.

Remarks

What a vendor request does, and what the model shows of it, is up to the plugin or the script: the model learns of its effects through the events, like of anything else that happens in OBS Studio. See SetEnabledAsync(bool, CancellationToken) for the order of changes.

Exceptions

ArgumentException

vendor or request is empty, or data is not an object, or can not be written as JSON.

ObsNotConnectedException

There is no connection to OBS Studio. Nothing was changed.

ObsNotReadyException

OBS Studio is changing its scene collection, or did so after the call. Nothing was changed.

ObsUnknownOutcomeException

OBS Studio did not answer in time, or the connection ended: it is not known what the vendor did.

ObsResponseException

OBS Studio refused the request: it has no vendor of that name, or the vendor has no such request (ErrorCode is ResourceNotFound).