本文整理匯總了Java中retrofit.client.Response類的典型用法代碼示例。如果您正苦於以下問題:Java Response類的具體用法?Java Response怎麽用?Java Response使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Response類屬於retrofit.client包,在下文中一共展示了Response類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAccessTokenFromAuthCode
import retrofit.client.Response; //導入依賴的package包/類
@FormUrlEncoded
@POST("/{tenantid}/oauth2/v2.0/token")
Response getAccessTokenFromAuthCode(
@Path("tenantid") String tenantId,
@Field("client_id") String clientId,
@Field("client_secret") String clientSecret,
@Field("grant_type") String grantType,
@Field("code") String code,
@Field("redirect_uri") String redirectUrl
);
示例2: getMessages
import retrofit.client.Response; //導入依賴的package包/類
@GET("/v1.0/me/mailfolders/{folderid}/messages")
Response getMessages(
@Path("folderid") String folderId,
@Query("$orderby") String orderBy,
@Query("$select") String select,
@Query("$filter") String filter,
@Query("$top") Integer maxResults
);
示例3: getPhotosAsync
import retrofit.client.Response; //導入依賴的package包/類
public void getPhotosAsync(final PhotoCallback callback) {
if (mPhotos == null) {
new RestAdapter.Builder()
.setEndpoint(UnsplashService.ENDPOINT)
.build()
.create(UnsplashService.class).getFeed(new Callback<List<Photo>>() {
@Override
public void success(List<Photo> photos, Response response) {
// the first items not interesting to us, get the last <n>
mPhotos = new ArrayList<>(photos.subList(photos.size() - PHOTO_COUNT,
photos.size()));
callback.success(mPhotos);
}
@Override
public void failure(RetrofitError error) {
callback.error();
Log.e(TAG, "Could not load photos, " + error);
}
});
} else {
callback.success(mPhotos);
}
}
示例4: sendRequestOpenedPush
import retrofit.client.Response; //導入依賴的package包/類
private void sendRequestOpenedPush(OSNotificationOpenResult result) {
RestAdapter retrofit = new RestAdapter.Builder()
.setEndpoint("https://onesignal.com/api/v1/")
.build();
OneSignalApi service = retrofit.create(OneSignalApi.class);
service.openedOneSignalPush(String.valueOf(result.notification.androidNotificationId), new OneSignalBody(), new Callback<OneSignalResponse>() {
@Override
public void success(OneSignalResponse oneSignalResponse, Response response) {
Log.d("RETROFIT", "Is success:" + oneSignalResponse.isSuccess());
}
@Override
public void failure(RetrofitError error) {
Log.e("RETROFIT", error.toString());
}
});
}
示例5: execute
import retrofit.client.Response; //導入依賴的package包/類
@Override
public void execute() throws Throwable {
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(context.getString(R.string.weather_url)).build();
Apis apis = restAdapter.create(Apis.class);
apis.getWeatherData(6359304, Locale.getDefault().getLanguage(), "metric", "43cd5e05d25e37bdffbad27e42619e3f", new Callback<WeatherResponse>() {
@Override
public void success(WeatherResponse weatherResponse, Response response) {
EventBus.getDefault().post(weatherResponse);
}
@Override
public void failure(RetrofitError error) {
EventBus.getDefault().post(new WeatherResponse());
}
});
}
示例6: getAccessTokenFromRefreshToken
import retrofit.client.Response; //導入依賴的package包/類
@FormUrlEncoded
@POST("/{tenantid}/oauth2/v2.0/token")
Response getAccessTokenFromRefreshToken(
@Path("tenantid") String tenantId,
@Field("client_id") String clientId,
@Field("client_secret") String clientSecret,
@Field("grant_type") String grantType,
@Field("refresh_token") String code,
@Field("redirect_uri") String redirectUrl
);
示例7: getUserLoginInfo
import retrofit.client.Response; //導入依賴的package包/類
public void getUserLoginInfo(UserLoginQuery userLoginQuery, final UserListener listener) {
mUserRestService.getUserLoginInfo(UserLoginQuery.Method, JSON, API_KEY, generateMD5(userLoginQuery.getSignature()), userLoginQuery.mUsername, userLoginQuery.mPassword, new Callback<UserLoginInfo>() {
@Override
public void success(UserLoginInfo userLoginInfo, Response response) {
Log.d("Logedin", userLoginInfo.mSession.mToken + " " + userLoginInfo.mSession.mUsername);
Bundle extras = new Bundle();
extras.putString("lf_token", userLoginInfo.mSession.mToken);
extras.putString("lf_user", userLoginInfo.mSession.mUsername);
PreferencesUtility.getInstance(context).updateService(extras);
mUserSession = userLoginInfo.mSession;
mUserSession.update(context);
listener.userSuccess();
}
@Override
public void failure(RetrofitError error) {
listener.userInfoFailed();
}
});
}
示例8: getUserReviews
import retrofit.client.Response; //導入依賴的package包/類
private void getUserReviews() {
RetroInterface.getZomatoRestApi().getUserPhotos(
user_id,
new Callback<RestaurantImageResponse>() {
@Override
public void success(RestaurantImageResponse restaurantImageResponse, Response response) {
if(restaurantImageResponse!=null)
{
restaurantImages = restaurantImageResponse.getItems();
profileRestaurantImageAdapter.refresh(restaurantImages);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例9: getUserReviews
import retrofit.client.Response; //導入依賴的package包/類
private void getUserReviews() {
RetroInterface.getZomatoRestApi().getUserDineline(
user_id,
new Callback<DinelineResponse>() {
@Override
public void success(DinelineResponse dinelineResponse, Response response) {
if (dinelineResponse != null) {
dinelineItems = dinelineResponse.getItems();
profileDinelineAdapter.refresh(dinelineItems);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例10: getUserReviews
import retrofit.client.Response; //導入依賴的package包/類
private void getUserReviews() {
RetroInterface.getZomatoRestApi().getUserReviews(
user_id,
new Callback<ProfileReviewResponse>() {
@Override
public void success(ProfileReviewResponse restaurantDetailResponse, Response response) {
if(restaurantDetailResponse!=null)
{
reviewItems = restaurantDetailResponse.getItems();
reviewAdapter.refresh(reviewItems);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例11: getAllCollections
import retrofit.client.Response; //導入依賴的package包/類
private void getAllCollections() {
RetroInterface.getZomatoRestApi().getSavedCollection(
SessionPreference.getUserId(context) + "",
new Callback<CollectionResponse>() {
@Override
public void success(CollectionResponse collectionResponse, Response response) {
if (collectionResponse != null && collectionResponse.isSuccess()) {
items = collectionResponse.getItems();
recyclerViewAdapter.refresh(items);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例12: getAllCollections
import retrofit.client.Response; //導入依賴的package包/類
private void getAllCollections() {
RetroInterface.getZomatoRestApi().getRecommendedCollection(
SessionPreference.getUserId(context) + "",
new Callback<CollectionResponse>() {
@Override
public void success(CollectionResponse collectionResponse, Response response) {
if(collectionResponse!=null && collectionResponse.isSuccess()){
items = collectionResponse.getItems();
recyclerViewAdapter.refresh(items);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例13: getAllCollections
import retrofit.client.Response; //導入依賴的package包/類
private void getAllCollections() {
RetroInterface.getZomatoRestApi().getMyCollection(
SessionPreference.getUserId(context) + "",
new Callback<CollectionResponse>() {
@Override
public void success(CollectionResponse collectionResponse, Response response) {
if(collectionResponse!=null && collectionResponse.isSuccess()){
items = collectionResponse.getItems();
recyclerViewAdapter.refresh(items);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例14: getAllCollections
import retrofit.client.Response; //導入依賴的package包/類
private void getAllCollections() {
RetroInterface.getZomatoRestApi().getFollowCollection(
SessionPreference.getUserId(context) + "",
new Callback<CollectionResponse>() {
@Override
public void success(CollectionResponse collectionResponse, Response response) {
if(collectionResponse!=null && collectionResponse.isSuccess()){
items = collectionResponse.getItems();
recyclerViewAdapter.refresh(items);
}
}
@Override
public void failure(RetrofitError error) {
}
}
);
}
示例15: updateLocation
import retrofit.client.Response; //導入依賴的package包/類
private void updateLocation(final UserLocation location) {
RetroInterface.getZomatoRestApi().setUserLocation(
SessionPreference.getUserId(context) + "",
location.getId() + "",
new Callback<NormalResponse>() {
@Override
public void success(NormalResponse normalResponse, Response response) {
LocationPreference.setLocationParams(context, location);
finish();
}
@Override
public void failure(RetrofitError error) {
}
}
);
}