@tungoai/sdk 0.2.0 → 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/CHANGELOG.md +90 -1
- package/README.kk.md +7 -5
- package/README.md +9 -7
- package/README.ru.md +7 -5
- package/dist/cjs/chat.js +3 -2
- package/dist/cjs/client.d.ts +6 -1
- package/dist/cjs/client.js +11 -3
- package/dist/cjs/core.d.ts +9 -2
- package/dist/cjs/core.js +191 -17
- package/dist/cjs/errors.d.ts +25 -0
- package/dist/cjs/errors.js +39 -3
- package/dist/cjs/generated/resources.d.ts +191 -2
- package/dist/cjs/generated/resources.js +197 -2
- package/dist/cjs/generated/types.d.ts +957 -428
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/json.d.ts +6 -0
- package/dist/cjs/json.js +17 -0
- package/dist/cjs/pagination.js +2 -1
- package/dist/cjs/streaming.d.ts +4 -2
- package/dist/cjs/streaming.js +40 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/webhooks.d.ts +5 -0
- package/dist/cjs/webhooks.js +17 -3
- package/dist/esm/chat.js +3 -2
- package/dist/esm/client.d.ts +6 -1
- package/dist/esm/client.js +11 -3
- package/dist/esm/core.d.ts +9 -2
- package/dist/esm/core.js +191 -17
- package/dist/esm/errors.d.ts +25 -0
- package/dist/esm/errors.js +36 -1
- package/dist/esm/generated/resources.d.ts +191 -2
- package/dist/esm/generated/resources.js +194 -1
- package/dist/esm/generated/types.d.ts +957 -428
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/json.d.ts +6 -0
- package/dist/esm/json.js +16 -0
- package/dist/esm/pagination.js +2 -1
- package/dist/esm/streaming.d.ts +4 -2
- package/dist/esm/streaming.js +41 -3
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webhooks.d.ts +5 -0
- package/dist/esm/webhooks.js +17 -3
- package/package.json +1 -1
package/dist/esm/errors.d.ts
CHANGED
|
@@ -79,6 +79,31 @@ export declare class DecodeError extends TungoError {
|
|
|
79
79
|
cause?: unknown;
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* A stream of items (not chat events; for example `feed.listEvents`) carried an `error` event: the
|
|
84
|
+
* server could not go on and ended the stream. It is thrown by the `for await` loop after the
|
|
85
|
+
* items that came before it. The stream did not finish: reconnect (from the cursor of the last
|
|
86
|
+
* item) to resume it.
|
|
87
|
+
*/
|
|
88
|
+
export declare class StreamError extends TungoError {
|
|
89
|
+
/** The machine-readable reason, for example `feed_failed`; null when the event had none. */
|
|
90
|
+
readonly code: string | null;
|
|
91
|
+
/** The text for people. */
|
|
92
|
+
readonly detail: string;
|
|
93
|
+
/** Request id: `request_id` of the event, else the `x-request-id` header. Quote it to support. */
|
|
94
|
+
readonly requestId: string | null;
|
|
95
|
+
/** Every other property of the event data. */
|
|
96
|
+
readonly extra: Record<string, unknown>;
|
|
97
|
+
/** The data of the event as received (possibly truncated to 2000 characters). */
|
|
98
|
+
readonly body: string;
|
|
99
|
+
constructor(init: {
|
|
100
|
+
code: string | null;
|
|
101
|
+
detail: string;
|
|
102
|
+
requestId: string | null;
|
|
103
|
+
extra: Record<string, unknown>;
|
|
104
|
+
body: string;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
82
107
|
/** Why a webhook was rejected. */
|
|
83
108
|
export type WebhookVerificationReason = 'invalid_tolerance' | 'invalid_secret' | 'missing_header' | 'malformed_timestamp' | 'timestamp_too_old' | 'timestamp_too_new' | 'signature_mismatch' | 'invalid_payload';
|
|
84
109
|
/** A webhook failed verification. Never trust the payload when this is thrown. */
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Code generated by tungo-sdkgen. DO NOT EDIT.
|
|
2
|
+
import { parseJSON } from './json.js';
|
|
2
3
|
/** Base class of every error thrown by the SDK. */
|
|
3
4
|
export class TungoError extends Error {
|
|
4
5
|
constructor(message, options) {
|
|
@@ -69,6 +70,39 @@ export class DecodeError extends TungoError {
|
|
|
69
70
|
this.partialResult = undefined;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* A stream of items (not chat events; for example `feed.listEvents`) carried an `error` event: the
|
|
75
|
+
* server could not go on and ended the stream. It is thrown by the `for await` loop after the
|
|
76
|
+
* items that came before it. The stream did not finish: reconnect (from the cursor of the last
|
|
77
|
+
* item) to resume it.
|
|
78
|
+
*/
|
|
79
|
+
export class StreamError extends TungoError {
|
|
80
|
+
/** The machine-readable reason, for example `feed_failed`; null when the event had none. */
|
|
81
|
+
code;
|
|
82
|
+
/** The text for people. */
|
|
83
|
+
detail;
|
|
84
|
+
/** Request id: `request_id` of the event, else the `x-request-id` header. Quote it to support. */
|
|
85
|
+
requestId;
|
|
86
|
+
/** Every other property of the event data. */
|
|
87
|
+
extra;
|
|
88
|
+
/** The data of the event as received (possibly truncated to 2000 characters). */
|
|
89
|
+
body;
|
|
90
|
+
constructor(init) {
|
|
91
|
+
let text = 'Tungo stream error';
|
|
92
|
+
if (init.code !== null)
|
|
93
|
+
text += ' (' + init.code + ')';
|
|
94
|
+
text += ': ' + init.detail;
|
|
95
|
+
if (init.requestId !== null)
|
|
96
|
+
text += ' [request id ' + init.requestId + ']';
|
|
97
|
+
super(text);
|
|
98
|
+
this.name = 'StreamError';
|
|
99
|
+
this.code = init.code;
|
|
100
|
+
this.detail = init.detail;
|
|
101
|
+
this.requestId = init.requestId;
|
|
102
|
+
this.extra = init.extra;
|
|
103
|
+
this.body = init.body.length > 2000 ? init.body.slice(0, 2000) : init.body;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
72
106
|
/** A webhook failed verification. Never trust the payload when this is thrown. */
|
|
73
107
|
export class WebhookVerificationError extends TungoError {
|
|
74
108
|
reason;
|
|
@@ -358,7 +392,8 @@ export function apiErrorFromResponse(status, headers, body, nowMs = Date.now())
|
|
|
358
392
|
};
|
|
359
393
|
let parsed;
|
|
360
394
|
try {
|
|
361
|
-
|
|
395
|
+
// parseJSON keeps an integer beyond 2^53 (a 64-bit amount in `extra`) exact, as a bigint.
|
|
396
|
+
parsed = parseJSON(body);
|
|
362
397
|
}
|
|
363
398
|
catch {
|
|
364
399
|
parsed = undefined;
|
|
@@ -117,6 +117,38 @@ export interface ChatListParams {
|
|
|
117
117
|
/** Сколько на странице: 1–100, по умолчанию 50 */
|
|
118
118
|
limit?: number | undefined;
|
|
119
119
|
}
|
|
120
|
+
/** Query parameters of `chat.listFiles`. */
|
|
121
|
+
export interface ChatListFilesParams {
|
|
122
|
+
/** next_cursor прошлой страницы; без него — самые новые файлы. Фильтры — те же, что у первой страницы */
|
|
123
|
+
cursor?: string | undefined;
|
|
124
|
+
/** Только из этого разговора */
|
|
125
|
+
dialog_id?: string | undefined;
|
|
126
|
+
/** Только этого формата: xlsx, docx, pdf или csv */
|
|
127
|
+
format?: T.ListCompanyChatFilesFormat | undefined;
|
|
128
|
+
/** Сколько на странице: 1–200, по умолчанию 50 */
|
|
129
|
+
limit?: number | undefined;
|
|
130
|
+
/** Подстрока имени файла, без учёта регистра */
|
|
131
|
+
q?: string | undefined;
|
|
132
|
+
}
|
|
133
|
+
/** Query parameters of `chat.listMentions`. */
|
|
134
|
+
export interface ChatListMentionsParams {
|
|
135
|
+
/** Сколько на каждый вид: 1–20, по умолчанию 8 */
|
|
136
|
+
limit?: number | undefined;
|
|
137
|
+
/** Что ищем: часть номера, названия, имени; у контрагента — от 2 знаков (или БИН цифрами). Пусто — свежие предложения и задания */
|
|
138
|
+
q?: string | undefined;
|
|
139
|
+
/** Виды через запятую; по умолчанию все. `proposal` — предложение (документ для 1С), id — его номер P-000123; `counterparty` — контрагент из 1С компании, id — его ссылка из поиска; `batch` — задание пачки (разбор выписки, в… */
|
|
140
|
+
types?: string | undefined;
|
|
141
|
+
}
|
|
142
|
+
/** Query parameters of `chat.getRatingOptions`. */
|
|
143
|
+
export interface ChatGetRatingOptionsParams {
|
|
144
|
+
/** Язык названий причин; по умолчанию ru */
|
|
145
|
+
lang?: T.ListCompanyChatRatingOptionsLang | undefined;
|
|
146
|
+
}
|
|
147
|
+
/** Query parameters of `chat.listSuggestions`. */
|
|
148
|
+
export interface ChatListSuggestionsParams {
|
|
149
|
+
/** Язык текстов — язык интерфейса кабинета. Не передан — язык ответов ИИ из профиля (`kk` — по-казахски, иначе по-русски) */
|
|
150
|
+
lang?: T.ListCompanyChatSuggestionsLang | undefined;
|
|
151
|
+
}
|
|
120
152
|
/** Query parameters of `chat.listEvents`. */
|
|
121
153
|
export interface ChatListEventsParams {
|
|
122
154
|
/** Номер хода (X-Turn-No), к которому переподключиться; без него — к текущему */
|
|
@@ -124,6 +156,10 @@ export interface ChatListEventsParams {
|
|
|
124
156
|
}
|
|
125
157
|
/** Query parameters of `proposals.list`. */
|
|
126
158
|
export interface ProposalsListParams {
|
|
159
|
+
/** true — только отправленные на одобрение и ещё не решённые; false — только остальные */
|
|
160
|
+
approval_requested?: T.ListCompanyProposalsApprovalRequested | undefined;
|
|
161
|
+
/** Только документы одного задания пачки (bat_…) — тот же состав, что в сводке задания и у «Одобрить и отправить в 1С». Не id задания — 400; задания нет — пустой список */
|
|
162
|
+
batch_id?: string | undefined;
|
|
127
163
|
/** next_cursor из ответа прошлой страницы; без него — первая (самая свежая) страница. Остальные фильтры — те же, что у первой страницы. */
|
|
128
164
|
cursor?: string | undefined;
|
|
129
165
|
/** Созданные не раньше этого дня (ГГГГ-ММ-ДД, день по Алматы) */
|
|
@@ -134,8 +170,10 @@ export interface ProposalsListParams {
|
|
|
134
170
|
kind?: string | undefined;
|
|
135
171
|
/** Сколько на странице: 1–100, по умолчанию 20 */
|
|
136
172
|
limit?: number | undefined;
|
|
137
|
-
/** Поиск без учёта регистра: номер предложения (P-…), номер документа 1С, контрагент (имя из превью),
|
|
173
|
+
/** Поиск без учёта регистра: номер предложения (P-…), номер документа 1С, контрагент (имя из превью), БИН/ИИН, сумма (как пишут: «150 000,50» или 150000.5) и другие реквизиты документа */
|
|
138
174
|
q?: string | undefined;
|
|
175
|
+
/** Только из этих источников (origin.source): один или несколько через запятую (chat, statement, esf, automation). Неизвестный — 400 */
|
|
176
|
+
source?: string | undefined;
|
|
139
177
|
/** Только в этих статусах: один или несколько через запятую (previewed, approved, rejected, committed, posted, verified, mismatch, failed); без него — все. Неизвестный — 400 */
|
|
140
178
|
status?: string | undefined;
|
|
141
179
|
}
|
|
@@ -536,6 +574,68 @@ export declare class ChatResource {
|
|
|
536
574
|
* Required permission: `chat.use`.
|
|
537
575
|
*/
|
|
538
576
|
countTokens(co: string, body: T.ChatTokenCountRequest, options?: RequestOptions): APIPromise<T.ChatTokenCount>;
|
|
577
|
+
/**
|
|
578
|
+
* Файлы от ИИ в своих разговорах, новые сверху
|
|
579
|
+
*
|
|
580
|
+
* Returns one page; iterate the result with `for await` to walk every item of every page.
|
|
581
|
+
*
|
|
582
|
+
* `GET /v1/companies/{co}/chat/files`
|
|
583
|
+
*
|
|
584
|
+
* Required permission: `chat.use`.
|
|
585
|
+
*/
|
|
586
|
+
listFiles(co: string, query?: ChatListFilesParams, options?: RequestOptions): PagePromise<T.ChatFileItem, T.ChatFileList>;
|
|
587
|
+
/**
|
|
588
|
+
* Every item of `listFiles`, across all pages. Pages are fetched lazily; leaving the loop stops fetching.
|
|
589
|
+
*/
|
|
590
|
+
listFilesAll(co: string, query?: ChatListFilesParams, options?: RequestOptions): AsyncGenerator<T.ChatFileItem, void, undefined>;
|
|
591
|
+
/**
|
|
592
|
+
* Что можно упомянуть через «@»
|
|
593
|
+
*
|
|
594
|
+
* `GET /v1/companies/{co}/chat/mentions`
|
|
595
|
+
*
|
|
596
|
+
* Required permission: `chat.use`.
|
|
597
|
+
*/
|
|
598
|
+
listMentions(co: string, query?: ChatListMentionsParams, options?: RequestOptions): APIPromise<T.ChatMentionSearch>;
|
|
599
|
+
/**
|
|
600
|
+
* Что нужно форме оценки: причины «вниз» и предел комментария
|
|
601
|
+
*
|
|
602
|
+
* `GET /v1/companies/{co}/chat/rating-options`
|
|
603
|
+
*
|
|
604
|
+
* Required permission: `chat.use`.
|
|
605
|
+
*/
|
|
606
|
+
getRatingOptions(co: string, query?: ChatGetRatingOptionsParams, options?: RequestOptions): APIPromise<T.ChatRatingOptions>;
|
|
607
|
+
/**
|
|
608
|
+
* Подсказки пустого чата
|
|
609
|
+
*
|
|
610
|
+
* `GET /v1/companies/{co}/chat/suggestions`
|
|
611
|
+
*
|
|
612
|
+
* Required permission: `chat.use`.
|
|
613
|
+
*/
|
|
614
|
+
listSuggestions(co: string, query?: ChatListSuggestionsParams, options?: RequestOptions): APIPromise<T.ChatSuggestions>;
|
|
615
|
+
/**
|
|
616
|
+
* Начать загрузку архива к сообщению
|
|
617
|
+
*
|
|
618
|
+
* `POST /v1/companies/{co}/chat/uploads`
|
|
619
|
+
*
|
|
620
|
+
* Required permission: `chat.use`.
|
|
621
|
+
*/
|
|
622
|
+
createUpload(co: string, body: T.ChatUploadCreate, options?: RequestOptions): APIPromise<T.ChatUpload>;
|
|
623
|
+
/**
|
|
624
|
+
* Отменить загрузку архива
|
|
625
|
+
*
|
|
626
|
+
* `DELETE /v1/companies/{co}/chat/uploads/{upload}`
|
|
627
|
+
*
|
|
628
|
+
* Required permission: `chat.use`.
|
|
629
|
+
*/
|
|
630
|
+
deleteUpload(co: string, upload: string, options?: RequestOptions): APIPromise<void>;
|
|
631
|
+
/**
|
|
632
|
+
* Часть архива
|
|
633
|
+
*
|
|
634
|
+
* `PUT /v1/companies/{co}/chat/uploads/{upload}/parts/{n}`
|
|
635
|
+
*
|
|
636
|
+
* Required permission: `chat.use`.
|
|
637
|
+
*/
|
|
638
|
+
putUploadPart(co: string, upload: string, n: string, options?: RequestOptions): APIPromise<T.ChatUploadPart>;
|
|
539
639
|
/**
|
|
540
640
|
* Разговор целиком
|
|
541
641
|
*
|
|
@@ -590,6 +690,38 @@ export declare class ChatResource {
|
|
|
590
690
|
* Required permission: `chat.use`.
|
|
591
691
|
*/
|
|
592
692
|
listEvents(co: string, id: string, query?: ChatListEventsParams, options?: RequestOptions): ChatStreamPromise;
|
|
693
|
+
/**
|
|
694
|
+
* Оценить ответ ИИ: палец вверх или вниз
|
|
695
|
+
*
|
|
696
|
+
* `PUT /v1/companies/{co}/chat/{id}/messages/{turn}/rating`
|
|
697
|
+
*
|
|
698
|
+
* Required permission: `chat.use`.
|
|
699
|
+
*/
|
|
700
|
+
rateMessage(co: string, id: string, turn: string, body: T.ChatMessageRatingBody, options?: RequestOptions): APIPromise<T.ChatMessageRated>;
|
|
701
|
+
/**
|
|
702
|
+
* Снять свою оценку ответа
|
|
703
|
+
*
|
|
704
|
+
* `DELETE /v1/companies/{co}/chat/{id}/messages/{turn}/rating`
|
|
705
|
+
*
|
|
706
|
+
* Required permission: `chat.use`.
|
|
707
|
+
*/
|
|
708
|
+
deleteMessageRating(co: string, id: string, turn: string, options?: RequestOptions): APIPromise<T.ChatMessageRated>;
|
|
709
|
+
/**
|
|
710
|
+
* Оценить разговор целиком: от 1 до 5
|
|
711
|
+
*
|
|
712
|
+
* `PUT /v1/companies/{co}/chat/{id}/rating`
|
|
713
|
+
*
|
|
714
|
+
* Required permission: `chat.use`.
|
|
715
|
+
*/
|
|
716
|
+
rate(co: string, id: string, body: T.ChatDialogRatingBody, options?: RequestOptions): APIPromise<T.ChatDialogRated>;
|
|
717
|
+
/**
|
|
718
|
+
* Не сейчас: закрыть предложение оценить разговор
|
|
719
|
+
*
|
|
720
|
+
* `POST /v1/companies/{co}/chat/{id}/rating/dismiss`
|
|
721
|
+
*
|
|
722
|
+
* Required permission: `chat.use`.
|
|
723
|
+
*/
|
|
724
|
+
dismissRating(co: string, id: string, options?: RequestOptions): APIPromise<T.ChatRatingDismissed>;
|
|
593
725
|
/**
|
|
594
726
|
* Остановить ход или закрыть открытый вопрос
|
|
595
727
|
*
|
|
@@ -598,6 +730,14 @@ export declare class ChatResource {
|
|
|
598
730
|
* Required permission: `chat.use`.
|
|
599
731
|
*/
|
|
600
732
|
stop(co: string, id: string, options?: RequestOptions): APIPromise<T.ChatStopResult>;
|
|
733
|
+
/**
|
|
734
|
+
* Перевести размышление на русский
|
|
735
|
+
*
|
|
736
|
+
* `POST /v1/companies/{co}/chat/{id}/thinking/{tid}/translate`
|
|
737
|
+
*
|
|
738
|
+
* Required permission: `chat.use`.
|
|
739
|
+
*/
|
|
740
|
+
translateThinking(co: string, id: string, tid: string, options?: RequestOptions): APIPromise<T.ChatThinkingTranslation>;
|
|
601
741
|
}
|
|
602
742
|
/** Предложения документов ИИ-бухгалтера: просмотр, одобрение записи в 1С и отклонение */
|
|
603
743
|
export declare class ProposalsResource {
|
|
@@ -649,6 +789,14 @@ export declare class ProposalsResource {
|
|
|
649
789
|
* Required permission: `proposals.approve`.
|
|
650
790
|
*/
|
|
651
791
|
reject(co: string, id: string, body: T.RejectRequest, options?: RequestOptions): APIPromise<T.ProposalDecision>;
|
|
792
|
+
/**
|
|
793
|
+
* Отправить на одобрение
|
|
794
|
+
*
|
|
795
|
+
* `POST /v1/companies/{co}/proposals/{id}/request-approval`
|
|
796
|
+
*
|
|
797
|
+
* Required permission: `proposals.create`.
|
|
798
|
+
*/
|
|
799
|
+
requestApproval(co: string, id: string, body?: T.ProposalApprovalRequestBody, options?: RequestOptions): APIPromise<T.ProposalApprovalRequestResult>;
|
|
652
800
|
}
|
|
653
801
|
/** Лента событий и предложений компании (страницы и живой поток SSE) */
|
|
654
802
|
export declare class FeedResource {
|
|
@@ -869,7 +1017,8 @@ export declare class AutomationsResource {
|
|
|
869
1017
|
* Принять событие по адресу хука
|
|
870
1018
|
*
|
|
871
1019
|
* The body is sent as it is (text or bytes) or serialised as JSON. With `options.secret` the exact bytes
|
|
872
|
-
* are signed in the `X-Signature: sha256=<hex>` header
|
|
1020
|
+
* are signed in the `X-Signature: sha256=<hex>` header, or in `options.signatureHeader` for a hook created with
|
|
1021
|
+
* its own `signature_header`. The API key is never sent to this endpoint.
|
|
873
1022
|
*
|
|
874
1023
|
* `POST /hooks/{token}`
|
|
875
1024
|
*/
|
|
@@ -1057,3 +1206,43 @@ export declare class AutomationsResource {
|
|
|
1057
1206
|
*/
|
|
1058
1207
|
putAutonomy(co: string, body: T.CompanyAutonomyInput, options?: RequestOptions): APIPromise<T.CompanyAutonomy>;
|
|
1059
1208
|
}
|
|
1209
|
+
/** Публичная проверка электронной подписи документов Tungo: по коду, по файлу, по блоку QR и ключи подписи (без ключа API) */
|
|
1210
|
+
export declare class VerificationResource {
|
|
1211
|
+
#private;
|
|
1212
|
+
constructor(client: APIClient);
|
|
1213
|
+
/**
|
|
1214
|
+
* Ключи подписи QR (JWKS)
|
|
1215
|
+
*
|
|
1216
|
+
* `GET /v1/public/verify-keys`
|
|
1217
|
+
*/
|
|
1218
|
+
listKeys(options?: RequestOptions): APIPromise<T.VerifyKeys>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Проверить подписанный блок QR
|
|
1221
|
+
*
|
|
1222
|
+
* `POST /v1/public/verify/qr`
|
|
1223
|
+
*/
|
|
1224
|
+
verifyQr(body: T.VerifyQrInput, options?: RequestOptions): APIPromise<T.VerifyQrResult>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Проверка подписи документа по коду
|
|
1227
|
+
*
|
|
1228
|
+
* `GET /v1/public/verify/{code}`
|
|
1229
|
+
*/
|
|
1230
|
+
get(code: string, options?: RequestOptions): APIPromise<T.PublicVerification>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Сверить файл с подписанным
|
|
1233
|
+
*
|
|
1234
|
+
* `POST /v1/public/verify/{code}/check`
|
|
1235
|
+
*/
|
|
1236
|
+
check(code: string, body: T.VerifyCheckInput, options?: RequestOptions): APIPromise<T.VerifyCheck>;
|
|
1237
|
+
}
|
|
1238
|
+
/** Публичный список загрузок: расширение 1С и Tungo Connector (без ключа API) */
|
|
1239
|
+
export declare class ReleasesResource {
|
|
1240
|
+
#private;
|
|
1241
|
+
constructor(client: APIClient);
|
|
1242
|
+
/**
|
|
1243
|
+
* Что скачать
|
|
1244
|
+
*
|
|
1245
|
+
* `GET /v1/public/downloads`
|
|
1246
|
+
*/
|
|
1247
|
+
list(options?: RequestOptions): APIPromise<T.Downloads>;
|
|
1248
|
+
}
|
|
@@ -389,6 +389,84 @@ export class ChatResource {
|
|
|
389
389
|
countTokens(co, body, options) {
|
|
390
390
|
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/chat/count-tokens', pathParams: { co }, body, options });
|
|
391
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Файлы от ИИ в своих разговорах, новые сверху
|
|
394
|
+
*
|
|
395
|
+
* Returns one page; iterate the result with `for await` to walk every item of every page.
|
|
396
|
+
*
|
|
397
|
+
* `GET /v1/companies/{co}/chat/files`
|
|
398
|
+
*
|
|
399
|
+
* Required permission: `chat.use`.
|
|
400
|
+
*/
|
|
401
|
+
listFiles(co, query, options) {
|
|
402
|
+
return requestPage(this.#client, { method: 'GET', path: '/v1/companies/{co}/chat/files', pathParams: { co }, query, options });
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Every item of `listFiles`, across all pages. Pages are fetched lazily; leaving the loop stops fetching.
|
|
406
|
+
*/
|
|
407
|
+
listFilesAll(co, query, options) {
|
|
408
|
+
return this.listFiles(co, query, options)[Symbol.asyncIterator]();
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Что можно упомянуть через «@»
|
|
412
|
+
*
|
|
413
|
+
* `GET /v1/companies/{co}/chat/mentions`
|
|
414
|
+
*
|
|
415
|
+
* Required permission: `chat.use`.
|
|
416
|
+
*/
|
|
417
|
+
listMentions(co, query, options) {
|
|
418
|
+
return this.#client.request({ method: 'GET', path: '/v1/companies/{co}/chat/mentions', pathParams: { co }, query, options });
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Что нужно форме оценки: причины «вниз» и предел комментария
|
|
422
|
+
*
|
|
423
|
+
* `GET /v1/companies/{co}/chat/rating-options`
|
|
424
|
+
*
|
|
425
|
+
* Required permission: `chat.use`.
|
|
426
|
+
*/
|
|
427
|
+
getRatingOptions(co, query, options) {
|
|
428
|
+
return this.#client.request({ method: 'GET', path: '/v1/companies/{co}/chat/rating-options', pathParams: { co }, query, options });
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Подсказки пустого чата
|
|
432
|
+
*
|
|
433
|
+
* `GET /v1/companies/{co}/chat/suggestions`
|
|
434
|
+
*
|
|
435
|
+
* Required permission: `chat.use`.
|
|
436
|
+
*/
|
|
437
|
+
listSuggestions(co, query, options) {
|
|
438
|
+
return this.#client.request({ method: 'GET', path: '/v1/companies/{co}/chat/suggestions', pathParams: { co }, query, options });
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Начать загрузку архива к сообщению
|
|
442
|
+
*
|
|
443
|
+
* `POST /v1/companies/{co}/chat/uploads`
|
|
444
|
+
*
|
|
445
|
+
* Required permission: `chat.use`.
|
|
446
|
+
*/
|
|
447
|
+
createUpload(co, body, options) {
|
|
448
|
+
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/chat/uploads', pathParams: { co }, body, options });
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Отменить загрузку архива
|
|
452
|
+
*
|
|
453
|
+
* `DELETE /v1/companies/{co}/chat/uploads/{upload}`
|
|
454
|
+
*
|
|
455
|
+
* Required permission: `chat.use`.
|
|
456
|
+
*/
|
|
457
|
+
deleteUpload(co, upload, options) {
|
|
458
|
+
return this.#client.request({ method: 'DELETE', path: '/v1/companies/{co}/chat/uploads/{upload}', pathParams: { co, upload }, emptyResult: true, options });
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Часть архива
|
|
462
|
+
*
|
|
463
|
+
* `PUT /v1/companies/{co}/chat/uploads/{upload}/parts/{n}`
|
|
464
|
+
*
|
|
465
|
+
* Required permission: `chat.use`.
|
|
466
|
+
*/
|
|
467
|
+
putUploadPart(co, upload, n, options) {
|
|
468
|
+
return this.#client.request({ method: 'PUT', path: '/v1/companies/{co}/chat/uploads/{upload}/parts/{n}', pathParams: { co, upload, n }, options });
|
|
469
|
+
}
|
|
392
470
|
/**
|
|
393
471
|
* Разговор целиком
|
|
394
472
|
*
|
|
@@ -455,6 +533,46 @@ export class ChatResource {
|
|
|
455
533
|
listEvents(co, id, query, options) {
|
|
456
534
|
return new ChatStreamPromise(this.#client.openStream({ method: 'GET', path: '/v1/companies/{co}/chat/{id}/events', pathParams: { co, id }, query, options }, (init) => new ChatStream(init)));
|
|
457
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* Оценить ответ ИИ: палец вверх или вниз
|
|
538
|
+
*
|
|
539
|
+
* `PUT /v1/companies/{co}/chat/{id}/messages/{turn}/rating`
|
|
540
|
+
*
|
|
541
|
+
* Required permission: `chat.use`.
|
|
542
|
+
*/
|
|
543
|
+
rateMessage(co, id, turn, body, options) {
|
|
544
|
+
return this.#client.request({ method: 'PUT', path: '/v1/companies/{co}/chat/{id}/messages/{turn}/rating', pathParams: { co, id, turn }, body, options });
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Снять свою оценку ответа
|
|
548
|
+
*
|
|
549
|
+
* `DELETE /v1/companies/{co}/chat/{id}/messages/{turn}/rating`
|
|
550
|
+
*
|
|
551
|
+
* Required permission: `chat.use`.
|
|
552
|
+
*/
|
|
553
|
+
deleteMessageRating(co, id, turn, options) {
|
|
554
|
+
return this.#client.request({ method: 'DELETE', path: '/v1/companies/{co}/chat/{id}/messages/{turn}/rating', pathParams: { co, id, turn }, options });
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Оценить разговор целиком: от 1 до 5
|
|
558
|
+
*
|
|
559
|
+
* `PUT /v1/companies/{co}/chat/{id}/rating`
|
|
560
|
+
*
|
|
561
|
+
* Required permission: `chat.use`.
|
|
562
|
+
*/
|
|
563
|
+
rate(co, id, body, options) {
|
|
564
|
+
return this.#client.request({ method: 'PUT', path: '/v1/companies/{co}/chat/{id}/rating', pathParams: { co, id }, body, options });
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Не сейчас: закрыть предложение оценить разговор
|
|
568
|
+
*
|
|
569
|
+
* `POST /v1/companies/{co}/chat/{id}/rating/dismiss`
|
|
570
|
+
*
|
|
571
|
+
* Required permission: `chat.use`.
|
|
572
|
+
*/
|
|
573
|
+
dismissRating(co, id, options) {
|
|
574
|
+
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/chat/{id}/rating/dismiss', pathParams: { co, id }, options });
|
|
575
|
+
}
|
|
458
576
|
/**
|
|
459
577
|
* Остановить ход или закрыть открытый вопрос
|
|
460
578
|
*
|
|
@@ -465,6 +583,16 @@ export class ChatResource {
|
|
|
465
583
|
stop(co, id, options) {
|
|
466
584
|
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/chat/{id}/stop', pathParams: { co, id }, options });
|
|
467
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Перевести размышление на русский
|
|
588
|
+
*
|
|
589
|
+
* `POST /v1/companies/{co}/chat/{id}/thinking/{tid}/translate`
|
|
590
|
+
*
|
|
591
|
+
* Required permission: `chat.use`.
|
|
592
|
+
*/
|
|
593
|
+
translateThinking(co, id, tid, options) {
|
|
594
|
+
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/chat/{id}/thinking/{tid}/translate', pathParams: { co, id, tid }, options });
|
|
595
|
+
}
|
|
468
596
|
}
|
|
469
597
|
/** Предложения документов ИИ-бухгалтера: просмотр, одобрение записи в 1С и отклонение */
|
|
470
598
|
export class ProposalsResource {
|
|
@@ -530,6 +658,16 @@ export class ProposalsResource {
|
|
|
530
658
|
reject(co, id, body, options) {
|
|
531
659
|
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/proposals/{id}/reject', pathParams: { co, id }, body, options });
|
|
532
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Отправить на одобрение
|
|
663
|
+
*
|
|
664
|
+
* `POST /v1/companies/{co}/proposals/{id}/request-approval`
|
|
665
|
+
*
|
|
666
|
+
* Required permission: `proposals.create`.
|
|
667
|
+
*/
|
|
668
|
+
requestApproval(co, id, body, options) {
|
|
669
|
+
return this.#client.request({ method: 'POST', path: '/v1/companies/{co}/proposals/{id}/request-approval', pathParams: { co, id }, body, options });
|
|
670
|
+
}
|
|
533
671
|
}
|
|
534
672
|
/** Лента событий и предложений компании (страницы и живой поток SSE) */
|
|
535
673
|
export class FeedResource {
|
|
@@ -810,7 +948,8 @@ export class AutomationsResource {
|
|
|
810
948
|
* Принять событие по адресу хука
|
|
811
949
|
*
|
|
812
950
|
* The body is sent as it is (text or bytes) or serialised as JSON. With `options.secret` the exact bytes
|
|
813
|
-
* are signed in the `X-Signature: sha256=<hex>` header
|
|
951
|
+
* are signed in the `X-Signature: sha256=<hex>` header, or in `options.signatureHeader` for a hook created with
|
|
952
|
+
* its own `signature_header`. The API key is never sent to this endpoint.
|
|
814
953
|
*
|
|
815
954
|
* `POST /hooks/{token}`
|
|
816
955
|
*/
|
|
@@ -1046,3 +1185,57 @@ export class AutomationsResource {
|
|
|
1046
1185
|
return this.#client.request({ method: 'PUT', path: '/v1/companies/{co}/autonomy', pathParams: { co }, body, options });
|
|
1047
1186
|
}
|
|
1048
1187
|
}
|
|
1188
|
+
/** Публичная проверка электронной подписи документов Tungo: по коду, по файлу, по блоку QR и ключи подписи (без ключа API) */
|
|
1189
|
+
export class VerificationResource {
|
|
1190
|
+
#client;
|
|
1191
|
+
constructor(client) {
|
|
1192
|
+
this.#client = client;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Ключи подписи QR (JWKS)
|
|
1196
|
+
*
|
|
1197
|
+
* `GET /v1/public/verify-keys`
|
|
1198
|
+
*/
|
|
1199
|
+
listKeys(options) {
|
|
1200
|
+
return this.#client.request({ method: 'GET', path: '/v1/public/verify-keys', auth: 'public', options });
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Проверить подписанный блок QR
|
|
1204
|
+
*
|
|
1205
|
+
* `POST /v1/public/verify/qr`
|
|
1206
|
+
*/
|
|
1207
|
+
verifyQr(body, options) {
|
|
1208
|
+
return this.#client.request({ method: 'POST', path: '/v1/public/verify/qr', body, auth: 'public', options });
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Проверка подписи документа по коду
|
|
1212
|
+
*
|
|
1213
|
+
* `GET /v1/public/verify/{code}`
|
|
1214
|
+
*/
|
|
1215
|
+
get(code, options) {
|
|
1216
|
+
return this.#client.request({ method: 'GET', path: '/v1/public/verify/{code}', pathParams: { code }, auth: 'public', options });
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Сверить файл с подписанным
|
|
1220
|
+
*
|
|
1221
|
+
* `POST /v1/public/verify/{code}/check`
|
|
1222
|
+
*/
|
|
1223
|
+
check(code, body, options) {
|
|
1224
|
+
return this.#client.request({ method: 'POST', path: '/v1/public/verify/{code}/check', pathParams: { code }, body, auth: 'public', options });
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
/** Публичный список загрузок: расширение 1С и Tungo Connector (без ключа API) */
|
|
1228
|
+
export class ReleasesResource {
|
|
1229
|
+
#client;
|
|
1230
|
+
constructor(client) {
|
|
1231
|
+
this.#client = client;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Что скачать
|
|
1235
|
+
*
|
|
1236
|
+
* `GET /v1/public/downloads`
|
|
1237
|
+
*/
|
|
1238
|
+
list(options) {
|
|
1239
|
+
return this.#client.request({ method: 'GET', path: '/v1/public/downloads', auth: 'public', options });
|
|
1240
|
+
}
|
|
1241
|
+
}
|