@credal/sdk 0.1.10 → 0.1.12
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/dist/cjs/BaseClient.d.ts +6 -1
- package/dist/cjs/BaseClient.js +47 -0
- package/dist/cjs/Client.d.ts +16 -16
- package/dist/cjs/Client.js +8 -49
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +21 -21
- package/dist/cjs/api/resources/copilots/client/Client.js +41 -22
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +22 -13
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +18 -18
- package/dist/cjs/api/resources/documentCollections/client/Client.js +34 -19
- package/dist/cjs/api/resources/search/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/search/client/Client.js +10 -7
- package/dist/cjs/api/resources/users/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/users/client/Client.js +10 -7
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/cjs/core/fetcher/Fetcher.js +202 -9
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +0 -6
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +6 -1
- package/dist/esm/BaseClient.mjs +13 -1
- package/dist/esm/Client.d.mts +16 -16
- package/dist/esm/Client.mjs +13 -21
- package/dist/esm/api/resources/copilots/client/Client.d.mts +21 -21
- package/dist/esm/api/resources/copilots/client/Client.mjs +39 -20
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +20 -11
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +18 -18
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +32 -17
- package/dist/esm/api/resources/search/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/search/client/Client.mjs +8 -5
- package/dist/esm/api/resources/users/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/users/client/Client.mjs +8 -5
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +0 -6
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
- package/reference.md +21 -21
|
@@ -0,0 +1,17 @@
|
|
|
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("./logger.js"), exports);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export declare const LogLevel: {
|
|
2
|
+
readonly Debug: "debug";
|
|
3
|
+
readonly Info: "info";
|
|
4
|
+
readonly Warn: "warn";
|
|
5
|
+
readonly Error: "error";
|
|
6
|
+
};
|
|
7
|
+
export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
8
|
+
export interface ILogger {
|
|
9
|
+
/**
|
|
10
|
+
* Logs a debug message.
|
|
11
|
+
* @param message - The message to log
|
|
12
|
+
* @param args - Additional arguments to log
|
|
13
|
+
*/
|
|
14
|
+
debug(message: string, ...args: unknown[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Logs an info message.
|
|
17
|
+
* @param message - The message to log
|
|
18
|
+
* @param args - Additional arguments to log
|
|
19
|
+
*/
|
|
20
|
+
info(message: string, ...args: unknown[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Logs a warning message.
|
|
23
|
+
* @param message - The message to log
|
|
24
|
+
* @param args - Additional arguments to log
|
|
25
|
+
*/
|
|
26
|
+
warn(message: string, ...args: unknown[]): void;
|
|
27
|
+
/**
|
|
28
|
+
* Logs an error message.
|
|
29
|
+
* @param message - The message to log
|
|
30
|
+
* @param args - Additional arguments to log
|
|
31
|
+
*/
|
|
32
|
+
error(message: string, ...args: unknown[]): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for logger initialization.
|
|
36
|
+
*/
|
|
37
|
+
export interface LogConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Minimum log level to output.
|
|
40
|
+
* @default LogLevel.Info
|
|
41
|
+
*/
|
|
42
|
+
level?: LogLevel;
|
|
43
|
+
/**
|
|
44
|
+
* Logger implementation to use.
|
|
45
|
+
* @default new ConsoleLogger()
|
|
46
|
+
*/
|
|
47
|
+
logger?: ILogger;
|
|
48
|
+
/**
|
|
49
|
+
* Whether logging should be silenced.
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
silent?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Default console-based logger implementation.
|
|
56
|
+
*/
|
|
57
|
+
export declare class ConsoleLogger implements ILogger {
|
|
58
|
+
debug(message: string, ...args: unknown[]): void;
|
|
59
|
+
info(message: string, ...args: unknown[]): void;
|
|
60
|
+
warn(message: string, ...args: unknown[]): void;
|
|
61
|
+
error(message: string, ...args: unknown[]): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logger class that provides level-based logging functionality.
|
|
65
|
+
*/
|
|
66
|
+
export declare class Logger {
|
|
67
|
+
private readonly level;
|
|
68
|
+
private readonly logger;
|
|
69
|
+
private readonly silent;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new logger instance.
|
|
72
|
+
* @param config - Logger configuration
|
|
73
|
+
*/
|
|
74
|
+
constructor(config: Required<LogConfig>);
|
|
75
|
+
/**
|
|
76
|
+
* Checks if a log level should be output based on configuration.
|
|
77
|
+
* @param level - The log level to check
|
|
78
|
+
* @returns True if the level should be logged
|
|
79
|
+
*/
|
|
80
|
+
shouldLog(level: LogLevel): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if debug logging is enabled.
|
|
83
|
+
* @returns True if debug logs should be output
|
|
84
|
+
*/
|
|
85
|
+
isDebug(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Logs a debug message if debug logging is enabled.
|
|
88
|
+
* @param message - The message to log
|
|
89
|
+
* @param args - Additional arguments to log
|
|
90
|
+
*/
|
|
91
|
+
debug(message: string, ...args: unknown[]): void;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if info logging is enabled.
|
|
94
|
+
* @returns True if info logs should be output
|
|
95
|
+
*/
|
|
96
|
+
isInfo(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Logs an info message if info logging is enabled.
|
|
99
|
+
* @param message - The message to log
|
|
100
|
+
* @param args - Additional arguments to log
|
|
101
|
+
*/
|
|
102
|
+
info(message: string, ...args: unknown[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* Checks if warning logging is enabled.
|
|
105
|
+
* @returns True if warning logs should be output
|
|
106
|
+
*/
|
|
107
|
+
isWarn(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Logs a warning message if warning logging is enabled.
|
|
110
|
+
* @param message - The message to log
|
|
111
|
+
* @param args - Additional arguments to log
|
|
112
|
+
*/
|
|
113
|
+
warn(message: string, ...args: unknown[]): void;
|
|
114
|
+
/**
|
|
115
|
+
* Checks if error logging is enabled.
|
|
116
|
+
* @returns True if error logs should be output
|
|
117
|
+
*/
|
|
118
|
+
isError(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Logs an error message if error logging is enabled.
|
|
121
|
+
* @param message - The message to log
|
|
122
|
+
* @param args - Additional arguments to log
|
|
123
|
+
*/
|
|
124
|
+
error(message: string, ...args: unknown[]): void;
|
|
125
|
+
}
|
|
126
|
+
export declare function createLogger(config?: LogConfig | Logger): Logger;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = exports.ConsoleLogger = exports.LogLevel = void 0;
|
|
4
|
+
exports.createLogger = createLogger;
|
|
5
|
+
exports.LogLevel = {
|
|
6
|
+
Debug: "debug",
|
|
7
|
+
Info: "info",
|
|
8
|
+
Warn: "warn",
|
|
9
|
+
Error: "error",
|
|
10
|
+
};
|
|
11
|
+
const logLevelMap = {
|
|
12
|
+
[exports.LogLevel.Debug]: 1,
|
|
13
|
+
[exports.LogLevel.Info]: 2,
|
|
14
|
+
[exports.LogLevel.Warn]: 3,
|
|
15
|
+
[exports.LogLevel.Error]: 4,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Default console-based logger implementation.
|
|
19
|
+
*/
|
|
20
|
+
class ConsoleLogger {
|
|
21
|
+
debug(message, ...args) {
|
|
22
|
+
console.debug(message, ...args);
|
|
23
|
+
}
|
|
24
|
+
info(message, ...args) {
|
|
25
|
+
console.info(message, ...args);
|
|
26
|
+
}
|
|
27
|
+
warn(message, ...args) {
|
|
28
|
+
console.warn(message, ...args);
|
|
29
|
+
}
|
|
30
|
+
error(message, ...args) {
|
|
31
|
+
console.error(message, ...args);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
35
|
+
/**
|
|
36
|
+
* Logger class that provides level-based logging functionality.
|
|
37
|
+
*/
|
|
38
|
+
class Logger {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new logger instance.
|
|
41
|
+
* @param config - Logger configuration
|
|
42
|
+
*/
|
|
43
|
+
constructor(config) {
|
|
44
|
+
this.level = logLevelMap[config.level];
|
|
45
|
+
this.logger = config.logger;
|
|
46
|
+
this.silent = config.silent;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if a log level should be output based on configuration.
|
|
50
|
+
* @param level - The log level to check
|
|
51
|
+
* @returns True if the level should be logged
|
|
52
|
+
*/
|
|
53
|
+
shouldLog(level) {
|
|
54
|
+
return !this.silent && this.level <= logLevelMap[level];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks if debug logging is enabled.
|
|
58
|
+
* @returns True if debug logs should be output
|
|
59
|
+
*/
|
|
60
|
+
isDebug() {
|
|
61
|
+
return this.shouldLog(exports.LogLevel.Debug);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logs a debug message if debug logging is enabled.
|
|
65
|
+
* @param message - The message to log
|
|
66
|
+
* @param args - Additional arguments to log
|
|
67
|
+
*/
|
|
68
|
+
debug(message, ...args) {
|
|
69
|
+
if (this.isDebug()) {
|
|
70
|
+
this.logger.debug(message, ...args);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if info logging is enabled.
|
|
75
|
+
* @returns True if info logs should be output
|
|
76
|
+
*/
|
|
77
|
+
isInfo() {
|
|
78
|
+
return this.shouldLog(exports.LogLevel.Info);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Logs an info message if info logging is enabled.
|
|
82
|
+
* @param message - The message to log
|
|
83
|
+
* @param args - Additional arguments to log
|
|
84
|
+
*/
|
|
85
|
+
info(message, ...args) {
|
|
86
|
+
if (this.isInfo()) {
|
|
87
|
+
this.logger.info(message, ...args);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if warning logging is enabled.
|
|
92
|
+
* @returns True if warning logs should be output
|
|
93
|
+
*/
|
|
94
|
+
isWarn() {
|
|
95
|
+
return this.shouldLog(exports.LogLevel.Warn);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Logs a warning message if warning logging is enabled.
|
|
99
|
+
* @param message - The message to log
|
|
100
|
+
* @param args - Additional arguments to log
|
|
101
|
+
*/
|
|
102
|
+
warn(message, ...args) {
|
|
103
|
+
if (this.isWarn()) {
|
|
104
|
+
this.logger.warn(message, ...args);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Checks if error logging is enabled.
|
|
109
|
+
* @returns True if error logs should be output
|
|
110
|
+
*/
|
|
111
|
+
isError() {
|
|
112
|
+
return this.shouldLog(exports.LogLevel.Error);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Logs an error message if error logging is enabled.
|
|
116
|
+
* @param message - The message to log
|
|
117
|
+
* @param args - Additional arguments to log
|
|
118
|
+
*/
|
|
119
|
+
error(message, ...args) {
|
|
120
|
+
if (this.isError()) {
|
|
121
|
+
this.logger.error(message, ...args);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.Logger = Logger;
|
|
126
|
+
function createLogger(config) {
|
|
127
|
+
var _a, _b, _c;
|
|
128
|
+
if (config == null) {
|
|
129
|
+
return defaultLogger;
|
|
130
|
+
}
|
|
131
|
+
if (config instanceof Logger) {
|
|
132
|
+
return config;
|
|
133
|
+
}
|
|
134
|
+
config = config !== null && config !== void 0 ? config : {};
|
|
135
|
+
(_a = config.level) !== null && _a !== void 0 ? _a : (config.level = exports.LogLevel.Info);
|
|
136
|
+
(_b = config.logger) !== null && _b !== void 0 ? _b : (config.logger = new ConsoleLogger());
|
|
137
|
+
(_c = config.silent) !== null && _c !== void 0 ? _c : (config.silent = true);
|
|
138
|
+
return new Logger(config);
|
|
139
|
+
}
|
|
140
|
+
const defaultLogger = new Logger({
|
|
141
|
+
level: exports.LogLevel.Info,
|
|
142
|
+
logger: new ConsoleLogger(),
|
|
143
|
+
silent: true,
|
|
144
|
+
});
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.12";
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as core from "./core/index.mjs";
|
|
2
2
|
import type * as environments from "./environments.mjs";
|
|
3
3
|
export interface BaseClientOptions {
|
|
4
4
|
environment?: core.Supplier<environments.CredalEnvironment | string>;
|
|
@@ -11,7 +11,11 @@ export interface BaseClientOptions {
|
|
|
11
11
|
timeoutInSeconds?: number;
|
|
12
12
|
/** The default number of times to retry the request. Defaults to 2. */
|
|
13
13
|
maxRetries?: number;
|
|
14
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
15
|
+
fetch?: typeof fetch;
|
|
14
16
|
fetcher?: core.FetchFunction;
|
|
17
|
+
/** Configure logging for the client. */
|
|
18
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
15
19
|
}
|
|
16
20
|
export interface BaseRequestOptions {
|
|
17
21
|
/** The maximum time to wait for a response in seconds. */
|
|
@@ -25,3 +29,4 @@ export interface BaseRequestOptions {
|
|
|
25
29
|
/** Additional headers to include in the request. */
|
|
26
30
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
27
31
|
}
|
|
32
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions>(options: T): T;
|
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
2
|
+
import { mergeHeaders } from "./core/headers.mjs";
|
|
3
|
+
import * as core from "./core/index.mjs";
|
|
4
|
+
export function normalizeClientOptions(options) {
|
|
5
|
+
const headers = mergeHeaders({
|
|
6
|
+
"X-Fern-Language": "JavaScript",
|
|
7
|
+
"X-Fern-SDK-Name": "@credal/sdk",
|
|
8
|
+
"X-Fern-SDK-Version": "0.1.12",
|
|
9
|
+
"User-Agent": "@credal/sdk/0.1.12",
|
|
10
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
11
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
12
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
13
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
14
|
+
}
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { CopilotsClient } from "./api/resources/copilots/client/Client.mjs";
|
|
2
|
+
import { DocumentCatalogClient } from "./api/resources/documentCatalog/client/Client.mjs";
|
|
3
|
+
import { DocumentCollectionsClient } from "./api/resources/documentCollections/client/Client.mjs";
|
|
4
|
+
import { SearchClient } from "./api/resources/search/client/Client.mjs";
|
|
5
|
+
import { UsersClient } from "./api/resources/users/client/Client.mjs";
|
|
6
6
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
7
7
|
export declare namespace CredalClient {
|
|
8
8
|
interface Options extends BaseClientOptions {
|
|
@@ -12,15 +12,15 @@ export declare namespace CredalClient {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class CredalClient {
|
|
14
14
|
protected readonly _options: CredalClient.Options;
|
|
15
|
-
protected _copilots:
|
|
16
|
-
protected _documentCatalog:
|
|
17
|
-
protected _documentCollections:
|
|
18
|
-
protected _search:
|
|
19
|
-
protected _users:
|
|
20
|
-
constructor(
|
|
21
|
-
get copilots():
|
|
22
|
-
get documentCatalog():
|
|
23
|
-
get documentCollections():
|
|
24
|
-
get search():
|
|
25
|
-
get users():
|
|
15
|
+
protected _copilots: CopilotsClient | undefined;
|
|
16
|
+
protected _documentCatalog: DocumentCatalogClient | undefined;
|
|
17
|
+
protected _documentCollections: DocumentCollectionsClient | undefined;
|
|
18
|
+
protected _search: SearchClient | undefined;
|
|
19
|
+
protected _users: UsersClient | undefined;
|
|
20
|
+
constructor(options?: CredalClient.Options);
|
|
21
|
+
get copilots(): CopilotsClient;
|
|
22
|
+
get documentCatalog(): DocumentCatalogClient;
|
|
23
|
+
get documentCollections(): DocumentCollectionsClient;
|
|
24
|
+
get search(): SearchClient;
|
|
25
|
+
get users(): UsersClient;
|
|
26
26
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import * as core from "./core/index.mjs";
|
|
2
|
+
import { CopilotsClient } from "./api/resources/copilots/client/Client.mjs";
|
|
3
|
+
import { DocumentCatalogClient } from "./api/resources/documentCatalog/client/Client.mjs";
|
|
4
|
+
import { DocumentCollectionsClient } from "./api/resources/documentCollections/client/Client.mjs";
|
|
5
|
+
import { SearchClient } from "./api/resources/search/client/Client.mjs";
|
|
6
|
+
import { UsersClient } from "./api/resources/users/client/Client.mjs";
|
|
7
|
+
import { normalizeClientOptions } from "./BaseClient.mjs";
|
|
9
8
|
export class CredalClient {
|
|
10
|
-
constructor(
|
|
11
|
-
this._options =
|
|
12
|
-
"X-Fern-Language": "JavaScript",
|
|
13
|
-
"X-Fern-SDK-Name": "@credal/sdk",
|
|
14
|
-
"X-Fern-SDK-Version": "0.1.10",
|
|
15
|
-
"User-Agent": "@credal/sdk/0.1.10",
|
|
16
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
17
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
18
|
-
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
this._options = normalizeClientOptions(options);
|
|
19
11
|
}
|
|
20
12
|
get copilots() {
|
|
21
13
|
var _a;
|
|
22
|
-
return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new
|
|
14
|
+
return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new CopilotsClient(this._options)));
|
|
23
15
|
}
|
|
24
16
|
get documentCatalog() {
|
|
25
17
|
var _a;
|
|
26
|
-
return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new
|
|
18
|
+
return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new DocumentCatalogClient(this._options)));
|
|
27
19
|
}
|
|
28
20
|
get documentCollections() {
|
|
29
21
|
var _a;
|
|
30
|
-
return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new
|
|
22
|
+
return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new DocumentCollectionsClient(this._options)));
|
|
31
23
|
}
|
|
32
24
|
get search() {
|
|
33
25
|
var _a;
|
|
34
|
-
return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new
|
|
26
|
+
return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new SearchClient(this._options)));
|
|
35
27
|
}
|
|
36
28
|
get users() {
|
|
37
29
|
var _a;
|
|
38
|
-
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new
|
|
30
|
+
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new UsersClient(this._options)));
|
|
39
31
|
}
|
|
40
32
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import type * as Credal from "../../../index.mjs";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace CopilotsClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class CopilotsClient {
|
|
11
|
+
protected readonly _options: CopilotsClient.Options;
|
|
12
|
+
constructor(options?: CopilotsClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Create a new agent. The API key used will be added to the agent for future Requests
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.CreateCopilotRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.copilots.createCopilot({
|
|
@@ -26,13 +26,13 @@ export declare class Copilots {
|
|
|
26
26
|
* }]
|
|
27
27
|
* })
|
|
28
28
|
*/
|
|
29
|
-
createCopilot(request: Credal.CreateCopilotRequest, requestOptions?:
|
|
29
|
+
createCopilot(request: Credal.CreateCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.CreateCopilotResponse>;
|
|
30
30
|
private __createCopilot;
|
|
31
31
|
/**
|
|
32
32
|
* OPTIONAL. Create a new conversation with the Agent. The conversation ID can be used in the `sendMessage` endpoint. The `sendMessage` endpoint automatically creates new conversations upon first request, but calling this endpoint can simplify certain use cases where it is helpful for the application to have the conversation ID before the first message is sent.
|
|
33
33
|
*
|
|
34
34
|
* @param {Credal.CreateConversationRequest} request
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* await client.copilots.createConversation({
|
|
@@ -40,11 +40,11 @@ export declare class Copilots {
|
|
|
40
40
|
* userEmail: "ravin@credal.ai"
|
|
41
41
|
* })
|
|
42
42
|
*/
|
|
43
|
-
createConversation(request: Credal.CreateConversationRequest, requestOptions?:
|
|
43
|
+
createConversation(request: Credal.CreateConversationRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.CreateConversationResponse>;
|
|
44
44
|
private __createConversation;
|
|
45
45
|
/**
|
|
46
46
|
* @param {Credal.ProvideMessageFeedbackRequest} request
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* await client.copilots.provideMessageFeedback({
|
|
@@ -58,11 +58,11 @@ export declare class Copilots {
|
|
|
58
58
|
* }
|
|
59
59
|
* })
|
|
60
60
|
*/
|
|
61
|
-
provideMessageFeedback(request: Credal.ProvideMessageFeedbackRequest, requestOptions?:
|
|
61
|
+
provideMessageFeedback(request: Credal.ProvideMessageFeedbackRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
62
62
|
private __provideMessageFeedback;
|
|
63
63
|
/**
|
|
64
64
|
* @param {Credal.SendMessageRequest} request
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* await client.copilots.sendMessage({
|
|
@@ -78,18 +78,18 @@ export declare class Copilots {
|
|
|
78
78
|
* }]
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
|
-
sendMessage(request: Credal.SendMessageRequest, requestOptions?:
|
|
81
|
+
sendMessage(request: Credal.SendMessageRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.SendAgentMessageResponse>;
|
|
82
82
|
private __sendMessage;
|
|
83
83
|
/**
|
|
84
84
|
* This endpoint allows you to send a message to a specific agent and get the response back as a streamed set of Server-Sent Events.
|
|
85
85
|
*/
|
|
86
|
-
streamMessage(request: Credal.StreamMessageRequest, requestOptions?:
|
|
86
|
+
streamMessage(request: Credal.StreamMessageRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<core.Stream<Credal.StreamingChunk>>;
|
|
87
87
|
private __streamMessage;
|
|
88
88
|
/**
|
|
89
89
|
* Link a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
90
90
|
*
|
|
91
91
|
* @param {Credal.AddCollectionToCopilotRequest} request
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* await client.copilots.addCollectionToCopilot({
|
|
@@ -97,13 +97,13 @@ export declare class Copilots {
|
|
|
97
97
|
* collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
|
|
98
98
|
* })
|
|
99
99
|
*/
|
|
100
|
-
addCollectionToCopilot(request: Credal.AddCollectionToCopilotRequest, requestOptions?:
|
|
100
|
+
addCollectionToCopilot(request: Credal.AddCollectionToCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
101
101
|
private __addCollectionToCopilot;
|
|
102
102
|
/**
|
|
103
103
|
* Unlink a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
104
104
|
*
|
|
105
105
|
* @param {Credal.RemoveCollectionFromCopilotRequest} request
|
|
106
|
-
* @param {
|
|
106
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
109
|
* await client.copilots.removeCollectionFromCopilot({
|
|
@@ -111,13 +111,13 @@ export declare class Copilots {
|
|
|
111
111
|
* collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
|
|
112
112
|
* })
|
|
113
113
|
*/
|
|
114
|
-
removeCollectionFromCopilot(request: Credal.RemoveCollectionFromCopilotRequest, requestOptions?:
|
|
114
|
+
removeCollectionFromCopilot(request: Credal.RemoveCollectionFromCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
115
115
|
private __removeCollectionFromCopilot;
|
|
116
116
|
/**
|
|
117
117
|
* Update the configuration for a agent
|
|
118
118
|
*
|
|
119
119
|
* @param {Credal.UpdateConfigurationRequest} request
|
|
120
|
-
* @param {
|
|
120
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
123
|
* await client.copilots.updateConfiguration({
|
|
@@ -133,18 +133,18 @@ export declare class Copilots {
|
|
|
133
133
|
* }
|
|
134
134
|
* })
|
|
135
135
|
*/
|
|
136
|
-
updateConfiguration(request: Credal.UpdateConfigurationRequest, requestOptions?:
|
|
136
|
+
updateConfiguration(request: Credal.UpdateConfigurationRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
137
137
|
private __updateConfiguration;
|
|
138
138
|
/**
|
|
139
139
|
* @param {Credal.DeleteCopilotRequest} request
|
|
140
|
-
* @param {
|
|
140
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
141
141
|
*
|
|
142
142
|
* @example
|
|
143
143
|
* await client.copilots.deleteCopilot({
|
|
144
144
|
* id: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
|
|
145
145
|
* })
|
|
146
146
|
*/
|
|
147
|
-
deleteCopilot(request: Credal.DeleteCopilotRequest, requestOptions?:
|
|
147
|
+
deleteCopilot(request: Credal.DeleteCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.DeleteCopilotResponse>;
|
|
148
148
|
private __deleteCopilot;
|
|
149
149
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
150
150
|
}
|