twilio 5.5.1 → 5.5.2

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.
@@ -0,0 +1,4 @@
1
+ import KnowledgeBase from "./KnowledgeBase";
2
+ declare class Knowledge extends KnowledgeBase {
3
+ }
4
+ export = Knowledge;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const KnowledgeBase_1 = __importDefault(require("./KnowledgeBase"));
6
+ class Knowledge extends KnowledgeBase_1.default {
7
+ }
8
+ module.exports = Knowledge;
@@ -0,0 +1,13 @@
1
+ import Domain from "../base/Domain";
2
+ import V1 from "./knowledge/V1";
3
+ declare class KnowledgeBase extends Domain {
4
+ _v1?: V1;
5
+ /**
6
+ * Initialize knowledge domain
7
+ *
8
+ * @param twilio - The twilio client
9
+ */
10
+ constructor(twilio: any);
11
+ get v1(): V1;
12
+ }
13
+ export = KnowledgeBase;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator.
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ const Domain_1 = __importDefault(require("../base/Domain"));
16
+ const V1_1 = __importDefault(require("./knowledge/V1"));
17
+ class KnowledgeBase extends Domain_1.default {
18
+ /**
19
+ * Initialize knowledge domain
20
+ *
21
+ * @param twilio - The twilio client
22
+ */
23
+ constructor(twilio) {
24
+ super(twilio, "https://knowledge.twilio.com");
25
+ }
26
+ get v1() {
27
+ this._v1 = this._v1 || new V1_1.default(this);
28
+ return this._v1;
29
+ }
30
+ }
31
+ module.exports = KnowledgeBase;
@@ -14,6 +14,7 @@ import Iam from "./Iam";
14
14
  import Insights from "./Insights";
15
15
  import Intelligence from "./Intelligence";
16
16
  import IpMessaging from "./IpMessaging";
17
+ import Knowledge from "./Knowledge";
17
18
  import Lookups from "./Lookups";
18
19
  import Marketplace from "./Marketplace";
19
20
  import Messaging from "./Messaging";
@@ -95,6 +96,8 @@ declare class Twilio extends Client {
95
96
  _intelligence?: Intelligence;
96
97
  /** (Twilio.IpMessaging) - ipMessaging domain */
97
98
  _ipMessaging?: IpMessaging;
99
+ /** (Twilio.Knowledge) - knowledge domain */
100
+ _knowledge?: Knowledge;
98
101
  /** (Twilio.Lookups) - lookups domain */
99
102
  _lookups?: Lookups;
100
103
  /** (Twilio.Marketplace) - marketplace domain */
@@ -183,6 +186,8 @@ declare class Twilio extends Client {
183
186
  get intelligence(): Intelligence;
184
187
  /** Getter for (Twilio.IpMessaging) domain */
185
188
  get ipMessaging(): IpMessaging;
189
+ /** Getter for (Twilio.Knowledge) domain */
190
+ get knowledge(): Knowledge;
186
191
  /** Getter for (Twilio.Lookups) domain */
187
192
  get lookups(): Lookups;
188
193
  /** Getter for (Twilio.Marketplace) domain */
@@ -47,6 +47,7 @@ class Twilio extends BaseTwilio_1.Client {
47
47
  this.insights;
48
48
  this.intelligence;
49
49
  this.ipMessaging;
50
+ this.knowledge;
50
51
  this.lookups;
51
52
  this.marketplace;
52
53
  this.messaging;
@@ -140,6 +141,10 @@ class Twilio extends BaseTwilio_1.Client {
140
141
  return (this._ipMessaging ??
141
142
  (this._ipMessaging = new (require("./IpMessaging"))(this)));
142
143
  }
144
+ /** Getter for (Twilio.Knowledge) domain */
145
+ get knowledge() {
146
+ return (this._knowledge ?? (this._knowledge = new (require("./Knowledge"))(this)));
147
+ }
143
148
  /** Getter for (Twilio.Lookups) domain */
144
149
  get lookups() {
145
150
  return this._lookups ?? (this._lookups = new (require("./Lookups"))(this));
@@ -0,0 +1,15 @@
1
+ import KnowledgeBase from "../KnowledgeBase";
2
+ import Version from "../../base/Version";
3
+ import { KnowledgeListInstance } from "./v1/knowledge";
4
+ export default class V1 extends Version {
5
+ /**
6
+ * Initialize the V1 version of Knowledge
7
+ *
8
+ * @param domain - The Twilio (Twilio.Knowledge) domain
9
+ */
10
+ constructor(domain: KnowledgeBase);
11
+ /** knowledge - { Twilio.Knowledge.V1.KnowledgeListInstance } resource */
12
+ protected _knowledge?: KnowledgeListInstance;
13
+ /** Getter for knowledge resource */
14
+ get knowledge(): KnowledgeListInstance;
15
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Knowledge
9
+ * This is the public Twilio REST API.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const Version_1 = __importDefault(require("../../base/Version"));
20
+ const knowledge_1 = require("./v1/knowledge");
21
+ class V1 extends Version_1.default {
22
+ /**
23
+ * Initialize the V1 version of Knowledge
24
+ *
25
+ * @param domain - The Twilio (Twilio.Knowledge) domain
26
+ */
27
+ constructor(domain) {
28
+ super(domain, "v1");
29
+ }
30
+ /** Getter for knowledge resource */
31
+ get knowledge() {
32
+ this._knowledge = this._knowledge || (0, knowledge_1.KnowledgeListInstance)(this);
33
+ return this._knowledge;
34
+ }
35
+ }
36
+ exports.default = V1;
@@ -0,0 +1,167 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import Page, { TwilioResponsePayload } from "../../../../base/Page";
4
+ import Response from "../../../../http/response";
5
+ import V1 from "../../V1";
6
+ /**
7
+ * Options to pass to each
8
+ */
9
+ export interface ChunkListInstanceEachOptions {
10
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
11
+ pageSize?: number;
12
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
13
+ callback?: (item: ChunkInstance, done: (err?: Error) => void) => void;
14
+ /** Function to be called upon completion of streaming */
15
+ done?: Function;
16
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
17
+ limit?: number;
18
+ }
19
+ /**
20
+ * Options to pass to list
21
+ */
22
+ export interface ChunkListInstanceOptions {
23
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
24
+ pageSize?: number;
25
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
26
+ limit?: number;
27
+ }
28
+ /**
29
+ * Options to pass to page
30
+ */
31
+ export interface ChunkListInstancePageOptions {
32
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
33
+ pageSize?: number;
34
+ /** Page Number, this value is simply for client state */
35
+ pageNumber?: number;
36
+ /** PageToken provided by the API */
37
+ pageToken?: string;
38
+ }
39
+ export interface ChunkSolution {
40
+ id: string;
41
+ }
42
+ export interface ChunkListInstance {
43
+ _version: V1;
44
+ _solution: ChunkSolution;
45
+ _uri: string;
46
+ /**
47
+ * Streams ChunkInstance records from the API.
48
+ *
49
+ * This operation lazily loads records as efficiently as possible until the limit
50
+ * is reached.
51
+ *
52
+ * The results are passed into the callback function, so this operation is memory
53
+ * efficient.
54
+ *
55
+ * If a function is passed as the first argument, it will be used as the callback
56
+ * function.
57
+ *
58
+ * @param { ChunkListInstanceEachOptions } [params] - Options for request
59
+ * @param { function } [callback] - Function to process each record
60
+ */
61
+ each(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
62
+ each(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
63
+ /**
64
+ * Retrieve a single target page of ChunkInstance records from the API.
65
+ *
66
+ * The request is executed immediately.
67
+ *
68
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
69
+ * @param { function } [callback] - Callback to handle list of records
70
+ */
71
+ getPage(targetUrl: string, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
72
+ /**
73
+ * Lists ChunkInstance records from the API as a list.
74
+ *
75
+ * If a function is passed as the first argument, it will be used as the callback
76
+ * function.
77
+ *
78
+ * @param { ChunkListInstanceOptions } [params] - Options for request
79
+ * @param { function } [callback] - Callback to handle list of records
80
+ */
81
+ list(callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
82
+ list(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
83
+ /**
84
+ * Retrieve a single page of ChunkInstance records from the API.
85
+ *
86
+ * The request is executed immediately.
87
+ *
88
+ * If a function is passed as the first argument, it will be used as the callback
89
+ * function.
90
+ *
91
+ * @param { ChunkListInstancePageOptions } [params] - Options for request
92
+ * @param { function } [callback] - Callback to handle list of records
93
+ */
94
+ page(callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
95
+ page(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
96
+ /**
97
+ * Provide a user-friendly representation
98
+ */
99
+ toJSON(): any;
100
+ [inspect.custom](_depth: any, options: InspectOptions): any;
101
+ }
102
+ export declare function ChunkListInstance(version: V1, id: string): ChunkListInstance;
103
+ interface ChunkPayload extends TwilioResponsePayload {
104
+ chunks: ChunkResource[];
105
+ }
106
+ interface ChunkResource {
107
+ account_sid: string;
108
+ content: string;
109
+ metadata: Record<string, object>;
110
+ date_created: Date;
111
+ date_updated: Date;
112
+ }
113
+ export declare class ChunkInstance {
114
+ protected _version: V1;
115
+ constructor(_version: V1, payload: ChunkResource, id: string);
116
+ /**
117
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
118
+ */
119
+ accountSid: string;
120
+ /**
121
+ * The chunk content.
122
+ */
123
+ content: string;
124
+ /**
125
+ * The metadata of the chunk.
126
+ */
127
+ metadata: Record<string, object>;
128
+ /**
129
+ * The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
130
+ */
131
+ dateCreated: Date;
132
+ /**
133
+ * The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
134
+ */
135
+ dateUpdated: Date;
136
+ /**
137
+ * Provide a user-friendly representation
138
+ *
139
+ * @returns Object
140
+ */
141
+ toJSON(): {
142
+ accountSid: string;
143
+ content: string;
144
+ metadata: Record<string, object>;
145
+ dateCreated: Date;
146
+ dateUpdated: Date;
147
+ };
148
+ [inspect.custom](_depth: any, options: InspectOptions): string;
149
+ }
150
+ export declare class ChunkPage extends Page<V1, ChunkPayload, ChunkResource, ChunkInstance> {
151
+ /**
152
+ * Initialize the ChunkPage
153
+ *
154
+ * @param version - Version of the resource
155
+ * @param response - Response from the API
156
+ * @param solution - Path solution
157
+ */
158
+ constructor(version: V1, response: Response<string>, solution: ChunkSolution);
159
+ /**
160
+ * Build an instance of ChunkInstance
161
+ *
162
+ * @param payload - Payload response from the API
163
+ */
164
+ getInstance(payload: ChunkResource): ChunkInstance;
165
+ [inspect.custom](depth: any, options: InspectOptions): string;
166
+ }
167
+ export {};
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Knowledge
9
+ * This is the public Twilio REST API.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ChunkPage = exports.ChunkInstance = exports.ChunkListInstance = void 0;
20
+ const util_1 = require("util");
21
+ const Page_1 = __importDefault(require("../../../../base/Page"));
22
+ const deserialize = require("../../../../base/deserialize");
23
+ const serialize = require("../../../../base/serialize");
24
+ const utility_1 = require("../../../../base/utility");
25
+ function ChunkListInstance(version, id) {
26
+ if (!(0, utility_1.isValidPathParam)(id)) {
27
+ throw new Error("Parameter 'id' is not valid.");
28
+ }
29
+ const instance = {};
30
+ instance._version = version;
31
+ instance._solution = { id };
32
+ instance._uri = `/Knowledge/${id}/Chunks`;
33
+ instance.page = function page(params, callback) {
34
+ if (params instanceof Function) {
35
+ callback = params;
36
+ params = {};
37
+ }
38
+ else {
39
+ params = params || {};
40
+ }
41
+ let data = {};
42
+ if (params["pageSize"] !== undefined)
43
+ data["PageSize"] = params["pageSize"];
44
+ if (params.pageNumber !== undefined)
45
+ data["Page"] = params.pageNumber;
46
+ if (params.pageToken !== undefined)
47
+ data["PageToken"] = params.pageToken;
48
+ const headers = {};
49
+ headers["Accept"] = "application/json";
50
+ let operationVersion = version, operationPromise = operationVersion.page({
51
+ uri: instance._uri,
52
+ method: "get",
53
+ params: data,
54
+ headers,
55
+ });
56
+ operationPromise = operationPromise.then((payload) => new ChunkPage(operationVersion, payload, instance._solution));
57
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
58
+ return operationPromise;
59
+ };
60
+ instance.each = instance._version.each;
61
+ instance.list = instance._version.list;
62
+ instance.getPage = function getPage(targetUrl, callback) {
63
+ const operationPromise = instance._version._domain.twilio.request({
64
+ method: "get",
65
+ uri: targetUrl,
66
+ });
67
+ let pagePromise = operationPromise.then((payload) => new ChunkPage(instance._version, payload, instance._solution));
68
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
69
+ return pagePromise;
70
+ };
71
+ instance.toJSON = function toJSON() {
72
+ return instance._solution;
73
+ };
74
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
75
+ return (0, util_1.inspect)(instance.toJSON(), options);
76
+ };
77
+ return instance;
78
+ }
79
+ exports.ChunkListInstance = ChunkListInstance;
80
+ class ChunkInstance {
81
+ constructor(_version, payload, id) {
82
+ this._version = _version;
83
+ this.accountSid = payload.account_sid;
84
+ this.content = payload.content;
85
+ this.metadata = payload.metadata;
86
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
87
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
88
+ }
89
+ /**
90
+ * Provide a user-friendly representation
91
+ *
92
+ * @returns Object
93
+ */
94
+ toJSON() {
95
+ return {
96
+ accountSid: this.accountSid,
97
+ content: this.content,
98
+ metadata: this.metadata,
99
+ dateCreated: this.dateCreated,
100
+ dateUpdated: this.dateUpdated,
101
+ };
102
+ }
103
+ [util_1.inspect.custom](_depth, options) {
104
+ return (0, util_1.inspect)(this.toJSON(), options);
105
+ }
106
+ }
107
+ exports.ChunkInstance = ChunkInstance;
108
+ class ChunkPage extends Page_1.default {
109
+ /**
110
+ * Initialize the ChunkPage
111
+ *
112
+ * @param version - Version of the resource
113
+ * @param response - Response from the API
114
+ * @param solution - Path solution
115
+ */
116
+ constructor(version, response, solution) {
117
+ super(version, response, solution);
118
+ }
119
+ /**
120
+ * Build an instance of ChunkInstance
121
+ *
122
+ * @param payload - Payload response from the API
123
+ */
124
+ getInstance(payload) {
125
+ return new ChunkInstance(this._version, payload, this._solution.id);
126
+ }
127
+ [util_1.inspect.custom](depth, options) {
128
+ return (0, util_1.inspect)(this.toJSON(), options);
129
+ }
130
+ }
131
+ exports.ChunkPage = ChunkPage;
@@ -0,0 +1,101 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import V1 from "../../V1";
4
+ export interface KnowledgeStatusContext {
5
+ /**
6
+ * Fetch a KnowledgeStatusInstance
7
+ *
8
+ * @param callback - Callback to handle processed record
9
+ *
10
+ * @returns Resolves to processed KnowledgeStatusInstance
11
+ */
12
+ fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
13
+ /**
14
+ * Provide a user-friendly representation
15
+ */
16
+ toJSON(): any;
17
+ [inspect.custom](_depth: any, options: InspectOptions): any;
18
+ }
19
+ export interface KnowledgeStatusContextSolution {
20
+ id: string;
21
+ }
22
+ export declare class KnowledgeStatusContextImpl implements KnowledgeStatusContext {
23
+ protected _version: V1;
24
+ protected _solution: KnowledgeStatusContextSolution;
25
+ protected _uri: string;
26
+ constructor(_version: V1, id: string);
27
+ fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
28
+ /**
29
+ * Provide a user-friendly representation
30
+ *
31
+ * @returns Object
32
+ */
33
+ toJSON(): KnowledgeStatusContextSolution;
34
+ [inspect.custom](_depth: any, options: InspectOptions): string;
35
+ }
36
+ interface KnowledgeStatusResource {
37
+ account_sid: string;
38
+ status: string;
39
+ last_status: string;
40
+ date_updated: Date;
41
+ }
42
+ export declare class KnowledgeStatusInstance {
43
+ protected _version: V1;
44
+ protected _solution: KnowledgeStatusContextSolution;
45
+ protected _context?: KnowledgeStatusContext;
46
+ constructor(_version: V1, payload: KnowledgeStatusResource, id: string);
47
+ /**
48
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
49
+ */
50
+ accountSid: string;
51
+ /**
52
+ * The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
53
+ */
54
+ status: string;
55
+ /**
56
+ * The last status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
57
+ */
58
+ lastStatus: string;
59
+ /**
60
+ * The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
61
+ */
62
+ dateUpdated: Date;
63
+ private get _proxy();
64
+ /**
65
+ * Fetch a KnowledgeStatusInstance
66
+ *
67
+ * @param callback - Callback to handle processed record
68
+ *
69
+ * @returns Resolves to processed KnowledgeStatusInstance
70
+ */
71
+ fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
72
+ /**
73
+ * Provide a user-friendly representation
74
+ *
75
+ * @returns Object
76
+ */
77
+ toJSON(): {
78
+ accountSid: string;
79
+ status: string;
80
+ lastStatus: string;
81
+ dateUpdated: Date;
82
+ };
83
+ [inspect.custom](_depth: any, options: InspectOptions): string;
84
+ }
85
+ export interface KnowledgeStatusSolution {
86
+ id: string;
87
+ }
88
+ export interface KnowledgeStatusListInstance {
89
+ _version: V1;
90
+ _solution: KnowledgeStatusSolution;
91
+ _uri: string;
92
+ (): KnowledgeStatusContext;
93
+ get(): KnowledgeStatusContext;
94
+ /**
95
+ * Provide a user-friendly representation
96
+ */
97
+ toJSON(): any;
98
+ [inspect.custom](_depth: any, options: InspectOptions): any;
99
+ }
100
+ export declare function KnowledgeStatusListInstance(version: V1, id: string): KnowledgeStatusListInstance;
101
+ export {};
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Knowledge
9
+ * This is the public Twilio REST API.
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator.
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.KnowledgeStatusListInstance = exports.KnowledgeStatusInstance = exports.KnowledgeStatusContextImpl = void 0;
17
+ const util_1 = require("util");
18
+ const deserialize = require("../../../../base/deserialize");
19
+ const serialize = require("../../../../base/serialize");
20
+ const utility_1 = require("../../../../base/utility");
21
+ class KnowledgeStatusContextImpl {
22
+ constructor(_version, id) {
23
+ this._version = _version;
24
+ if (!(0, utility_1.isValidPathParam)(id)) {
25
+ throw new Error("Parameter 'id' is not valid.");
26
+ }
27
+ this._solution = { id };
28
+ this._uri = `/Knowledge/${id}/Status`;
29
+ }
30
+ fetch(callback) {
31
+ const headers = {};
32
+ headers["Accept"] = "application/json";
33
+ const instance = this;
34
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
35
+ uri: instance._uri,
36
+ method: "get",
37
+ headers,
38
+ });
39
+ operationPromise = operationPromise.then((payload) => new KnowledgeStatusInstance(operationVersion, payload, instance._solution.id));
40
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
41
+ return operationPromise;
42
+ }
43
+ /**
44
+ * Provide a user-friendly representation
45
+ *
46
+ * @returns Object
47
+ */
48
+ toJSON() {
49
+ return this._solution;
50
+ }
51
+ [util_1.inspect.custom](_depth, options) {
52
+ return (0, util_1.inspect)(this.toJSON(), options);
53
+ }
54
+ }
55
+ exports.KnowledgeStatusContextImpl = KnowledgeStatusContextImpl;
56
+ class KnowledgeStatusInstance {
57
+ constructor(_version, payload, id) {
58
+ this._version = _version;
59
+ this.accountSid = payload.account_sid;
60
+ this.status = payload.status;
61
+ this.lastStatus = payload.last_status;
62
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
63
+ this._solution = { id };
64
+ }
65
+ get _proxy() {
66
+ this._context =
67
+ this._context ||
68
+ new KnowledgeStatusContextImpl(this._version, this._solution.id);
69
+ return this._context;
70
+ }
71
+ /**
72
+ * Fetch a KnowledgeStatusInstance
73
+ *
74
+ * @param callback - Callback to handle processed record
75
+ *
76
+ * @returns Resolves to processed KnowledgeStatusInstance
77
+ */
78
+ fetch(callback) {
79
+ return this._proxy.fetch(callback);
80
+ }
81
+ /**
82
+ * Provide a user-friendly representation
83
+ *
84
+ * @returns Object
85
+ */
86
+ toJSON() {
87
+ return {
88
+ accountSid: this.accountSid,
89
+ status: this.status,
90
+ lastStatus: this.lastStatus,
91
+ dateUpdated: this.dateUpdated,
92
+ };
93
+ }
94
+ [util_1.inspect.custom](_depth, options) {
95
+ return (0, util_1.inspect)(this.toJSON(), options);
96
+ }
97
+ }
98
+ exports.KnowledgeStatusInstance = KnowledgeStatusInstance;
99
+ function KnowledgeStatusListInstance(version, id) {
100
+ if (!(0, utility_1.isValidPathParam)(id)) {
101
+ throw new Error("Parameter 'id' is not valid.");
102
+ }
103
+ const instance = (() => instance.get());
104
+ instance.get = function get() {
105
+ return new KnowledgeStatusContextImpl(version, id);
106
+ };
107
+ instance._version = version;
108
+ instance._solution = { id };
109
+ instance._uri = ``;
110
+ instance.toJSON = function toJSON() {
111
+ return instance._solution;
112
+ };
113
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
114
+ return (0, util_1.inspect)(instance.toJSON(), options);
115
+ };
116
+ return instance;
117
+ }
118
+ exports.KnowledgeStatusListInstance = KnowledgeStatusListInstance;