Show / Hide Table of Contents

Class BaseRestClient

A base class for HTTP clients used to communicate with the Klarna APIs

Inheritance
System.Object
BaseRestClient
BaseRestClient
BaseStore
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Klarna.Rest.Core.Communication
Assembly: Klarna.Rest.Core.dll
Syntax
public abstract class BaseRestClient

Constructors

| Improve this Doc View Source

BaseRestClient(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 Source

ApiSession

Session information related to this RestClient

Declaration
protected readonly ApiSession ApiSession
Field Value
Type Description
ApiSession

Methods

| Improve this Doc View Source

Delete(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
| Improve this Doc View Source

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

| Improve this Doc View Source

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
| Improve this Doc View Source

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

| Improve this Doc View Source

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

| Improve this Doc View Source

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
| Improve this Doc View Source

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
| Improve this Doc View Source

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

| Improve this Doc View Source

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
| Improve this Doc View Source

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

  • Improve this Doc
  • View Source
Back to top Copyright (c) 2005-2019 Klarna Bank AB (publ). All rights reserved.