@saritasa/renewaire-frontend-sdk 0.1.2 → 0.1.4

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.
package/configuration.ts DELETED
@@ -1,219 +0,0 @@
1
- import {
2
- HttpHeaders,
3
- HttpParams,
4
- HttpParameterCodec,
5
- } from "@angular/common/http";
6
- import { Param } from "./param";
7
-
8
- export interface ConfigurationParameters {
9
- /**
10
- * @deprecated Since 5.0. Use credentials instead
11
- */
12
- apiKeys?: { [key: string]: string };
13
- username?: string;
14
- password?: string;
15
- /**
16
- * @deprecated Since 5.0. Use credentials instead
17
- */
18
- accessToken?: string | (() => string);
19
- basePath?: string;
20
- withCredentials?: boolean;
21
- /**
22
- * Takes care of encoding query- and form-parameters.
23
- */
24
- encoder?: HttpParameterCodec;
25
- /**
26
- * Override the default method for encoding path parameters in various
27
- * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
28
- * <p>
29
- * See {@link README.md} for more details
30
- * </p>
31
- */
32
- encodeParam?: (param: Param) => string;
33
- /**
34
- * The keys are the names in the securitySchemes section of the OpenAPI
35
- * document. They should map to the value used for authentication
36
- * minus any standard prefixes such as 'Basic' or 'Bearer'.
37
- */
38
- credentials?: { [key: string]: string | (() => string | undefined) };
39
- }
40
-
41
- export class Configuration {
42
- /**
43
- * @deprecated Since 5.0. Use credentials instead
44
- */
45
- apiKeys?: { [key: string]: string };
46
- username?: string;
47
- password?: string;
48
- /**
49
- * @deprecated Since 5.0. Use credentials instead
50
- */
51
- accessToken?: string | (() => string);
52
- basePath?: string;
53
- withCredentials?: boolean;
54
- /**
55
- * Takes care of encoding query- and form-parameters.
56
- */
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;
66
- /**
67
- * The keys are the names in the securitySchemes section of the OpenAPI
68
- * document. They should map to the value used for authentication
69
- * minus any standard prefixes such as 'Basic' or 'Bearer'.
70
- */
71
- credentials: { [key: string]: string | (() => string | undefined) };
72
-
73
- constructor({
74
- accessToken,
75
- apiKeys,
76
- basePath,
77
- credentials,
78
- encodeParam,
79
- encoder,
80
- password,
81
- username,
82
- withCredentials,
83
- }: ConfigurationParameters = {}) {
84
- if (apiKeys) {
85
- this.apiKeys = apiKeys;
86
- }
87
- if (username !== undefined) {
88
- this.username = username;
89
- }
90
- if (password !== undefined) {
91
- this.password = password;
92
- }
93
- if (accessToken !== undefined) {
94
- this.accessToken = accessToken;
95
- }
96
- if (basePath !== undefined) {
97
- this.basePath = basePath;
98
- }
99
- if (withCredentials !== undefined) {
100
- this.withCredentials = withCredentials;
101
- }
102
- if (encoder) {
103
- this.encoder = encoder;
104
- }
105
- this.encodeParam =
106
- encodeParam ?? ((param) => this.defaultEncodeParam(param));
107
- this.credentials = credentials ?? {};
108
-
109
- // init default Bearer credential
110
- if (!this.credentials["Bearer"]) {
111
- this.credentials["Bearer"] = () => {
112
- return typeof this.accessToken === "function"
113
- ? this.accessToken()
114
- : this.accessToken;
115
- };
116
- }
117
- }
118
-
119
- /**
120
- * Select the correct content-type to use for a request.
121
- * Uses {@link Configuration#isJsonMime} to determine the correct content-type.
122
- * If no content type is found return the first found type if the contentTypes is not empty
123
- * @param contentTypes - the array of content types that are available for selection
124
- * @returns the selected content-type or <code>undefined</code> if no selection could be made.
125
- */
126
- public selectHeaderContentType(contentTypes: string[]): string | undefined {
127
- if (contentTypes.length === 0) {
128
- return undefined;
129
- }
130
-
131
- const type = contentTypes.find((x: string) => this.isJsonMime(x));
132
- if (type === undefined) {
133
- return contentTypes[0];
134
- }
135
- return type;
136
- }
137
-
138
- /**
139
- * Select the correct accept content-type to use for a request.
140
- * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
141
- * If no content type is found return the first found type if the contentTypes is not empty
142
- * @param accepts - the array of content types that are available for selection.
143
- * @returns the selected content-type or <code>undefined</code> if no selection could be made.
144
- */
145
- public selectHeaderAccept(accepts: string[]): string | undefined {
146
- if (accepts.length === 0) {
147
- return undefined;
148
- }
149
-
150
- const type = accepts.find((x: string) => this.isJsonMime(x));
151
- if (type === undefined) {
152
- return accepts[0];
153
- }
154
- return type;
155
- }
156
-
157
- /**
158
- * Check if the given MIME is a JSON MIME.
159
- * JSON MIME examples:
160
- * application/json
161
- * application/json; charset=UTF8
162
- * APPLICATION/JSON
163
- * application/vnd.company+json
164
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
165
- * @return True if the given MIME is JSON, false otherwise.
166
- */
167
- public isJsonMime(mime: string): boolean {
168
- const jsonMime: RegExp = new RegExp(
169
- "^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$",
170
- "i",
171
- );
172
- return (
173
- mime !== null &&
174
- (jsonMime.test(mime) ||
175
- mime.toLowerCase() === "application/json-patch+json")
176
- );
177
- }
178
-
179
- public lookupCredential(key: string): string | undefined {
180
- const value = this.credentials[key];
181
- return typeof value === "function" ? value() : value;
182
- }
183
-
184
- public addCredentialToHeaders(
185
- credentialKey: string,
186
- headerName: string,
187
- headers: HttpHeaders,
188
- prefix?: string,
189
- ): HttpHeaders {
190
- const value = this.lookupCredential(credentialKey);
191
- return value ? headers.set(headerName, (prefix ?? "") + value) : headers;
192
- }
193
-
194
- public addCredentialToQuery(
195
- credentialKey: string,
196
- paramName: string,
197
- query: HttpParams,
198
- ): HttpParams {
199
- const value = this.lookupCredential(credentialKey);
200
- return value ? query.set(paramName, value) : query;
201
- }
202
-
203
- private defaultEncodeParam(param: Param): string {
204
- // This implementation exists as fallback for missing configuration
205
- // and for backwards compatibility to older typescript-angular generator versions.
206
- // It only works for the 'simple' parameter style.
207
- // Date-handling only works for the 'date-time' format.
208
- // All other styles and Date-formats are probably handled incorrectly.
209
- //
210
- // But: if that's all you need (i.e.: the most common use-case): no need for customization!
211
-
212
- const value =
213
- param.dataFormat === "date-time" && param.value instanceof Date
214
- ? (param.value as Date).toISOString()
215
- : param.value;
216
-
217
- return encodeURIComponent(String(value));
218
- }
219
- }
package/encoder.ts DELETED
@@ -1,20 +0,0 @@
1
- import { HttpParameterCodec } from "@angular/common/http";
2
-
3
- /**
4
- * Custom HttpParameterCodec
5
- * Workaround for https://github.com/angular/angular/issues/18261
6
- */
7
- export class CustomHttpParameterCodec implements HttpParameterCodec {
8
- encodeKey(k: string): string {
9
- return encodeURIComponent(k);
10
- }
11
- encodeValue(v: string): string {
12
- return encodeURIComponent(v);
13
- }
14
- decodeKey(k: string): string {
15
- return decodeURIComponent(k);
16
- }
17
- decodeValue(v: string): string {
18
- return decodeURIComponent(v);
19
- }
20
- }
package/git_push.sh DELETED
@@ -1,57 +0,0 @@
1
- #!/bin/sh
2
- # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
- #
4
- # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
-
6
- git_user_id=$1
7
- git_repo_id=$2
8
- release_note=$3
9
- git_host=$4
10
-
11
- if [ "$git_host" = "" ]; then
12
- git_host="github.com"
13
- echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
- fi
15
-
16
- if [ "$git_user_id" = "" ]; then
17
- git_user_id="saritasa-nest"
18
- echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
- fi
20
-
21
- if [ "$git_repo_id" = "" ]; then
22
- git_repo_id="renewaire-frontend-sdk"
23
- echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
- fi
25
-
26
- if [ "$release_note" = "" ]; then
27
- release_note="Minor update"
28
- echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
- fi
30
-
31
- # Initialize the local directory as a Git repository
32
- git init
33
-
34
- # Adds the files in the local repository and stages them for commit.
35
- git add .
36
-
37
- # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
- git commit -m "$release_note"
39
-
40
- # Sets the new remote
41
- git_remote=$(git remote)
42
- if [ "$git_remote" = "" ]; then # git remote not defined
43
-
44
- if [ "$GIT_TOKEN" = "" ]; then
45
- echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
- git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
- else
48
- git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
- fi
50
-
51
- fi
52
-
53
- git pull origin master
54
-
55
- # Pushes (Forces) the changes in the local repository up to the remote repository
56
- echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
- git push origin master 2>&1 | grep -v 'To https'
package/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from "./api/api";
2
- export * from "./model/models";
3
- export * from "./variables";
4
- export * from "./configuration";
5
- export * from "./api.module";
6
- export * from "./provide-api";
7
- export * from "./param";
@@ -1,23 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * Email confirmation token DTO.
13
- */
14
- export interface EmailConfirmationTokenDto {
15
- /**
16
- * Email address.
17
- */
18
- email: string;
19
- /**
20
- * Confirmation token (code).
21
- */
22
- token: string;
23
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * DTO to return Id of entity.
13
- */
14
- export interface Int32IdDto {
15
- id: number;
16
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * Login user command.
13
- */
14
- export interface LoginUserCommand {
15
- /**
16
- * Username (email).
17
- */
18
- userName: string;
19
- /**
20
- * Password.
21
- */
22
- password: string;
23
- /**
24
- * Remember user\'s cookie for longer period.
25
- */
26
- rememberMe: boolean;
27
- }
package/model/models.ts DELETED
@@ -1,10 +0,0 @@
1
- export * from "./email-confirmation-token-dto";
2
- export * from "./int32-id-dto";
3
- export * from "./login-user-command";
4
- export * from "./physical-address-dto";
5
- export * from "./refresh-token-command";
6
- export * from "./token-model";
7
- export * from "./user-email-dto";
8
- export * from "./user-preferences-dto";
9
- export * from "./user-profile-dto";
10
- export * from "./user-registration-dto";
@@ -1,33 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * Physical address.
13
- */
14
- export interface PhysicalAddressDto {
15
- /**
16
- * Address display name.
17
- */
18
- displayAddress: string;
19
- street1: string;
20
- stateCode: string;
21
- /**
22
- * Country name.
23
- */
24
- country: string;
25
- /**
26
- * Postal code.
27
- */
28
- postalCode: string;
29
- apartmentNumber?: string | null;
30
- street2?: string | null;
31
- county?: string | null;
32
- city?: string | null;
33
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * Refresh token command.
13
- */
14
- export interface RefreshTokenCommand {
15
- /**
16
- * User token.
17
- */
18
- token: string;
19
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * API generated token model.
13
- */
14
- export interface TokenModel {
15
- /**
16
- * Token.
17
- */
18
- token: string;
19
- /**
20
- * Token expiration in seconds.
21
- */
22
- expiresIn: number;
23
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * User email DTO.
13
- */
14
- export interface UserEmailDto {
15
- /**
16
- * <inheritdoc cref=\"P:RenewAire.Cores.Domain.Users.User.Email\" />.
17
- */
18
- email: string;
19
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * User preferences DTO.
13
- */
14
- export interface UserPreferencesDto {
15
- occupation: string;
16
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
-
11
- /**
12
- * User profile DTO.
13
- */
14
- export interface UserProfileDto {
15
- firstName: string;
16
- lastName: string;
17
- company: string;
18
- title: string;
19
- /**
20
- * Phone number.
21
- */
22
- workPhoneNumber: string;
23
- /**
24
- * Work phone number extension. Optional.
25
- */
26
- workPhoneNumberExt?: string | null;
27
- /**
28
- * Work phone.
29
- */
30
- mobilePhoneNumber?: string | null;
31
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * RenewAire CORES API
3
- *
4
- * Contact: renewaire@saritasa.com
5
- *
6
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
- * https://openapi-generator.tech
8
- * Do not edit the class manually.
9
- */
10
- import { UserProfileDto } from "./user-profile-dto";
11
- import { PhysicalAddressDto } from "./physical-address-dto";
12
- import { EmailConfirmationTokenDto } from "./email-confirmation-token-dto";
13
- import { UserPreferencesDto } from "./user-preferences-dto";
14
-
15
- /**
16
- * User registration DTO.
17
- */
18
- export interface UserRegistrationDto {
19
- /**
20
- * Email address and confirmation token.
21
- */
22
- emailToken: EmailConfirmationTokenDto;
23
- /**
24
- * Password.
25
- */
26
- password: string;
27
- /**
28
- * User profile information.
29
- */
30
- profile: UserProfileDto;
31
- /**
32
- * Physical address.
33
- */
34
- address: PhysicalAddressDto;
35
- /**
36
- * Preferences.
37
- */
38
- preferences: UserPreferencesDto;
39
- }
package/ng-package.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "index.ts"
5
- }
6
- }
package/param.ts DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Standard parameter styles defined by OpenAPI spec
3
- */
4
- export type StandardParamStyle =
5
- | "matrix"
6
- | "label"
7
- | "form"
8
- | "simple"
9
- | "spaceDelimited"
10
- | "pipeDelimited"
11
- | "deepObject";
12
-
13
- /**
14
- * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
15
- */
16
- export type ParamStyle = StandardParamStyle | string;
17
-
18
- /**
19
- * Standard parameter locations defined by OpenAPI spec
20
- */
21
- export type ParamLocation = "query" | "header" | "path" | "cookie";
22
-
23
- /**
24
- * Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
25
- */
26
- export type StandardDataType =
27
- | "integer"
28
- | "number"
29
- | "boolean"
30
- | "string"
31
- | "object"
32
- | "array";
33
-
34
- /**
35
- * Standard {@link DataType}s plus your own types/classes.
36
- */
37
- export type DataType = StandardDataType | string;
38
-
39
- /**
40
- * Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
41
- */
42
- export type StandardDataFormat =
43
- | "int32"
44
- | "int64"
45
- | "float"
46
- | "double"
47
- | "byte"
48
- | "binary"
49
- | "date"
50
- | "date-time"
51
- | "password";
52
-
53
- export type DataFormat = StandardDataFormat | string;
54
-
55
- /**
56
- * The parameter to encode.
57
- */
58
- export interface Param {
59
- name: string;
60
- value: unknown;
61
- in: ParamLocation;
62
- style: ParamStyle;
63
- explode: boolean;
64
- dataType: DataType;
65
- dataFormat: DataFormat | undefined;
66
- }
package/provide-api.ts DELETED
@@ -1,17 +0,0 @@
1
- import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core";
2
- import { Configuration, ConfigurationParameters } from "./configuration";
3
- import { BASE_PATH } from "./variables";
4
-
5
- // Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig).
6
- export function provideApi(
7
- configOrBasePath: string | ConfigurationParameters,
8
- ): EnvironmentProviders {
9
- return makeEnvironmentProviders([
10
- typeof configOrBasePath === "string"
11
- ? { provide: BASE_PATH, useValue: configOrBasePath }
12
- : {
13
- provide: Configuration,
14
- useValue: new Configuration({ ...configOrBasePath }),
15
- },
16
- ]);
17
- }
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "emitDecoratorMetadata": true,
4
- "experimentalDecorators": true,
5
- "noImplicitAny": false,
6
- "target": "es5",
7
- "module": "commonjs",
8
- "moduleResolution": "node",
9
- "removeComments": true,
10
- "strictNullChecks": true,
11
- "exactOptionalPropertyTypes": true,
12
- "sourceMap": true,
13
- "outDir": "./dist",
14
- "noLib": false,
15
- "declaration": true,
16
- "lib": ["es6", "dom"],
17
- "typeRoots": ["node_modules/@types"]
18
- },
19
- "exclude": ["node_modules", "dist"],
20
- "filesGlob": ["./model/*.ts", "./api/*.ts"]
21
- }