{"id":21232803,"url":"https://github.com/hotstu/tinyritro","last_synced_at":"2025-03-15T02:42:20.234Z","repository":{"id":73762843,"uuid":"135535323","full_name":"hotstu/tinyritro","owner":"hotstu","description":"仿retrofit 轻量的api请求库","archived":false,"fork":false,"pushed_at":"2021-07-22T08:26:25.000Z","size":191,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T18:33:48.530Z","etag":null,"topics":["android","http","okhttp3","retrofit"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hotstu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-31T05:21:15.000Z","updated_at":"2021-07-22T08:26:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"e38da998-8a6e-40e6-b56c-0f47a1c76a36","html_url":"https://github.com/hotstu/tinyritro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotstu%2Ftinyritro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotstu%2Ftinyritro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotstu%2Ftinyritro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotstu%2Ftinyritro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hotstu","download_url":"https://codeload.github.com/hotstu/tinyritro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243676707,"owners_count":20329431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","http","okhttp3","retrofit"],"created_at":"2024-11-20T23:54:44.497Z","updated_at":"2025-03-15T02:42:20.221Z","avatar_url":"https://github.com/hotstu.png","language":"Java","readme":" [![Download](https://img.shields.io/maven-central/v/io.github.hotstu.tinyritro/runtime?style=flat-square) ](https://search.maven.org/search?q=g:io.github.hotstu.tinyritro) \n [![Build Status](https://travis-ci.org/hotstu/tinyritro.svg?branch=master)](https://travis-ci.org/hotstu/tinyritro)\n [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\n## tinyritro\n\n轻量的api请求库，基于okhttp3、rxjava2, 使用方式类似retrofit，使用apt，不使用反射,自动完成api请求、json解析，并返回Flowable用于后续调用\n\n\n## 使用\n\n\n加入依赖\n\n```java app/build.gradle\n    annotationProcessor 'io.github.hotstu.tinyritro:compiler:1.0.0'\n    implementation 'io.github.hotstu.tinyritro:runtime:1.0.0'\n    implementation 'io.reactivex.rxjava2:rxjava:2.1.8'\n    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'\n    implementation 'com.squareup.okhttp3:okhttp:3.9.1'\n    implementation 'com.google.code.gson:gson:2.8.2'\n```\n\n定义接口\n\n```java\n@EntryPoint(value = \"http://httpbin.org\")\npublic interface APIService1 {\n    @Query(path = \"/get?id=${id}\")\n    Flowable\u003cString\u003e get(Map\u003cString, String\u003e params, @PathParam(\"id\") String ids, @PathParam int name);\n\n    @Query(method = POST,url = \"http://www.example.com/app/open\")\n    Flowable\u003cPerson\u003e post(Map\u003cString, String\u003e params);\n\n    @Query(method = POST,url = \"http://www.example.com/app/open\")\n    Flowable\u003cPerson\u003e post2(@QueryParam String query1);\n}\n\n```\n\n执行build后会根据定义的接口生成调用类tinyritro.java\n调用\n\n```java\n        TinyRitro build = new TinyRitro.Builder().client(OkHttpClientMgr.getInstance()).build();\n        HashMap\u003cString, String\u003e params = new HashMap\u003c\u003e();\n        params.put(\"aaa\", \"bbb\");\n        build.getAPIService1().get(params, \"233\",233)\n                .compose(RxSchedulers.\u003cString\u003eio_main())\n                .subscribe(new Consumer\u003cString\u003e() {\n                    @Override\n                    public void accept(String strings) throws Exception {\n                        Log.d(\"result\", \"\" + strings);\n                    }\n                }, new Consumer\u003cThrowable\u003e() {\n                    @Override\n                    public void accept(Throwable throwable) throws Exception {\n                        throwable.printStackTrace();\n                    }\n                });\n```\n\n\n## more about me\n\n|简书| 掘金|JCenter | dockerHub|\n| ------------- |------------- |------------- |------------- |\n| [简书](https://www.jianshu.com/u/ca2207af2001) | [掘金](https://juejin.im/user/5bee320651882516be2ebbfe) |[JCenter ](https://bintray.com/hglf/maven)      | [dockerHub](https://hub.docker.com/u/hglf)|\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotstu%2Ftinyritro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhotstu%2Ftinyritro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotstu%2Ftinyritro/lists"}