@cairul/sdk 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/dist/generated/apis/DocumentationApi.d.ts +41 -0
- package/dist/generated/apis/DocumentationApi.js +76 -0
- package/dist/generated/apis/HealthApi.d.ts +30 -0
- package/dist/generated/apis/HealthApi.js +49 -0
- package/dist/generated/apis/IdentitiesApi.d.ts +36 -0
- package/dist/generated/apis/IdentitiesApi.js +53 -0
- package/dist/generated/apis/JourneysApi.d.ts +161 -0
- package/dist/generated/apis/JourneysApi.js +268 -0
- package/dist/generated/apis/PlansApi.d.ts +73 -0
- package/dist/generated/apis/PlansApi.js +121 -0
- package/dist/generated/apis/index.d.ts +5 -0
- package/dist/generated/apis/index.js +7 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +5 -0
- package/dist/generated/models/APIError.d.ts +30 -0
- package/dist/generated/models/APIError.js +43 -0
- package/dist/generated/models/ApiHealth.d.ts +30 -0
- package/dist/generated/models/ApiHealth.js +43 -0
- package/dist/generated/models/CapturePolicy.d.ts +47 -0
- package/dist/generated/models/CapturePolicy.js +53 -0
- package/dist/generated/models/Check.d.ts +39 -0
- package/dist/generated/models/Check.js +52 -0
- package/dist/generated/models/CheckAction.d.ts +43 -0
- package/dist/generated/models/CheckAction.js +50 -0
- package/dist/generated/models/CheckInput.d.ts +35 -0
- package/dist/generated/models/CheckInput.js +48 -0
- package/dist/generated/models/EventPublication.d.ts +60 -0
- package/dist/generated/models/EventPublication.js +64 -0
- package/dist/generated/models/ExecutionObservation.d.ts +56 -0
- package/dist/generated/models/ExecutionObservation.js +73 -0
- package/dist/generated/models/HarnessIdentity.d.ts +42 -0
- package/dist/generated/models/HarnessIdentity.js +57 -0
- package/dist/generated/models/Identity.d.ts +58 -0
- package/dist/generated/models/Identity.js +61 -0
- package/dist/generated/models/JournalEntry.d.ts +75 -0
- package/dist/generated/models/JournalEntry.js +88 -0
- package/dist/generated/models/Journey.d.ts +85 -0
- package/dist/generated/models/Journey.js +113 -0
- package/dist/generated/models/MCPRequestObservation.d.ts +50 -0
- package/dist/generated/models/MCPRequestObservation.js +66 -0
- package/dist/generated/models/ModelObservation.d.ts +47 -0
- package/dist/generated/models/ModelObservation.js +58 -0
- package/dist/generated/models/ObservationBatch.d.ts +40 -0
- package/dist/generated/models/ObservationBatch.js +55 -0
- package/dist/generated/models/ObservationEvent.d.ts +66 -0
- package/dist/generated/models/ObservationEvent.js +74 -0
- package/dist/generated/models/Phase.d.ts +39 -0
- package/dist/generated/models/Phase.js +52 -0
- package/dist/generated/models/PhaseInput.d.ts +35 -0
- package/dist/generated/models/PhaseInput.js +48 -0
- package/dist/generated/models/Plan.d.ts +55 -0
- package/dist/generated/models/Plan.js +70 -0
- package/dist/generated/models/PlanInput.d.ts +39 -0
- package/dist/generated/models/PlanInput.js +52 -0
- package/dist/generated/models/PublicationResult.d.ts +35 -0
- package/dist/generated/models/PublicationResult.js +46 -0
- package/dist/generated/models/RecordingEndObservation.d.ts +52 -0
- package/dist/generated/models/RecordingEndObservation.js +67 -0
- package/dist/generated/models/RecordingStartObservation.d.ts +35 -0
- package/dist/generated/models/RecordingStartObservation.js +48 -0
- package/dist/generated/models/StartJourneyInput.d.ts +59 -0
- package/dist/generated/models/StartJourneyInput.js +64 -0
- package/dist/generated/models/StartedJourney.d.ts +40 -0
- package/dist/generated/models/StartedJourney.js +55 -0
- package/dist/generated/models/TokenUsage.d.ts +46 -0
- package/dist/generated/models/TokenUsage.js +49 -0
- package/dist/generated/models/ToolObservation.d.ts +64 -0
- package/dist/generated/models/ToolObservation.js +73 -0
- package/dist/generated/models/WorkflowActionType.d.ts +29 -0
- package/dist/generated/models/WorkflowActionType.js +47 -0
- package/dist/generated/models/WorkflowJourneyStatus.d.ts +26 -0
- package/dist/generated/models/WorkflowJourneyStatus.js +44 -0
- package/dist/generated/models/index.d.ts +29 -0
- package/dist/generated/models/index.js +31 -0
- package/dist/generated/runtime.d.ts +217 -0
- package/dist/generated/runtime.js +455 -0
- package/package.json +23 -3
- package/README.md +0 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Cairul API
|
|
5
|
+
* Backend API for Cairul.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
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
|
+
import { MCPRequestObservationFromJSON, MCPRequestObservationToJSON, } from './MCPRequestObservation.js';
|
|
15
|
+
/**
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export const ToolObservationTimingEnum = {
|
|
19
|
+
Runtime: 'runtime',
|
|
20
|
+
McpRequest: 'mcp_request',
|
|
21
|
+
Rollout: 'rollout',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the ToolObservation interface.
|
|
25
|
+
*/
|
|
26
|
+
export function instanceOfToolObservation(value) {
|
|
27
|
+
if ((!('callId' in value) && !('call_id' in value)) ||
|
|
28
|
+
(value['callId'] === undefined && value['call_id'] === undefined))
|
|
29
|
+
return false;
|
|
30
|
+
if (!('name' in value) || value['name'] === undefined)
|
|
31
|
+
return false;
|
|
32
|
+
if ((!('startedAt' in value) && !('started_at' in value)) ||
|
|
33
|
+
(value['startedAt'] === undefined &&
|
|
34
|
+
value['started_at'] === undefined))
|
|
35
|
+
return false;
|
|
36
|
+
if (!('timing' in value) || value['timing'] === undefined)
|
|
37
|
+
return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
export function ToolObservationFromJSON(json) {
|
|
41
|
+
return ToolObservationFromJSONTyped(json, false);
|
|
42
|
+
}
|
|
43
|
+
export function ToolObservationFromJSONTyped(json, ignoreDiscriminator) {
|
|
44
|
+
if (json == null) {
|
|
45
|
+
return json;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
callId: json['call_id'],
|
|
49
|
+
endedAt: json['ended_at'] == null ? undefined : json['ended_at'],
|
|
50
|
+
failed: json['failed'] == null ? undefined : json['failed'],
|
|
51
|
+
name: json['name'],
|
|
52
|
+
request: json['request'] == null ? undefined : MCPRequestObservationFromJSON(json['request']),
|
|
53
|
+
startedAt: json['started_at'],
|
|
54
|
+
timing: json['timing'],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function ToolObservationToJSON(json) {
|
|
58
|
+
return ToolObservationToJSONTyped(json, false);
|
|
59
|
+
}
|
|
60
|
+
export function ToolObservationToJSONTyped(value, ignoreDiscriminator = false) {
|
|
61
|
+
if (value == null) {
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
call_id: value['callId'],
|
|
66
|
+
ended_at: value['endedAt'],
|
|
67
|
+
failed: value['failed'],
|
|
68
|
+
name: value['name'],
|
|
69
|
+
request: MCPRequestObservationToJSON(value['request']),
|
|
70
|
+
started_at: value['startedAt'],
|
|
71
|
+
timing: value['timing'],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cairul API
|
|
3
|
+
* Backend API for Cairul.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
export declare const WorkflowActionType: {
|
|
17
|
+
readonly Manual: "manual";
|
|
18
|
+
readonly Delay: "delay";
|
|
19
|
+
readonly GitHubCheck: "github_check";
|
|
20
|
+
readonly GitHubPullRequestStatus: "github_pull_request_status";
|
|
21
|
+
readonly GitHubIssuePullRequestsStatus: "github_issue_pull_requests_status";
|
|
22
|
+
readonly GitHubIssueStatus: "github_issue_status";
|
|
23
|
+
};
|
|
24
|
+
export type WorkflowActionType = (typeof WorkflowActionType)[keyof typeof WorkflowActionType];
|
|
25
|
+
export declare function instanceOfWorkflowActionType(value: any): boolean;
|
|
26
|
+
export declare function WorkflowActionTypeFromJSON(json: any): WorkflowActionType;
|
|
27
|
+
export declare function WorkflowActionTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): WorkflowActionType;
|
|
28
|
+
export declare function WorkflowActionTypeToJSON(value?: WorkflowActionType | null): any;
|
|
29
|
+
export declare function WorkflowActionTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): WorkflowActionType;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Cairul API
|
|
5
|
+
* Backend API for Cairul.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
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
|
|
17
|
+
*/
|
|
18
|
+
export const WorkflowActionType = {
|
|
19
|
+
Manual: 'manual',
|
|
20
|
+
Delay: 'delay',
|
|
21
|
+
GitHubCheck: 'github_check',
|
|
22
|
+
GitHubPullRequestStatus: 'github_pull_request_status',
|
|
23
|
+
GitHubIssuePullRequestsStatus: 'github_issue_pull_requests_status',
|
|
24
|
+
GitHubIssueStatus: 'github_issue_status',
|
|
25
|
+
};
|
|
26
|
+
export function instanceOfWorkflowActionType(value) {
|
|
27
|
+
for (const key in WorkflowActionType) {
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(WorkflowActionType, key)) {
|
|
29
|
+
if (WorkflowActionType[key] === value) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
export function WorkflowActionTypeFromJSON(json) {
|
|
37
|
+
return WorkflowActionTypeFromJSONTyped(json, false);
|
|
38
|
+
}
|
|
39
|
+
export function WorkflowActionTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
40
|
+
return json;
|
|
41
|
+
}
|
|
42
|
+
export function WorkflowActionTypeToJSON(value) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
export function WorkflowActionTypeToJSONTyped(value, ignoreDiscriminator) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cairul API
|
|
3
|
+
* Backend API for Cairul.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
export declare const WorkflowJourneyStatus: {
|
|
17
|
+
readonly Active: "active";
|
|
18
|
+
readonly Aborted: "aborted";
|
|
19
|
+
readonly Completed: "completed";
|
|
20
|
+
};
|
|
21
|
+
export type WorkflowJourneyStatus = (typeof WorkflowJourneyStatus)[keyof typeof WorkflowJourneyStatus];
|
|
22
|
+
export declare function instanceOfWorkflowJourneyStatus(value: any): boolean;
|
|
23
|
+
export declare function WorkflowJourneyStatusFromJSON(json: any): WorkflowJourneyStatus;
|
|
24
|
+
export declare function WorkflowJourneyStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): WorkflowJourneyStatus;
|
|
25
|
+
export declare function WorkflowJourneyStatusToJSON(value?: WorkflowJourneyStatus | null): any;
|
|
26
|
+
export declare function WorkflowJourneyStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): WorkflowJourneyStatus;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Cairul API
|
|
5
|
+
* Backend API for Cairul.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
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
|
|
17
|
+
*/
|
|
18
|
+
export const WorkflowJourneyStatus = {
|
|
19
|
+
Active: 'active',
|
|
20
|
+
Aborted: 'aborted',
|
|
21
|
+
Completed: 'completed',
|
|
22
|
+
};
|
|
23
|
+
export function instanceOfWorkflowJourneyStatus(value) {
|
|
24
|
+
for (const key in WorkflowJourneyStatus) {
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(WorkflowJourneyStatus, key)) {
|
|
26
|
+
if (WorkflowJourneyStatus[key] === value) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
export function WorkflowJourneyStatusFromJSON(json) {
|
|
34
|
+
return WorkflowJourneyStatusFromJSONTyped(json, false);
|
|
35
|
+
}
|
|
36
|
+
export function WorkflowJourneyStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
37
|
+
return json;
|
|
38
|
+
}
|
|
39
|
+
export function WorkflowJourneyStatusToJSON(value) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
export function WorkflowJourneyStatusToJSONTyped(value, ignoreDiscriminator) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './APIError.js';
|
|
2
|
+
export * from './ApiHealth.js';
|
|
3
|
+
export * from './CapturePolicy.js';
|
|
4
|
+
export * from './Check.js';
|
|
5
|
+
export * from './CheckAction.js';
|
|
6
|
+
export * from './CheckInput.js';
|
|
7
|
+
export * from './EventPublication.js';
|
|
8
|
+
export * from './ExecutionObservation.js';
|
|
9
|
+
export * from './HarnessIdentity.js';
|
|
10
|
+
export * from './Identity.js';
|
|
11
|
+
export * from './JournalEntry.js';
|
|
12
|
+
export * from './Journey.js';
|
|
13
|
+
export * from './MCPRequestObservation.js';
|
|
14
|
+
export * from './ModelObservation.js';
|
|
15
|
+
export * from './ObservationBatch.js';
|
|
16
|
+
export * from './ObservationEvent.js';
|
|
17
|
+
export * from './Phase.js';
|
|
18
|
+
export * from './PhaseInput.js';
|
|
19
|
+
export * from './Plan.js';
|
|
20
|
+
export * from './PlanInput.js';
|
|
21
|
+
export * from './PublicationResult.js';
|
|
22
|
+
export * from './RecordingEndObservation.js';
|
|
23
|
+
export * from './RecordingStartObservation.js';
|
|
24
|
+
export * from './StartJourneyInput.js';
|
|
25
|
+
export * from './StartedJourney.js';
|
|
26
|
+
export * from './TokenUsage.js';
|
|
27
|
+
export * from './ToolObservation.js';
|
|
28
|
+
export * from './WorkflowActionType.js';
|
|
29
|
+
export * from './WorkflowJourneyStatus.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export * from './APIError.js';
|
|
4
|
+
export * from './ApiHealth.js';
|
|
5
|
+
export * from './CapturePolicy.js';
|
|
6
|
+
export * from './Check.js';
|
|
7
|
+
export * from './CheckAction.js';
|
|
8
|
+
export * from './CheckInput.js';
|
|
9
|
+
export * from './EventPublication.js';
|
|
10
|
+
export * from './ExecutionObservation.js';
|
|
11
|
+
export * from './HarnessIdentity.js';
|
|
12
|
+
export * from './Identity.js';
|
|
13
|
+
export * from './JournalEntry.js';
|
|
14
|
+
export * from './Journey.js';
|
|
15
|
+
export * from './MCPRequestObservation.js';
|
|
16
|
+
export * from './ModelObservation.js';
|
|
17
|
+
export * from './ObservationBatch.js';
|
|
18
|
+
export * from './ObservationEvent.js';
|
|
19
|
+
export * from './Phase.js';
|
|
20
|
+
export * from './PhaseInput.js';
|
|
21
|
+
export * from './Plan.js';
|
|
22
|
+
export * from './PlanInput.js';
|
|
23
|
+
export * from './PublicationResult.js';
|
|
24
|
+
export * from './RecordingEndObservation.js';
|
|
25
|
+
export * from './RecordingStartObservation.js';
|
|
26
|
+
export * from './StartJourneyInput.js';
|
|
27
|
+
export * from './StartedJourney.js';
|
|
28
|
+
export * from './TokenUsage.js';
|
|
29
|
+
export * from './ToolObservation.js';
|
|
30
|
+
export * from './WorkflowActionType.js';
|
|
31
|
+
export * from './WorkflowJourneyStatus.js';
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cairul API
|
|
3
|
+
* Backend API for Cairul.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BASE_PATH: string;
|
|
13
|
+
export interface ConfigurationParameters {
|
|
14
|
+
basePath?: string;
|
|
15
|
+
fetchApi?: FetchAPI;
|
|
16
|
+
middleware?: Middleware[];
|
|
17
|
+
queryParamsStringify?: (params: HTTPQuery) => string;
|
|
18
|
+
username?: string;
|
|
19
|
+
password?: string;
|
|
20
|
+
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>);
|
|
21
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
|
|
22
|
+
headers?: HTTPHeaders;
|
|
23
|
+
credentials?: RequestCredentials;
|
|
24
|
+
}
|
|
25
|
+
export declare class Configuration {
|
|
26
|
+
private configuration;
|
|
27
|
+
constructor(configuration?: ConfigurationParameters);
|
|
28
|
+
set config(configuration: Configuration);
|
|
29
|
+
get basePath(): string;
|
|
30
|
+
get fetchApi(): FetchAPI | undefined;
|
|
31
|
+
get middleware(): Middleware[];
|
|
32
|
+
get queryParamsStringify(): (params: HTTPQuery) => string;
|
|
33
|
+
get username(): string | undefined;
|
|
34
|
+
get password(): string | undefined;
|
|
35
|
+
get apiKey(): ((name: string) => string | Promise<string>) | undefined;
|
|
36
|
+
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
|
|
37
|
+
get headers(): HTTPHeaders | undefined;
|
|
38
|
+
get credentials(): RequestCredentials | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const DefaultConfig: Configuration;
|
|
41
|
+
/**
|
|
42
|
+
* This is the base class for all generated API classes.
|
|
43
|
+
*/
|
|
44
|
+
export declare class BaseAPI {
|
|
45
|
+
protected configuration: Configuration;
|
|
46
|
+
private static readonly jsonRegex;
|
|
47
|
+
private middleware;
|
|
48
|
+
constructor(configuration?: Configuration);
|
|
49
|
+
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
|
|
50
|
+
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
|
|
51
|
+
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
|
|
52
|
+
/**
|
|
53
|
+
* Check if the given MIME is a JSON MIME.
|
|
54
|
+
* JSON MIME examples:
|
|
55
|
+
* application/json
|
|
56
|
+
* application/json; charset=UTF8
|
|
57
|
+
* APPLICATION/JSON
|
|
58
|
+
* application/vnd.company+json
|
|
59
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
60
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
protected isJsonMime(mime: string | null | undefined): boolean;
|
|
63
|
+
protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
|
|
64
|
+
private createFetchParams;
|
|
65
|
+
private fetchApi;
|
|
66
|
+
/**
|
|
67
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
68
|
+
* and then shallow cloning data members.
|
|
69
|
+
*/
|
|
70
|
+
private clone;
|
|
71
|
+
}
|
|
72
|
+
export declare class ResponseError extends Error {
|
|
73
|
+
response: Response;
|
|
74
|
+
name: 'ResponseError';
|
|
75
|
+
constructor(response: Response, msg?: string);
|
|
76
|
+
}
|
|
77
|
+
export declare class FetchError extends Error {
|
|
78
|
+
cause: Error;
|
|
79
|
+
name: 'FetchError';
|
|
80
|
+
constructor(cause: Error, msg?: string);
|
|
81
|
+
}
|
|
82
|
+
export declare class RequiredError extends Error {
|
|
83
|
+
field: string;
|
|
84
|
+
name: 'RequiredError';
|
|
85
|
+
constructor(field: string, msg?: string);
|
|
86
|
+
}
|
|
87
|
+
export declare const COLLECTION_FORMATS: {
|
|
88
|
+
csv: string;
|
|
89
|
+
ssv: string;
|
|
90
|
+
tsv: string;
|
|
91
|
+
pipes: string;
|
|
92
|
+
};
|
|
93
|
+
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
|
|
94
|
+
export type Json = any;
|
|
95
|
+
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
96
|
+
export type HTTPHeaders = {
|
|
97
|
+
[key: string]: string;
|
|
98
|
+
};
|
|
99
|
+
export type HTTPQuery = {
|
|
100
|
+
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
|
|
101
|
+
};
|
|
102
|
+
export type HTTPBody = Json | FormData | URLSearchParams;
|
|
103
|
+
export type HTTPRequestInit = {
|
|
104
|
+
headers?: HTTPHeaders;
|
|
105
|
+
method: HTTPMethod;
|
|
106
|
+
credentials?: RequestCredentials;
|
|
107
|
+
body?: HTTPBody;
|
|
108
|
+
};
|
|
109
|
+
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
|
|
110
|
+
export type InitOverrideFunction = (requestContext: {
|
|
111
|
+
init: HTTPRequestInit;
|
|
112
|
+
context: RequestOpts;
|
|
113
|
+
}) => Promise<RequestInit>;
|
|
114
|
+
export interface FetchParams {
|
|
115
|
+
url: string;
|
|
116
|
+
init: RequestInit;
|
|
117
|
+
}
|
|
118
|
+
export interface RequestOpts {
|
|
119
|
+
path: string;
|
|
120
|
+
method: HTTPMethod;
|
|
121
|
+
headers: HTTPHeaders;
|
|
122
|
+
query?: HTTPQuery;
|
|
123
|
+
body?: HTTPBody;
|
|
124
|
+
}
|
|
125
|
+
export declare function querystring(params: HTTPQuery, prefix?: string): string;
|
|
126
|
+
export declare function exists(json: any, key: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Every generated date call site routes through these.
|
|
129
|
+
*
|
|
130
|
+
* `format: date` is a calendar date, with no time and no offset, so it is converted
|
|
131
|
+
* against the local calendar on both ends: they have to agree or the date shifts by
|
|
132
|
+
* a day. `format: date-time` is an instant and uses UTC.
|
|
133
|
+
*/
|
|
134
|
+
export declare function serializeDateTime(value: Date): string;
|
|
135
|
+
export declare function serializeDate(value: Date): string;
|
|
136
|
+
export declare function parseDate(value: Date | string): Date;
|
|
137
|
+
export declare function parseDateTime(value: any): Date;
|
|
138
|
+
export declare function mapValues(data: any, fn: (item: any) => any): {
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
};
|
|
141
|
+
export declare function anyToJSON(value: any): any;
|
|
142
|
+
export declare function canConsumeForm(consumes: Consume[]): boolean;
|
|
143
|
+
export interface Consume {
|
|
144
|
+
contentType: string;
|
|
145
|
+
}
|
|
146
|
+
export interface RequestContext {
|
|
147
|
+
fetch: FetchAPI;
|
|
148
|
+
url: string;
|
|
149
|
+
init: RequestInit;
|
|
150
|
+
}
|
|
151
|
+
export interface ResponseContext {
|
|
152
|
+
fetch: FetchAPI;
|
|
153
|
+
url: string;
|
|
154
|
+
init: RequestInit;
|
|
155
|
+
response: Response;
|
|
156
|
+
}
|
|
157
|
+
export interface ErrorContext {
|
|
158
|
+
fetch: FetchAPI;
|
|
159
|
+
url: string;
|
|
160
|
+
init: RequestInit;
|
|
161
|
+
error: unknown;
|
|
162
|
+
response?: Response;
|
|
163
|
+
}
|
|
164
|
+
export interface Middleware {
|
|
165
|
+
pre?(context: RequestContext): Promise<FetchParams | void>;
|
|
166
|
+
post?(context: ResponseContext): Promise<Response | void>;
|
|
167
|
+
onError?(context: ErrorContext): Promise<Response | void>;
|
|
168
|
+
}
|
|
169
|
+
export interface ApiResponse<T> {
|
|
170
|
+
raw: Response;
|
|
171
|
+
value(): Promise<T>;
|
|
172
|
+
}
|
|
173
|
+
export interface ResponseTransformer<T> {
|
|
174
|
+
(json: any): T;
|
|
175
|
+
}
|
|
176
|
+
export declare class JSONApiResponse<T> {
|
|
177
|
+
raw: Response;
|
|
178
|
+
private transformer;
|
|
179
|
+
constructor(raw: Response, transformer?: ResponseTransformer<T>);
|
|
180
|
+
value(): Promise<T>;
|
|
181
|
+
}
|
|
182
|
+
export declare class VoidApiResponse {
|
|
183
|
+
raw: Response;
|
|
184
|
+
constructor(raw: Response);
|
|
185
|
+
value(): Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A Blob carrying the file name the server advertised, empty when it did not send one. It is a File
|
|
189
|
+
* wherever one can be built, and the bare Blob given a name otherwise. Same name and shape as the
|
|
190
|
+
* `typescript` generator's browser HttpFile.
|
|
191
|
+
*/
|
|
192
|
+
export type HttpFile = Blob & {
|
|
193
|
+
readonly name: string;
|
|
194
|
+
};
|
|
195
|
+
export declare class BlobApiResponse {
|
|
196
|
+
raw: Response;
|
|
197
|
+
constructor(raw: Response);
|
|
198
|
+
/**
|
|
199
|
+
* The body named after the Content-Disposition header, so that a download keeps the name the
|
|
200
|
+
* server gave it. A File is built from a native Blob; the Blob itself is named where there is no
|
|
201
|
+
* global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
|
|
202
|
+
* native one, as returned by an injected fetch implementation such as node-fetch, which a File
|
|
203
|
+
* would stringify instead of wrapping.
|
|
204
|
+
*/
|
|
205
|
+
value(): Promise<HttpFile>;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The file name advertised by a Content-Disposition header (RFC 6266): the RFC 5987 encoded
|
|
209
|
+
* `filename*` parameter first, falling back to the plain `filename` when it is malformed, not UTF-8
|
|
210
|
+
* or has no usable name. Any directory part is dropped; undefined when no usable name is advertised.
|
|
211
|
+
*/
|
|
212
|
+
export declare function parseContentDispositionFilename(headers: Headers): string | undefined;
|
|
213
|
+
export declare class TextApiResponse {
|
|
214
|
+
raw: Response;
|
|
215
|
+
constructor(raw: Response);
|
|
216
|
+
value(): Promise<string>;
|
|
217
|
+
}
|