{"id":16837755,"url":"https://github.com/orhanobut/wasp","last_synced_at":"2025-04-04T22:05:46.595Z","repository":{"id":24896127,"uuid":"28312494","full_name":"orhanobut/wasp","owner":"orhanobut","description":"Compact and easy to use, 'all-in-one' android network solution","archived":false,"fork":false,"pushed_at":"2018-04-11T12:45:52.000Z","size":2549,"stargazers_count":584,"open_issues_count":19,"forks_count":71,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-28T21:05:31.510Z","etag":null,"topics":[],"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/orhanobut.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}},"created_at":"2014-12-21T20:42:13.000Z","updated_at":"2024-10-07T14:17:54.000Z","dependencies_parsed_at":"2022-08-23T09:50:47.579Z","dependency_job_id":null,"html_url":"https://github.com/orhanobut/wasp","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fwasp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fwasp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fwasp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fwasp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orhanobut","download_url":"https://codeload.github.com/orhanobut/wasp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"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":[],"created_at":"2024-10-13T12:18:44.891Z","updated_at":"2025-04-04T22:05:46.574Z","avatar_url":"https://github.com/orhanobut.png","language":"Java","funding_links":[],"categories":["Libs","网络编程"],"sub_categories":["\u003cA NAME=\"Network\"\u003e\u003c/A\u003eNetwork"],"readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Wasp-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1412)    [![API](https://img.shields.io/badge/API-10%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=10) [![Join the chat at https://gitter.im/orhanobut/wasp](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/orhanobut/wasp?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) [![](https://img.shields.io/badge/AndroidWeekly-%23143-blue.svg)](http://androidweekly.net/issues/issue-143)\n\n\u003cimg align='right' src='https://github.com/orhanobut/wasp/blob/master/images/logo_wasp.png' width='128' height='128'/\u003e\n\n# Deprecated\nUnfortunately due to many reasons including maintenance cost, this library is deprecated. I recommend to use Retrofit/OkHttp instead. Currently this project only aims to provide some experimental functionalities.\n\n# Wasp\nA compact and easy to use, 'all-in-one' network solution. \n\n\u003cimg src='https://github.com/orhanobut/wasp/blob/master/images/wasp-diagram.png'/\u003e\n\n#### The problem\nWhen it comes to daily development, you need more than just a library to handle networking, you need to handle mocking calls, using multiple end points, handling certificates and cookies and many other boiler plate code. With wasp, you can easily handle everything.\n\nWasp internally uses:\n- Volley for the network stack\n- Gson for parsing\n- OkHttp for the http stack\n\nWasp provides:\n- Easy implementation\n- **MOCK** response via text file or **auto generated** from model class!\n- Request Interceptors to add attributes (query params, headers, retry policy) to each call\n- **Api call based headers**\n- Api call based end point\n- Api call based retry policy\n- **Cookie management**\n- **Certificate management**\n- Painless Image loading\n- **RxJava support**\n- **Request cancelation**\n- Sync request call\n- Async request call\n\nWasp aims :\n- There are many open issues to contribute. Get this chance to contribute and improve your knowledge!\n- We want to make something that is useful and also motivates people to contribute\n\n### Add dependency\nMore info https://jitpack.io/#orhanobut/wasp/1.15\n```groovy\nrepositories {\n  // ...\n  maven { url \"https://jitpack.io\" }\n}\n\ndependencies {\n  compile 'com.github.orhanobut:wasp:1.15'\n}\n```\n\n#### Create a service interface\n\n```java\npublic interface GitHubService {\n\n  // Async call\n  @GET(\"/repos/{id}\")\n  void getRepo(@Path(\"id\") String id, Callback\u003cRepo\u003e callback);\n  \n  // Async call with WaspRequest (cancelable)\n  @GET(\"/repos/{id}\")\n  WaspRequest getRepo(@Path(\"id\") String id, Callback\u003cRepo\u003e callback);\n    \n  // Rx\n  @Mock\n  @POST(\"/repos\")\n  Observable\u003cRepo\u003e createRepo(@Body Repo repo);\n  \n  // sync call\n  @GET(\"/users/{id}\")\n  User getUser(@Path(\"id\") String id);\n}\n```\n\n#### Initialize the wasp\n\n```java\nGitHubService service = new Wasp.Builder(this)\n  .setEndpoint(\"https://api.github.com\")\n  .setRequestInterceptor                     // Optional\n  .trustCertificates                         // Optional\n  .setHttpStack                              // Optional\n  .enableCookies                             // Optional\n  .setNetworkMode(NetworkMode.MOCK)          // Optional(Used for Mock)\n  .build()\n  .create(GitHubService.class);\n```\n\n#### And use it everywhere!\nAsync\n```java\nservice.getRepo(id, new Callback\u003cRepo\u003e{\n\n  @Override\n  public void onSuccess(Response response, Repo repo) {\n    // do something\n  }\n  \n  @Override\n  public void onError(WaspError error) {\n    // handle error\n  }\n});\n```\n\nAsync with WaspRequest (cancelable)\n```java\nWaspRequest request = service.getRepo(id, new Callback\u003cRepo\u003e{\n\n  @Override\n  public void onSuccess(Response response, Repo repo) {\n    // do something\n  }\n  \n  @Override\n  public void onError(WaspError error) {\n    // handle error\n  }\n});\nrequest.cancel();  //cancels the request\n```\n\nRx\n```java\nObservable\u003cRepo\u003e observable = service.createRepo(repo);\n```\n\nSync\n```java\nUser user = service.getUser(id);\n```\n#### Check wiki for more details\n\n### License\n\u003cpre\u003e\nCopyright 2014 Orhan Obut\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhanobut%2Fwasp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forhanobut%2Fwasp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhanobut%2Fwasp/lists"}