Class ContentfulClientBase
Base class for Contentful clients.
Inheritance
System.Object
ContentfulClientBase
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace:Contentful.Core
Assembly:cs.temp.dll.dll
Syntax
public abstract class ContentfulClientBase
Fields
_httpClient
The HttpClient used for API calls.
Declaration
protected HttpClient _httpClient
Field Value
Type | Description |
---|---|
HttpClient |
_options
The ContentfulOptions for this ContentfulClient.
Declaration
protected ContentfulOptions _options
Field Value
Type | Description |
---|---|
ContentfulOptions |
Properties
Application
Property for sending a custom tracking header.
Declaration
public string Application { get; set; }
Property Value
Type | Description |
---|---|
System.String |
SerializerSettings
Gets or sets the settings that should be used for deserialization.
Declaration
public JsonSerializerSettings SerializerSettings { get; set; }
Property Value
Type | Description |
---|---|
JsonSerializerSettings |
Version
Returns the current version of the package.
Declaration
public string Version { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddVersionHeader(Nullable<Int32>, HttpRequestMessage)
Adds a Contentful version header to the request.
Declaration
protected void AddVersionHeader(int? version, HttpRequestMessage message)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | version | The version to add. |
HttpRequestMessage | message | The message to add the header to. |
CreateExceptionForFailedRequest(HttpResponseMessage)
Creates an exception for a failed API request.
Declaration
protected Task CreateExceptionForFailedRequest(HttpResponseMessage res)
Parameters
Type | Name | Description |
---|---|---|
HttpResponseMessage | res | The HttpResonseMessage. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
EnsureSuccessfulResult(HttpResponseMessage)
Ensures an HttpResponse is successful.
Declaration
protected Task<HttpResponseMessage> EnsureSuccessfulResult(HttpResponseMessage response)
Parameters
Type | Name | Description |
---|---|---|
HttpResponseMessage | response |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HttpResponseMessage> |
SendHttpRequest(String, HttpMethod, String, CancellationToken, HttpContent, Nullable<Int32>, String, String, List<KeyValuePair<String, IEnumerable<String>>>)
Sends an Http request.
Declaration
protected Task<HttpResponseMessage> SendHttpRequest(string url, HttpMethod method, string authToken, CancellationToken cancellationToken, HttpContent content = null, int? version = default(int? ), string contentTypeId = null, string organisationId = null, List<KeyValuePair<string, IEnumerable<string>>> additionalHeaders = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The url to send to. |
HttpMethod | method | The HTTP method to use. |
System.String | authToken | The authorization token. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
HttpContent | content | The HTTP content. |
System.Nullable<System.Int32> | version | The version of the content. |
System.String | contentTypeId | The contenttype id header. |
System.String | organisationId | The organisation it header. |
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.Collections.Generic.IEnumerable<System.String>>> | additionalHeaders | Any additional headers to send with the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HttpResponseMessage> |