Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Last active January 24, 2023 12:46
Show Gist options
  • Save wmakeev/83bc10cfb1102007a90179c73ff6bef2 to your computer and use it in GitHub Desktop.
Save wmakeev/83bc10cfb1102007a90179c73ff6bef2 to your computer and use it in GitHub Desktop.
[Yandex.Cloud] #yandex #cloud #trigger #type
type AliceNluEntity =
| {
type: "YANDEX.NUMBER";
tokens: { start: number; end: number };
value: number;
}
| {
type: "YANDEX.STRING";
tokens: { start: number; end: number };
value: string;
}
| {
type: string;
tokens: { start: number; end: number };
value: string;
};
interface AliceEvent {
meta: {
locale: "ru-RU";
/** `Asia/Yekaterinburg` */
timezone: string;
/** `aliced/1.0 (Yandex yandexmini; Linux 1.0)` */
client_id: string;
interfaces: { payments: {}; account_linking: {} };
};
session: {
message_id: number;
session_id: string;
skill_id: string;
user: {
user_id: string;
};
application: {
application_id: string;
};
user_id: string;
new: boolean;
};
request: {
type: "SimpleUtterance";
command: string;
original_utterance: string;
nlu: {
tokens: string[];
entities: AliceEntity[];
intents: Record<string, { slots: Record<string, AliceEntity> }>;
};
markup: { dangerous_context: boolean };
};
version: "1.0";
}
interface FunctionContext {
deadlineMs: number;
token: {
access_token: string;
};
}
interface FunctionEvent {
httpMethod: "GET";
headers: Record<string, string>;
url: string;
params: {};
multiValueParams: {};
pathParams: {};
multiValueHeaders: Record<string, string[]>;
queryStringParameters: Record<string, string>;
multiValueQueryStringParameters: Record<string, string[]>;
requestContext: {
identity: {
sourceIp: string;
userAgent: string;
};
httpMethod: string;
requestId: string;
/** `'6/Dec/2022:12:41:38 +0000'` */
requestTime: string;
/** `1670330498` */
requestTimeEpoch: number;
};
body: string;
isBase64Encoded: boolean;
}
interface FunctionHtmlAsyncResponse {
statusCode?: number;
headers?: Record<string, string>;
multiValueHeaders?: Record<string, string[]>;
body: string;
isBase64Encoded?: boolean;
}
/**
* Триггер для Message Queue
* @link https://cloud.yandex.ru/docs/functions/concepts/trigger/ymq-trigger
*/
interface MessageQueueTriggerLambdaEvent {
messages: Array<{
event_metadata: {
event_id: string;
event_type: "yandex.cloud.events.messagequeue.QueueMessage";
/** Например: `2019-09-24T00:54:28.980441Z` */
created_at: string;
};
details: {
/** Пример: `yrn:yc:ymq:ru-central1:21i6v0tesmsaoeon7pas:event-queue` */
queue_id: string;
message: {
message_id: string;
md5_of_body: string;
body: string;
attributes: {
/** Строка `1569285804456` */
SentTimestamp: string;
};
message_attributes: {
messageAttributeKey: {
dataType: "StringValue";
stringValue: "value";
};
};
md5_of_message_attributes: string;
};
};
}>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment