RestApiHelper
public class RestApiHelper
extends Object
implements IRestApiHelper
java.lang.Nesne | |
↳ | com.android.tradefed.util.RestApiHelper |
REST API çağrıları gerçekleştirmek için bir yardımcı sınıf.
Özet
sabitler | |
---|---|
int | DEFAULT_NUMBER_OF_RETRIES
|
Alanlar | |
---|---|
protected static final JsonFactory | JSON_FACTORY |
protected static final String | JSON_MIME
|
Kamu inşaatçıları | |
---|---|
RestApiHelper (HttpRequestFactory requestFactory, String baseUri) Verilen bilgilerle bir API yardımcı örneği oluşturur. |
Genel yöntemler | |
---|---|
GenericUrl | buildQueryUri (String[] uriParts, options) buildQueryUri (String[] uriParts, options) Verilen URI bölümleri ve seçenekleriyle bir API çağrısı için bir URI oluşturun. |
HttpResponse | execute (String method, String[] uriParts, options, JSONObject data) execute (String method, String[] uriParts, options, JSONObject data) Bir API isteği yürütür. |
HttpRequestFactory | getRequestFactory () HttpRequestFactory'yi döndürür. |
static RestApiHelper | newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile, scopes) newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile, scopes) Bir kullanan bir API yardımcı örneği oluşturur |
static RestApiHelper | newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile, scopes) newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile, scopes) Bir kullanan bir API yardımcı örneği oluşturur |
sabitler
DEFAULT_NUMBER_OF_RETRIES
protected static final int DEFAULT_NUMBER_OF_RETRIES
Sabit Değer: 2 (0x00000002)
Alanlar
JSON_FACTORY
protected static final JsonFactory JSON_FACTORY
JSON_MIME
protected static final String JSON_MIME
Kamu inşaatçıları
RestApiHelper
public RestApiHelper (HttpRequestFactory requestFactory, String baseUri)
Verilen bilgilerle bir API yardımcı örneği oluşturur.
parametreler | |
---|---|
requestFactory | HttpRequestFactory : kullanımına fabrika oluştururken HttpRequest s. |
baseUri | String : API temel tanım |
Genel yöntemler
buildQueryUri
public GenericUrl buildQueryUri (String[] uriParts,options)
Verilen URI bölümleri ve seçenekleriyle bir API çağrısı için bir URI oluşturun. uriParts zaten URL ile kodlanmış olmalı, seçenekler ise kodlanmamış Dizeler olmalıdır.
parametreler | |
---|---|
uriParts | String |
options |
İadeler | |
---|---|
GenericUrl |
uygulamak
public HttpResponse execute (String method, String[] uriParts,options, JSONObject data)
Bir API isteği yürütür.
parametreler | |
---|---|
method | String : talebinin bir HTTP yöntemi |
uriParts | String : URL URI parçaları isteği URI oluşturmak için kullanılacak kodlanmış. |
options | |
data | JSONObject : Veriler isteği ile gönderilecek |
İadeler | |
---|---|
HttpResponse | bir HttpResponse nesnesi |
getRequestFactory
public HttpRequestFactory getRequestFactory ()
HttpRequestFactory'yi döndürür.
Test için maruz bırakıldı.
İadeler | |
---|---|
HttpRequestFactory |
newInstanceWithGoogleKimlik Bilgileri
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile,scopes)
Bir kullanan bir API yardımcı örneği oluşturur Credential
kimlik doğrulaması için.
parametreler | |
---|---|
baseUri | String : API temel tanım |
jsonKeyFile | File : Hizmet hesabı json anahtar dosyası |
scopes |
İadeler | |
---|---|
RestApiHelper |
atar | |
---|---|
| GeneralSecurityException |
newInstanceWithGoogleKimlik Bilgileri
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile,scopes)
Bir kullanan bir API yardımcı örneği oluşturur Credential
kimlik doğrulaması için.
parametreler | |
---|---|
baseUri | String : API temel tanım |
serviceAccount | String : hizmetin adı kullanımına hesabı |
keyFile | File : Hizmet hesabı anahtar dosyası |
scopes |
İadeler | |
---|---|
RestApiHelper |
atar | |
---|---|
| GenelGüvenlikİstisnası |