Skip to main content

CkMethodClientBase

Namespace: Meshmakers.Octo.Sdk.ServiceClient.AssetRepositoryServices.Tenants.Methods

Base class of the generated CK method clients. A generated client (one per CK type with methods, Rt{Type}MethodClient) builds the GraphQL document of each method and sends it through ITenantClient.SendMutationAsync<TDto>(GraphQLRequest). This class turns the answer into a CkMethodResult: a success, or one of the errors the method declares; every other error is thrown as CkMethodCallException, transport errors as before (e.g. UnauthorizedServiceAccessException, ServiceClientException).

public abstract class CkMethodClientBase

Inheritance Object → CkMethodClientBase

Methods​

InvokeCkMethodAsync<TResponse, TValue>(String, String, String, Object, IReadOnlyCollection<String>, Func<TResponse, TValue>)​

Calls a method with a declared result.

protected Task<CkMethodResult<TValue>> InvokeCkMethodAsync<TResponse, TValue>(string methodId, string document, string operationName, object variables, IReadOnlyCollection<string> declaredErrorCodes, Func<TResponse, TValue> selectValue)

Type Parameters​

TResponse
The generated response type of the method field

TValue
The C# type of the result

Parameters​

methodId String
Qualified id of the method (for errors)

document String
The GraphQL document

operationName String
The operation name of the document

variables Object
The variables (rtId, input, idempotencyKey)

declaredErrorCodes IReadOnlyCollection<String>
The error codes the method declares

selectValue Func<TResponse, TValue>
Reads the result value from the response

Returns​

Task<CkMethodResult<TValue>>

InvokeCkMethodAsync<TResponse>(String, String, String, Object, IReadOnlyCollection<String>)​

Calls a method without a declared result.

protected Task<CkMethodResult> InvokeCkMethodAsync<TResponse>(string methodId, string document, string operationName, object variables, IReadOnlyCollection<string> declaredErrorCodes)

Type Parameters​

TResponse
The generated response type of the method field

Parameters​

methodId String
Qualified id of the method (for errors)

document String
The GraphQL document

operationName String
The operation name of the document

variables Object
The variables (rtId, input, idempotencyKey)

declaredErrorCodes IReadOnlyCollection<String>
The error codes the method declares

Returns​

Task<CkMethodResult>

StartCkOperationAsync<TResponse, TValue>(String, String, String, Object, IReadOnlyCollection<String>, JsonSerializerOptions)​

Calls an asynchronous method (execution.mode: async) with a declared result: the call returns the operation handle at once; the result is read later with CkOperationsClient.

protected Task<CkMethodResult<CkOperationHandle<TValue>>> StartCkOperationAsync<TResponse, TValue>(string methodId, string document, string operationName, object variables, IReadOnlyCollection<string> declaredErrorCodes, JsonSerializerOptions resultOptions)

Type Parameters​

TResponse
The generated response type of the method field

TValue
The C# type of the result

Parameters​

methodId String
Qualified id of the method (for errors)

document String
The GraphQL document

operationName String
The operation name of the document

variables Object
The variables (rtId, input, idempotencyKey)

declaredErrorCodes IReadOnlyCollection<String>
The error codes the method declares

resultOptions JsonSerializerOptions
The JSON options the result is read with; null for the defaults

Returns​

Task<CkMethodResult<CkOperationHandle<TValue>>>

StartCkOperationAsync<TResponse>(String, String, String, Object, IReadOnlyCollection<String>)​

Calls an asynchronous method (execution.mode: async) without a declared result, see .

protected Task<CkMethodResult<CkOperationHandle>> StartCkOperationAsync<TResponse>(string methodId, string document, string operationName, object variables, IReadOnlyCollection<string> declaredErrorCodes)

Type Parameters​

TResponse
The generated response type of the method field

Parameters​

methodId String
Qualified id of the method (for errors)

document String
The GraphQL document

operationName String
The operation name of the document

variables Object
The variables (rtId, input, idempotencyKey)

declaredErrorCodes IReadOnlyCollection<String>
The error codes the method declares

Returns​

Task<CkMethodResult<CkOperationHandle>>