本文整理汇总了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) {
}
}
);
}