├── .gitignore ├── LICENSE.md ├── README.md ├── RELEASE.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── build.gradle └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── meisolsson │ │ └── githubsdk │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── meisolsson │ │ │ └── githubsdk │ │ │ ├── core │ │ │ ├── FormattedHtml.java │ │ │ ├── FormattedHtmlAdapter.java │ │ │ ├── FormattedTime.java │ │ │ ├── FormattedTimeAdapter.java │ │ │ ├── GitHubEventAdapter.java │ │ │ ├── GitHubPaginationInterceptor.java │ │ │ ├── GitHubPayloadAdapter.java │ │ │ ├── GitHubPayloadTypeAdapter.java │ │ │ ├── HtmlUtils.java │ │ │ ├── MyAdapterFactory.java │ │ │ ├── ServiceGenerator.java │ │ │ ├── StringResponseConverterFactory.java │ │ │ └── TokenStore.java │ │ │ ├── model │ │ │ ├── AuthorAssociation.java │ │ │ ├── Branch.java │ │ │ ├── ClientErrorResponse.java │ │ │ ├── Commit.java │ │ │ ├── CommitCompare.java │ │ │ ├── Content.java │ │ │ ├── ContentCommit.java │ │ │ ├── ContentType.java │ │ │ ├── DeployKey.java │ │ │ ├── Deployment.java │ │ │ ├── DeploymentStatus.java │ │ │ ├── Download.java │ │ │ ├── Error.java │ │ │ ├── Gist.java │ │ │ ├── GistFile.java │ │ │ ├── GistRevision.java │ │ │ ├── GitHubComment.java │ │ │ ├── GitHubCommentBase.java │ │ │ ├── GitHubEvent.java │ │ │ ├── GitHubEventType.java │ │ │ ├── GitHubFile.java │ │ │ ├── GitHubStats.java │ │ │ ├── GitHubToken.java │ │ │ ├── GitHubWikiPage.java │ │ │ ├── Issue.java │ │ │ ├── IssueEvent.java │ │ │ ├── IssueEventType.java │ │ │ ├── IssueState.java │ │ │ ├── Label.java │ │ │ ├── Membership.java │ │ │ ├── MergeResponse.java │ │ │ ├── Milestone.java │ │ │ ├── NotificationReason.java │ │ │ ├── NotificationSubject.java │ │ │ ├── NotificationThread.java │ │ │ ├── Page.java │ │ │ ├── PageBuild.java │ │ │ ├── PagesBuild.java │ │ │ ├── PagesInfo.java │ │ │ ├── Permissions.java │ │ │ ├── PositionalCommentBase.java │ │ │ ├── PullRequest.java │ │ │ ├── PullRequestMarker.java │ │ │ ├── Reaction.java │ │ │ ├── Reactions.java │ │ │ ├── ReferenceType.java │ │ │ ├── Release.java │ │ │ ├── ReleaseAsset.java │ │ │ ├── Rename.java │ │ │ ├── Repository.java │ │ │ ├── Review.java │ │ │ ├── ReviewComment.java │ │ │ ├── ReviewState.java │ │ │ ├── SearchCode.java │ │ │ ├── SearchPage.java │ │ │ ├── Status.java │ │ │ ├── StatusState.java │ │ │ ├── Subscription.java │ │ │ ├── Team.java │ │ │ ├── TextMatch.java │ │ │ ├── User.java │ │ │ ├── UserType.java │ │ │ ├── VerificationResult.java │ │ │ ├── git │ │ │ │ ├── GitBlob.java │ │ │ │ ├── GitComment.java │ │ │ │ ├── GitCommit.java │ │ │ │ ├── GitEntryType.java │ │ │ │ ├── GitReference.java │ │ │ │ ├── GitReferenceEntry.java │ │ │ │ ├── GitTag.java │ │ │ │ ├── GitTree.java │ │ │ │ ├── GitTreeEntry.java │ │ │ │ └── GitUser.java │ │ │ ├── payload │ │ │ │ ├── CommitCommentPayload.java │ │ │ │ ├── CreatePayload.java │ │ │ │ ├── DeletePayload.java │ │ │ │ ├── DeploymentPayload.java │ │ │ │ ├── DeploymentStatusPayload.java │ │ │ │ ├── DownloadPayload.java │ │ │ │ ├── FollowPayload.java │ │ │ │ ├── ForkApplyPayload.java │ │ │ │ ├── ForkPayload.java │ │ │ │ ├── GistPayload.java │ │ │ │ ├── GitHubPayload.java │ │ │ │ ├── GollumPayload.java │ │ │ │ ├── IssueCommentPayload.java │ │ │ │ ├── IssuesPayload.java │ │ │ │ ├── MemberPayload.java │ │ │ │ ├── MembershipPayload.java │ │ │ │ ├── PageBuildPayload.java │ │ │ │ ├── PublicPayload.java │ │ │ │ ├── PullRequestPayload.java │ │ │ │ ├── PullRequestReviewCommentPayload.java │ │ │ │ ├── PushPayload.java │ │ │ │ ├── ReleasePayload.java │ │ │ │ ├── RepositoryPayload.java │ │ │ │ ├── StatusPayload.java │ │ │ │ ├── TeamAddPayload.java │ │ │ │ └── WatchPayload.java │ │ │ └── request │ │ │ │ ├── CommentRequest.java │ │ │ │ ├── NotificationReadRequest.java │ │ │ │ ├── ReactionRequest.java │ │ │ │ ├── RequestMarkdown.java │ │ │ │ ├── RequestToken.java │ │ │ │ ├── activity │ │ │ │ └── SubscriptionRequest.java │ │ │ │ ├── gist │ │ │ │ └── CreateGist.java │ │ │ │ ├── git │ │ │ │ ├── CreateGitBlob.java │ │ │ │ ├── CreateGitCommit.java │ │ │ │ ├── CreateGitReference.java │ │ │ │ ├── CreateGitTag.java │ │ │ │ ├── CreateGitTree.java │ │ │ │ └── UpdateGitReference.java │ │ │ │ ├── issue │ │ │ │ ├── CreateMilestone.java │ │ │ │ └── IssueRequest.java │ │ │ │ ├── organization │ │ │ │ ├── CreateTeam.java │ │ │ │ ├── CreateTeamMembership.java │ │ │ │ ├── EditOrganization.java │ │ │ │ ├── EditOrganizationMembership.java │ │ │ │ └── EditOrganizationMembershipState.java │ │ │ │ ├── pull_request │ │ │ │ ├── CreatePullRequest.java │ │ │ │ ├── CreateReview.java │ │ │ │ ├── CreateReviewComment.java │ │ │ │ ├── DismissReview.java │ │ │ │ ├── EditPullRequest.java │ │ │ │ ├── MergeRequest.java │ │ │ │ └── SubmitReview.java │ │ │ │ ├── repository │ │ │ │ ├── CreateCommitComment.java │ │ │ │ ├── CreateContent.java │ │ │ │ ├── CreateDeployKey.java │ │ │ │ ├── CreateDeployment.java │ │ │ │ ├── CreateDeploymentStatus.java │ │ │ │ ├── CreateRelease.java │ │ │ │ ├── CreateRepository.java │ │ │ │ ├── CreateStatus.java │ │ │ │ ├── DeleteContent.java │ │ │ │ ├── EditContent.java │ │ │ │ ├── EditReleaseAsset.java │ │ │ │ └── EditRepository.java │ │ │ │ └── user │ │ │ │ └── EditUser.java │ │ │ └── service │ │ │ ├── OAuthService.java │ │ │ ├── activity │ │ │ ├── EventService.java │ │ │ ├── NotificationService.java │ │ │ ├── StarringService.java │ │ │ └── WatchingService.java │ │ │ ├── gists │ │ │ ├── GistCommentService.java │ │ │ └── GistService.java │ │ │ ├── git │ │ │ └── GitService.java │ │ │ ├── issues │ │ │ ├── IssueAssigneeService.java │ │ │ ├── IssueCommentService.java │ │ │ ├── IssueEventService.java │ │ │ ├── IssueLabelService.java │ │ │ ├── IssueMilestoneService.java │ │ │ ├── IssueService.java │ │ │ └── IssueTimelineService.java │ │ │ ├── misc │ │ │ └── MarkdownService.java │ │ │ ├── organizations │ │ │ ├── OrganizationMemberService.java │ │ │ ├── OrganizationService.java │ │ │ └── OrganizationTeamService.java │ │ │ ├── pull_request │ │ │ ├── PullRequestReviewCommentService.java │ │ │ ├── PullRequestReviewService.java │ │ │ └── PullRequestService.java │ │ │ ├── reactions │ │ │ └── ReactionService.java │ │ │ ├── repositories │ │ │ ├── RepositoryBranchService.java │ │ │ ├── RepositoryCollaboratorService.java │ │ │ ├── RepositoryCommentService.java │ │ │ ├── RepositoryCommitService.java │ │ │ ├── RepositoryContentService.java │ │ │ ├── RepositoryDeployKeyService.java │ │ │ ├── RepositoryDeploymentService.java │ │ │ ├── RepositoryForkService.java │ │ │ ├── RepositoryMergeService.java │ │ │ ├── RepositoryPagesService.java │ │ │ ├── RepositoryReleaseService.java │ │ │ ├── RepositoryService.java │ │ │ └── RepositoryStatusService.java │ │ │ ├── search │ │ │ └── SearchService.java │ │ │ └── users │ │ │ ├── UserFollowerService.java │ │ │ └── UserService.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── meisolsson │ └── githubsdk │ └── ExampleUnitTest.java ├── proguard-rules.pro └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | 10 | #### Library #### 11 | 12 | /library/build 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is this? 2 | 3 | As the project name suggests it's a SDK for GitHub and it's written for Android(/Java). It's built on Retrofit, Auto Value, RxJava and Moshi. 4 | 5 | # How do I get it? 6 | 7 | Import it with Gradle like this: 8 | 9 | compile 'com.github.meisolsson:githubsdk:0.5.1' 10 | 11 | # How do I use it? 12 | 13 | Firstly we init JodaTimeAndroid 14 | ```java 15 | JodaTimeAndroid.init(this); 16 | ``` 17 | 18 | Next we get a token and add it to the TokenStore 19 | ```java 20 | ServiceGenerator.createAuthService() 21 | .getToken(request) 22 | .subscribe(new SingleObserver() { 23 | @Override 24 | public void onSubscribe(Disposable d) { 25 | } 26 | 27 | @Override 28 | public void onSuccess(GitHubToken token) { 29 | if (token.accessToken() != null) { 30 | TokenStore.getInstance(context).saveToken(token); 31 | } else if (token.error() != null) { 32 | //TODO: Handle error 33 | } 34 | } 35 | 36 | @Override 37 | public void onError(Throwable e) { 38 | //TODO: Handle error 39 | } 40 | }); 41 | ``` 42 | 43 | After saving the token we can start fetching data! (This gets the currently authenticated user) 44 | ```java 45 | Single single = ServiceGenerator.createService(context, UserService.class).getUser(); 46 | ``` 47 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | #Release 2 | 1. `clean build releaseAndroidJavadocsJar releaseAndroidSourcesJar` 3 | 2. `generatePomFileForReleasePublication bintrayUpload -PdryRun=false` -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | #org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maniac103/GitHubSdk/5c1e76dd87b162eecf99245f25879eca47c8cfe1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /library/src/androidTest/java/com/meisolsson/githubsdk/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk; 18 | 19 | import android.content.Context; 20 | import android.support.test.InstrumentationRegistry; 21 | import android.support.test.runner.AndroidJUnit4; 22 | 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | /** 29 | * Instrumentation test, which will execute on an Android device. 30 | * 31 | * @see Testing documentation 32 | */ 33 | @RunWith(AndroidJUnit4.class) 34 | public class ExampleInstrumentedTest { 35 | @Test 36 | public void useAppContext() throws Exception { 37 | // Context of the app under test. 38 | Context appContext = InstrumentationRegistry.getTargetContext(); 39 | 40 | assertEquals("com.github.pockethub.githubsdk.test", appContext.getPackageName()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/FormattedHtml.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import com.squareup.moshi.JsonQualifier; 20 | 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @JsonQualifier 26 | public @interface FormattedHtml { 27 | } 28 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/FormattedHtmlAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import com.squareup.moshi.FromJson; 20 | import com.squareup.moshi.ToJson; 21 | 22 | public class FormattedHtmlAdapter { 23 | 24 | @FromJson @FormattedHtml String fromJson(String body_html){ 25 | return String.valueOf(HtmlUtils.format(body_html)); 26 | } 27 | 28 | @ToJson String toJson(@FormattedHtml String body_html){ 29 | return body_html; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/FormattedTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import com.squareup.moshi.JsonQualifier; 20 | 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @JsonQualifier 26 | public @interface FormattedTime { 27 | } 28 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/FormattedTimeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import com.squareup.moshi.FromJson; 20 | import com.squareup.moshi.ToJson; 21 | 22 | import org.joda.time.DateTime; 23 | import org.joda.time.format.DateTimeFormat; 24 | import org.joda.time.format.DateTimeFormatter; 25 | 26 | import java.util.Date; 27 | 28 | public class FormattedTimeAdapter { 29 | 30 | @FromJson 31 | @FormattedTime 32 | Date fromJson(String time){ 33 | DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); 34 | DateTime t = format.withZoneUTC().parseDateTime(time); 35 | return t.toDate(); 36 | } 37 | 38 | @ToJson 39 | String toJson(@FormattedTime Date date){ 40 | DateTimeFormatter formats = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); 41 | return formats.print(date.getTime()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/MyAdapterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import com.ryanharter.auto.value.moshi.MoshiAdapterFactory; 20 | import com.squareup.moshi.JsonAdapter; 21 | 22 | @MoshiAdapterFactory(nullSafe = true) 23 | public abstract class MyAdapterFactory implements JsonAdapter.Factory { 24 | 25 | // Static factory method to access the package 26 | // private generated implementation 27 | public static JsonAdapter.Factory create() { 28 | return new AutoValueMoshi_MyAdapterFactory(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/StringResponseConverterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import java.io.IOException; 20 | import java.lang.annotation.Annotation; 21 | import java.lang.reflect.Type; 22 | 23 | import okhttp3.ResponseBody; 24 | import retrofit2.Converter; 25 | import retrofit2.Retrofit; 26 | 27 | public class StringResponseConverterFactory extends Converter.Factory { 28 | 29 | @Override 30 | public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { 31 | if(type == String.class) 32 | return new StringResponseConverter(); 33 | else 34 | return null; 35 | } 36 | 37 | public class StringResponseConverter implements Converter { 38 | 39 | 40 | @Override 41 | public String convert(ResponseBody value) throws IOException { 42 | return value.string(); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/core/TokenStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.core; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | import android.content.pm.ApplicationInfo; 22 | import android.content.pm.PackageManager; 23 | 24 | public class TokenStore { 25 | 26 | private static final String KEY_TOKEN = "token"; 27 | 28 | private static TokenStore instance; 29 | 30 | private SharedPreferences preferences; 31 | 32 | public static TokenStore getInstance(Context context) { 33 | if(instance == null) 34 | instance = new TokenStore(context); 35 | 36 | return instance; 37 | } 38 | 39 | private TokenStore(Context context) { 40 | try { 41 | ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); 42 | String name = ai.metaData.getString("com.github.pockethub.githubsdk.client_id"); 43 | preferences = context.getSharedPreferences(name, Context.MODE_PRIVATE); 44 | } catch (PackageManager.NameNotFoundException e) { 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | public String getToken(){ 50 | return preferences.getString(KEY_TOKEN, null); 51 | } 52 | 53 | public void saveToken(String key){ 54 | preferences.edit().putString(KEY_TOKEN, key).apply(); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/AuthorAssociation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import com.squareup.moshi.Json; 20 | 21 | public enum AuthorAssociation { 22 | @Json(name = "COLLABORATOR") Collaborator, 23 | @Json(name = "CONTRIBUTOR") Contributor, 24 | @Json(name = "FIRST_TIMER") FirstTimer, 25 | @Json(name = "FIRST_TIME_CONTRIBUTOR") FirstTimeContributor, 26 | @Json(name = "MEMBER") Member, 27 | @Json(name = "NONE") None, 28 | @Json(name = "OWNER") Owner 29 | } 30 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Branch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.Json; 24 | import com.squareup.moshi.JsonAdapter; 25 | import com.squareup.moshi.Moshi; 26 | 27 | @AutoValue 28 | public abstract class Branch implements Parcelable { 29 | 30 | @Nullable 31 | public abstract String name(); 32 | 33 | @Nullable 34 | public abstract Commit commit(); 35 | 36 | @Json(name = "protected") 37 | @Nullable 38 | public abstract Boolean isProtected(); 39 | 40 | @Nullable 41 | public abstract VerificationResult verification(); 42 | 43 | public static JsonAdapter jsonAdapter(Moshi moshi) { 44 | return new AutoValue_Branch.MoshiJsonAdapter(moshi); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/CommitCompare.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.NonNull; 21 | import android.support.annotation.Nullable; 22 | 23 | import com.google.auto.value.AutoValue; 24 | import com.squareup.moshi.Json; 25 | import com.squareup.moshi.JsonAdapter; 26 | import com.squareup.moshi.Moshi; 27 | 28 | import java.util.List; 29 | 30 | @AutoValue 31 | public abstract class CommitCompare implements Parcelable { 32 | 33 | @Nullable 34 | public abstract String url(); 35 | 36 | @Json(name = "base_commit") 37 | @Nullable 38 | public abstract Commit baseCommit(); 39 | 40 | @Json(name = "merge_base_commit") 41 | @Nullable 42 | public abstract Commit mergeBaseCommit(); 43 | 44 | @Nullable 45 | public abstract String status(); 46 | 47 | @Json(name = "ahead_by") 48 | @Nullable 49 | public abstract Integer aheadBy(); 50 | 51 | @Json(name = "behind_by") 52 | @Nullable 53 | public abstract Integer behindBy(); 54 | 55 | @Json(name = "total_commits") 56 | @Nullable 57 | public abstract Integer totalCommits(); 58 | 59 | @NonNull 60 | public abstract List commits(); 61 | 62 | @NonNull 63 | public abstract List files(); 64 | 65 | public static JsonAdapter jsonAdapter(Moshi moshi){ 66 | return new AutoValue_CommitCompare.MoshiJsonAdapter(moshi); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Content.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.Json; 24 | import com.squareup.moshi.JsonAdapter; 25 | import com.squareup.moshi.Moshi; 26 | 27 | @AutoValue 28 | public abstract class Content implements Parcelable { 29 | 30 | @Nullable 31 | public abstract ContentType type(); 32 | 33 | @Nullable 34 | public abstract String encoding(); 35 | 36 | @Nullable 37 | public abstract Integer size(); 38 | 39 | @Nullable 40 | public abstract String name(); 41 | 42 | @Nullable 43 | public abstract String path(); 44 | 45 | @Nullable 46 | public abstract String content(); 47 | 48 | @Nullable 49 | public abstract String sha(); 50 | 51 | @Nullable 52 | public abstract String url(); 53 | 54 | @Json(name = "submodule_git_url") 55 | @Nullable 56 | public abstract String submoduleGitUrl(); 57 | 58 | public static JsonAdapter jsonAdapter(Moshi moshi) { 59 | return new AutoValue_Content.MoshiJsonAdapter(moshi); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/ContentCommit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.meisolsson.githubsdk.model.git.GitCommit; 23 | import com.google.auto.value.AutoValue; 24 | import com.squareup.moshi.JsonAdapter; 25 | import com.squareup.moshi.Moshi; 26 | 27 | @AutoValue 28 | public abstract class ContentCommit implements Parcelable { 29 | 30 | @Nullable 31 | public abstract Content content(); 32 | 33 | @Nullable 34 | public abstract GitCommit commit(); 35 | 36 | public static JsonAdapter jsonAdapter(Moshi moshi) { 37 | return new AutoValue_ContentCommit.MoshiJsonAdapter(moshi); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/ContentType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import com.squareup.moshi.Json; 20 | 21 | public enum ContentType { 22 | @Json(name = "dir") Directory, 23 | @Json(name = "file") File, 24 | @Json(name = "submodule") Submodule, 25 | @Json(name = "symlink") Symlink 26 | } 27 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/DeployKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.meisolsson.githubsdk.core.FormattedTime; 23 | import com.google.auto.value.AutoValue; 24 | import com.squareup.moshi.Json; 25 | import com.squareup.moshi.JsonAdapter; 26 | import com.squareup.moshi.Moshi; 27 | 28 | import java.util.Date; 29 | 30 | @AutoValue 31 | public abstract class DeployKey implements Parcelable { 32 | 33 | @Nullable 34 | public abstract Long id(); 35 | 36 | @Nullable 37 | public abstract String key(); 38 | 39 | @Nullable 40 | public abstract String url(); 41 | 42 | @Nullable 43 | public abstract String title(); 44 | 45 | @Nullable 46 | public abstract Boolean verified(); 47 | 48 | @Json(name = "created_at") 49 | @Nullable 50 | @FormattedTime 51 | public abstract Date createdAt(); 52 | 53 | @Json(name = "read_only") 54 | @Nullable 55 | public abstract Boolean readOnly(); 56 | 57 | public static JsonAdapter jsonAdapter(Moshi moshi) { 58 | return new AutoValue_DeployKey.MoshiJsonAdapter(moshi); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Deployment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.meisolsson.githubsdk.core.FormattedTime; 23 | import com.google.auto.value.AutoValue; 24 | import com.squareup.moshi.Json; 25 | import com.squareup.moshi.JsonAdapter; 26 | import com.squareup.moshi.Moshi; 27 | 28 | import java.util.Date; 29 | import java.util.Map; 30 | 31 | @AutoValue 32 | public abstract class Deployment implements Parcelable { 33 | 34 | @Nullable 35 | public abstract String url(); 36 | 37 | @Nullable 38 | public abstract String sha(); 39 | 40 | @Nullable 41 | public abstract String ref(); 42 | 43 | @Nullable 44 | public abstract String task(); 45 | 46 | @Nullable 47 | public abstract String environment(); 48 | 49 | @Nullable 50 | public abstract String description(); 51 | 52 | @Nullable 53 | public abstract Long id(); 54 | 55 | @Nullable 56 | public abstract Map payload(); 57 | 58 | @Nullable 59 | public abstract User creator(); 60 | 61 | @Json(name = "created_at") 62 | @Nullable 63 | @FormattedTime 64 | public abstract Date createdAt(); 65 | 66 | @Json(name = "updated_at") 67 | @Nullable 68 | @FormattedTime 69 | public abstract Date updatedAt(); 70 | 71 | public static JsonAdapter jsonAdapter(Moshi moshi) { 72 | return new AutoValue_Deployment.MoshiJsonAdapter(moshi); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/DeploymentStatus.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2015 Henrik Olsson 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.meisolsson.githubsdk.model; 19 | 20 | import android.os.Parcelable; 21 | import android.support.annotation.Nullable; 22 | 23 | import com.meisolsson.githubsdk.core.FormattedTime; 24 | import com.google.auto.value.AutoValue; 25 | import com.squareup.moshi.Json; 26 | import com.squareup.moshi.JsonAdapter; 27 | import com.squareup.moshi.Moshi; 28 | 29 | import java.util.Date; 30 | 31 | @AutoValue 32 | public abstract class DeploymentStatus implements Parcelable { 33 | 34 | @Nullable 35 | public abstract String url(); 36 | 37 | @Nullable 38 | public abstract String state(); 39 | 40 | @Nullable 41 | public abstract String description(); 42 | 43 | @Nullable 44 | public abstract Long id(); 45 | 46 | @Nullable 47 | public abstract User creator(); 48 | 49 | @Json(name = "target_url") 50 | @Nullable 51 | public abstract String targetUrl(); 52 | 53 | @Json(name = "created_at") 54 | @Nullable 55 | @FormattedTime 56 | public abstract Date createdAt(); 57 | 58 | @Json(name = "updated_at") 59 | @Nullable 60 | @FormattedTime 61 | public abstract Date updatedAt(); 62 | 63 | public static JsonAdapter jsonAdapter(Moshi moshi) { 64 | return new AutoValue_DeploymentStatus.MoshiJsonAdapter(moshi); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Download.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.meisolsson.githubsdk.core.FormattedTime; 24 | import com.squareup.moshi.Json; 25 | import com.squareup.moshi.JsonAdapter; 26 | import com.squareup.moshi.Moshi; 27 | 28 | import java.util.Date; 29 | 30 | @AutoValue 31 | public abstract class Download implements Parcelable { 32 | 33 | @Nullable 34 | public abstract String url(); 35 | 36 | @Nullable 37 | public abstract String name(); 38 | 39 | @Nullable 40 | public abstract String description(); 41 | 42 | @Nullable 43 | public abstract Long id(); 44 | 45 | @Nullable 46 | public abstract Integer size(); 47 | 48 | @Json(name = "html_url") 49 | @Nullable 50 | public abstract String htmlUrl(); 51 | 52 | @Json(name = "download_count") 53 | public abstract Integer downloadCount(); 54 | 55 | @Json(name = "content_type") 56 | @Nullable 57 | public abstract String contentType(); 58 | 59 | @Json(name = "created_at") 60 | @Nullable 61 | @FormattedTime 62 | public abstract Date createdAt(); 63 | 64 | public static JsonAdapter jsonAdapter(Moshi moshi) { 65 | return new AutoValue_Download.MoshiJsonAdapter(moshi); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Error.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.JsonAdapter; 24 | import com.squareup.moshi.Moshi; 25 | 26 | @AutoValue 27 | public abstract class Error implements Parcelable { 28 | 29 | @Nullable 30 | public abstract String message(); 31 | 32 | public static JsonAdapter jsonAdapter(Moshi moshi) { 33 | return new AutoValue_Error.MoshiJsonAdapter(moshi); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GistRevision.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.meisolsson.githubsdk.core.FormattedTime; 23 | import com.google.auto.value.AutoValue; 24 | import com.squareup.moshi.Json; 25 | import com.squareup.moshi.JsonAdapter; 26 | import com.squareup.moshi.Moshi; 27 | 28 | import java.util.Date; 29 | 30 | @AutoValue 31 | public abstract class GistRevision implements Parcelable { 32 | 33 | @Nullable 34 | public abstract String url(); 35 | 36 | @Nullable 37 | public abstract String version(); 38 | 39 | @Nullable 40 | public abstract User user(); 41 | 42 | @Json(name = "change_status") 43 | @Nullable 44 | public abstract GitHubStats changeStatus(); 45 | 46 | @Json(name = "committed_at") 47 | @Nullable 48 | @FormattedTime 49 | public abstract Date committedAt(); 50 | 51 | public static JsonAdapter jsonAdapter(Moshi moshi) { 52 | return new AutoValue_GistRevision.MoshiJsonAdapter(moshi); 53 | } 54 | } -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GitHubComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.support.annotation.Nullable; 20 | 21 | import com.google.auto.value.AutoValue; 22 | import com.squareup.moshi.Json; 23 | import com.squareup.moshi.JsonAdapter; 24 | import com.squareup.moshi.Moshi; 25 | 26 | import java.util.Date; 27 | 28 | @AutoValue 29 | public abstract class GitHubComment extends GitHubCommentBase { 30 | 31 | public abstract Builder toBuilder(); 32 | 33 | public static Builder builder() { 34 | return new AutoValue_GitHubComment.Builder(); 35 | } 36 | 37 | public static JsonAdapter jsonAdapter(Moshi moshi) { 38 | return new AutoValue_GitHubComment.MoshiJsonAdapter(moshi); 39 | } 40 | 41 | @AutoValue.Builder 42 | public abstract static class Builder extends GitHubCommentBase.Builder { 43 | public abstract GitHubComment build(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GitHubEventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | public enum GitHubEventType { 20 | CommitCommentEvent, 21 | CreateEvent, 22 | DeleteEvent, 23 | DeploymentEvent, 24 | DeploymentStatusEvent, 25 | DownloadEvent, 26 | FollowEvent, 27 | ForkEvent, 28 | ForkApplyEvent, 29 | GistEvent, 30 | GollumEvent, 31 | IssueCommentEvent, 32 | IssuesEvent, 33 | MemberEvent, 34 | MembershipEvent, 35 | PageBuildEvent, 36 | PublicEvent, 37 | PullRequestEvent, 38 | PullRequestReviewCommentEvent, 39 | PushEvent, 40 | ReleaseEvent, 41 | RepositoryEvent, 42 | StatusEvent, 43 | TeamAddEvent, 44 | WatchEvent 45 | } 46 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GitHubStats.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.JsonAdapter; 24 | import com.squareup.moshi.Moshi; 25 | 26 | @AutoValue 27 | public abstract class GitHubStats implements Parcelable { 28 | 29 | @Nullable 30 | public abstract Integer additions(); 31 | 32 | @Nullable 33 | public abstract Integer deletions(); 34 | 35 | @Nullable 36 | public abstract Integer total(); 37 | 38 | public static JsonAdapter jsonAdapter(Moshi moshi) { 39 | return new AutoValue_GitHubStats.MoshiJsonAdapter(moshi); 40 | } 41 | } -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GitHubToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.Json; 24 | import com.squareup.moshi.JsonAdapter; 25 | import com.squareup.moshi.Moshi; 26 | 27 | @AutoValue 28 | public abstract class GitHubToken implements Parcelable { 29 | 30 | @Json(name = "access_token") 31 | @Nullable 32 | public abstract String accessToken(); 33 | 34 | @Nullable 35 | public abstract String scope(); 36 | 37 | @Json(name = "token_type") 38 | @Nullable 39 | public abstract String tokeType(); 40 | 41 | @Nullable 42 | public abstract String error(); 43 | 44 | public static JsonAdapter jsonAdapter(Moshi moshi){ 45 | return new AutoValue_GitHubToken.MoshiJsonAdapter(moshi); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/GitHubWikiPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.Json; 24 | import com.squareup.moshi.JsonAdapter; 25 | import com.squareup.moshi.Moshi; 26 | 27 | @AutoValue 28 | public abstract class GitHubWikiPage implements Parcelable { 29 | 30 | @Nullable 31 | public abstract String title(); 32 | 33 | @Nullable 34 | public abstract String action(); 35 | 36 | @Nullable 37 | public abstract String sha(); 38 | 39 | @Json(name = "page_name") 40 | @Nullable 41 | public abstract String pageName(); 42 | 43 | @Json(name = "html_url") 44 | @Nullable 45 | public abstract String htmlUrl(); 46 | 47 | public static JsonAdapter jsonAdapter(Moshi moshi) { 48 | return new AutoValue_GitHubWikiPage.MoshiJsonAdapter(moshi); 49 | } 50 | } -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/IssueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import com.squareup.moshi.Json; 20 | 21 | public enum IssueState { 22 | @Json(name = "open") Open, 23 | @Json(name = "closed") Closed 24 | } 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/meisolsson/githubsdk/model/Label.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Henrik Olsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.meisolsson.githubsdk.model; 18 | 19 | import android.os.Parcelable; 20 | import android.support.annotation.Nullable; 21 | 22 | import com.google.auto.value.AutoValue; 23 | import com.squareup.moshi.JsonAdapter; 24 | import com.squareup.moshi.Moshi; 25 | 26 | @AutoValue 27 | public abstract class Label implements Parcelable { 28 | 29 | @Nullable 30 | public abstract String url(); 31 | 32 | @Nullable 33 | public abstract String name(); 34 | 35 | @Nullable 36 | public abstract String color(); 37 | 38 | public abstract Builder toBuilder(); 39 | 40 | public static Builder builder() { 41 | return new AutoValue_Label.Builder(); 42 | } 43 | 44 | public static JsonAdapter