-
Notifications
You must be signed in to change notification settings - Fork 435
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
Milestones module development #343
base: master
Are you sure you want to change the base?
Changes from all commits
081cf03
ae5596c
2d6fe3f
2c8f445
56e2ae2
970e2d0
f7ba846
e2a05c3
0f89372
1d4b946
3c2e2f3
97ef560
177aff9
f789379
fcff329
61d168e
fe86c30
095bbf9
be4ea89
e98304c
a49d793
25634e3
46b674a
7f9bcc3
98123ee
3e97b5c
cd188da
bc378c7
2fe6404
6e2c675
0bddafe
ce9fb35
ee9cd86
01ed3cc
59a4f43
233d72c
c3b3504
620200e
d1137ac
f19b59f
255aef7
9df359c
ff7665e
19429a6
db30f03
7affe5d
d8d5aaf
5a29dc2
6fa48a4
80c2d1a
411a16b
ff8356f
cc7da89
6d3f519
548d9fd
5377028
2757d25
b45e03c
c73bfad
f2e7240
45e45df
1f78dbd
4f5ff22
fdfe8f5
d03ed67
5f549cc
8c0ed93
2bcf70e
aaeb72d
4719e9e
33e9980
c21e65b
9a3f483
f3928f2
af5a5a0
8e2b5db
7043b70
135d903
9aeb8a2
a8fecea
25824b6
0f80cc2
b39189c
25bd40d
90b08e0
6073cbc
f8a2b01
fb43465
ae70857
02863ad
69ccc84
ed44be6
d61237d
cf31ab7
e860b82
c57c96b
fd6a50a
e518b7c
e4602e6
baa1bd8
4cc54a6
00d3e2b
cd41a4a
6e47980
bf37592
ab0329d
c4d3159
4b87e74
e3a85c2
9e5ae56
30048f0
0883b55
f493fe9
d3658ad
19d4db3
f2044a2
42f616c
d2b391c
68a24e6
f60a50e
4b38c89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,13 @@ Call<Issue> getIssue( | |
@Path("repo") String repo, | ||
@Path("number") long number); | ||
|
||
@Headers("Accept: application/vnd.github.squirrel-girl-preview") | ||
@GET("repos/{owner}/{repo}/issues") | ||
Call<List<Issue>> getIssues( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Query("milestone") String milestone); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This request doesn't work with pagination (we can fix it in a future commit if you prefer) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We prefer to fix it in future because it is not the vital problem for milestones |
||
@Headers({"Accept: application/vnd.github.v3.full+json", | ||
"Accept: application/vnd.github.mockingbird-preview", | ||
"Accept: application/vnd.github.squirrel-girl-preview"}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2016 Jon Ander Peñalba | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.mobile.api.service; | ||
|
||
import com.github.mobile.api.model.Issue; | ||
import com.github.mobile.api.model.Milestone; | ||
import java.util.List; | ||
|
||
import retrofit2.Call; | ||
import retrofit2.http.Body; | ||
import retrofit2.http.DELETE; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.Headers; | ||
import retrofit2.http.PATCH; | ||
import retrofit2.http.POST; | ||
import retrofit2.http.Path; | ||
import retrofit2.http.Query; | ||
|
||
public interface MilestoneService { | ||
@GET("repos/{owner}/{repo}/milestones/{number}") | ||
Call<Milestone> getMilestone( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Path("number") long number); | ||
|
||
@GET("repos/{owner}/{repo}/milestones") | ||
Call<List<Milestone>> getMilestones( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo); | ||
|
||
@Headers("Accept: application/vnd.github.squirrel-girl-preview") | ||
@GET("repos/{owner}/{repo}/issues") | ||
Call<List<Issue>> getIssues( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Query("milestone") long milestone); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More pagination problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We prefer to fix it in future because it is not the vital problem for milestones |
||
|
||
@POST("repos/{owner}/{repo}/milestones") | ||
Call<Milestone> createMilestone ( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Body Milestone milestone); | ||
|
||
@PATCH("repos/{owner}/{repo}/milestones/{number}") | ||
Call<Milestone> editMilestone ( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Path("number") long number, | ||
@Body Milestone milestone); | ||
|
||
@DELETE("repos/{owner}/{repo}/milestones/{number}") | ||
Call<Milestone> deleteMilestone( | ||
@Path("owner") String owner, | ||
@Path("repo") String repo, | ||
@Path("number") long number); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a custom adapter for milestones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To allow setting null due_date for milestone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you achieve the same result by modifying the current
DateAdapter
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, default adapter for milestones just ignores null properties.
So there is no other way to send patch request with due_on = null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean changing the behavior of https://github.com/jonan/ForkHub/blob/master/app/src/main/java/com/github/mobile/api/DateAdapter.java which is already being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we set due_on = null, then DateAdapter is not being called by Milestone adapter because it skips null properties.
Yes, we can achieve it only with DateAdapter, if use some date as null. For example, DateAdapter will replace 01/01/1990 to null. But I am not sure, that it is a better alternative.