Watch Star Fork

samlin / gitee-clientJava

Gitee Java Api
克隆/下载
yu.wu 最后提交于 2017-11-14 21:08 readme
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
2017-11-14 16:15
2017-11-14 21:08
2017-11-14 16:59
2017-11-14 16:15
2017-11-14 21:08
2017-11-14 16:08
2017-11-14 16:08
2017-11-14 16:08
Loading...
README.md 6.39 KB

gitee-api

安装

sh mvnw install

使用

<dependency>
    <groupId>com.gitee</groupId>
    <artifactId>gitee-api</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>

目录结构

└─src
    ├─main
    │  └─java
    │      └─com
    │          └─gitee
    │              └─api
    │                  │  ApiClient.java
    │                  │  CollectionFormats.java
    │                  │  JSON.java
    │                  │  StringUtil.java
    │                  │
    │                  ├─api
    │                  │      ActivityApi.java
    │                  │      AuthApi.java
    │                  │      GistsApi.java
    │                  │      GitDataApi.java
    │                  │      IssuesApi.java
    │                  │      LabelsApi.java
    │                  │      MilestonesApi.java
    │                  │      MiscellaneousApi.java
    │                  │      OrganizationsApi.java
    │                  │      PullRequestsApi.java
    │                  │      RepositoriesApi.java
    │                  │      UsersApi.java
    │                  │      WebhooksApi.java
    │                  │
    │                  └─model
    │                          Blob.java
    │                          Branch.java
    │                          Code.java
    │                          CodeComment.java
    │                          CodeForks.java
    │                          CodeForksHistory.java
    │                          Commit.java
    │                          CommitContent.java
    │                          Compare.java
    │                          CompleteBranch.java
    │                          Content.java
    │                          ContentBasic.java
    │                          Event.java
    │                          Group.java
    │                          GroupDetail.java
    │                          GroupMember.java
    │                          Hook.java
    │                          Issue.java
    │                          Label.java
    │                          Milestone.java
    │                          OAuth2AccessToken.java
    │                          Project.java
    │                          ProjectBasic.java
    │                          PullRequest.java
    │                          PullRequestComments.java
    │                          PullRequestCommits.java
    │                          PullRequestFiles.java
    │                          Release.java
    │                          RepoCommit.java
    │                          SSHKey.java
    │                          SSHKeyBasic.java
    │                          Tree.java
    │                          User.java
    │                          UserAddress.java
    │                          UserBasic.java
    │                          UserDetail.java
    │                          UserEmail.java
    │                          UserMessage.java
    │                          UserNotification.java
    │
    └─test
        └─java
            └─com
                └─gitee
                    └─api
                        └─api
                                ActivityApiTest.java
                                AuthApiTest.java
                                GistsApiTest.java
                                GitDataApiTest.java
                                IssuesApiTest.java
                                LabelsApiTest.java
                                MilestonesApiTest.java
                                MiscellaneousApiTest.java
                                OrganizationsApiTest.java
                                PullRequestsApiTest.java
                                RepositoriesApiTest.java
                                UsersApiTest.java
                                WebhooksApiTest.java

获取Token

 AuthApi api = new ApiClient().createService(AuthApi.class);
 Observable<OAuth2AccessToken> token = api.getToken("邮箱",
                "密码",
                "重定向网站",
                "clientId",
                "clientSecret",
                "password",
                "projects user_info issues notes");

        token.subscribe(new Observer<OAuth2AccessToken>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable throwable) {
                System.err.println(throwable.getMessage());
            }

            @Override
            public void onNext(OAuth2AccessToken oAuth2AccessToken) {
                System.err.println(oAuth2AccessToken);
            }
        });

创建仓库

    RepositoriesApi api = new ApiClient().createService(RepositoriesApi.class);

    String owner = null;
    String repo = null;
    String tagName = null;
    String name = null;
    String body = null;
    String targetCommitish = null;
    String accessToken = null;
    Boolean prerelease = null;
    Observable<Release> response = api.postV5ReposOwnerRepoReleases(owner, repo, tagName, name, body, targetCommitish, accessToken, prerelease);
    response.subscribe(new Observer<Release>() {
        @Override
        public void onCompleted() {

        }

        @Override
        public void onError(Throwable throwable) {

        }

        @Override
        public void onNext(Release release) {

        }
    });

获取关注用户

AuthApi api = new ApiClient().createService(UsersApi.class);
public void getV5UserFollowersTest() {
        String accessToken = "";
        Integer page = 1;
        Integer perPage = 10;
        Observable<List<UserBasic>> response = api.getV5UserFollowers(accessToken, page, perPage);
        response.subscribe(new Observer<List<UserBasic>>() {
            @Override
            public void onCompleted() {
                
            }

            @Override
            public void onError(Throwable throwable) {

            }

            @Override
            public void onNext(List<UserBasic> userBasics) {

            }
        });
    }

项目点评 ( 0 )

你可以在登录后,对此项目发表评论

6_float_left_people 6_float_left_close