Skip to content

Commit

Permalink
Milestones Service
Browse files Browse the repository at this point in the history
  • Loading branch information
tsnik committed Dec 17, 2017
1 parent 43e3c8c commit 1d4b946
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/com/github/mobile/ServicesModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ MilestoneService milestoneService(GitHubClient client) {
return new MilestoneService(client);
}

@Provides
com.github.mobile.api.service.MilestoneService milestoneService(Retrofit retrofit) {
return retrofit.create(com.github.mobile.api.service.MilestoneService.class);
}

@Provides
LabelService labelService(GitHubClient client) {
return new LabelService(client);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.Milestone;
import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
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 {
@Headers("Accept: application/vnd.github.squirrel-girl-preview")
@GET("repos/{owner}/{repo}/milestones/{number}")
Call<Milestone> getMilestone(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("number") long number);

@Headers("Accept: application/vnd.github.squirrel-girl-preview")
@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<Milestone>> getIssues(
@Path("owner") String owner,
@Path("repo") String repo,
@Query("milestone") long milestone);

@Headers("Accept: application/vnd.github.squirrel-girl-preview")
@POST("repos/{owner}/{repo}/milestones")
Call<Milestone> createMilestone (
@Path("owner") String owner,
@Path("repo") String repo,
@Body Milestone milestone);

@Headers("Accept: application/vnd.github.squirrel-girl-preview")
@PATCH("repos/{owner}/{repo}/milestones/{number}")
Call<Milestone> editMilestone (
@Path("owner") String owner,
@Path("repo") String repo,
@Path("number") long number,
@Body Milestone milestone);
}

0 comments on commit 1d4b946

Please sign in to comment.