Class ApiBase
APIの基底クラス
Inherited Members
Namespace: Pixiv.VroidSdk.Api
Assembly: Pixiv.VroidSdk.dll
Syntax
public abstract class ApiBase
Constructors
ApiBase(IApiRequestable)
ApiBaseのインスタンスを作成するコンストラクタ
Declaration
public ApiBase(IApiRequestable client)
Parameters
| Type | Name | Description |
|---|---|---|
| IApiRequestable | client | APIリクエストを行うクライアント |
Fields
_client
Declaration
protected IApiRequestable _client
Field Value
| Type | Description |
|---|---|
| IApiRequestable |
Methods
ConvertApiResponse<T>(IHttpResponse)
レスポンスをApiResponseTemplate<DataType>に変換する
Declaration
protected ApiResponseTemplate<T> ConvertApiResponse<T>(IHttpResponse response)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpResponse | response | 変換するHTTPレスポンス |
Returns
| Type | Description |
|---|---|
| ApiResponseTemplate<T> |
Type Parameters
| Name | Description |
|---|---|
| T | APIレスポンスの型 |
ConvertErrorResponse(IHttpResponse)
エラーのレスポンスをApiErrorFormatに変換する
Declaration
protected ApiErrorFormat ConvertErrorResponse(IHttpResponse response)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpResponse | response | エラーのレスポンス |
Returns
| Type | Description |
|---|---|
| ApiErrorFormat | エラーを表すApiErrorFormat |
OmitApiLinksFormat<T>(Action<T>)
成功コールバックからApiLinksFormatを取り除く
Declaration
protected Action<T, ApiLinksFormat> OmitApiLinksFormat<T>(Action<T> onSuccess)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<T> | onSuccess | ApiLinksFormatを含む成功コールバック |
Returns
| Type | Description |
|---|---|
| Action<T, ApiLinksFormat> | ApiLinksFormatを含まない成功コールバック |
Type Parameters
| Name | Description |
|---|---|
| T | レスポンスの型 |
OnHttpRequestFailed(Action<Account>, Action<ApiErrorFormat>)
HTTPリクエストが失敗した
Declaration
protected Action<HttpRequestFailedException> OnHttpRequestFailed(Action<Account> onRefreshCode, Action<ApiErrorFormat> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<Account> | onRefreshCode | トークンリフレッシュが成功したときのコールバック |
| Action<ApiErrorFormat> | onError | 失敗コールバック |
Returns
| Type | Description |
|---|---|
| Action<HttpRequestFailedException> | 失敗を処理するAction |
OnSuccessCallback<T>(IHttpResponse, Action<T, ApiLinksFormat>, Action<ApiErrorFormat>)
成功コールバック
Declaration
protected void OnSuccessCallback<T>(IHttpResponse response, Action<T, ApiLinksFormat> onSuccess, Action<ApiErrorFormat> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpResponse | response | HTTPレスポンス |
| Action<T, ApiLinksFormat> | onSuccess | 成功コールバック |
| Action<ApiErrorFormat> | onError | 失敗コールバック |
Type Parameters
| Name | Description |
|---|---|
| T | レスポンスの型 |
OnSuccessCallback<T>(IHttpResponse, Action<T>, Action<ApiErrorFormat>)
成功コールバック
Declaration
protected void OnSuccessCallback<T>(IHttpResponse response, Action<T> onSuccess, Action<ApiErrorFormat> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpResponse | response | HTTPレスポンス |
| Action<T> | onSuccess | 成功コールバック |
| Action<ApiErrorFormat> | onError | 失敗コールバック |
Type Parameters
| Name | Description |
|---|---|
| T | レスポンスの型 |