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) יוצר מופע עוזר 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 : ה- URI הבסיס של API |
שיטות ציבוריות
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 : כתובת האתר מקודד חלקים 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 : ה- URI הבסיס של API |
jsonKeyFile | File : קובץ מפתח שירות חשבון JSON |
scopes |
החזרות | |
---|---|
RestApiHelper |
זורק | |
---|---|
| GeneralSecurityException |
newInstanceWithGoogleCredential
public static RestApiHelper newInstanceWithGoogleCredential (String baseUri, String serviceAccount, File keyFile,scopes)
יוצר מופע עוזר API אשר משתמש Credential
לאימות.
פרמטרים | |
---|---|
baseUri | String : ה- URI הבסיס של API |
serviceAccount | String : את השם של השירות חשבון לשימוש |
keyFile | File : קובץ מפתח חשבון השירות |
scopes |
החזרות | |
---|---|
RestApiHelper |
זורק | |
---|---|
| GeneralSecurityException |