Class BaseRestClient
A base class for HTTP clients used to communicate with the Klarna APIs
Inherited Members
Namespace: Klarna.Rest.Core.Communication
Assembly: Klarna.Rest.Core.dll
Syntax
public abstract class BaseRestClient
Constructors
| Improve this Doc View SourceBaseRestClient(ApiSession, IJsonSerializer)
Constructor
Declaration
protected BaseRestClient(ApiSession apiSession, IJsonSerializer jsonSerializer)
Parameters
Type | Name | Description |
---|---|---|
ApiSession | apiSession | The API session instance used to communicate with Klarna APIs |
IJsonSerializer | jsonSerializer | The JSON Serializer instance to use when sending / receiving data |
Fields
| Improve this Doc View SourceApiSession
Session information related to this RestClient
Declaration
protected readonly ApiSession ApiSession
Field Value
Type | Description |
---|---|
ApiSession |
Methods
| Improve this Doc View SourceDelete(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP DELETE calls
Declaration
protected Task Delete(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Delete<T>(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP PATCH calls
Declaration
protected Task<T> Delete<T>(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | HTTP response deserialized to T type |
Type Parameters
Name | Description |
---|---|
T | Type to convert response message to |
Get(String, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP GET calls
Declaration
protected Task Get(string url, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> response = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | response | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Get<T>(String, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP GET calls
Declaration
protected Task<T> Get<T>(string url, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | HTTP response deserialized to T type |
Type Parameters
Name | Description |
---|---|
T | Type to convert response message to |
GetStream(String)
Performs an HTTP call and returns result as a binary stream. Used to download binary/text files, like CSVs and PDFs.
Declaration
protected Task<Stream> GetStream(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Stream endpoint |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | Stream |
Patch(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP PATCH calls
Declaration
protected Task Patch(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Post(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP POST calls
Declaration
protected Task Post(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Post<T>(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP POST calls
Declaration
protected Task<T> Post<T>(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | HTTP response deserialized to T type |
Type Parameters
Name | Description |
---|---|
T | Type to convert response message to |
Put(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP PUT calls
Declaration
protected Task Put(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Put<T>(String, Object, IDictionary<String, String>, Ref<HttpResponseMessage>)
Handles HTTP PUT calls
Declaration
protected Task<T> Put<T>(string url, object data = null, IDictionary<string, string> headers = null, Ref<HttpResponseMessage> outResponse = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to call |
System.Object | data | The data to send |
System.Collections.Generic.IDictionary<System.String, System.String> | headers | The HTTP headers to send when performing a request |
Ref<System.Net.Http.HttpResponseMessage> | outResponse | Ref to raw HttpResponseMessage message |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | HTTP response deserialized to T type |
Type Parameters
Name | Description |
---|---|
T | Type to convert response message to |