@teemill/countries 0.1.0 → 0.1.1

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 (59) hide show
  1. package/README.md +40 -3
  2. package/api.ts +185 -0
  3. package/base.ts +86 -0
  4. package/common.ts +150 -0
  5. package/configuration.ts +115 -0
  6. package/dist/api.d.ts +121 -0
  7. package/dist/api.js +133 -0
  8. package/dist/base.d.ts +66 -0
  9. package/dist/base.js +65 -0
  10. package/dist/common.d.ts +65 -0
  11. package/dist/common.js +161 -0
  12. package/dist/configuration.d.ts +91 -0
  13. package/dist/configuration.js +44 -0
  14. package/dist/esm/api.d.ts +121 -0
  15. package/dist/esm/api.js +126 -0
  16. package/dist/esm/base.d.ts +66 -0
  17. package/dist/esm/base.js +60 -0
  18. package/dist/esm/common.d.ts +65 -0
  19. package/dist/esm/common.js +149 -0
  20. package/dist/esm/configuration.d.ts +91 -0
  21. package/dist/esm/configuration.js +40 -0
  22. package/dist/esm/index.d.ts +13 -0
  23. package/dist/esm/index.js +15 -0
  24. package/dist/index.d.ts +13 -3
  25. package/dist/index.js +15 -5
  26. package/docs/ApiError.md +22 -0
  27. package/docs/CountriesApi.md +55 -0
  28. package/docs/Country.md +22 -0
  29. package/docs/InlineObject.md +20 -0
  30. package/git_push.sh +57 -0
  31. package/index.ts +18 -0
  32. package/package.json +18 -4
  33. package/tsconfig.esm.json +7 -0
  34. package/tsconfig.json +4 -6
  35. package/.openapi-generator/FILES +0 -13
  36. package/.openapi-generator/VERSION +0 -1
  37. package/.openapi-generator-ignore +0 -23
  38. package/dist/apis/CountriesApi.d.ts +0 -28
  39. package/dist/apis/CountriesApi.js +0 -136
  40. package/dist/apis/index.d.ts +0 -1
  41. package/dist/apis/index.js +0 -19
  42. package/dist/models/ApiError.d.ts +0 -37
  43. package/dist/models/ApiError.js +0 -53
  44. package/dist/models/Country.d.ts +0 -37
  45. package/dist/models/Country.js +0 -53
  46. package/dist/models/GetCountries200Response.d.ts +0 -32
  47. package/dist/models/GetCountries200Response.js +0 -51
  48. package/dist/models/index.d.ts +0 -3
  49. package/dist/models/index.js +0 -21
  50. package/dist/runtime.d.ts +0 -187
  51. package/dist/runtime.js +0 -565
  52. package/src/apis/CountriesApi.ts +0 -77
  53. package/src/apis/index.ts +0 -3
  54. package/src/index.ts +0 -5
  55. package/src/models/ApiError.ts +0 -74
  56. package/src/models/Country.ts +0 -75
  57. package/src/models/GetCountries200Response.ts +0 -72
  58. package/src/models/index.ts +0 -5
  59. package/src/runtime.ts +0 -441
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- ## @teemill/countries@0.1.0
1
+ ## @teemill/countries@0.1.1
2
2
 
3
- This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
3
+ This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
4
4
 
5
5
  Environment
6
6
  * Node.js
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install @teemill/countries@0.1.0 --save
39
+ npm install @teemill/countries@0.1.1 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -44,3 +44,40 @@ _unPublished (not recommended):_
44
44
  ```
45
45
  npm install PATH_TO_GENERATED_PACKAGE --save
46
46
  ```
47
+
48
+ ### Documentation for API Endpoints
49
+
50
+ All URIs are relative to *https://localhost:8080*
51
+
52
+ Class | Method | HTTP request | Description
53
+ ------------ | ------------- | ------------- | -------------
54
+ *CountriesApi* | [**getCountries**](docs/CountriesApi.md#getcountries) | **GET** /v1/countries | List countries
55
+
56
+
57
+ ### Documentation For Models
58
+
59
+ - [ApiError](docs/ApiError.md)
60
+ - [Country](docs/Country.md)
61
+ - [InlineObject](docs/InlineObject.md)
62
+
63
+
64
+ <a id="documentation-for-authorization"></a>
65
+ ## Documentation For Authorization
66
+
67
+
68
+ Authentication schemes defined for the API:
69
+ <a id="api-key"></a>
70
+ ### api-key
71
+
72
+ - **Type**: API key
73
+ - **API key parameter name**: Authorization
74
+ - **Location**: HTTP header
75
+
76
+ <a id="session-oauth"></a>
77
+ ### session-oauth
78
+
79
+ - **Type**: OAuth
80
+ - **Flow**: password
81
+ - **Authorization URL**:
82
+ - **Scopes**: N/A
83
+
package/api.ts ADDED
@@ -0,0 +1,185 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Countries API
5
+ * Manage PodOS Countries
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
18
+ import globalAxios from 'axios';
19
+ // Some imports not used depending on template conditions
20
+ // @ts-ignore
21
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
22
+ import type { RequestArgs } from './base';
23
+ // @ts-ignore
24
+ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
25
+
26
+ /**
27
+ *
28
+ * @export
29
+ * @interface ApiError
30
+ */
31
+ export interface ApiError {
32
+ /**
33
+ *
34
+ * @type {string}
35
+ * @memberof ApiError
36
+ */
37
+ 'code'?: string;
38
+ /**
39
+ *
40
+ * @type {string}
41
+ * @memberof ApiError
42
+ */
43
+ 'message': string;
44
+ }
45
+ /**
46
+ *
47
+ * @export
48
+ * @interface Country
49
+ */
50
+ export interface Country {
51
+ /**
52
+ * The unique identifier for the country
53
+ * @type {string}
54
+ * @memberof Country
55
+ */
56
+ 'id': string;
57
+ /**
58
+ * The name of the country
59
+ * @type {string}
60
+ * @memberof Country
61
+ */
62
+ 'name': string;
63
+ }
64
+ /**
65
+ *
66
+ * @export
67
+ * @interface InlineObject
68
+ */
69
+ export interface InlineObject {
70
+ /**
71
+ *
72
+ * @type {Array<Country>}
73
+ * @memberof InlineObject
74
+ */
75
+ 'countries'?: Array<Country>;
76
+ }
77
+
78
+ /**
79
+ * CountriesApi - axios parameter creator
80
+ * @export
81
+ */
82
+ export const CountriesApiAxiosParamCreator = function (configuration?: Configuration) {
83
+ return {
84
+ /**
85
+ * List all countries
86
+ * @summary List countries
87
+ * @param {*} [options] Override http request option.
88
+ * @throws {RequiredError}
89
+ */
90
+ getCountries: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
91
+ const localVarPath = `/v1/countries`;
92
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
93
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
94
+ let baseOptions;
95
+ if (configuration) {
96
+ baseOptions = configuration.baseOptions;
97
+ }
98
+
99
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
100
+ const localVarHeaderParameter = {} as any;
101
+ const localVarQueryParameter = {} as any;
102
+
103
+ // authentication session-oauth required
104
+ // oauth required
105
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
106
+
107
+ // authentication api-key required
108
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
109
+
110
+
111
+
112
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
113
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
114
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
115
+
116
+ return {
117
+ url: toPathString(localVarUrlObj),
118
+ options: localVarRequestOptions,
119
+ };
120
+ },
121
+ }
122
+ };
123
+
124
+ /**
125
+ * CountriesApi - functional programming interface
126
+ * @export
127
+ */
128
+ export const CountriesApiFp = function(configuration?: Configuration) {
129
+ const localVarAxiosParamCreator = CountriesApiAxiosParamCreator(configuration)
130
+ return {
131
+ /**
132
+ * List all countries
133
+ * @summary List countries
134
+ * @param {*} [options] Override http request option.
135
+ * @throws {RequiredError}
136
+ */
137
+ async getCountries(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineObject>> {
138
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getCountries(options);
139
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
140
+ const localVarOperationServerBasePath = operationServerMap['CountriesApi.getCountries']?.[localVarOperationServerIndex]?.url;
141
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
142
+ },
143
+ }
144
+ };
145
+
146
+ /**
147
+ * CountriesApi - factory interface
148
+ * @export
149
+ */
150
+ export const CountriesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
151
+ const localVarFp = CountriesApiFp(configuration)
152
+ return {
153
+ /**
154
+ * List all countries
155
+ * @summary List countries
156
+ * @param {*} [options] Override http request option.
157
+ * @throws {RequiredError}
158
+ */
159
+ getCountries(options?: RawAxiosRequestConfig): AxiosPromise<InlineObject> {
160
+ return localVarFp.getCountries(options).then((request) => request(axios, basePath));
161
+ },
162
+ };
163
+ };
164
+
165
+ /**
166
+ * CountriesApi - object-oriented interface
167
+ * @export
168
+ * @class CountriesApi
169
+ * @extends {BaseAPI}
170
+ */
171
+ export class CountriesApi extends BaseAPI {
172
+ /**
173
+ * List all countries
174
+ * @summary List countries
175
+ * @param {*} [options] Override http request option.
176
+ * @throws {RequiredError}
177
+ * @memberof CountriesApi
178
+ */
179
+ public getCountries(options?: RawAxiosRequestConfig) {
180
+ return CountriesApiFp(this.configuration).getCountries(options).then((request) => request(this.axios, this.basePath));
181
+ }
182
+ }
183
+
184
+
185
+
package/base.ts ADDED
@@ -0,0 +1,86 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Countries API
5
+ * Manage PodOS Countries
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
20
+ import globalAxios from 'axios';
21
+
22
+ export const BASE_PATH = "https://localhost:8080".replace(/\/+$/, "");
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ */
28
+ export const COLLECTION_FORMATS = {
29
+ csv: ",",
30
+ ssv: " ",
31
+ tsv: "\t",
32
+ pipes: "|",
33
+ };
34
+
35
+ /**
36
+ *
37
+ * @export
38
+ * @interface RequestArgs
39
+ */
40
+ export interface RequestArgs {
41
+ url: string;
42
+ options: RawAxiosRequestConfig;
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @export
48
+ * @class BaseAPI
49
+ */
50
+ export class BaseAPI {
51
+ protected configuration: Configuration | undefined;
52
+
53
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
54
+ if (configuration) {
55
+ this.configuration = configuration;
56
+ this.basePath = configuration.basePath ?? basePath;
57
+ }
58
+ }
59
+ };
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ * @class RequiredError
65
+ * @extends {Error}
66
+ */
67
+ export class RequiredError extends Error {
68
+ constructor(public field: string, msg?: string) {
69
+ super(msg);
70
+ this.name = "RequiredError"
71
+ }
72
+ }
73
+
74
+ interface ServerMap {
75
+ [key: string]: {
76
+ url: string,
77
+ description: string,
78
+ }[];
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @export
84
+ */
85
+ export const operationServerMap: ServerMap = {
86
+ }
package/common.ts ADDED
@@ -0,0 +1,150 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Countries API
5
+ * Manage PodOS Countries
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from "./configuration";
17
+ import type { RequestArgs } from "./base";
18
+ import type { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { RequiredError } from "./base";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = 'https://example.com'
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
33
+ if (paramValue === null || paramValue === undefined) {
34
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @export
41
+ */
42
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
43
+ if (configuration && configuration.apiKey) {
44
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
45
+ ? await configuration.apiKey(keyParamName)
46
+ : await configuration.apiKey;
47
+ object[keyParamName] = localVarApiKeyValue;
48
+ }
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
56
+ if (configuration && (configuration.username || configuration.password)) {
57
+ object["auth"] = { username: configuration.username, password: configuration.password };
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
66
+ if (configuration && configuration.accessToken) {
67
+ const accessToken = typeof configuration.accessToken === 'function'
68
+ ? await configuration.accessToken()
69
+ : await configuration.accessToken;
70
+ object["Authorization"] = "Bearer " + accessToken;
71
+ }
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @export
77
+ */
78
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
79
+ if (configuration && configuration.accessToken) {
80
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
81
+ ? await configuration.accessToken(name, scopes)
82
+ : await configuration.accessToken;
83
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
84
+ }
85
+ }
86
+
87
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88
+ if (parameter == null) return;
89
+ if (typeof parameter === "object") {
90
+ if (Array.isArray(parameter)) {
91
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key !== '' ? `${key}[]` : key));
92
+ }
93
+ else {
94
+ Object.keys(parameter).forEach(currentKey =>
95
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96
+ );
97
+ }
98
+ }
99
+ else {
100
+ if (urlSearchParams.has(key)) {
101
+ urlSearchParams.append(key, parameter);
102
+ }
103
+ else {
104
+ urlSearchParams.set(key, parameter);
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @export
112
+ */
113
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
114
+ const searchParams = new URLSearchParams(url.search);
115
+ setFlattenedQueryParams(searchParams, objects);
116
+ url.search = decodeURIComponent(searchParams.toString());
117
+ }
118
+
119
+ /**
120
+ *
121
+ * @export
122
+ */
123
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
124
+ const nonString = typeof value !== 'string';
125
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
126
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
127
+ : nonString;
128
+ return needsSerialization
129
+ ? JSON.stringify(value !== undefined ? value : {})
130
+ : (value || "");
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @export
136
+ */
137
+ export const toPathString = function (url: URL) {
138
+ return url.pathname + url.search + url.hash
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @export
144
+ */
145
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
146
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
147
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
148
+ return axios.request<T, R>(axiosRequestArgs);
149
+ };
150
+ }
@@ -0,0 +1,115 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Countries API
5
+ * Manage PodOS Countries
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ export interface ConfigurationParameters {
17
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
18
+ username?: string;
19
+ password?: string;
20
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
21
+ basePath?: string;
22
+ serverIndex?: number;
23
+ baseOptions?: any;
24
+ formDataCtor?: new () => any;
25
+ }
26
+
27
+ export class Configuration {
28
+ /**
29
+ * parameter for apiKey security
30
+ * @param name security name
31
+ * @memberof Configuration
32
+ */
33
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
34
+ /**
35
+ * parameter for basic security
36
+ *
37
+ * @type {string}
38
+ * @memberof Configuration
39
+ */
40
+ username?: string;
41
+ /**
42
+ * parameter for basic security
43
+ *
44
+ * @type {string}
45
+ * @memberof Configuration
46
+ */
47
+ password?: string;
48
+ /**
49
+ * parameter for oauth2 security
50
+ * @param name security name
51
+ * @param scopes oauth2 scope
52
+ * @memberof Configuration
53
+ */
54
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
55
+ /**
56
+ * override base path
57
+ *
58
+ * @type {string}
59
+ * @memberof Configuration
60
+ */
61
+ basePath?: string;
62
+ /**
63
+ * override server index
64
+ *
65
+ * @type {number}
66
+ * @memberof Configuration
67
+ */
68
+ serverIndex?: number;
69
+ /**
70
+ * base options for axios calls
71
+ *
72
+ * @type {any}
73
+ * @memberof Configuration
74
+ */
75
+ baseOptions?: any;
76
+ /**
77
+ * The FormData constructor that will be used to create multipart form data
78
+ * requests. You can inject this here so that execution environments that
79
+ * do not support the FormData class can still run the generated client.
80
+ *
81
+ * @type {new () => FormData}
82
+ */
83
+ formDataCtor?: new () => any;
84
+
85
+ constructor(param: ConfigurationParameters = {}) {
86
+ this.apiKey = param.apiKey;
87
+ this.username = param.username;
88
+ this.password = param.password;
89
+ this.accessToken = param.accessToken;
90
+ this.basePath = param.basePath;
91
+ this.serverIndex = param.serverIndex;
92
+ this.baseOptions = {
93
+ ...param.baseOptions,
94
+ headers: {
95
+ ...param.baseOptions?.headers,
96
+ },
97
+ };
98
+ this.formDataCtor = param.formDataCtor;
99
+ }
100
+
101
+ /**
102
+ * Check if the given MIME is a JSON MIME.
103
+ * JSON MIME examples:
104
+ * application/json
105
+ * application/json; charset=UTF8
106
+ * APPLICATION/JSON
107
+ * application/vnd.company+json
108
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
109
+ * @return True if the given MIME is JSON, false otherwise.
110
+ */
111
+ public isJsonMime(mime: string): boolean {
112
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
113
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
114
+ }
115
+ }