Table of Contents

Class JsonClient

Namespace
NetCoreForce.Client
Assembly
NetCoreForce.Client.dll
public class JsonClient : IDisposable
Inheritance
JsonClient
Implements
Inherited Members

Constructors

JsonClient(string, HttpClient)

Intialize the JSON client.

By default, uses a shared static HttpClient instance for best performance.

public JsonClient(string accessToken, HttpClient httpClient = null)

Parameters

accessToken string

API Access token

httpClient HttpClient

Optional custom HttpClient. Ideally this should be a shared static instance for best performance.

Methods

Dispose()

Dispose client - only disposes instance HttpClient, if any. Shared static HttpClient is left as-is.

public void Dispose()

HttpDeleteAsync<T>(Uri, Dictionary<string, string>, bool)

public Task<T> HttpDeleteAsync<T>(Uri uri, Dictionary<string, string> customHeaders = null, bool deserializeResponse = true)

Parameters

uri Uri
customHeaders Dictionary<string, string>
deserializeResponse bool

Returns

Task<T>

Type Parameters

T

HttpGetAsync<T>(Uri, Dictionary<string, string>, bool)

public Task<T> HttpGetAsync<T>(Uri uri, Dictionary<string, string> customHeaders = null, bool deserializeResponse = true)

Parameters

uri Uri
customHeaders Dictionary<string, string>
deserializeResponse bool

Returns

Task<T>

Type Parameters

T

HttpPatchAsync<T>(object, Uri, Dictionary<string, string>, bool, bool, bool, List<string>, bool)

Submits a PATCH request

public Task<T> HttpPatchAsync<T>(object inputObject, Uri uri, Dictionary<string, string> customHeaders = null, bool deserializeResponse = true, bool serializeComplete = false, bool includeSObjectId = false, List<string> fieldsToNull = null, bool ignoreNulls = true)

Parameters

inputObject object
uri Uri
customHeaders Dictionary<string, string>
deserializeResponse bool
serializeComplete bool

Serializes ALL object properties to include in the request, even those not appropriate for some update/patch calls.

includeSObjectId bool

includes the SObject ID when serializing the request content

fieldsToNull List<string>

A list of properties that should be set to null, but inclusing the null values in the serialized output

ignoreNulls bool

Use with caution. By default null values are not serialized, this will serialize all explicitly nulled or missing properties as null

Returns

Task<T>

Type Parameters

T

HttpPostAsync<T>(object, Uri, Dictionary<string, string>, bool, List<string>, bool)

public Task<T> HttpPostAsync<T>(object inputObject, Uri uri, Dictionary<string, string> customHeaders = null, bool deserializeResponse = true, List<string> fieldsToNull = null, bool ignoreNulls = true)

Parameters

inputObject object
uri Uri
customHeaders Dictionary<string, string>
deserializeResponse bool
fieldsToNull List<string>
ignoreNulls bool

Returns

Task<T>

Type Parameters

T