use of retrofit2.http.GET in project Pokemap by omkarmoghe.
the class NianticManager method loginPTC.
private void loginPTC(final String username, final String password, NianticService.LoginValues values, final LoginListener loginListener) {
HttpUrl url = HttpUrl.parse(LOGIN_URL).newBuilder().addQueryParameter("lt", values.getLt()).addQueryParameter("execution", values.getExecution()).addQueryParameter("_eventId", "submit").addQueryParameter("username", username).addQueryParameter("password", password).build();
OkHttpClient client = mClient.newBuilder().followRedirects(false).followSslRedirects(false).build();
NianticService service = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).client(client).build().create(NianticService.class);
Callback<NianticService.LoginResponse> loginCallback = new Callback<NianticService.LoginResponse>() {
@Override
public void onResponse(Call<NianticService.LoginResponse> call, Response<NianticService.LoginResponse> response) {
String location = response.headers().get("location");
if (location != null && location.split("ticket=").length > 0) {
String ticket = location.split("ticket=")[1];
requestToken(ticket, loginListener);
} else {
Log.e(TAG, "PTC login failed via loginPTC(). There was no location header in response.");
loginListener.authFailed("Pokemon Trainer Club Login Failed");
}
}
@Override
public void onFailure(Call<NianticService.LoginResponse> call, Throwable t) {
t.printStackTrace();
Log.e(TAG, "PTC login failed via loginPTC(). loginCallback.onFailure() threw: " + t.getMessage());
loginListener.authFailed("Pokemon Trainer Club Login Failed");
}
};
Call<NianticService.LoginResponse> call = service.login(url.toString());
call.enqueue(loginCallback);
}
use of retrofit2.http.GET in project azure-sdk-for-java by Azure.
the class WebAppsInner method listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync.
/**
* Gets the publishing profile for an app (or deployment slot, if specified).
* Gets the publishing profile for an app (or deployment slot, if specified).
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of the app.
* @param slot Name of the deployment slot. If a slot is not specified, the API will get the publishing profile for the production slot.
* @param format Name of the format. Valid values are:
FileZilla3
WebDeploy -- default
Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp'
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the InputStream object
*/
public Observable<ServiceResponse<InputStream>> listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync(String resourceGroupName, String name, String slot, PublishingProfileFormat format) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (slot == null) {
throw new IllegalArgumentException("Parameter slot is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2016-08-01";
CsmPublishingProfileOptions publishingProfileOptions = new CsmPublishingProfileOptions();
publishingProfileOptions.withFormat(format);
return service.listPublishingProfileXmlWithSecretsSlot(resourceGroupName, name, slot, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), publishingProfileOptions, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<InputStream>>>() {
@Override
public Observable<ServiceResponse<InputStream>> call(Response<ResponseBody> response) {
try {
ServiceResponse<InputStream> clientResponse = listPublishingProfileXmlWithSecretsSlotDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of retrofit2.http.GET in project azure-sdk-for-java by Azure.
the class WebSiteManagementClientImpl method listGeoRegionsSinglePageAsync.
/**
* Get a list of available geographical regions.
* Get a list of available geographical regions.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<GeoRegionInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<GeoRegionInner>>> listGeoRegionsSinglePageAsync() {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2016-03-01";
final SkuName sku = null;
final Boolean linuxWorkersEnabled = null;
return service.listGeoRegions(this.subscriptionId(), sku, linuxWorkersEnabled, apiVersion, this.acceptLanguage(), this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<GeoRegionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<GeoRegionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<GeoRegionInner>> result = listGeoRegionsDelegate(response);
return Observable.just(new ServiceResponse<Page<GeoRegionInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of retrofit2.http.GET in project azure-sdk-for-java by Azure.
the class ServicePrincipalsInner method updateKeyCredentialsWithServiceResponseAsync.
/**
* Update the keyCredentials associated with a service principal.
*
* @param objectId The object ID for which to get service principal information.
* @param value A collection of KeyCredentials.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> updateKeyCredentialsWithServiceResponseAsync(String objectId, List<KeyCredentialInner> value) {
if (objectId == null) {
throw new IllegalArgumentException("Parameter objectId is required and cannot be null.");
}
if (this.client.tenantID() == null) {
throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (value == null) {
throw new IllegalArgumentException("Parameter value is required and cannot be null.");
}
Validator.validate(value);
KeyCredentialsUpdateParameters parameters = new KeyCredentialsUpdateParameters();
parameters.withValue(value);
return service.updateKeyCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = updateKeyCredentialsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of retrofit2.http.GET in project azure-sdk-for-java by Azure.
the class UsersInner method getMemberGroupsWithServiceResponseAsync.
/**
* Gets a collection that contains the object IDs of the groups of which the user is a member.
*
* @param objectId The object ID of the user for which to get group membership.
* @param securityEnabledOnly If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<String> object
*/
public Observable<ServiceResponse<List<String>>> getMemberGroupsWithServiceResponseAsync(String objectId, boolean securityEnabledOnly) {
if (objectId == null) {
throw new IllegalArgumentException("Parameter objectId is required and cannot be null.");
}
if (this.client.tenantID() == null) {
throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
UserGetMemberGroupsParameters parameters = new UserGetMemberGroupsParameters();
parameters.withSecurityEnabledOnly(securityEnabledOnly);
return service.getMemberGroups(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<String>>>>() {
@Override
public Observable<ServiceResponse<List<String>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl1<String>> result = getMemberGroupsDelegate(response);
ServiceResponse<List<String>> clientResponse = new ServiceResponse<List<String>>(result.body().items(), result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations