Skip to content

Commit c33601f

Browse files
committed
duplicate class removed.
1 parent ff0a5c1 commit c33601f

File tree

9 files changed

+37
-93
lines changed

9 files changed

+37
-93
lines changed

library/src/main/java/io/syslogic/github/api/GithubClient.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import io.syslogic.github.api.model.Repository;
1919
import io.syslogic.github.api.model.RepositorySearch;
2020
import io.syslogic.github.api.model.User;
21-
import io.syslogic.github.api.model.WorkflowJobsResponse;
21+
import io.syslogic.github.api.model.WorkflowJobs;
2222
import io.syslogic.github.api.model.WorkflowRun;
23-
import io.syslogic.github.api.model.WorkflowRunsResponse;
24-
import io.syslogic.github.api.model.WorkflowsResponse;
23+
import io.syslogic.github.api.model.WorkflowRuns;
24+
import io.syslogic.github.api.model.Workflows;
2525

2626
import okhttp3.OkHttpClient;
2727
import okhttp3.ResponseBody;
@@ -197,7 +197,7 @@ public class GithubClient {
197197
* @param repo the name of the repository.
198198
* @return Retrofit2 call.
199199
*/
200-
@NonNull public static Call<WorkflowsResponse> getWorkflows(@Nullable String token, @NonNull String owner, @NonNull String repo) {
200+
@NonNull public static Call<Workflows> getWorkflows(@Nullable String token, @NonNull String owner, @NonNull String repo) {
201201
return getService().getWorkflows("token " + token, owner, repo);
202202
}
203203

@@ -209,7 +209,7 @@ public class GithubClient {
209209
* @param repo the name of the repository.
210210
* @return Retrofit2 call.
211211
*/
212-
@NonNull public static Call<WorkflowRunsResponse> getWorkflowRuns(@Nullable String token, @NonNull String owner, @NonNull String repo) {
212+
@NonNull public static Call<WorkflowRuns> getWorkflowRuns(@Nullable String token, @NonNull String owner, @NonNull String repo) {
213213
return getService().getWorkflowRuns("token " + token, owner, repo);
214214
}
215215

@@ -235,7 +235,7 @@ public class GithubClient {
235235
* @param runId the ID of the run to list jobs for.
236236
* @return Retrofit2 call.
237237
*/
238-
@NonNull public static Call<WorkflowJobsResponse> getWorkflowJobs(@Nullable String token, @NonNull String owner, @NonNull String repo, @NonNull Long runId) {
238+
@NonNull public static Call<WorkflowJobs> getWorkflowJobs(@Nullable String token, @NonNull String owner, @NonNull String repo, @NonNull Long runId) {
239239
return getService().getWorkflowJobs("token " + token, owner, repo, runId);
240240
}
241241

library/src/main/java/io/syslogic/github/api/GithubService.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import io.syslogic.github.api.model.RepositorySearch;
1212
import io.syslogic.github.api.model.User;
1313

14-
import io.syslogic.github.api.model.WorkflowJobsResponse;
14+
import io.syslogic.github.api.model.WorkflowJobs;
1515
import io.syslogic.github.api.model.WorkflowRun;
16-
import io.syslogic.github.api.model.WorkflowRunsResponse;
17-
import io.syslogic.github.api.model.WorkflowsResponse;
16+
import io.syslogic.github.api.model.WorkflowRuns;
17+
import io.syslogic.github.api.model.Workflows;
1818

1919
import okhttp3.ResponseBody;
2020

@@ -231,7 +231,7 @@ Call<RepositorySearch> getRepositories(
231231
*/
232232
@NonNull
233233
@GET("/repos/{owner}/{repo}/actions/workflows")
234-
Call<WorkflowsResponse> getWorkflows(
234+
Call<Workflows> getWorkflows(
235235
@NonNull @Header("Authorization") String token,
236236
@NonNull @Path(value = "owner") String owner,
237237
@NonNull @Path(value = "repo") String repo
@@ -246,7 +246,7 @@ Call<WorkflowsResponse> getWorkflows(
246246
*/
247247
@NonNull
248248
@GET("/repos/{owner}/{repo}/actions/runs")
249-
Call<WorkflowRunsResponse> getWorkflowRuns(
249+
Call<WorkflowRuns> getWorkflowRuns(
250250
@NonNull @Header("Authorization") String token,
251251
@NonNull @Path(value = "owner") String owner,
252252
@NonNull @Path(value = "repo") String repo
@@ -271,15 +271,16 @@ Call<WorkflowRun> getWorkflowRun(
271271

272272
/**
273273
* GitHub Actions: Workflow Run Jobs.
274+
*
274275
* @param token the personal access token.
275276
* @param owner the owner of the repository.
276-
* @param repo the name of the repository.
277+
* @param repo the name of the repository.
277278
* @param runId the ID of the workflow run.
278279
* @return Retrofit2 call.
279280
*/
280281
@NonNull
281282
@GET("/repos/{owner}/{repo}/actions/runs/{runId}/jobs")
282-
Call<WorkflowJobsResponse> getWorkflowJobs(
283+
Call<WorkflowJobs> getWorkflowJobs(
283284
@NonNull @Header("Authorization") String token,
284285
@NonNull @Path(value = "owner") String owner,
285286
@NonNull @Path(value = "repo") String repo,

library/src/main/java/io/syslogic/github/api/model/WorkflowJobsResponse.java

-57
This file was deleted.

library/src/main/java/io/syslogic/github/api/model/WorkflowRunsResponse.java renamed to library/src/main/java/io/syslogic/github/api/model/WorkflowRuns.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @author Martin Zeitler
1414
*/
15-
public class WorkflowRunsResponse {
15+
public class WorkflowRuns {
1616

1717
@SerializedName("workflow_runs")
1818
private ArrayList<WorkflowRun> workflowRuns;

library/src/main/java/io/syslogic/github/api/model/WorkflowsResponse.java renamed to library/src/main/java/io/syslogic/github/api/model/Workflows.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @author Martin Zeitler
1414
*/
15-
public class WorkflowsResponse {
15+
public class Workflows {
1616

1717
/** Items */
1818
@SerializedName("workflows")

mobile/src/main/java/io/syslogic/github/recyclerview/RepositoriesAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import io.syslogic.github.api.GithubClient;
3131
import io.syslogic.github.api.model.Repository;
3232
import io.syslogic.github.api.model.Workflow;
33-
import io.syslogic.github.api.model.WorkflowsResponse;
33+
import io.syslogic.github.api.model.Workflows;
3434
import io.syslogic.github.databinding.CardviewRepositoryBinding;
3535
import io.syslogic.github.databinding.FragmentRepositoriesBinding;
3636
import io.syslogic.github.model.PagerState;
@@ -154,15 +154,15 @@ void getWorkflows(int positionStart) {
154154
final int[] index = {0};
155155
for (Repository item : this.getItems()) {
156156

157-
Call<WorkflowsResponse> api = GithubClient.getWorkflows(accessToken, username, item.getName());
157+
Call<Workflows> api = GithubClient.getWorkflows(accessToken, username, item.getName());
158158
GithubClient.logUrl(LOG_TAG, api);
159159

160160
api.enqueue(new Callback<>() {
161161
@Override
162-
public void onResponse(@NonNull Call<WorkflowsResponse> call, @NonNull Response<WorkflowsResponse> response) {
162+
public void onResponse(@NonNull Call<Workflows> call, @NonNull Response<Workflows> response) {
163163
if (response.code() == 200) { // OK
164164
if (response.body() != null) {
165-
WorkflowsResponse items = response.body();
165+
Workflows items = response.body();
166166
if (BuildConfig.DEBUG) {
167167
if (items.getWorkflows() != null && items.getWorkflows().size() > 0) {
168168

@@ -182,7 +182,7 @@ public void onResponse(@NonNull Call<WorkflowsResponse> call, @NonNull Response<
182182
}
183183

184184
@Override
185-
public void onFailure(@NonNull Call<WorkflowsResponse> call, @NonNull Throwable t) {
185+
public void onFailure(@NonNull Call<Workflows> call, @NonNull Throwable t) {
186186
if (BuildConfig.DEBUG) {Log.e(LOG_TAG, "onFailure: " + t.getMessage());}
187187
}
188188
});

mobile/src/main/java/io/syslogic/github/recyclerview/WorkflowRunsAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import io.syslogic.github.activity.BaseActivity;
2626
import io.syslogic.github.api.GithubClient;
2727
import io.syslogic.github.api.model.WorkflowRun;
28-
import io.syslogic.github.api.model.WorkflowRunsResponse;
28+
import io.syslogic.github.api.model.WorkflowRuns;
2929
import io.syslogic.github.api.room.Abstraction;
3030
import io.syslogic.github.databinding.CardviewWorkflowRunBinding;
3131

@@ -95,15 +95,15 @@ protected Context getContext() {
9595

9696
public void getWorkflowRuns(String accessToken, String username, String repositoryName) {
9797

98-
Call<WorkflowRunsResponse> api = GithubClient.getWorkflowRuns(accessToken, username, repositoryName);
98+
Call<WorkflowRuns> api = GithubClient.getWorkflowRuns(accessToken, username, repositoryName);
9999
GithubClient.logUrl(LOG_TAG, api);
100100

101101
api.enqueue(new Callback<>() {
102102
@Override
103-
public void onResponse(@NonNull Call<WorkflowRunsResponse> call, @NonNull Response<WorkflowRunsResponse> response) {
103+
public void onResponse(@NonNull Call<WorkflowRuns> call, @NonNull Response<WorkflowRuns> response) {
104104
if (response.code() == 200) { // OK
105105
if (response.body() != null) {
106-
WorkflowRunsResponse items = response.body();
106+
WorkflowRuns items = response.body();
107107
if (items.getWorkflowRuns() != null && items.getWorkflowRuns().size() > 0) {
108108
mItems = items.getWorkflowRuns();
109109
notifyItemRangeChanged(0, mItems.size());
@@ -115,7 +115,7 @@ public void onResponse(@NonNull Call<WorkflowRunsResponse> call, @NonNull Respon
115115
}
116116

117117
@Override
118-
public void onFailure(@NonNull Call<WorkflowRunsResponse> call, @NonNull Throwable t) {
118+
public void onFailure(@NonNull Call<WorkflowRuns> call, @NonNull Throwable t) {
119119
if (BuildConfig.DEBUG) {Log.e(LOG_TAG, "onFailure: " + t.getMessage());}
120120
}
121121
});

mobile/src/main/java/io/syslogic/github/recyclerview/WorkflowStepsAdapter.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import io.syslogic.github.BuildConfig;
1818
import io.syslogic.github.R;
1919
import io.syslogic.github.api.GithubClient;
20-
import io.syslogic.github.api.model.WorkflowJobsResponse;
20+
import io.syslogic.github.api.model.WorkflowJobs;
2121
import io.syslogic.github.api.model.WorkflowStep;
2222
import io.syslogic.github.api.room.Abstraction;
2323
import io.syslogic.github.databinding.CardviewWorkflowStepBinding;
@@ -86,16 +86,16 @@ protected Context getContext() {
8686

8787
public void getWorkflowSteps(String accessToken, String username, String repositoryName, Long runId) {
8888

89-
Call<WorkflowJobsResponse> api = GithubClient.getWorkflowJobs(accessToken, username, repositoryName, runId);
89+
Call<WorkflowJobs> api = GithubClient.getWorkflowJobs(accessToken, username, repositoryName, runId);
9090
GithubClient.logUrl(LOG_TAG, api);
9191

9292
api.enqueue(new Callback<>() {
9393
@Override
94-
public void onResponse(@NonNull Call<WorkflowJobsResponse> call, @NonNull Response<WorkflowJobsResponse> response) {
94+
public void onResponse(@NonNull Call<WorkflowJobs> call, @NonNull Response<WorkflowJobs> response) {
9595
if (response.code() == 200) { // OK
9696
if (response.body() != null) {
97-
WorkflowJobsResponse items = response.body();
98-
if (items.getJobs() != null && items.getJobs().get(0).getSteps().size() > 0) {
97+
WorkflowJobs items = response.body();
98+
if (! items.getJobs().get(0).getSteps().isEmpty()) {
9999
setItems(items.getJobs().get(0).getSteps());
100100
notifyItemRangeChanged(0, mItems.size());
101101
}
@@ -106,7 +106,7 @@ public void onResponse(@NonNull Call<WorkflowJobsResponse> call, @NonNull Respon
106106
}
107107

108108
@Override
109-
public void onFailure(@NonNull Call<WorkflowJobsResponse> call, @NonNull Throwable t) {
109+
public void onFailure(@NonNull Call<WorkflowJobs> call, @NonNull Throwable t) {
110110
if (BuildConfig.DEBUG) {Log.e(LOG_TAG, "onFailure: " + t.getMessage());}
111111
}
112112
});

mobile/src/main/java/io/syslogic/github/recyclerview/WorkflowsAdapter.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import io.syslogic.github.activity.BaseActivity;
2626
import io.syslogic.github.api.GithubClient;
2727
import io.syslogic.github.api.model.Workflow;
28-
import io.syslogic.github.api.model.WorkflowsResponse;
28+
import io.syslogic.github.api.model.Workflows;
2929
import io.syslogic.github.api.room.Abstraction;
3030
import io.syslogic.github.databinding.CardviewWorkflowBinding;
3131

@@ -98,15 +98,15 @@ public void setRepositoryId(Long value) {
9898

9999
public void getWorkflows(String accessToken, String username, String repositoryName) {
100100

101-
Call<WorkflowsResponse> api = GithubClient.getWorkflows(accessToken, username, repositoryName);
101+
Call<Workflows> api = GithubClient.getWorkflows(accessToken, username, repositoryName);
102102
GithubClient.logUrl(LOG_TAG, api);
103103

104104
api.enqueue(new Callback<>() {
105105
@Override
106-
public void onResponse(@NonNull Call<WorkflowsResponse> call, @NonNull Response<WorkflowsResponse> response) {
106+
public void onResponse(@NonNull Call<Workflows> call, @NonNull Response<Workflows> response) {
107107
if (response.code() == 200) { // OK
108108
if (response.body() != null) {
109-
WorkflowsResponse items = response.body();
109+
Workflows items = response.body();
110110
if (items.getWorkflows() != null && items.getWorkflows().size() > 0) {
111111
mItems = items.getWorkflows();
112112
for (Workflow item : mItems) {item.setRepositoryId(repositoryId);}
@@ -119,7 +119,7 @@ public void onResponse(@NonNull Call<WorkflowsResponse> call, @NonNull Response<
119119
}
120120

121121
@Override
122-
public void onFailure(@NonNull Call<WorkflowsResponse> call, @NonNull Throwable t) {
122+
public void onFailure(@NonNull Call<Workflows> call, @NonNull Throwable t) {
123123
if (BuildConfig.DEBUG) {Log.e(LOG_TAG, "onFailure: " + t.getMessage());}
124124
}
125125
});

0 commit comments

Comments
 (0)