RestApiHelper
public
class
RestApiHelper
extends Object
implements
IRestApiHelper
| java.lang.Object | |
| ↳ | com.android.tradefed.util.RestApiHelper |
REST API çağrıları yapmak için yardımcı sınıf.
Özet
Sabitler | |
|---|---|
int |
DEFAULT_NUMBER_OF_RETRIES
|
String |
JSON_MIME
|
Fields'ın oynadığı filmler | |
|---|---|
protected
static
final
JsonFactory |
JSON_FACTORY
|
Herkese açık oluşturucular | |
|---|---|
RestApiHelper(HttpRequestFactory requestFactory, String baseUri)
Belirtilen bilgilerle bir API yardımcı programı örneği oluşturur. |
|
Herkese açık yöntemler | |
|---|---|
GenericUrl
|
buildQueryUri(String[] uriParts,
Belirli URI bölümleri ve seçenekleriyle bir API çağrısı için URI oluşturun. |
HttpResponse
|
execute(String method, String[] uriParts,
Bir API isteğini yürütür. |
HttpRequestFactory
|
getRequestFactory()
HttpRequestFactory'yi döndürür. |
static
RestApiHelper
|
newInstanceWithGoogleCredential(String baseUri, File jsonKeyFile,
Kimlik doğrulama için |
Sabitler
DEFAULT_NUMBER_OF_RETRIES
protected static final int DEFAULT_NUMBER_OF_RETRIES
Sabit Değer: 2 (0x00000002)
JSON_MIME
protected static final String JSON_MIME
Sabit Değer: "application/json"
Fields'ın oynadığı filmler
JSON_FACTORY
protected static final JsonFactory JSON_FACTORY
Herkese açık oluşturucular
RestApiHelper
public RestApiHelper (HttpRequestFactory requestFactory,
String baseUri)Belirtilen bilgilerle bir API yardımcı programı örneği oluşturur.
| Parametreler | |
|---|---|
requestFactory |
HttpRequestFactory: HttpRequest oluştururken kullanılacak fabrika. |
baseUri |
String: API'nin temel URI'si |
Herkese açık yöntemler
buildQueryUri
public GenericUrl buildQueryUri (String[] uriParts,
options) Belirli URI bölümleri ve seçenekleriyle bir API çağrısı için URI oluşturun. uriParts zaten URL kodlamalı olmalı, seçenekler ise kodlanmamış dizeler olmalıdır.
| Parametreler | |
|---|---|
uriParts |
String |
options |
|
| İlerlemeler | |
|---|---|
GenericUrl |
|
execute
public HttpResponse execute (String method,
String[] uriParts,
options,
JSONObject data) Bir API isteğini yürütür.
| Parametreler | |
|---|---|
method |
String: İsteğin HTTP yöntemi |
uriParts |
String: İstek URI'sini oluşturmak için kullanılacak URL kodlu URI bölümleri. |
options |
: Sorgu dizesini oluşturmak için kullanılan kodlanmamış parametre adları ve değerleri |
data |
JSONObject: İstekle birlikte gönderilecek veriler |
| İlerlemeler | |
|---|---|
HttpResponse |
HttpResponse nesnesi |
getRequestFactory
public HttpRequestFactory getRequestFactory ()
HttpRequestFactory'yi döndürür.
Test için kullanıma sunulmuştur.
| İlerlemeler | |
|---|---|
HttpRequestFactory |
|
newInstanceWithGoogleCredential
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile,scopes)
Kimlik doğrulama için Credential kullanan bir API yardımcı örneği oluşturur.
| Parametreler | |
|---|---|
baseUri |
String: API'nin temel URI'si |
jsonKeyFile |
File: Hizmet hesabı JSON anahtar dosyası |
scopes |
: Hizmet hesabıyla kullanılacak OAuth kapsamları koleksiyonu |
| İlerlemeler | |
|---|---|
RestApiHelper |
|
| Dekoratif yastıklar | |
|---|---|
|
GeneralSecurityException |
|
IOException |