{"_id":"@andcup/retrofit","_rev":"1-8deb8e56a59cb303e28efbb0bf97567f","name":"@andcup/retrofit","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@andcup/retrofit","version":"0.0.1","author":{"name":"andcup"},"contributors":[{"name":"and","email":"redmy@163.com"}],"license":"MIT","description":"Project inspired in Retrofit.","main":"dist/index.js","keywords":["typescript","axios","rxjs","promise","javascript"],"bugs":{"url":"https://github.com/andcup/retrofit/issues"},"homepage":"https://github.com/andcup/retrofit","repository":{"type":"git","url":"git+https://github.com/andcup/retrofit.git"},"scripts":{"allure:clean":"rimraf -rf allure-*","allure:serve":"run-s test allure:serve:cmd","allure:serve:cmd":"allure serve","build":"run-s clean lint test build:prod","build:prod":"tsc -p tsconfig.prod.json","build:test":"tsc -p tsconfig.test.json","changelog":"changelog -f CURRENT_CHANGES.md","commit":"git-cz","clean":"rimraf -rf allure* coverage dist documentation","clean:all":"run-s clean clean:all:cmd","clean:all:cmd":"rimraf -rf node_modules package-lock.json yarn.lock","clean:coverage":"rimraf -rf coverage","compodoc":"npx compodoc","format":"prettier --write \"src/**/*.ts\"","format:samples":"prettier --write \"samples/**/*.ts\"","lint":"eslint \"{src,apps,libs}/**/*.ts\" --fix","lint:test":"eslint \"test/**/*.ts\" --fix","prepublish":"run-s build","test":"run-s clean:coverage allure:clean build:test"},"dependencies":{"axios":"^0.19.2","lodash":"^4.17.19","reflect-metadata":"^0.1.13","rxjs":"^6.5.4","typescript-char":"0.0.0"},"devDependencies":{"@commitlint/cli":"^8.3.5","@commitlint/config-conventional":"^8.3.4","@compodoc/compodoc":"^1.1.11","@typescript-eslint/eslint-plugin":"^2.25.0","@typescript-eslint/parser":"^2.25.0","allure-commandline":"^2.13.0","cz-conventional-changelog":"^3.1.0","cz-customizable":"^6.2.0","eslint":"^6.8.0","eslint-config-prettier":"^6.10.1","eslint-plugin-import":"^2.20.2","express":"^4.17.1","generate-changelog":"^1.8.0","husky":"^4.2.3","jest":"^25.2.3","jest-allure":"^0.1.1","npm-run-all":"^4.1.5","prettier":"^2.0.2","rimraf":"^3.0.2","testcontainers":"^2.6.0","ts-jest":"^25.2.1","ts-node":"^8.8.1","typescript":"^3.8.3"},"engines":{"node":">=12.0.0","npm":">=6.9.0"},"directories":{"test":"test"},"husky":{"hooks":{"prepare-commit-msg":"exec < /dev/tty && git cz --hook || true","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"config":{"commitizen":{"path":"./node_modules/cz-customizable"},"cz-customizable":{"config":"config/path/to/my/config.js"}},"gitHead":"3cd7657313fe3da12ac291ac86305cf0ffe028af","_id":"@andcup/retrofit@0.0.1","_nodeVersion":"12.16.1","_npmVersion":"6.14.2","dist":{"integrity":"sha512-yn33J7Y/Ge4/R8dAzsVpuJRGe9znxrzub8E6prjcRFmbZVoMBIQzckrUnj2Q/v/daO6shTB03rNKLNSSPEBi/w==","shasum":"72bd6540bab86691af77549e83377431c53078c8","tarball":"https://registry.npmjs.org/@andcup/retrofit/-/retrofit-0.0.1.tgz","fileCount":52,"unpackedSize":340578,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMReRCRA9TVsSAnZWagAAgpYP/RZYw+vtcdp0jfyDinbH\n3zmS7RLwyUFOundJ2DkcNwpWlWv2PXyc4zs8lUjkivZdmucMOp6B/X2+el0Z\ngL0+/Id4Qq4ZL0nu2HkUCqoI31KcQnuk43lgWQbvcovG0XwRVEDWWqTthHDm\nSNyxwZNjvsYPxZ54SRP1A481+x5ccz0jBuNW6buMUvQAf8/sdI/ZO6M1vR1f\nPr1oVmqVyj86N7DC0JamkM4LbS/gshnZoFHn5ruTSYEIOyXPoF+6AWUjgNDl\nadAahaXSF90c6mQtVquWwix8Tv3APca1eLISCaf4a+9LfLXeAC0/QF2rnVIL\ndyko+uC8Wzw8DPMciKnCg54J7iU8o/6HehkGGZviE833OIC7nHJSEDkIVNd9\nrhWh22qkvB3mGPKqi4IKOTb+g1JuBi8LoVeAzBGA8P42xD14UoENuQcmsyg1\nW0wB2ZeNynkv45m11GFStoipQp9SG7rGHqeWVlEfn/Udx+d4+DI2e12h5EsX\n9ck6bifHUXXR8rAjodjkwmvsjRNdS/7sqgXJPpiNo9wsW87cEvcsiEpG8loI\n+fDYE7/eTYw5QSAMjGENHTYKYp/vnsxdyZff84p3RGDSLeYOJJmhixvkE9I5\nM4MBD/5y/ryWut0RUZO677qu3Tj03FhIyoSBYiVVn5z6ykbSbFoOqMaixDXu\nQota\r\n=6TcQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3b7+nlSW6yfePVMVYCMIMLQ1Mgl9EviYUHsGVBRVH8gIhAJ0gi7kUmufO3Xi00ZdHPS28MWs4Xg8WeAK+88NMA8bX"}]},"maintainers":[{"name":"andcup","email":"redmy@163.com"}],"_npmUser":{"name":"andcup","email":"redmy@163.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retrofit_0.0.1_1597052816599_0.13313036397996103"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-10T09:46:56.557Z","0.0.1":"2020-08-10T09:46:56.721Z","modified":"2022-04-04T13:57:31.791Z"},"maintainers":[{"name":"andcup","email":"redmy@163.com"}],"description":"Project inspired in Retrofit.","homepage":"https://github.com/andcup/retrofit","keywords":["typescript","axios","rxjs","promise","javascript"],"repository":{"type":"git","url":"git+https://github.com/andcup/retrofit.git"},"contributors":[{"name":"and","email":"redmy@163.com"}],"author":{"name":"andcup"},"bugs":{"url":"https://github.com/andcup/retrofit/issues"},"license":"MIT","readme":"# Retrofit\r\n\r\n![GitHub package.json version](https://img.shields.io/github/package-json/v/yggdrasilts/Retrofit)\r\n![NPM](https://img.shields.io/npm/l/@yggdrasilts/Retrofit)\r\n![GitHub issues](https://img.shields.io/github/issues/yggdrasilts/Retrofit)\r\n![GitHub pull requests](https://img.shields.io/github/issues-pr/yggdrasilts/Retrofit)\r\n\r\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\r\n![npm](https://img.shields.io/npm/dw/@yggdrasilts/Retrofit)\r\n\r\n![Twitter Follow](https://img.shields.io/twitter/follow/yggdrasilts?style=social)\r\n\r\nRetrofit is a project inspired by [Retrofit](https://square.github.io/retrofit/) to create declarative HTTP clients using [axios](https://github.com/axios/axios) as the http client for browsers and nodejs, all the [TypeScript](http://www.typescriptlang.org/) features and [RxJS](https://rxjs-dev.firebaseapp.com/) to manage the requests using [Reactive programming](https://en.wikipedia.org/wiki/Reactive_programming) and all the Observable powers (_also, you can use Promises as well_).\r\n\r\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\r\n\r\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\r\n\r\n**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_\r\n\r\n<!-- markdownlint-disable -->\r\n\r\n- [Retrofit](#Retrofit)\r\n  - [Purpose](#purpose)\r\n  - [Install](#install)\r\n  - [Contributing](#contributing)\r\n  - [Documentation](#documentation)\r\n    - [Available Decorators](#available-decorators)\r\n      - [Class Decorators](#class-decorators)\r\n        - [Considerations](#considerations)\r\n      - [Method Decorators](#method-decorators)\r\n      - [Parameter Decorators](#parameter-decorators)\r\n      - [Configuration](#configuration)\r\n  - [<a name=\"usage\"></a>Usage](#usage)\r\n    - [1. Create a service class](#1-create-a-service-class)\r\n      - [1.1 Service class for Angular application uglifying the code to deploy in production](#11-service-class-for-angular-application-uglifying-the-code-to-deploy-in-production)\r\n    - [2. Create Retrofit instance](#2-create-Retrofit-instance)\r\n    - [3. Perform an Retrofit request](#3-perform-an-Retrofit-request)\r\n    - [4. Using Promises](#4-using-promises)\r\n      - [4.1 Modify service class return type](#41-modify-service-class-return-type)\r\n    - [<a name=\"headers\"></a>Headers](#headers)\r\n    - [Other features](#other-features)\r\n      - [<a name=\"interceptors\"></a>Interceptors](#interceptors)\r\n        - [Request Interceptor](#request-interceptor)\r\n        - [Response Interceptor](#response-interceptor)\r\n  - [<a name=\"samples_section\"></a>Examples](#examples)\r\n\r\n<!-- markdownlint-restore -->\r\n\r\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\r\n\r\n## Purpose\r\n\r\nThis project has been thought to be used inside [TypeScript](http://www.typescriptlang.org/) projects to use its incredible features to build frontend and/or backend applications.\r\n\r\nUsing [Retrofit](https://www.npmjs.com/package/@yggdrasilts/Retrofit?activeTab=readme) inside your project, you will be able to organize all your requests as a typical [TypeScript class](https://www.typescriptlang.org/docs/handbook/classes.html). In that way, all of your application requests can be stored in a unique object and be managed. See our [Examples section](#samples_section) or our [application samples](./samples) to know more about how to use it.\r\n\r\n**IMPORTANT**: [Retrofit](https://www.npmjs.com/package/@yggdrasilts/Retrofit?activeTab=readme) only works for building frontend applications using [Angular](https://angular.io/) or backend applications using nodejs with [TypeScript](http://www.typescriptlang.org/). Althought [Retrofit](https://www.npmjs.com/package/@yggdrasilts/Retrofit?activeTab=readme) can be used in a typical [TypeScript](http://www.typescriptlang.org/) application, we strongly recommend to use [NestJS](https://nestjs.com/) framework to build backend applications.\r\n\r\n## Install\r\n\r\n`npm i --save @yggdrasilts/Retrofit`\r\n\r\n## Contributing\r\n\r\nIf you want to contribute this amazing project, see [CONTRIBUTING Guide](CONTRIBUTING.md).\r\n\r\n## Documentation\r\n\r\nThis project use [compodoc](https://compodoc.app/) to generate the full documentation. To see it, executes `npm run compodoc`.\r\n\r\n### Available Decorators\r\n\r\nAs we all know, to build a request is necessary a [URL](https://en.wikipedia.org/wiki/URL) and, using one of the top TypeScript feature, the [TypeScript Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html), Retrofit give you some specifical Decorators to create an awesome service to store all the information to form your [URL](https://en.wikipedia.org/wiki/URL) to manage your HTTP requests.\r\n\r\n#### Class Decorators\r\n\r\n- [@HTTP(endpointPath?: string | RetrofitConfig, axisofitConfig?: RetrofitConfig)](miscellaneous/variables.html#HTTP)\r\n- [@Interceptors(...interceptors: RetrofitInterceptor[])](miscellaneous/variables.html#Interceptors)\r\n\r\n**@HTTP** is the main Decorator to configure your Retrofit service and indicates that the class is an Retrofit instance. Also, it can be configured with the base path of your API server using its _endpointPath_ property and configure more Retrofit option using the [RetrofitConfig](#RetrofitConfig) object.\r\n\r\n**@Interceptors** decorator can be use to add interceptors to the requests or responses. These interceptors must implements RetrofitInterceptor interface and you can add as many as you want separated by comma. You can see the [Interceptors section](#interceptors) for more information.\r\n\r\n##### Considerations\r\n\r\n**Angular applications**: Due to the uglify process when you build an Angular application with --prod parameters, you need to create a static readonly property called `serviceName` inside the class to give it a unique name that works as unique identifier used by Retrofit. In the [Usage section](#usage) you can see how to use it. You also have more samples inside the [samples folder](./samples).\r\n\r\n#### Method Decorators\r\n\r\n- [@GET(endpoint: string)](miscellaneous/variables.html#GET)\r\n- [@POST(endpoint: string)](miscellaneous/variables.html#POST)\r\n- [@PUT(endpoint: string)](miscellaneous/variables.html#PUT)\r\n- [@DELETE(endpoint: string)](miscellaneous/variables.html#DELETE)\r\n- [@HEAD(endpoint: string)](miscellaneous/variables.html#HEAD)\r\n- [@PATCH(endpoint: string)](miscellaneous/variables.html#PATCH)\r\n\r\nTo request any API server, it is needed to know with method is necessary. For this reason Retrofit give you Decorators to indicate which method has to be used.\r\n\r\n#### Parameter Decorators\r\n\r\n- [@Path(paramName: string)](miscellaneous/variables.html#Path)\r\n- [@Param(paramName: string)](miscellaneous/variables.html#Param)\r\n- [@ParamMap(paramName: string)](miscellaneous/variables.html#ParamMap)\r\n- [@Header(headerName: string)](miscellaneous/variables.html#Header)\r\n- [@HeaderMap(name: string)](miscellaneous/variables.html#HeaderMap)\r\n- [@Body()](miscellaneous/variables.html#Body)\r\n\r\nAnother part is the _path_ and the _body_ of your request and Retrofit also has these Decorators to configure your service.\r\n\r\n---\r\n\r\nExamples of using all of these Decorators are shown in the [Examples section](#samples_section) or you can find specific samples inside the [samples folder](./samples).\r\n\r\n---\r\n\r\n#### Configuration\r\n\r\n- <a name=\"RetrofitConfig\"></a>RetrofitConfig\r\n  - _usePromises_: Default _false_. Configure Retrofit service to return Observable object or a Promise.\r\n  - _enableAxiosLogger_: Default _false_. Configure Retrofit service to use the Retrofit logger to print the request and response to the console.\r\n\r\n## <a name=\"usage\"></a>Usage\r\n\r\nTo build an Retrofit service a few steps need to be done:\r\n\r\n### 1. Create a service class\r\n\r\nA service class needs to be created because it will store all the requests information. The following code shows a simple service:\r\n\r\n```typescript\r\n@HTTP('/simple')\r\nexport class SimpleService {\r\n  @GET('/service')\r\n  public getSimpleService(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\nIf you want to use Promises instead of Observable:\r\n\r\n```typescript\r\n@HTTP('/simple', { usePromises: true })\r\nexport class SimpleService {\r\n  @GET('/service')\r\n  public getSimpleService(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\n#### 1.1 Service class for Angular application uglifying the code to deploy in production\r\n\r\n```typescript\r\n@HTTP('/simple')\r\nexport class SimpleService {\r\n  private static readonly serviceName = 'SimpleService';\r\n\r\n  @GET('/service')\r\n  public getSimpleService(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\n### 2. Create Retrofit instance\r\n\r\nOnce the service class is created, the Retrofit instance can be built:\r\n\r\n```typescript\r\nconst simpleService = new Retrofit<SimpleService>().baseUrl('http://simpleservice.com').create(SimpleService);\r\n```\r\n\r\n### 3. Perform an Retrofit request\r\n\r\nAfter all steps, the service can be managed as a typical class:\r\n\r\n```typescript\r\nsimpleService.getSimpleService().subscribe(\r\n  axiosResponse => console.log(axiosResponse.data),\r\n  axiosError => console.error(axiosError),\r\n);\r\n```\r\n\r\n### 4. Using Promises\r\n\r\nRetrofit manage responses using Observables or Promises. The above example shows how to use Observables but, if you prefer use Promises, a minimal change has to be done:\r\n\r\n#### 4.1 Modify service class return type\r\n\r\n```typescript\r\n@HTTP('/simple')\r\nexport class SimpleService {\r\n  @GET('/service')\r\n  public getSimpleService(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\nOnce the change is made, you can use Retrofit response like a typical Promise:\r\n\r\n```typescript\r\nsimpleService\r\n  .getSimpleService()\r\n  .then(axiosResponse => console.log(axiosResponse.data))\r\n  .catch(axiosError => console.error(axiosError));\r\n```\r\n\r\n### <a name=\"headers\"></a>Headers\r\n\r\nHTTP headers let the client and the server pass additional information with an HTTP request or response. Retrofit has various decorators that enabled you to modify these HTTP headers.\r\n\r\n- The @Header parameter decorator gives you the option to add some header individually.\r\n\r\n```typescript\r\n@GET(TestRoutes.GET.REQUEST.URL)\r\npublic performGetRequestWithHeader(@Header('Authorization') token: string): Observable<AxiosResponse<string>> {\r\n  return null;\r\n}\r\n```\r\n\r\n- The @HeaderMap parameter decorator gives you the option to pass a map with various headers.\r\n\r\n```typescript\r\n@GET(TestRoutes.GET.REQUEST.URL)\r\npublic performGetRequestWithHeaderMap(@HeaderMap('map') map: IHeadersMap): Observable<AxiosResponse<string>> {\r\n  return null;\r\n}\r\n```\r\n\r\n### Other features\r\n\r\n#### <a name=\"interceptors\"></a>Interceptors\r\n\r\nInterceptors are other [axios](https://github.com/axios/axios#interceptors) feature that Retrofit implements.\r\n\r\nThere are 2 ways to use interceptors:\r\n\r\n1. Using the [@Interceptors(...interceptors: RetrofitInterceptor[])](miscellaneous/variables.html#Interceptors) decorator:\r\n\r\nWith this first way, the interceptor, or a list of interceptors separated by commas, needs to be added as a decorator parameter:\r\n\r\n```typescript\r\n@HTTP('/simple')\r\n@Interceptors(SimpleInterceptor)\r\nexport class SimpleService {\r\n  @GET('/service')\r\n  public getSimpleService(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\nIn the following sample you can see how to implement it and alse see the differences.\r\n\r\n```typescript\r\nexport class SimpleInterceptor implements RetrofitRequestInterceptor, RetrofitResponseInterceptor {\r\n  onRequest(config: AxiosRequestConfig): AxiosRequestConfig | Promise<AxiosRequestConfig> {\r\n    // tslint:disable-next-line: no-string-literal\r\n    config.headers['authorization'] = 'Bearer token';\r\n    return config;\r\n  }\r\n\r\n  onResponse(response: AxiosResponse<any>): AxiosResponse<any> | Promise<AxiosResponse<any>> {\r\n    // tslint:disable-next-line: no-string-literal\r\n    const currentData = response.data;\r\n    response.data = {\r\n      ...currentData,\r\n      newData: 'new',\r\n    };\r\n    return response;\r\n  }\r\n}\r\n```\r\n\r\n1. Add the interceptor when the Retrofit service is created.\r\n\r\nUsing this second method, a request and/or response interceptors must be created when the Retrofit instance is created.\r\n\r\n```typescript\r\nexport const simpleService = new Retrofit<SimpleService>()\r\n  .baseUrl('http://simpleservice.com')\r\n  .addInterceptor(interceptor)\r\n  .create(SimpleService);\r\n```\r\n\r\n##### Request Interceptor\r\n\r\n```typescript\r\nexport class SimpleNewInterceptorRequest implements RetrofitRequestInterceptor {\r\n  onRequest(config: AxiosRequestConfig): AxiosRequestConfig | Promise<AxiosRequestConfig> {\r\n    // tslint:disable-next-line: no-string-literal\r\n    config.headers['authorization'] = 'Bearer token';\r\n    return config;\r\n  }\r\n}\r\n```\r\n\r\n##### Response Interceptor\r\n\r\n```typescript\r\nexport class SimpleInterceptorResponse implements RetrofitResponseInterceptor {\r\n  onResponse(response: AxiosResponse<any>): AxiosResponse<any> | Promise<AxiosResponse<any>> {\r\n    // tslint:disable-next-line: no-string-literal\r\n    const currentData = response.data;\r\n    response.data = {\r\n      ...currentData,\r\n      newData: 'new',\r\n    };\r\n    return response;\r\n  }\r\n}\r\n```\r\n\r\n## <a name=\"samples_section\"></a>Examples\r\n\r\n- Create class with the endpoints methods:\r\n  \r\n  - Using Observables:\r\n\r\n```typescript\r\nimport {\r\n  HTTP,\r\n  Header,\r\n  HeaderMap,\r\n  GET,\r\n  DELETE,\r\n  HEAD,\r\n  POST,\r\n  PUT,\r\n  PATCH,\r\n  Path,\r\n  Body,\r\n  Observable,\r\n  AxiosResponse,\r\n  Param,\r\n  ParamMap,\r\n  IParamMap,\r\n  IHeadersMap,\r\n} from '../../../src';\r\nimport { TestRoutes } from '../TestRoutes';\r\n\r\n@HTTP(TestRoutes.BASE, { enableAxiosLogger: true })\r\nexport class TestObservableService {\r\n  private static readonly serviceName = 'TestObservableService';\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequest(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequestWithHeader(@Header('Authorization') token: string): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequestWithHeaderMap(@HeaderMap('map') map: IHeadersMap): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequestWithParameter(@Param('id') id: string): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequestWithParametersMap(@ParamMap('map') map: IParamMap): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequestWithParameters(\r\n    @Param('id1') id1: string,\r\n    @Param('id2') id2: string,\r\n    @ParamMap('map') map: IParamMap,\r\n  ): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_REQUEST_INTERCEPTOR.URL)\r\n  public performGetRequestAddingReqInterceptor(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_RESPONSE_INTERCEPTOR.URL)\r\n  public performGetRequestAddingResInterceptor(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_PARAM.URL)\r\n  public performGetRequestUsingAPathVariable(@Path(TestRoutes.GET.WITH_PARAM.PARAMS.ID) id: string): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_PARAMS.URL)\r\n  public performGetRequestUsingPathVariables(\r\n    @Path(TestRoutes.GET.WITH_PARAMS.PARAMS.ID) id: string,\r\n    @Path(TestRoutes.GET.WITH_PARAMS.PARAMS.ID2) id2: string,\r\n  ): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @DELETE(TestRoutes.DELETE.REQUEST.URL)\r\n  public performDeleteRequest(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @HEAD(TestRoutes.HEAD.REQUEST.URL)\r\n  public performHeadRequest(): Observable<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @POST(TestRoutes.POST.REQUEST.URL)\r\n  public performPostRequest(@Body() body: any): Observable<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n\r\n  @PUT(TestRoutes.PUT.REQUEST.URL)\r\n  public performPutRequest(@Body() body: any): Observable<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n\r\n  @PATCH(TestRoutes.PATCH.REQUEST.URL)\r\n  public performPatchRequest(@Body() body: any): Observable<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\n- Using Promises:\r\n\r\n```typescript\r\nimport { HTTP, GET, DELETE, HEAD, POST, PUT, PATCH, Path, Body, AxiosResponse } from '../../src';\r\nimport { TestRoutes } from './TestRoutes';\r\n\r\n@HTTP(TestRoutes.BASE, { usePromises: true })\r\nexport class TestService {\r\n  @GET(TestRoutes.GET.REQUEST.URL)\r\n  public performGetRequest(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_REQUEST_INTERCEPTOR.URL)\r\n  public performGetRequestAddingReqInterceptor(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_RESPONSE_INTERCEPTOR.URL)\r\n  public performGetRequestAddingResInterceptor(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_PARAM.URL)\r\n  public performGetRequestUsingAPathVariable(@Path(TestRoutes.GET.WITH_PARAM.PARAMS.ID) id: string): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @GET(TestRoutes.GET.WITH_PARAMS.URL)\r\n  public performGetRequestUsingPathVariables(\r\n    @Path(TestRoutes.GET.WITH_PARAMS.PARAMS.ID) id: string,\r\n    @Path(TestRoutes.GET.WITH_PARAMS.PARAMS.ID2) id2: string,\r\n  ): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @DELETE(TestRoutes.DELETE.REQUEST.URL)\r\n  public performDeleteRequest(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @HEAD(TestRoutes.HEAD.REQUEST.URL)\r\n  public performHeadRequest(): Promise<AxiosResponse<string>> {\r\n    return null;\r\n  }\r\n\r\n  @POST(TestRoutes.POST.REQUEST.URL)\r\n  public performPostRequest(@Body() body: any): Promise<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n\r\n  @PUT(TestRoutes.PUT.REQUEST.URL)\r\n  public performPutRequest(@Body() body: any): Promise<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n\r\n  @PATCH(TestRoutes.PATCH.REQUEST.URL)\r\n  public performPatchRequest(@Body() body: any): Promise<AxiosResponse<any>> {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\n- Create the `Retrofit` instance:\r\n\r\n```typescript\r\nimport { Retrofit } from '@yggdrasilts/Retrofit';\r\n\r\nconst methodsService = new Retrofit<TestService>().baseUrl(process.env.MOCK_SERVER_URL).create(TestService);\r\n```\r\n\r\n- Call methods using observables:\r\n  \r\n  - Using Observables:\r\n\r\n```typescript\r\nimport { AxiosResponse, AxiosError } from '@yggdrasilts/Retrofit';\r\n\r\nmethodsService.performGetRequest().subscribe(\r\n  (response: AxiosResponse<string>) => console.log('OK', response.data),\r\n  (error: AxiosError<any>) => console.error('KO', error),\r\n);\r\n```\r\n\r\n- Using Promises:\r\n\r\n```typescript\r\nimport { AxiosResponse, AxiosError } from '@yggdrasilts/Retrofit';\r\n\r\nmethodsService\r\n  .performGetRequest()\r\n  .then((response: AxiosResponse<string>) => console.log('OK', response.data))\r\n  .catch((error: AxiosError<any>) => console.error('KO', error));\r\n```\r\n\r\nNOTE: The example code can be seen in the [test](./test) folder.\r\n","readmeFilename":"README.md"}