RestApiHelper
public class RestApiHelper
extends Object
implements IRestApiHelper
java.lang.Object | |
↳ | com.android.tradefed.util.RestApiHelper |
RESTAPI呼び出しを実行するためのヘルパークラス。
概要
定数 | |
---|---|
int | DEFAULT_NUMBER_OF_RETRIES
|
田畑 | |
---|---|
protected static final JsonFactory | JSON_FACTORY |
protected static final String | JSON_MIME
|
パブリックコンストラクター | |
---|---|
RestApiHelper (HttpRequestFactory requestFactory, String baseUri) 指定された情報を使用してAPIヘルパーインスタンスを作成します。 |
パブリックメソッド | |
---|---|
GenericUrl | buildQueryUri (String[] uriParts, options) buildQueryUri (String[] uriParts, options) 指定されたURIパーツとオプションを使用してAPI呼び出しのURIを作成します。 |
HttpResponse | execute (String method, String[] uriParts, options, JSONObject data) execute (String method, String[] uriParts, options, JSONObject data) APIリクエストを実行します。 |
HttpRequestFactory | getRequestFactory () HttpRequestFactoryを返します。 |
static RestApiHelper | newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile, scopes) newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile, scopes) 使用するAPIヘルパーのインスタンスを作成し |
static RestApiHelper | newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile, scopes) newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile, scopes) 使用するAPIヘルパーのインスタンスを作成し |
定数
DEFAULT_NUMBER_OF_RETRIES
protected static final int DEFAULT_NUMBER_OF_RETRIES
定数値:2(0x00000002)
田畑
JSON_FACTORY
protected static final JsonFactory JSON_FACTORY
JSON_MIME
protected static final String JSON_MIME
パブリックコンストラクター
RestApiHelper
public RestApiHelper (HttpRequestFactory requestFactory, String baseUri)
指定された情報を使用してAPIヘルパーインスタンスを作成します。
パラメーター | |
---|---|
requestFactory | HttpRequestFactory :作成するときに使用する工場HttpRequest 秒。 |
baseUri | String :APIのベースURI |
パブリックメソッド
buildQueryUri
public GenericUrl buildQueryUri (String[] uriParts,options)
指定されたURIパーツとオプションを使用してAPI呼び出しのURIを作成します。 uriPartsはすでにURLエンコードされている必要がありますが、オプションはエンコードされていない文字列である必要があります。
パラメーター | |
---|---|
uriParts | String |
options |
戻り値 | |
---|---|
GenericUrl |
実行する
public HttpResponse execute (String method, String[] uriParts,options, JSONObject data)
APIリクエストを実行します。
パラメーター | |
---|---|
method | String :リクエストのHTTPメソッド |
uriParts | String :URLは、リクエストURIを構築するために使用されるURIの部分をコードしていました。 |
options | |
data | JSONObject :要求を送信するデータ |
戻り値 | |
---|---|
HttpResponse | HttpResponseオブジェクト |
getRequestFactory
public HttpRequestFactory getRequestFactory ()
HttpRequestFactoryを返します。
テストのために公開されました。
戻り値 | |
---|---|
HttpRequestFactory |
newInstanceWithGoogleCredential
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile,scopes)
使用するAPIヘルパーのインスタンスを作成しCredential
認証のために。
パラメーター | |
---|---|
baseUri | String :APIのベースURI |
jsonKeyFile | File :サービスアカウントJSONキーファイル |
scopes |
戻り値 | |
---|---|
RestApiHelper |
投げる | |
---|---|
| GeneralSecurityException |
newInstanceWithGoogleCredential
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile,scopes)
使用するAPIヘルパーのインスタンスを作成しCredential
認証のために。
パラメーター | |
---|---|
baseUri | String :APIのベースURI |
serviceAccount | String :サービスアカウントの名前を使用します |
keyFile | File :サービスアカウントのキーファイル |
scopes |
戻り値 | |
---|---|
RestApiHelper |
投げる | |
---|---|
| GeneralSecurityException |