當前位置: 首頁>>代碼示例>>Java>>正文


Java Response類代碼示例

本文整理匯總了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
);
 
開發者ID:OwaNotifier,項目名稱:owa-notifier,代碼行數:11,代碼來源:TokenService.java

示例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
);
 
開發者ID:OwaNotifier,項目名稱:owa-notifier,代碼行數:9,代碼來源:OutlookService.java

示例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);
    }
}
 
開發者ID:googlesamples,項目名稱:android-instant-apps,代碼行數:25,代碼來源:PhotoService.java

示例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());
        }
    });
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:19,代碼來源:MADBikeNotificationOpenedHandler.java

示例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());
        }
    });

}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:18,代碼來源:PostWeatherInteractor.java

示例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
);
 
開發者ID:OwaNotifier,項目名稱:owa-notifier,代碼行數:11,代碼來源:TokenService.java

示例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();
        }
    });
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:21,代碼來源:LastFmClient.java

示例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) {

                    }
                }
        );


    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:26,代碼來源:ProfilePhotoFragment.java

示例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) {

                    }
                }
        );


    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:25,代碼來源:ProfileDinelineFragment.java

示例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) {

                    }
                }
        );


    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:26,代碼來源:ProfileReviewFragment.java

示例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) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:23,代碼來源:SavedCollectionFragment.java

示例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) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:24,代碼來源:SuggestedCollectionFragment.java

示例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) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:23,代碼來源:MyCollectionFragment.java

示例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) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:23,代碼來源:FollowingCollectionFragment.java

示例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) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:20,代碼來源:SelectLocationActivity.java


注:本文中的retrofit.client.Response類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。