RestApiHelper
public
class
RestApiHelper
extends Object
implements
IRestApiHelper
| java.lang.Object | |
| ↳ | com.android.tradefed.util.RestApiHelper |
REST API कॉल करने के लिए सहायक क्लास.
खास जानकारी
कॉन्स्टेंट | |
|---|---|
int |
DEFAULT_NUMBER_OF_RETRIES
|
फ़ील्ड्स की फ़िल्में | |
|---|---|
protected
static
final
JsonFactory |
JSON_FACTORY
|
protected
static
final
String |
JSON_MIME
|
पब्लिक कंस्ट्रक्टर | |
|---|---|
RestApiHelper(HttpRequestFactory requestFactory, String baseUri)
दी गई जानकारी के साथ एपीआई हेल्पर इंस्टेंस बनाता है. |
|
सार्वजनिक तरीके | |
|---|---|
GenericUrl
|
buildQueryUri(String[] uriParts,
दिए गए यूआरआई के हिस्सों और विकल्पों की मदद से, एपीआई कॉल के लिए यूआरआई बनाएं. |
HttpResponse
|
execute(String method, String[] uriParts,
एपीआई अनुरोध को पूरा करता है. |
HttpRequestFactory
|
getRequestFactory()
HttpRequestFactory दिखाता है. |
static
RestApiHelper
|
newInstanceWithGoogleCredential(String baseUri, File jsonKeyFile,
यह एक एपीआई हेल्पर इंस्टेंस बनाता है, जो पुष्टि करने के लिए |
कॉन्स्टेंट
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)दी गई जानकारी के साथ एपीआई हेल्पर इंस्टेंस बनाता है.
| पैरामीटर | |
|---|---|
requestFactory |
HttpRequestFactory: HttpRequest बनाते समय इस्तेमाल की जाने वाली फ़ैक्ट्री. |
baseUri |
String: एपीआई का बेस यूआरआई |
सार्वजनिक तरीके
buildQueryUri
public GenericUrl buildQueryUri (String[] uriParts,
options) दिए गए यूआरआई के हिस्सों और विकल्पों के साथ, एपीआई कॉल के लिए यूआरआई बनाएं. uriParts को पहले से ही यूआरएल-कोड में बदल दिया जाना चाहिए, जबकि विकल्पों को कोड में बदला नहीं जाना चाहिए.
| पैरामीटर | |
|---|---|
uriParts |
String |
options |
|
| रिटर्न | |
|---|---|
GenericUrl |
|
execute
public HttpResponse execute (String method,
String[] uriParts,
options,
JSONObject data) एपीआई अनुरोध को पूरा करता है.
| पैरामीटर | |
|---|---|
method |
String: अनुरोध का एचटीटीपी तरीका |
uriParts |
String: अनुरोध यूआरआई बनाने के लिए, यूआरएल कोड में बदले गए यूआरआई के हिस्से. |
options |
: क्वेरी स्ट्रिंग बनाने के लिए इस्तेमाल किए गए, कोड में बदले बिना पैरामीटर के नाम और वैल्यू |
data |
JSONObject: अनुरोध के साथ भेजा जाने वाला डेटा |
| रिटर्न | |
|---|---|
HttpResponse |
HttpResponse ऑब्जेक्ट |
getRequestFactory
public HttpRequestFactory getRequestFactory ()
HttpRequestFactory दिखाता है.
टेस्टिंग के लिए एक्सपोज़ किया गया.
| रिटर्न | |
|---|---|
HttpRequestFactory |
|
newInstanceWithGoogleCredential
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, File jsonKeyFile,scopes)
यह एक एपीआई हेल्पर इंस्टेंस बनाता है, जो पुष्टि करने के लिए Credential का इस्तेमाल करता है.
| पैरामीटर | |
|---|---|
baseUri |
String: एपीआई का बेस यूआरआई |
jsonKeyFile |
File: सेवा खाते की JSON कुंजी फ़ाइल |
scopes |
: सेवा खाते के साथ इस्तेमाल करने के लिए, OAuth के दायरों का कलेक्शन |
| रिटर्न | |
|---|---|
RestApiHelper |
|
| थ्रो | |
|---|---|
|
GeneralSecurityException |
|
IOException |