Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Call Class #6

Closed
mitch10e opened this issue Sep 9, 2016 · 2 comments
Closed

Create Call Class #6

mitch10e opened this issue Sep 9, 2016 · 2 comments

Comments

@mitch10e
Copy link
Contributor

mitch10e commented Sep 9, 2016

TaskService taskService = ServiceGenerator.createService(TaskService.class);  
Call<List<Task>> call = taskService.getTasks();  
call.enqueue(new Callback<List<Task>>() {  
    @Override
    public void onResponse(Call<List<Task>> call, Response<List<Task>> response) {
        if (response.isSuccessful()) {
            // tasks available
        } else {
            // error response, no access to resource?
        }
    }

    @Override
    public void onFailure(Call<List<Task>> call, Throwable t) {
        // something went completely south (like no internet connection)
        Log.d("Error", t.getMessage());
    }
}
@mitch10e mitch10e changed the title Create Call Class Create Call Class Sep 9, 2016
@mitch10e
Copy link
Contributor Author

mitch10e commented Sep 9, 2016

enum Response {
    case .success
    case .failure
}

@cbh2000
Copy link
Contributor

cbh2000 commented Sep 12, 2016

Results of our API discussion for Response enum: https://gist.github.com/cbh2000/e1403a479cbfd9198f86c5adb60ab1d5

@cbh2000 cbh2000 closed this as completed Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants