@smartbit4all/ng-client 3.0.6 → 3.0.7

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 (46) hide show
  1. package/esm2020/lib/session/dev-tool/smart-dev-tool-dialog/smart-dev-tool-dialog.service.mjs +2 -2
  2. package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
  3. package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +49 -27
  4. package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
  5. package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +20 -1
  6. package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
  7. package/esm2020/lib/smart-grid/api/grid-api/index.mjs +2 -1
  8. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnMeta.mjs +1 -1
  9. package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
  10. package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
  11. package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
  12. package/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
  13. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
  14. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
  15. package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
  16. package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
  17. package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
  18. package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
  19. package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
  20. package/esm2020/lib/smart-grid/api/grid-api/param.mjs +2 -0
  21. package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
  22. package/esm2020/lib/smart-grid/smart-grid.component.mjs +25 -11
  23. package/esm2020/lib/smart-grid/smart-grid.service.mjs +16 -15
  24. package/esm2020/lib/view-context/projects.mjs +14 -14
  25. package/esm2020/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.mjs +2 -2
  26. package/esm2020/lib/view-context/smart-view-context.module.mjs +4 -2
  27. package/esm2020/lib/view-context/smart-view-context.service.mjs +15 -6
  28. package/fesm2015/smartbit4all-ng-client.mjs +122 -55
  29. package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
  30. package/fesm2020/smartbit4all-ng-client.mjs +121 -54
  31. package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
  32. package/lib/session/dev-tool/smart-dev-tool-dialog/smart-dev-tool-dialog.service.d.ts +1 -1
  33. package/lib/smart-grid/api/grid-api/api/grid.service.d.ts +1 -1
  34. package/lib/smart-grid/api/grid-api/configuration.d.ts +24 -0
  35. package/lib/smart-grid/api/grid-api/index.d.ts +1 -0
  36. package/lib/smart-grid/api/grid-api/model/gridViewDescriptor.d.ts +1 -0
  37. package/lib/smart-grid/api/grid-api/param.d.ts +37 -0
  38. package/lib/smart-grid/smart-grid.component.d.ts +2 -0
  39. package/lib/smart-grid/smart-grid.service.d.ts +1 -2
  40. package/lib/view-context/projects.d.ts +13 -13
  41. package/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.d.ts +1 -1
  42. package/lib/view-context/smart-view-context.service.d.ts +4 -2
  43. package/package.json +1 -1
  44. package/smartbit4all-ng-client-3.0.7.tgz +0 -0
  45. package/src/lib/smart-grid/api/grid-api/README.md +226 -203
  46. package/smartbit4all-ng-client-3.0.6.tgz +0 -0
@@ -2,7 +2,7 @@ import { MatDialog } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
3
  import { Subject } from 'rxjs';
4
4
  import { SmartDevToolDescriptor, SmartDevToolService } from '../smart-dev-tool.service';
5
- import { SmartdialogService } from '../../../../projects';
5
+ import { SmartdialogService } from '../../../smart-dialog/projects';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class SmartDevToolDialogService extends SmartdialogService {
8
8
  service: SmartDevToolService;
@@ -11,7 +11,7 @@ export declare class GridService {
11
11
  defaultHeaders: HttpHeaders;
12
12
  configuration: Configuration;
13
13
  encoder: HttpParameterCodec;
14
- constructor(httpClient: HttpClient, basePath: string, configuration: Configuration);
14
+ constructor(httpClient: HttpClient, basePath: string | string[], configuration: Configuration);
15
15
  private addToHttpParams;
16
16
  private addToHttpParamsRecursive;
17
17
  /**
@@ -1,4 +1,5 @@
1
1
  import { HttpParameterCodec } from '@angular/common/http';
2
+ import { Param } from './param';
2
3
  export interface ConfigurationParameters {
3
4
  /**
4
5
  * @deprecated Since 5.0. Use credentials instead
@@ -14,7 +15,18 @@ export interface ConfigurationParameters {
14
15
  accessToken?: string | (() => string);
15
16
  basePath?: string;
16
17
  withCredentials?: boolean;
18
+ /**
19
+ * Takes care of encoding query- and form-parameters.
20
+ */
17
21
  encoder?: HttpParameterCodec;
22
+ /**
23
+ * Override the default method for encoding path parameters in various
24
+ * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
25
+ * <p>
26
+ * See {@link README.md} for more details
27
+ * </p>
28
+ */
29
+ encodeParam?: (param: Param) => string;
18
30
  /**
19
31
  * The keys are the names in the securitySchemes section of the OpenAPI
20
32
  * document. They should map to the value used for authentication
@@ -39,7 +51,18 @@ export declare class Configuration {
39
51
  accessToken?: string | (() => string);
40
52
  basePath?: string;
41
53
  withCredentials?: boolean;
54
+ /**
55
+ * Takes care of encoding query- and form-parameters.
56
+ */
42
57
  encoder?: HttpParameterCodec;
58
+ /**
59
+ * Encoding of various path parameter
60
+ * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
61
+ * <p>
62
+ * See {@link README.md} for more details
63
+ * </p>
64
+ */
65
+ encodeParam: (param: Param) => string;
43
66
  /**
44
67
  * The keys are the names in the securitySchemes section of the OpenAPI
45
68
  * document. They should map to the value used for authentication
@@ -77,4 +100,5 @@ export declare class Configuration {
77
100
  */
78
101
  isJsonMime(mime: string): boolean;
79
102
  lookupCredential(key: string): string | undefined;
103
+ private defaultEncodeParam;
80
104
  }
@@ -3,3 +3,4 @@ export * from './model/models';
3
3
  export * from './variables';
4
4
  export * from './configuration';
5
5
  export * from './api.module';
6
+ export * from './param';
@@ -23,6 +23,7 @@ export interface GridViewDescriptor {
23
23
  selectionMode?: GridSelectionMode;
24
24
  selectionType?: GridSelectionType;
25
25
  preserveSelectionOnPageChange?: boolean;
26
+ showEditColumns?: boolean;
26
27
  }
27
28
  export declare namespace GridViewDescriptor {
28
29
  type KindEnum = 'TABLE' | 'EXPANDABLECARDS1';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Standard parameter styles defined by OpenAPI spec
3
+ */
4
+ export declare type StandardParamStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
5
+ /**
6
+ * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
7
+ */
8
+ export declare type ParamStyle = StandardParamStyle | string;
9
+ /**
10
+ * Standard parameter locations defined by OpenAPI spec
11
+ */
12
+ export declare type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
13
+ /**
14
+ * Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
15
+ */
16
+ export declare type StandardDataType = "integer" | "number" | "boolean" | "string" | "object" | "array";
17
+ /**
18
+ * Standard {@link DataType}s plus your own types/classes.
19
+ */
20
+ export declare type DataType = StandardDataType | string;
21
+ /**
22
+ * Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
23
+ */
24
+ export declare type StandardDataFormat = "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "password";
25
+ export declare type DataFormat = StandardDataFormat | string;
26
+ /**
27
+ * The parameter to encode.
28
+ */
29
+ export interface Param {
30
+ name: string;
31
+ value: unknown;
32
+ in: ParamLocation;
33
+ style: ParamStyle;
34
+ explode: boolean;
35
+ dataType: DataType;
36
+ dataFormat: DataFormat | undefined;
37
+ }
@@ -12,6 +12,8 @@ import * as i0 from "@angular/core";
12
12
  export declare class SmartGridComponent implements AfterViewInit, OnDestroy, OnChanges {
13
13
  private service;
14
14
  private cfService;
15
+ private readonly defaultPageSize;
16
+ private readonly defaultPageSizeOptions;
15
17
  private _destroy$;
16
18
  smartGrid?: SmartGrid;
17
19
  uuid: string;
@@ -9,8 +9,6 @@ export declare class SmartGridService extends SmartdialogService {
9
9
  private api;
10
10
  gridModelChanged: Subject<void>;
11
11
  gridModel: GridModel;
12
- pageSize?: number;
13
- length?: number;
14
12
  constructor(api: GridService, dialog: MatDialog, router: Router);
15
13
  load(uuid: string, gridIdentifier: string): Promise<void>;
16
14
  setPage(uuid: string, gridIdentifier: string, offset: string, limit: string): Promise<void>;
@@ -21,6 +19,7 @@ export declare class SmartGridService extends SmartdialogService {
21
19
  update(uuid: string, identifier: string, updateData: GridUpdateData): Promise<void>;
22
20
  closeDialog(): Promise<void>;
23
21
  handleAfterClosed(): void;
22
+ private updateGrid;
24
23
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartGridService, never>;
25
24
  static ɵprov: i0.ɵɵInjectableDeclaration<SmartGridService>;
26
25
  }
@@ -1,13 +1,13 @@
1
- export * from "./smart-view-context.service";
2
- export * from "./smart-view-context.model";
3
- export * from "./smart-view-context.module";
4
- export * from "./smart-view-redirect/smart-view-redirect";
5
- export * from "./api/index";
6
- export * from "./smart-ui-action/ui-action-toolbar.component";
7
- export * from "./smart-ui-action/ui-action.service";
8
- export * from "./smart-ui-action/ui-action.model";
9
- export * from "./smart-ui-action/ui-action.descriptor.service";
10
- export * from "./smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.service";
11
- export * from "./smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.component";
12
- export * from "./smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.service";
13
- export * from "./smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.component";
1
+ export * from './smart-view-context.service';
2
+ export * from './smart-view-context.model';
3
+ export * from './smart-view-context.module';
4
+ export * from './smart-view-redirect/smart-view-redirect';
5
+ export * from './api/index';
6
+ export * from './smart-ui-action/ui-action-toolbar.component';
7
+ export * from './smart-ui-action/ui-action.service';
8
+ export * from './smart-ui-action/ui-action.model';
9
+ export * from './smart-ui-action/ui-action.descriptor.service';
10
+ export * from './smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.service';
11
+ export * from './smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.component';
12
+ export * from './smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.service';
13
+ export * from './smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.component';
@@ -1,9 +1,9 @@
1
1
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
- import { SmartdialogService } from '../../../projects';
4
3
  import { ViewApiError } from '../api';
5
4
  import { SmartViewContextApiError } from '../smart-view-context.model';
6
5
  import { SmartViewContextService } from '../smart-view-context.service';
6
+ import { SmartdialogService } from '../../smart-dialog/projects';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class SmartViewContextErrorDialogService extends SmartdialogService {
9
9
  private viewContext;
@@ -1,4 +1,4 @@
1
- import { OnDestroy } from '@angular/core';
1
+ import { InjectionToken, Injector, OnDestroy } from '@angular/core';
2
2
  import { Subject } from 'rxjs';
3
3
  import { SmartSessionService } from '../session/smart-session.service';
4
4
  import { ComponentModel, DataChange, MessageData, MessageResult, UiActionDescriptor, UiActionRequest, ViewConstraint, ViewContextChange, ViewContextData, ViewContextUpdate, ViewData, ViewService } from './api';
@@ -10,12 +10,14 @@ import * as i0 from "@angular/core";
10
10
  export declare const SmartViewContextErrorDialogButtonLabel = "SmartViewContextErrorDialogButtonLabel";
11
11
  export declare const SmartViewContextErrorDialogTitle = "SmartViewContextErrorDialogTitle";
12
12
  export declare const SmartViewContextErrorDialogMessage = "SmartViewContextErrorDialogMessage";
13
+ export declare const DIALOG_DISABLE_CLOSE: InjectionToken<boolean>;
13
14
  export declare class SmartViewContextService implements OnDestroy {
14
15
  private view;
15
16
  private session;
16
17
  private navigation;
17
18
  private dialog;
18
19
  private apiQueueService;
20
+ private inject;
19
21
  private tabIdName;
20
22
  private tabIdhttpHeaderName;
21
23
  messageDialogname: string | undefined;
@@ -39,7 +41,7 @@ export declare class SmartViewContextService implements OnDestroy {
39
41
  get translateService(): SmartTranslateService | undefined;
40
42
  private _translateService?;
41
43
  translateServiceChanged: Subject<void>;
42
- constructor(view: ViewService, session: SmartSessionService, navigation: SmartNavigationService, dialog: SmartdialogService, apiQueueService: ApiQueueService);
44
+ constructor(view: ViewService, session: SmartSessionService, navigation: SmartNavigationService, dialog: SmartdialogService, apiQueueService: ApiQueueService, inject: Injector);
43
45
  ngOnDestroy(): void;
44
46
  follow(uuid: string, detectChange: SmartSubject<any>): void;
45
47
  unfollow(uuid: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbit4all/ng-client",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^13.3.9",
6
6
  "@angular/common": "^13.2.0",
Binary file
@@ -1,203 +1,226 @@
1
- ## @
2
-
3
- ### Building
4
-
5
- To install the required dependencies and to build the typescript sources run:
6
- ```
7
- npm install
8
- npm run build
9
- ```
10
-
11
- ### publishing
12
-
13
- First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
14
-
15
- ### consuming
16
-
17
- Navigate to the folder of your consuming project and run one of next commands.
18
-
19
- _published:_
20
-
21
- ```
22
- npm install @ --save
23
- ```
24
-
25
- _without publishing (not recommended):_
26
-
27
- ```
28
- npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
29
- ```
30
-
31
- _It's important to take the tgz file, otherwise you'll get trouble with links on windows_
32
-
33
- _using `npm link`:_
34
-
35
- In PATH_TO_GENERATED_PACKAGE/dist:
36
- ```
37
- npm link
38
- ```
39
-
40
- In your project:
41
- ```
42
- npm link
43
- ```
44
-
45
- __Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
46
- Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
47
- Published packages are not effected by this issue.
48
-
49
-
50
- #### General usage
51
-
52
- In your Angular project:
53
-
54
-
55
- ```
56
- // without configuring providers
57
- import { ApiModule } from '';
58
- import { HttpClientModule } from '@angular/common/http';
59
-
60
- @NgModule({
61
- imports: [
62
- ApiModule,
63
- // make sure to import the HttpClientModule in the AppModule only,
64
- // see https://github.com/angular/angular/issues/20575
65
- HttpClientModule
66
- ],
67
- declarations: [ AppComponent ],
68
- providers: [],
69
- bootstrap: [ AppComponent ]
70
- })
71
- export class AppModule {}
72
- ```
73
-
74
- ```
75
- // configuring providers
76
- import { ApiModule, Configuration, ConfigurationParameters } from '';
77
-
78
- export function apiConfigFactory (): Configuration {
79
- const params: ConfigurationParameters = {
80
- // set configuration parameters here.
81
- }
82
- return new Configuration(params);
83
- }
84
-
85
- @NgModule({
86
- imports: [ ApiModule.forRoot(apiConfigFactory) ],
87
- declarations: [ AppComponent ],
88
- providers: [],
89
- bootstrap: [ AppComponent ]
90
- })
91
- export class AppModule {}
92
- ```
93
-
94
- ```
95
- // configuring providers with an authentication service that manages your access tokens
96
- import { ApiModule, Configuration } from '';
97
-
98
- @NgModule({
99
- imports: [ ApiModule ],
100
- declarations: [ AppComponent ],
101
- providers: [
102
- {
103
- provide: Configuration,
104
- useFactory: (authService: AuthService) => new Configuration(
105
- {
106
- basePath: environment.apiUrl,
107
- accessToken: authService.getAccessToken.bind(authService)
108
- }
109
- ),
110
- deps: [AuthService],
111
- multi: false
112
- }
113
- ],
114
- bootstrap: [ AppComponent ]
115
- })
116
- export class AppModule {}
117
- ```
118
-
119
- ```
120
- import { DefaultApi } from '';
121
-
122
- export class AppComponent {
123
- constructor(private apiGateway: DefaultApi) { }
124
- }
125
- ```
126
-
127
- Note: The ApiModule is restricted to being instantiated once app wide.
128
- This is to ensure that all services are treated as singletons.
129
-
130
- #### Using multiple OpenAPI files / APIs / ApiModules
131
- In order to use multiple `ApiModules` generated from different OpenAPI files,
132
- you can create an alias name when importing the modules
133
- in order to avoid naming conflicts:
134
- ```
135
- import { ApiModule } from 'my-api-path';
136
- import { ApiModule as OtherApiModule } from 'my-other-api-path';
137
- import { HttpClientModule } from '@angular/common/http';
138
-
139
- @NgModule({
140
- imports: [
141
- ApiModule,
142
- OtherApiModule,
143
- // make sure to import the HttpClientModule in the AppModule only,
144
- // see https://github.com/angular/angular/issues/20575
145
- HttpClientModule
146
- ]
147
- })
148
- export class AppModule {
149
-
150
- }
151
- ```
152
-
153
-
154
- ### Set service base path
155
- If different than the generated base path, during app bootstrap, you can provide the base path to your service.
156
-
157
- ```
158
- import { BASE_PATH } from '';
159
-
160
- bootstrap(AppComponent, [
161
- { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
162
- ]);
163
- ```
164
- or
165
-
166
- ```
167
- import { BASE_PATH } from '';
168
-
169
- @NgModule({
170
- imports: [],
171
- declarations: [ AppComponent ],
172
- providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
173
- bootstrap: [ AppComponent ]
174
- })
175
- export class AppModule {}
176
- ```
177
-
178
-
179
- #### Using @angular/cli
180
- First extend your `src/environments/*.ts` files by adding the corresponding base path:
181
-
182
- ```
183
- export const environment = {
184
- production: false,
185
- API_BASE_PATH: 'http://127.0.0.1:8080'
186
- };
187
- ```
188
-
189
- In the src/app/app.module.ts:
190
- ```
191
- import { BASE_PATH } from '';
192
- import { environment } from '../environments/environment';
193
-
194
- @NgModule({
195
- declarations: [
196
- AppComponent
197
- ],
198
- imports: [ ],
199
- providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
200
- bootstrap: [ AppComponent ]
201
- })
202
- export class AppModule { }
203
- ```
1
+ ## @
2
+
3
+ ### Building
4
+
5
+ To install the required dependencies and to build the typescript sources run:
6
+ ```
7
+ npm install
8
+ npm run build
9
+ ```
10
+
11
+ ### publishing
12
+
13
+ First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
14
+
15
+ ### consuming
16
+
17
+ Navigate to the folder of your consuming project and run one of next commands.
18
+
19
+ _published:_
20
+
21
+ ```
22
+ npm install @ --save
23
+ ```
24
+
25
+ _without publishing (not recommended):_
26
+
27
+ ```
28
+ npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
29
+ ```
30
+
31
+ _It's important to take the tgz file, otherwise you'll get trouble with links on windows_
32
+
33
+ _using `npm link`:_
34
+
35
+ In PATH_TO_GENERATED_PACKAGE/dist:
36
+ ```
37
+ npm link
38
+ ```
39
+
40
+ In your project:
41
+ ```
42
+ npm link
43
+ ```
44
+
45
+ __Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
46
+ Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
47
+ Published packages are not effected by this issue.
48
+
49
+
50
+ #### General usage
51
+
52
+ In your Angular project:
53
+
54
+
55
+ ```
56
+ // without configuring providers
57
+ import { ApiModule } from '';
58
+ import { HttpClientModule } from '@angular/common/http';
59
+
60
+ @NgModule({
61
+ imports: [
62
+ ApiModule,
63
+ // make sure to import the HttpClientModule in the AppModule only,
64
+ // see https://github.com/angular/angular/issues/20575
65
+ HttpClientModule
66
+ ],
67
+ declarations: [ AppComponent ],
68
+ providers: [],
69
+ bootstrap: [ AppComponent ]
70
+ })
71
+ export class AppModule {}
72
+ ```
73
+
74
+ ```
75
+ // configuring providers
76
+ import { ApiModule, Configuration, ConfigurationParameters } from '';
77
+
78
+ export function apiConfigFactory (): Configuration {
79
+ const params: ConfigurationParameters = {
80
+ // set configuration parameters here.
81
+ }
82
+ return new Configuration(params);
83
+ }
84
+
85
+ @NgModule({
86
+ imports: [ ApiModule.forRoot(apiConfigFactory) ],
87
+ declarations: [ AppComponent ],
88
+ providers: [],
89
+ bootstrap: [ AppComponent ]
90
+ })
91
+ export class AppModule {}
92
+ ```
93
+
94
+ ```
95
+ // configuring providers with an authentication service that manages your access tokens
96
+ import { ApiModule, Configuration } from '';
97
+
98
+ @NgModule({
99
+ imports: [ ApiModule ],
100
+ declarations: [ AppComponent ],
101
+ providers: [
102
+ {
103
+ provide: Configuration,
104
+ useFactory: (authService: AuthService) => new Configuration(
105
+ {
106
+ basePath: environment.apiUrl,
107
+ accessToken: authService.getAccessToken.bind(authService)
108
+ }
109
+ ),
110
+ deps: [AuthService],
111
+ multi: false
112
+ }
113
+ ],
114
+ bootstrap: [ AppComponent ]
115
+ })
116
+ export class AppModule {}
117
+ ```
118
+
119
+ ```
120
+ import { DefaultApi } from '';
121
+
122
+ export class AppComponent {
123
+ constructor(private apiGateway: DefaultApi) { }
124
+ }
125
+ ```
126
+
127
+ Note: The ApiModule is restricted to being instantiated once app wide.
128
+ This is to ensure that all services are treated as singletons.
129
+
130
+ #### Using multiple OpenAPI files / APIs / ApiModules
131
+ In order to use multiple `ApiModules` generated from different OpenAPI files,
132
+ you can create an alias name when importing the modules
133
+ in order to avoid naming conflicts:
134
+ ```
135
+ import { ApiModule } from 'my-api-path';
136
+ import { ApiModule as OtherApiModule } from 'my-other-api-path';
137
+ import { HttpClientModule } from '@angular/common/http';
138
+
139
+ @NgModule({
140
+ imports: [
141
+ ApiModule,
142
+ OtherApiModule,
143
+ // make sure to import the HttpClientModule in the AppModule only,
144
+ // see https://github.com/angular/angular/issues/20575
145
+ HttpClientModule
146
+ ]
147
+ })
148
+ export class AppModule {
149
+
150
+ }
151
+ ```
152
+
153
+
154
+ ### Set service base path
155
+ If different than the generated base path, during app bootstrap, you can provide the base path to your service.
156
+
157
+ ```
158
+ import { BASE_PATH } from '';
159
+
160
+ bootstrap(AppComponent, [
161
+ { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
162
+ ]);
163
+ ```
164
+ or
165
+
166
+ ```
167
+ import { BASE_PATH } from '';
168
+
169
+ @NgModule({
170
+ imports: [],
171
+ declarations: [ AppComponent ],
172
+ providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
173
+ bootstrap: [ AppComponent ]
174
+ })
175
+ export class AppModule {}
176
+ ```
177
+
178
+
179
+ #### Using @angular/cli
180
+ First extend your `src/environments/*.ts` files by adding the corresponding base path:
181
+
182
+ ```
183
+ export const environment = {
184
+ production: false,
185
+ API_BASE_PATH: 'http://127.0.0.1:8080'
186
+ };
187
+ ```
188
+
189
+ In the src/app/app.module.ts:
190
+ ```
191
+ import { BASE_PATH } from '';
192
+ import { environment } from '../environments/environment';
193
+
194
+ @NgModule({
195
+ declarations: [
196
+ AppComponent
197
+ ],
198
+ imports: [ ],
199
+ providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
200
+ bootstrap: [ AppComponent ]
201
+ })
202
+ export class AppModule { }
203
+ ```
204
+
205
+ ### Customizing path parameter encoding
206
+
207
+ Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
208
+ and Dates for format 'date-time' are encoded correctly.
209
+
210
+ Other styles (e.g. "matrix") are not that easy to encode
211
+ and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
212
+
213
+ To implement your own parameter encoding (or call another library),
214
+ pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
215
+ (see [General Usage](#general-usage) above).
216
+
217
+ Example value for use in your Configuration-Provider:
218
+ ```typescript
219
+ new Configuration({
220
+ encodeParam: (param: Param) => myFancyParamEncoder(param),
221
+ })
222
+ ```
223
+
224
+ [parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
225
+ [style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
226
+ [@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
Binary file