Class ApiBase
API base class
Inherited Members
Namespace: Pixiv.VroidSdk.Api
Assembly: Pixiv.VroidSdk.dll
Syntax
public abstract class ApiBase
Constructors
ApiBase(IApiRequestable)
Constructor to create ApiBase instance
Declaration
public ApiBase(IApiRequestable client)
Parameters
Type | Name | Description |
---|---|---|
IApiRequestable | client | Client to carry out API request |
Fields
_client
Declaration
protected IApiRequestable _client
Field Value
Type | Description |
---|---|
IApiRequestable |
Methods
ConvertApiResponse<T>(IHttpResponse)
Convert response to ApiResponseTemplate<DataType>
Declaration
protected ApiResponseTemplate<T> ConvertApiResponse<T>(IHttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
IHttpResponse | response | HTTP response to convert |
Returns
Type | Description |
---|---|
ApiResponseTemplate<T> | Post-conversion ApiResponseTemplate<DataType> |
Type Parameters
Name | Description |
---|---|
T | API response type |
ConvertErrorResponse(IHttpResponse)
Convert error respnse to ApiErrorFormat
Declaration
protected ApiErrorFormat ConvertErrorResponse(IHttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
IHttpResponse | response | Error response |
Returns
Type | Description |
---|---|
ApiErrorFormat | ApiErrorFormat to display error |
OmitApiLinksFormat<T>(Action<T>)
Omit ApiLinksFormat from success callback
Declaration
protected Action<T, ApiLinksFormat> OmitApiLinksFormat<T>(Action<T> onSuccess)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onSuccess | success callback including ApiLinksFormat |
Returns
Type | Description |
---|---|
Action<T, ApiLinksFormat> | Success callback excluding ApiLinksFormat |
Type Parameters
Name | Description |
---|---|
T | Response type |
OnHttpRequestFailed(Action<Account>, Action<ApiErrorFormat>)
HTTP request failed
Declaration
protected Action<HttpRequestFailedException> OnHttpRequestFailed(Action<Account> onRefreshCode, Action<ApiErrorFormat> onError)
Parameters
Type | Name | Description |
---|---|---|
Action<Account> | onRefreshCode | Callback on token refresh |
Action<ApiErrorFormat> | onError | Callback on failure |
Returns
Type | Description |
---|---|
Action<HttpRequestFailedException> | Fix the errorAction |
OnSuccessCallback<T>(IHttpResponse, Action<T, ApiLinksFormat>, Action<ApiErrorFormat>)
Success callback
Declaration
protected void OnSuccessCallback<T>(IHttpResponse response, Action<T, ApiLinksFormat> onSuccess, Action<ApiErrorFormat> onError)
Parameters
Type | Name | Description |
---|---|---|
IHttpResponse | response | HTTP response |
Action<T, ApiLinksFormat> | onSuccess | Success callback |
Action<ApiErrorFormat> | onError | Failure callback |
Type Parameters
Name | Description |
---|---|
T | Response type |
OnSuccessCallback<T>(IHttpResponse, Action<T>, Action<ApiErrorFormat>)
Success callback
Declaration
protected void OnSuccessCallback<T>(IHttpResponse response, Action<T> onSuccess, Action<ApiErrorFormat> onError)
Parameters
Type | Name | Description |
---|---|---|
IHttpResponse | response | HTTP response |
Action<T> | onSuccess | Success callback |
Action<ApiErrorFormat> | onError | Failure callback |
Type Parameters
Name | Description |
---|---|
T | Response type |