RestApiHelper

public class RestApiHelper
extends Object implements IRestApiHelper

java.lang.Object
   ↳ com.android.tradefed.util.RestApiHelper


REST API çağrıları yapmak için kullanılan bir yardımcı sınıf.

Özet

Sabitler

int DEFAULT_NUMBER_OF_RETRIES

Fields'ın oynadığı filmler

protected static final JsonFactory JSON_FACTORY

protected static final String JSON_MIME

Herkese açık kurucular

RestApiHelper(HttpRequestFactory requestFactory, String baseUri)

Belirtilen bilgilerle bir API yardımcısı örneği oluşturur.

Herkese açık yöntemler

GenericUrl buildQueryUri(String[] uriParts, options)

Belirli URI parçaları ve seçenekleriyle bir API çağrısı için URI oluşturun.

HttpResponse execute(String method, String[] uriParts, options, JSONObject data)

Bir API isteğini yürütür.

HttpRequestFactory getRequestFactory()

HttpRequestFactory'yi döndürür.

static RestApiHelper newInstanceWithGoogleCredential(String baseUri, File jsonKeyFile, scopes)

Kimlik doğrulama için Credential kullanan bir API yardımcısı örneği oluşturur.

Sabitler

DEFAULT_NUMBER_OF_RETRIES

protected static final int DEFAULT_NUMBER_OF_RETRIES

Sabit Değer: 2 (0x00000002)

Fields'ın oynadığı filmler

JSON_FACTORY

protected static final JsonFactory JSON_FACTORY

JSON_MIME

protected static final String JSON_MIME

Herkese açık kurucular

RestApiHelper

public RestApiHelper (HttpRequestFactory requestFactory, 
                String baseUri)

Belirtilen bilgilerle bir API yardımcısı ö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)

Belirtilen URI bölümleri ve seçenekleriyle bir API çağrısı için URI oluşturun. uriParts zaten URL kodlamalı, options ise kodlanmamış dize 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 parçaları.

options : sorgu dizesini oluşturmak için kullanılan kodlanmamış parametre adları ve değerleri

data JSONObject: istekle birlikte gönderilecek veriler

İlerlemeler
HttpResponse HttpResponse nesnesi

getRequestFactory

public HttpRequestFactory getRequestFactory ()

HttpRequestFactory'yi döndürür.

Test için yayınlandı.

İlerlemeler
HttpRequestFactory

newInstanceWithGoogleCredential

public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, 
                File jsonKeyFile, 
                 scopes)

Kimlik doğrulama için Credential kullanan bir API yardımcısı ö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

Atışlar
GeneralSecurityException
IOException