@o3r/apis-manager 11.0.0-prerelease.16 → 11.0.0-prerelease.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -12
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -39,6 +39,7 @@ The **ApiManager** requires the default API Client, which will be used across al
39
39
 
40
40
  In the example that follows, we define the default base configuration that API classes will use, as well as a custom configuration for the 'ExampleApi'.
41
41
  The plugins and fetch client come from the ``@ama-sdk/core`` module, but custom ones can be created if needed as long as they follow the ``ApiClient`` interface from ``@ama-sdk/core``. More details on ``@ama-sdk/core`` [here](https://www.npmjs.com/package/@ama-sdk/core).
42
+
42
43
  ```typescript
43
44
  import { ApiFetchClient, ApiKeyRequest, JsonTokenReply, JsonTokenRequest, ReviverReply, ExceptionReply } from '@ama-sdk/core';
44
45
  import { ApiManager, ApiManagerModule } from '@o3r/apis-manager';
@@ -113,15 +114,13 @@ The API instances can be retrieved via the injection of the ``ApiFactoryService`
113
114
  import { ExampleApi } from '@shared/sdk';
114
115
  import { ApiFactoryService } from '@o3r/apis-manager';
115
116
 
116
- @Inject()
117
+ @Injectable()
117
118
  class MyClass {
118
119
 
119
- constructor(private apiFactoryService: ApiFactoryService) {
120
- }
120
+ private exampleApi = inject(ApiFactoryService).getApi(ExampleApi); // <- retrieve example API instantiated with set configuration
121
121
 
122
122
  doSomething() {
123
- const exampleApi = apiFactoryService.getApi(ExampleApi); // <- retrieve example API instantiated with set configuration
124
- const call = exampleApi.doSomething({ ... });
123
+ const call = this.exampleApi.doSomething({ ... });
125
124
  }
126
125
 
127
126
  }
@@ -155,12 +154,10 @@ import { ApiFactoryService } from '@o3r/apis-manager';
155
154
  @Injectable()
156
155
  class MyClass {
157
156
 
158
- constructor(private apiFactoryService: ApiFactoryService) {
159
- }
157
+ private exampleApi = inject(ApiFactoryService).getApi(ExampleApi); // <- retrieve example API instantiated in @custom/sdk
160
158
 
161
159
  doSomething() {
162
- const exampleApi = apiFactoryService.getApi(ExampleApi); // <- retrieve example API instantiated in @custom/sdk
163
- const call = exampleApi.doSomething({ ... });
160
+ const call = this.exampleApi.doSomething({ ... });
164
161
  }
165
162
 
166
163
  }
@@ -175,18 +172,18 @@ The configuration can be overridden after the instantiation of the API.
175
172
 
176
173
  ```typescript
177
174
  import { ExampleApi } from '@shared/sdk';
178
- import { ApiFactoryService, INTERNAL_API_TOKEN } from '@o3r/apis-manager';
175
+ import { ApiFactoryService } from '@o3r/apis-manager';
179
176
  import { ApiFetchClient } from '@ama-sdk/core';
180
177
 
181
178
  @Injectable()
182
179
  class MyClass {
183
180
 
184
- constructor(@Inject(INTERNAL_API_TOKEN) private apiManager: ApiManager, private apiFactoryService: ApiFactoryService) {
181
+ constructor(private apiManager: ApiManager, private apiFactoryService: ApiFactoryService) {
185
182
  }
186
183
 
187
184
  doSomething() {
188
185
  this.apiManager.setConfiguration(new ApiFetchClient(), ExampleApi); // <- override configuration of Example API
189
- const exampleApi = apiFactoryService.getApi(ExampleApi, true); // <- retrieve example API with the new configuration (and refresh the cache)
186
+ const exampleApi = this.apiFactoryService.getApi(ExampleApi, true); // <- retrieve example API with the new configuration (and refresh the cache)
190
187
  }
191
188
 
192
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/apis-manager",
3
- "version": "11.0.0-prerelease.16",
3
+ "version": "11.0.0-prerelease.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,11 +11,11 @@
11
11
  "otter-module"
12
12
  ],
13
13
  "peerDependencies": {
14
- "@ama-sdk/core": "^11.0.0-prerelease.16",
14
+ "@ama-sdk/core": "^11.0.0-prerelease.18",
15
15
  "@angular-devkit/schematics": "~17.3.0",
16
16
  "@angular/common": "~17.3.0",
17
17
  "@angular/core": "~17.3.0",
18
- "@o3r/schematics": "^11.0.0-prerelease.16",
18
+ "@o3r/schematics": "^11.0.0-prerelease.18",
19
19
  "@schematics/angular": "~17.3.0",
20
20
  "rxjs": "^7.8.1",
21
21
  "typescript": "~5.4.2"