@scout9/admin 1.0.0
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/README.md +1 -0
- package/build/api-openai.d.ts +2992 -0
- package/build/api-openai.js +1968 -0
- package/build/api.d.ts +78 -0
- package/build/api.js +90 -0
- package/build/base.d.ts +43 -0
- package/build/base.js +52 -0
- package/build/common.d.ts +54 -0
- package/build/common.js +132 -0
- package/build/configuration.d.ts +84 -0
- package/build/configuration.js +106 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +18 -0
- package/build/schemas/common/algolia.d.ts +20 -0
- package/build/schemas/common/algolia.js +2 -0
- package/build/schemas/common/contact-map.d.ts +33 -0
- package/build/schemas/common/contact-map.js +2 -0
- package/build/schemas/common/currency.d.ts +1 -0
- package/build/schemas/common/currency.js +2 -0
- package/build/schemas/common/index.d.ts +6 -0
- package/build/schemas/common/index.js +22 -0
- package/build/schemas/common/location.d.ts +5 -0
- package/build/schemas/common/location.js +2 -0
- package/build/schemas/common/task.d.ts +20 -0
- package/build/schemas/common/task.js +2 -0
- package/build/schemas/common/time.d.ts +14 -0
- package/build/schemas/common/time.js +2 -0
- package/build/schemas/common.d.ts +77 -0
- package/build/schemas/common.js +8 -0
- package/build/schemas/conversations/context.d.ts +55 -0
- package/build/schemas/conversations/context.js +2 -0
- package/build/schemas/conversations/conversation.d.ts +53 -0
- package/build/schemas/conversations/conversation.js +2 -0
- package/build/schemas/conversations/index.d.ts +6 -0
- package/build/schemas/conversations/index.js +22 -0
- package/build/schemas/conversations/message.d.ts +62 -0
- package/build/schemas/conversations/message.js +2 -0
- package/build/schemas/conversations/parsed.d.ts +7 -0
- package/build/schemas/conversations/parsed.js +2 -0
- package/build/schemas/conversations/scheduled-conversation.d.ts +31 -0
- package/build/schemas/conversations/scheduled-conversation.js +2 -0
- package/build/schemas/conversations/webhook.d.ts +8 -0
- package/build/schemas/conversations/webhook.js +2 -0
- package/build/schemas/index.d.ts +3 -0
- package/build/schemas/index.js +19 -0
- package/build/schemas/users/businesses/agents/agent.d.ts +76 -0
- package/build/schemas/users/businesses/agents/agent.js +2 -0
- package/build/schemas/users/businesses/agents/auth.d.ts +7 -0
- package/build/schemas/users/businesses/agents/auth.js +2 -0
- package/build/schemas/users/businesses/agents/index.d.ts +2 -0
- package/build/schemas/users/businesses/agents/index.js +18 -0
- package/build/schemas/users/businesses/business-location.d.ts +10 -0
- package/build/schemas/users/businesses/business-location.js +2 -0
- package/build/schemas/users/businesses/business.d.ts +32 -0
- package/build/schemas/users/businesses/business.js +2 -0
- package/build/schemas/users/businesses/context/context-indexed.d.ts +9 -0
- package/build/schemas/users/businesses/context/context-indexed.js +2 -0
- package/build/schemas/users/businesses/context/context-saves.d.ts +12 -0
- package/build/schemas/users/businesses/context/context-saves.js +2 -0
- package/build/schemas/users/businesses/context/context.d.ts +64 -0
- package/build/schemas/users/businesses/context/context.js +2 -0
- package/build/schemas/users/businesses/context/index.d.ts +2 -0
- package/build/schemas/users/businesses/context/index.js +18 -0
- package/build/schemas/users/businesses/index.d.ts +5 -0
- package/build/schemas/users/businesses/index.js +21 -0
- package/build/schemas/users/businesses/notifications.d.ts +7 -0
- package/build/schemas/users/businesses/notifications.js +2 -0
- package/build/schemas/users/businesses/offerings/index.d.ts +2 -0
- package/build/schemas/users/businesses/offerings/index.js +18 -0
- package/build/schemas/users/businesses/offerings/offer-indexed.d.ts +34 -0
- package/build/schemas/users/businesses/offerings/offer-indexed.js +2 -0
- package/build/schemas/users/businesses/offerings/offer.d.ts +29 -0
- package/build/schemas/users/businesses/offerings/offer.js +2 -0
- package/build/schemas/users/businesses/thread.d.ts +44 -0
- package/build/schemas/users/businesses/thread.js +2 -0
- package/build/schemas/users/customers/customer.d.ts +35 -0
- package/build/schemas/users/customers/customer.js +2 -0
- package/build/schemas/users/customers/index.d.ts +1 -0
- package/build/schemas/users/customers/index.js +17 -0
- package/build/schemas/users/index.d.ts +2 -0
- package/build/schemas/users/index.js +18 -0
- package/package.json +33 -0
- package/src/api-openai.txt +4117 -0
- package/src/api.ts +141 -0
- package/src/base.ts +55 -0
- package/src/common.ts +136 -0
- package/src/configuration.ts +124 -0
- package/src/index.ts +2 -0
- package/src/schemas/common/algolia.ts +24 -0
- package/src/schemas/common/contact-map.ts +35 -0
- package/src/schemas/common/currency.ts +1 -0
- package/src/schemas/common/index.ts +6 -0
- package/src/schemas/common/location.ts +6 -0
- package/src/schemas/common/task.ts +26 -0
- package/src/schemas/common/time.ts +15 -0
- package/src/schemas/common.ts +94 -0
- package/src/schemas/conversations/context.ts +64 -0
- package/src/schemas/conversations/conversation.ts +68 -0
- package/src/schemas/conversations/index.ts +6 -0
- package/src/schemas/conversations/message.ts +78 -0
- package/src/schemas/conversations/parsed.ts +5 -0
- package/src/schemas/conversations/scheduled-conversation.ts +35 -0
- package/src/schemas/conversations/webhook.ts +10 -0
- package/src/schemas/index.ts +3 -0
- package/src/schemas/users/businesses/agents/agent.ts +107 -0
- package/src/schemas/users/businesses/agents/auth.ts +8 -0
- package/src/schemas/users/businesses/agents/index.ts +2 -0
- package/src/schemas/users/businesses/business-location.ts +15 -0
- package/src/schemas/users/businesses/business.ts +43 -0
- package/src/schemas/users/businesses/context/context-indexed.ts +11 -0
- package/src/schemas/users/businesses/context/context-saves.ts +14 -0
- package/src/schemas/users/businesses/context/context.ts +76 -0
- package/src/schemas/users/businesses/context/index.ts +2 -0
- package/src/schemas/users/businesses/index.ts +6 -0
- package/src/schemas/users/businesses/notifications.ts +12 -0
- package/src/schemas/users/businesses/offerings/index.ts +2 -0
- package/src/schemas/users/businesses/offerings/offer-indexed.ts +42 -0
- package/src/schemas/users/businesses/offerings/offer.ts +39 -0
- package/src/schemas/users/businesses/thread.ts +55 -0
- package/src/schemas/users/customers/customer.ts +46 -0
- package/src/schemas/users/customers/index.ts +1 -0
- package/src/schemas/users/index.ts +2 -0
- package/tsconfig.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
package/build/api.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Configuration } from './configuration';
|
|
2
|
+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
3
|
+
import type { RequestArgs } from './base';
|
|
4
|
+
import { BaseAPI } from './base';
|
|
5
|
+
import { ICustomer } from './schemas';
|
|
6
|
+
export type ICustomerCreateRequest = ICustomer;
|
|
7
|
+
export interface ICustomerCreateResponse {
|
|
8
|
+
success: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ICustomerUpdateRequest = Partial<ICustomer>;
|
|
11
|
+
export interface ICustomerUpdateResponse {
|
|
12
|
+
success: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ICustomerRemoveRequest {
|
|
15
|
+
customer: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ICustomerRemoveResponse {
|
|
18
|
+
success: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ICustomerCreateBulkRequest {
|
|
21
|
+
customers: ICustomer[];
|
|
22
|
+
}
|
|
23
|
+
export interface ICustomerCreateBulkResponse {
|
|
24
|
+
success: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ICustomerRemoveBulkRequest {
|
|
27
|
+
customers: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface ICustomerRemoveBulkResponse {
|
|
30
|
+
success: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ICustomerUpdateBulkRequest {
|
|
33
|
+
customers: Partial<ICustomer>[];
|
|
34
|
+
}
|
|
35
|
+
export interface ICustomerUpdateBulkResponse {
|
|
36
|
+
success: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const Scout9ApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @summary Creates a model response for the given chat conversation.
|
|
42
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
43
|
+
* @param {*} [options] Override http request option.
|
|
44
|
+
* @throws {RequiredError}
|
|
45
|
+
*/
|
|
46
|
+
createCustomer: (createCustomerRequest: ICustomerCreateRequest, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Scout9Api - functional programming interface
|
|
50
|
+
* @export
|
|
51
|
+
*/
|
|
52
|
+
export declare const Scout9ApiFp: (configuration?: Configuration) => {
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @summary Creates a model response for the given chat conversation.
|
|
56
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
57
|
+
* @param {*} [options] Override http request option.
|
|
58
|
+
* @throws {RequiredError}
|
|
59
|
+
*/
|
|
60
|
+
createCustomer(createCustomerRequest: ICustomerCreateRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ICustomerCreateResponse>>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Scout9Api - object-oriented interface
|
|
64
|
+
* @export
|
|
65
|
+
* @class Scout9Api
|
|
66
|
+
* @extends {BaseAPI}
|
|
67
|
+
*/
|
|
68
|
+
export declare class Scout9Api extends BaseAPI {
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @summary Creates a model response for the given chat conversation.
|
|
72
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
73
|
+
* @param {*} [options] Override http request option.
|
|
74
|
+
* @throws {RequiredError}
|
|
75
|
+
* @memberof Scout9Api
|
|
76
|
+
*/
|
|
77
|
+
createCustomer(createCustomerRequest: ICustomerCreateRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ICustomerCreateResponse, any>>;
|
|
78
|
+
}
|
package/build/api.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Scout9Api = exports.Scout9ApiFp = exports.Scout9ApiAxiosParamCreator = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
// Some imports not used depending on template conditions
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const common_1 = require("./common");
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
const base_1 = require("./base");
|
|
13
|
+
const Scout9ApiAxiosParamCreator = function (configuration) {
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @summary Creates a model response for the given chat conversation.
|
|
18
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
19
|
+
* @param {*} [options] Override http request option.
|
|
20
|
+
* @throws {RequiredError}
|
|
21
|
+
*/
|
|
22
|
+
createCustomer: async (createCustomerRequest, options = {}) => {
|
|
23
|
+
// verify required parameter 'createChatCompletionRequest' is not null or undefined
|
|
24
|
+
(0, common_1.assertParamExists)('createCustomer', 'createCustomerRequest', createCustomerRequest);
|
|
25
|
+
const localVarPath = `${configuration?.apiVersion || ''}-customers-customer-create`;
|
|
26
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
27
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
28
|
+
let baseOptions;
|
|
29
|
+
if (configuration) {
|
|
30
|
+
baseOptions = configuration.baseOptions;
|
|
31
|
+
}
|
|
32
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
33
|
+
const localVarHeaderParameter = {};
|
|
34
|
+
const localVarQueryParameter = {};
|
|
35
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
36
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
37
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
38
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
39
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createCustomerRequest, localVarRequestOptions, configuration);
|
|
40
|
+
return {
|
|
41
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
42
|
+
options: localVarRequestOptions,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.Scout9ApiAxiosParamCreator = Scout9ApiAxiosParamCreator;
|
|
48
|
+
/**
|
|
49
|
+
* Scout9Api - functional programming interface
|
|
50
|
+
* @export
|
|
51
|
+
*/
|
|
52
|
+
const Scout9ApiFp = function (configuration) {
|
|
53
|
+
const localVarAxiosParamCreator = (0, exports.Scout9ApiAxiosParamCreator)(configuration);
|
|
54
|
+
return {
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @summary Creates a model response for the given chat conversation.
|
|
58
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
59
|
+
* @param {*} [options] Override http request option.
|
|
60
|
+
* @throws {RequiredError}
|
|
61
|
+
*/
|
|
62
|
+
async createCustomer(createCustomerRequest, options) {
|
|
63
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomer(createCustomerRequest, options);
|
|
64
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
exports.Scout9ApiFp = Scout9ApiFp;
|
|
69
|
+
/**
|
|
70
|
+
* Scout9Api - object-oriented interface
|
|
71
|
+
* @export
|
|
72
|
+
* @class Scout9Api
|
|
73
|
+
* @extends {BaseAPI}
|
|
74
|
+
*/
|
|
75
|
+
class Scout9Api extends base_1.BaseAPI {
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @summary Creates a model response for the given chat conversation.
|
|
79
|
+
* @param {ICustomerCreateRequest} createCustomerRequest
|
|
80
|
+
* @param {*} [options] Override http request option.
|
|
81
|
+
* @throws {RequiredError}
|
|
82
|
+
* @memberof Scout9Api
|
|
83
|
+
*/
|
|
84
|
+
createCustomer(createCustomerRequest, options) {
|
|
85
|
+
return (0, exports.Scout9ApiFp)(this.configuration)
|
|
86
|
+
.createCustomer(createCustomerRequest, options)
|
|
87
|
+
.then((request) => request(this.axios, this.basePath));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Scout9Api = Scout9Api;
|
package/build/base.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Configuration } from './configuration';
|
|
2
|
+
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
3
|
+
export declare const BASE_PATH: string;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
*/
|
|
8
|
+
export declare const COLLECTION_FORMATS: {
|
|
9
|
+
csv: string;
|
|
10
|
+
ssv: string;
|
|
11
|
+
tsv: string;
|
|
12
|
+
pipes: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface RequestArgs
|
|
18
|
+
*/
|
|
19
|
+
export interface RequestArgs {
|
|
20
|
+
url: string;
|
|
21
|
+
options: AxiosRequestConfig;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @export
|
|
26
|
+
* @class BaseAPI
|
|
27
|
+
*/
|
|
28
|
+
export declare class BaseAPI {
|
|
29
|
+
protected basePath: string;
|
|
30
|
+
protected axios: AxiosInstance;
|
|
31
|
+
protected configuration: Configuration | undefined;
|
|
32
|
+
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @class RequiredError
|
|
38
|
+
* @extends {Error}
|
|
39
|
+
*/
|
|
40
|
+
export declare class RequiredError extends Error {
|
|
41
|
+
field: string;
|
|
42
|
+
constructor(field: string, msg?: string);
|
|
43
|
+
}
|
package/build/base.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
exports.BASE_PATH = "https://us-central1-jumpstart.cloudfunctions.net".replace(/\/+$/, "");
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
*/
|
|
13
|
+
exports.COLLECTION_FORMATS = {
|
|
14
|
+
csv: ",",
|
|
15
|
+
ssv: " ",
|
|
16
|
+
tsv: "\t",
|
|
17
|
+
pipes: "|",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @class BaseAPI
|
|
23
|
+
*/
|
|
24
|
+
class BaseAPI {
|
|
25
|
+
basePath;
|
|
26
|
+
axios;
|
|
27
|
+
configuration;
|
|
28
|
+
constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
|
|
29
|
+
this.basePath = basePath;
|
|
30
|
+
this.axios = axios;
|
|
31
|
+
if (configuration) {
|
|
32
|
+
this.configuration = configuration;
|
|
33
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BaseAPI = BaseAPI;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
* @class RequiredError
|
|
42
|
+
* @extends {Error}
|
|
43
|
+
*/
|
|
44
|
+
class RequiredError extends Error {
|
|
45
|
+
field;
|
|
46
|
+
constructor(field, msg) {
|
|
47
|
+
super(msg);
|
|
48
|
+
this.field = field;
|
|
49
|
+
this.name = "RequiredError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.RequiredError = RequiredError;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Configuration } from "./configuration";
|
|
2
|
+
import type { RequestArgs } from "./base";
|
|
3
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
*/
|
|
8
|
+
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @throws {RequiredError}
|
|
12
|
+
* @export
|
|
13
|
+
*/
|
|
14
|
+
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
*/
|
|
24
|
+
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
*/
|
|
29
|
+
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
*/
|
|
34
|
+
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
*/
|
|
39
|
+
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @export
|
|
43
|
+
*/
|
|
44
|
+
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
*/
|
|
49
|
+
export declare const toPathString: (url: URL) => string;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @export
|
|
53
|
+
*/
|
|
54
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
package/build/common.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
*/
|
|
9
|
+
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @throws {RequiredError}
|
|
13
|
+
* @export
|
|
14
|
+
*/
|
|
15
|
+
const assertParamExists = function (functionName, paramName, paramValue) {
|
|
16
|
+
if (paramValue === null || paramValue === undefined) {
|
|
17
|
+
throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.assertParamExists = assertParamExists;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
26
|
+
if (configuration && configuration.apiKey) {
|
|
27
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
28
|
+
? await configuration.apiKey(keyParamName)
|
|
29
|
+
: await configuration.apiKey;
|
|
30
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.setApiKeyToObject = setApiKeyToObject;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
*/
|
|
38
|
+
const setBasicAuthToObject = function (object, configuration) {
|
|
39
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
40
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @export
|
|
47
|
+
*/
|
|
48
|
+
const setBearerAuthToObject = async function (object, configuration) {
|
|
49
|
+
if (configuration && configuration.accessToken) {
|
|
50
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
51
|
+
? await configuration.accessToken()
|
|
52
|
+
: await configuration.accessToken;
|
|
53
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @export
|
|
60
|
+
*/
|
|
61
|
+
const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
62
|
+
if (configuration && configuration.accessToken) {
|
|
63
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
64
|
+
? await configuration.accessToken(name, scopes)
|
|
65
|
+
: await configuration.accessToken;
|
|
66
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.setOAuthToObject = setOAuthToObject;
|
|
70
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
71
|
+
if (parameter == null)
|
|
72
|
+
return;
|
|
73
|
+
if (typeof parameter === "object") {
|
|
74
|
+
if (Array.isArray(parameter)) {
|
|
75
|
+
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (urlSearchParams.has(key)) {
|
|
83
|
+
urlSearchParams.append(key, parameter);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
urlSearchParams.set(key, parameter);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @export
|
|
93
|
+
*/
|
|
94
|
+
const setSearchParams = function (url, ...objects) {
|
|
95
|
+
const searchParams = new URLSearchParams(url.search);
|
|
96
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
97
|
+
url.search = searchParams.toString();
|
|
98
|
+
};
|
|
99
|
+
exports.setSearchParams = setSearchParams;
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @export
|
|
103
|
+
*/
|
|
104
|
+
const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
105
|
+
const nonString = typeof value !== 'string';
|
|
106
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
107
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
108
|
+
: nonString;
|
|
109
|
+
return needsSerialization
|
|
110
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
111
|
+
: (value || "");
|
|
112
|
+
};
|
|
113
|
+
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @export
|
|
117
|
+
*/
|
|
118
|
+
const toPathString = function (url) {
|
|
119
|
+
return url.pathname + url.search + url.hash;
|
|
120
|
+
};
|
|
121
|
+
exports.toPathString = toPathString;
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @export
|
|
125
|
+
*/
|
|
126
|
+
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
127
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
128
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
|
|
129
|
+
return axios.request(axiosRequestArgs);
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
exports.createRequestFunction = createRequestFunction;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface ConfigurationParameters {
|
|
2
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
3
|
+
organization?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
7
|
+
basePath?: string;
|
|
8
|
+
baseOptions?: any;
|
|
9
|
+
formDataCtor?: new () => any;
|
|
10
|
+
}
|
|
11
|
+
export declare class Configuration {
|
|
12
|
+
/**
|
|
13
|
+
* parameter for apiKey security
|
|
14
|
+
* @param name security name
|
|
15
|
+
* @memberof Configuration
|
|
16
|
+
*/
|
|
17
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
18
|
+
/**
|
|
19
|
+
* Scout9 organization id
|
|
20
|
+
*
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @memberof Configuration
|
|
23
|
+
*/
|
|
24
|
+
organization?: string;
|
|
25
|
+
/**
|
|
26
|
+
* parameter for basic security
|
|
27
|
+
*
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @memberof Configuration
|
|
30
|
+
*/
|
|
31
|
+
username?: string;
|
|
32
|
+
/**
|
|
33
|
+
* parameter for basic security
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
* @memberof Configuration
|
|
37
|
+
*/
|
|
38
|
+
password?: string;
|
|
39
|
+
/**
|
|
40
|
+
* parameter for oauth2 security
|
|
41
|
+
* @param name security name
|
|
42
|
+
* @param scopes oauth2 scope
|
|
43
|
+
* @memberof Configuration
|
|
44
|
+
*/
|
|
45
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
46
|
+
/**
|
|
47
|
+
* override base path
|
|
48
|
+
*
|
|
49
|
+
* @type {string}
|
|
50
|
+
* @memberof Configuration
|
|
51
|
+
*/
|
|
52
|
+
basePath?: string;
|
|
53
|
+
/**
|
|
54
|
+
* base options for axios calls
|
|
55
|
+
*
|
|
56
|
+
* @type {any}
|
|
57
|
+
* @memberof Configuration
|
|
58
|
+
*/
|
|
59
|
+
baseOptions?: any;
|
|
60
|
+
/**
|
|
61
|
+
* The FormData constructor that will be used to create multipart form data
|
|
62
|
+
* requests. You can inject this here so that execution environments that
|
|
63
|
+
* do not support the FormData class can still run the generated client.
|
|
64
|
+
*
|
|
65
|
+
* @type {new () => FormData}
|
|
66
|
+
*/
|
|
67
|
+
formDataCtor?: new () => any;
|
|
68
|
+
/**
|
|
69
|
+
* The version of the Scout9 API that this client library version is
|
|
70
|
+
*/
|
|
71
|
+
apiVersion?: string;
|
|
72
|
+
constructor(param?: ConfigurationParameters);
|
|
73
|
+
/**
|
|
74
|
+
* Check if the given MIME is a JSON MIME.
|
|
75
|
+
* JSON MIME examples:
|
|
76
|
+
* application/json
|
|
77
|
+
* application/json; charset=UTF8
|
|
78
|
+
* APPLICATION/JSON
|
|
79
|
+
* application/vnd.company+json
|
|
80
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
81
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
82
|
+
*/
|
|
83
|
+
isJsonMime(mime: string): boolean;
|
|
84
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Configuration = void 0;
|
|
4
|
+
const packageJson = require("../package.json");
|
|
5
|
+
class Configuration {
|
|
6
|
+
/**
|
|
7
|
+
* parameter for apiKey security
|
|
8
|
+
* @param name security name
|
|
9
|
+
* @memberof Configuration
|
|
10
|
+
*/
|
|
11
|
+
apiKey;
|
|
12
|
+
/**
|
|
13
|
+
* Scout9 organization id
|
|
14
|
+
*
|
|
15
|
+
* @type {string}
|
|
16
|
+
* @memberof Configuration
|
|
17
|
+
*/
|
|
18
|
+
organization;
|
|
19
|
+
/**
|
|
20
|
+
* parameter for basic security
|
|
21
|
+
*
|
|
22
|
+
* @type {string}
|
|
23
|
+
* @memberof Configuration
|
|
24
|
+
*/
|
|
25
|
+
username;
|
|
26
|
+
/**
|
|
27
|
+
* parameter for basic security
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @memberof Configuration
|
|
31
|
+
*/
|
|
32
|
+
password;
|
|
33
|
+
/**
|
|
34
|
+
* parameter for oauth2 security
|
|
35
|
+
* @param name security name
|
|
36
|
+
* @param scopes oauth2 scope
|
|
37
|
+
* @memberof Configuration
|
|
38
|
+
*/
|
|
39
|
+
accessToken;
|
|
40
|
+
/**
|
|
41
|
+
* override base path
|
|
42
|
+
*
|
|
43
|
+
* @type {string}
|
|
44
|
+
* @memberof Configuration
|
|
45
|
+
*/
|
|
46
|
+
basePath;
|
|
47
|
+
/**
|
|
48
|
+
* base options for axios calls
|
|
49
|
+
*
|
|
50
|
+
* @type {any}
|
|
51
|
+
* @memberof Configuration
|
|
52
|
+
*/
|
|
53
|
+
baseOptions;
|
|
54
|
+
/**
|
|
55
|
+
* The FormData constructor that will be used to create multipart form data
|
|
56
|
+
* requests. You can inject this here so that execution environments that
|
|
57
|
+
* do not support the FormData class can still run the generated client.
|
|
58
|
+
*
|
|
59
|
+
* @type {new () => FormData}
|
|
60
|
+
*/
|
|
61
|
+
formDataCtor;
|
|
62
|
+
/**
|
|
63
|
+
* The version of the Scout9 API that this client library version is
|
|
64
|
+
*/
|
|
65
|
+
apiVersion;
|
|
66
|
+
constructor(param = {}) {
|
|
67
|
+
this.apiKey = param.apiKey;
|
|
68
|
+
this.organization = param.organization;
|
|
69
|
+
this.username = param.username;
|
|
70
|
+
this.password = param.password;
|
|
71
|
+
this.accessToken = param.accessToken;
|
|
72
|
+
this.basePath = param.basePath;
|
|
73
|
+
this.baseOptions = param.baseOptions;
|
|
74
|
+
this.formDataCtor = param.formDataCtor;
|
|
75
|
+
this.apiVersion = 'v' + packageJson.version.split(".")[0];
|
|
76
|
+
if (!this.baseOptions) {
|
|
77
|
+
this.baseOptions = {};
|
|
78
|
+
}
|
|
79
|
+
this.baseOptions.headers = {
|
|
80
|
+
'User-Agent': `Scout9/NodeJS/${packageJson.version}`,
|
|
81
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
82
|
+
...this.baseOptions.headers,
|
|
83
|
+
};
|
|
84
|
+
if (this.organization) {
|
|
85
|
+
this.baseOptions.headers['Scout9-Organization'] = this.organization;
|
|
86
|
+
}
|
|
87
|
+
if (!this.formDataCtor) {
|
|
88
|
+
this.formDataCtor = require("form-data");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if the given MIME is a JSON MIME.
|
|
93
|
+
* JSON MIME examples:
|
|
94
|
+
* application/json
|
|
95
|
+
* application/json; charset=UTF8
|
|
96
|
+
* APPLICATION/JSON
|
|
97
|
+
* application/vnd.company+json
|
|
98
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
99
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
100
|
+
*/
|
|
101
|
+
isJsonMime(mime) {
|
|
102
|
+
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
103
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.Configuration = Configuration;
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./configuration"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper schedule to bridge algolia records with internal db
|
|
3
|
+
*/
|
|
4
|
+
export interface IAlgoliaIndexedObject {
|
|
5
|
+
/**
|
|
6
|
+
* Where this object is stored in the database
|
|
7
|
+
*/
|
|
8
|
+
parent: string;
|
|
9
|
+
/**
|
|
10
|
+
* Algolia objectID required
|
|
11
|
+
*/
|
|
12
|
+
objectID: string;
|
|
13
|
+
/**
|
|
14
|
+
* Algolia geolocation for a given object
|
|
15
|
+
*/
|
|
16
|
+
_geoloc?: {
|
|
17
|
+
lat: number;
|
|
18
|
+
lng: number;
|
|
19
|
+
};
|
|
20
|
+
}
|