use of com.googleapis.www.model.DirectoryList in project gce2retrofit by chiuki.
the class Discovery method main.
public static void main(String[] args) {
Retrofit restAdapter = new Retrofit.Builder().baseUrl(API_URL).addConverterFactory(GsonConverterFactory.create()).build();
Apis apis = restAdapter.create(Apis.class);
try {
Response<DirectoryList> response = apis.list(null, null).execute();
System.out.println(response.body().kind);
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
use of com.googleapis.www.model.DirectoryList in project gce2retrofit by chiuki.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final TextView textView = new TextView(this);
setContentView(textView);
Retrofit restAdapter = new Retrofit.Builder().baseUrl(API_URL).addConverterFactory(GsonConverterFactory.create()).build();
Apis apis = restAdapter.create(Apis.class);
Call<DirectoryList> call = apis.list(null, null);
call.enqueue(new Callback<DirectoryList>() {
@Override
public void onResponse(Call<DirectoryList> call, Response<DirectoryList> response) {
textView.setText(response.body().kind);
}
@Override
public void onFailure(Call<DirectoryList> call, Throwable t) {
String msg = t.getMessage();
if (TextUtils.isEmpty(msg)) {
textView.setText(t.getClass().getSimpleName());
}
}
});
}
Aggregations