Skip to main content

Class Raw

Namespace: Consul
Assembly: Consul.dll

Raw can be used to do raw queries against custom endpoints

public class Raw : IRawEndpoint

Inheritance

objectRaw

Implements

IRawEndpoint

Inherited Members

object.Equals(object) , object.Equals(object, object) , object.GetHashCode() , object.GetType() , object.MemberwiseClone() , object.ReferenceEquals(object, object) , object.ToString()

Methods

Query(string, QueryOptions, CancellationToken)

Query is used to do a GET request against an endpoint and deserialize the response into an interface using standard Consul conventions.

public Task<QueryResult<dynamic>> Query(string endpoint, QueryOptions q, CancellationToken ct = default)

Parameters

endpoint string

The URL endpoint to access

q QueryOptions

Custom query options

ct CancellationToken

Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing

Returns

Task <QueryResult <dynamic>>

The data returned by the custom endpoint

Write(string, object, WriteOptions, CancellationToken)

Write is used to do a PUT request against an endpoint and serialize/deserialized using the standard Consul conventions.

public Task<WriteResult<dynamic>> Write(string endpoint, object obj, WriteOptions q, CancellationToken ct = default)

Parameters

endpoint string

The URL endpoint to access

obj object

The object to serialize and send to the endpoint. Must be able to be JSON serialized, or be an object of type byte[], which is sent without serialzation.

q WriteOptions

Custom write options

ct CancellationToken

The cancellation token

Returns

Task <WriteResult <dynamic>>

The data returned by the custom endpoint in response to the write request

  • Methods
    • Query(string, QueryOptions, CancellationToken)
    • Write(string, object, WriteOptions, CancellationToken)