{"id":44009629,"url":"https://github.com/coolerfall/revival","last_synced_at":"2026-02-07T14:13:27.973Z","repository":{"id":57156006,"uuid":"104966983","full_name":"coolerfall/revival","owner":"coolerfall","description":"A RESTful http client for typescript  based on XMLHttpRequest.","archived":false,"fork":false,"pushed_at":"2018-11-20T10:53:13.000Z","size":87,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T10:19:47.455Z","etag":null,"topics":["restful","typescript","xmlhttprequest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coolerfall.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":"2017-09-27T03:20:47.000Z","updated_at":"2022-10-10T09:32:49.000Z","dependencies_parsed_at":"2022-08-28T14:00:30.660Z","dependency_job_id":null,"html_url":"https://github.com/coolerfall/revival","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/coolerfall/revival","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolerfall%2Frevival","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolerfall%2Frevival/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolerfall%2Frevival/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolerfall%2Frevival/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coolerfall","download_url":"https://codeload.github.com/coolerfall/revival/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolerfall%2Frevival/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29196877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T12:38:28.597Z","status":"ssl_error","status_checked_at":"2026-02-07T12:38:23.888Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["restful","typescript","xmlhttprequest"],"created_at":"2026-02-07T14:13:23.109Z","updated_at":"2026-02-07T14:13:27.967Z","avatar_url":"https://github.com/coolerfall.png","language":"TypeScript","readme":"Revival\n======\nA RESTful http client for react native and typescript based on XMLHttpRequest.\n\nInstallation and Usage\n====\n\n* Revival only support typescript cause it uses decoratos:\n\n```sh\nnpm install revival\n```\nor\n```sh\nyarn add revival\n```\n\n* Add `\"experimentalDecorators\": true` and `\"emitDecoratorMetadata\": true` in `tsconfig.json`.\n\n* Create api in your project as below:\n\n```typescript\nimport { DUMMY, GET, Path } from \"revival\"\n\nclass MyApi {\n  @GET(\"user/{id}\")\n  loadAccount(@Path(\"id\") id: string) : Call\u003cAccount\u003e {\n    return DUMMY;\n  }\n}\n```\n\n* `Revival` will turns all decorators to http request:\n```typescript\nlet revival: Revival = new RevivalBuilder()\n  .baseUrl(\"http://test.com/\")\n  .addInterceptor(new LogInterceptor())\n  .build();\n\nlet myapi = revival.create(MyApi);\n```\n\n* Then you can call the api with asynchronous mode(with enqueue):\n```typescript\nlet Call\u003cAccount\u003e = myapi.loadAccount(\"Vincent\");\n```\n\n* Revival supports `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`.\n* Request url can be set dynamically with `@Path`, and the path must surrounded by { and }:\n```typescript\n  @GET(\"user/{id}\")\n  loadAccount(@Path(\"id\") id: string) : Call\u003cAccount\u003e {\n    return DUMMY;\n  }\n```\n\nQuery parameter can be added with `@Query`:\n```typescript\n@GET(\"user/{id}\")\n  loadAccount(@Path(\"id\") id: string, @Query(\"type\") type: string) : Call\u003cAccount\u003e {\n    return DUMMY;\n  }\n```\n\nFor complex query parameters, you can use a object with `@QueryMap`:\n```typescript\n@GET(\"user/{id}\")\nloadAccount(@Path(\"id\") id: string, @QueryMap user: User) : Call\u003cAccount\u003e {\n    return DUMMY;\n  }\n```\n\n* An object can be used as a http request body with `@Body`:\n```typescript\n@POST(\"user/new\")\ncreateUser(@Body user: User) : Call\u003cAccount\u003e {\n  return DUMMY;\n}\n```\n\n* Methods can also be declared to send form-encoded(wtth `@FormUrlEncoded`) and multipart(with `@Multipart`) data:\n```typescript\n@FormUrlEncoded\n@POST(\"user/update\")\nupdateAccount(@Field(\"age\") age: number, @Field(\"email\") email: string) {\n  return DUMMY;\n}\n\n@Multipart\n@PUT(\"user/update\")\nupdateAccount(@Part(\"avatar\") avatar: Avatar, @Part(\"name\") name: string) {\n  return DUMMY;\n}\n```\n\n* Revival will use json to serialize and  parse body by default, if you want to convert to something else like xml, you can implement a `ConverterFactory` to serialize and parse body. Use them as below:\n```typescript\nlet revival: Revival = new RevivalBuilder()\n  .baseUrl(\"http://test.com/\")\n  .converterFactory(new XmlConvertFactory())\n  .build();\n```\n\nIf you just want a `ReviResponse`, you must add `@Raw`:\n```typescript\n@Raw\n@POST(\"user/password\")\ncreatePassword(@Body password: Password) : Call\u003cReviResponse\u003e {\n  return DUMMY;\n}\n```\n\n* Revival supports call adapter  which will turn `Call` to rxjs, promise, you can install them via:\n\n```sh\nnpm install revival-adapter-rxjs revival-adapter-promise\n```\nor\n```sh\nyarn add revival-adapter-rxjs revival-adapter-promise\n```\n\nAnd use them as below:\n```typescript\nlet revival: Revival = new RevivalBuilder()\n  .baseUrl(\"http://test.com/\")\n  .addCallAdapter(RxjsCallAdapter.create())\n  .addCallAdapter(PromiseCallAdapter.create())\n  .build();\n```\n\n\nCredits\n=======\n* [Retrofit][1] - Type-safe HTTP client for Android and Java by Square, Inc.\n* [Angular/http][2] - One framework. Mobile \u0026 desktop. \n\n\nLicense\n======\n```text\n\tMIT License\n\n\tCopyright (C) 2017-present Vincent Cheung\n\n\tThis source code is licensed under the MIT license found in the\n\tLICENSE file in the root directory of this source tree.\n```\n\n[1]: https://github.com/square/retrofit\n[2]: https://github.com/angular/angular","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolerfall%2Frevival","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoolerfall%2Frevival","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolerfall%2Frevival/lists"}