diff --git a/src/ClientServiceInvite.ts b/src/ClientServiceInvite.ts index 65e1ab0..7557a1c 100644 --- a/src/ClientServiceInvite.ts +++ b/src/ClientServiceInvite.ts @@ -21,14 +21,15 @@ export class ClientServiceInvite { this.handle = handle; } - async createInviteLink(connectProperties: {[key: string]: string}, infoProperties: {[key: string]: string}, createNew: boolean) : Promise> { + async createInviteLink(connectProperties: {[key: string]: string}, infoProperties: {[key: string]: string}, createNew: boolean, expire_timestamp: number) : Promise> { const connection = this.handle.getConnection(); const notify = connection.catchNotify("NotifyInviteCreated"); const result = await connection.executeCommand("InviteCreate", { new_link: createNew, properties_connect: connectProperties, - properties_info: infoProperties + properties_info: infoProperties, + timestamp_expired: expire_timestamp }); const notifyResult = notify(); diff --git a/src/Messages.ts b/src/Messages.ts index 1fbfdf0..ab9579d 100644 --- a/src/Messages.ts +++ b/src/Messages.ts @@ -1,7 +1,7 @@ /* Basic message declarations */ export type Message = | { type: "Command"; token: string; command: MessageCommand } - | { type: "CommandResult"; token: string | null; result: MessageCommandResult } + | { type: "CommandResult"; token: string | null; result: MessageCommandResult } | { type: "Notify"; notify: MessageNotify }; export type MessageCommand = @@ -21,7 +21,7 @@ export type MessageCommandResult = | { type: "ServerInternalError" } | { type: "ParameterInvalid"; parameter: string } | { type: "CommandParseError"; error: string } - | { type: "CommandEnqueueError"; fields: string } + | { type: "CommandEnqueueError"; error: string } | { type: "CommandNotFound" } | { type: "CommandNotImplemented" } | { type: "SessionAlreadyInitialized" } @@ -31,8 +31,9 @@ export type MessageCommandResult = | { type: "SessionInvalidType" } | { type: "InviteSessionNotInitialized" } | { type: "InviteSessionAlreadyInitialized" } - | { type: "InviteKeyInvalid"; fields: string } - | { type: "InviteKeyNotFound" }; + | { type: "InviteKeyInvalid"; error: string } + | { type: "InviteKeyNotFound" } + | { type: "InviteKeyExpired" }; export type MessageCommandErrorResult = Exclude; @@ -51,19 +52,20 @@ export enum ClientSessionType { /* All commands */ export type CommandSessionInitialize = { anonymize_ip: boolean }; -export type CommandSessionInitializeAgent = { session_type: ClientSessionType; platform: string | null; platform_version: string | null; architecture: string | null; client_version: string | null; ui_version: string | null }; +export type CommandSessionInitializeAgent = { session_type: ClientSessionType; platform: string | null; platform_version: string | null; architecture: string | null; client_version: string | null; ui_version: string | null }; -export type CommandSessionUpdateLocale = { ip_country: string | null; selected_locale: string | null; local_timestamp: number }; +export type CommandSessionUpdateLocale = { ip_country: string | null; selected_locale: string | null; local_timestamp: number }; -export type CommandInviteQueryInfo = { link_id: string, register_view: boolean }; +export type CommandInviteQueryInfo = { link_id: string; register_view: boolean }; export type CommandInviteLogAction = { click_type: number }; -export type CommandInviteCreate = { new_link: boolean; properties_connect: { [key: string]: string }; properties_info: { [key: string]: string } }; +export type CommandInviteCreate = { new_link: boolean; properties_connect: { [key: string]: string }; properties_info: { [key: string]: string }; timestamp_expired: number }; /* Notifies */ -export type NotifyClientsOnline = { users_online: { [key: number]: number }; unique_users_online: { [key: number]: number }; total_users_online: number; total_unique_users_online: number }; +export type NotifyClientsOnline = { users_online: { [key: number]: number }; unique_users_online: { [key: number]: number }; total_users_online: number; total_unique_users_online: number }; export type NotifyInviteCreated = { link_id: string; admin_token: string | null }; -export type NotifyInviteInfo = { link_id: string; timestamp_created: number; timestamp_deleted: number; amount_viewed: number; amount_clicked: number; properties_connect: { [key: string]: string }; properties_info: { [key: string]: string } }; +export type NotifyInviteInfo = { link_id: string; timestamp_created: number; timestamp_deleted: number; timestamp_expired: number; amount_viewed: number; amount_clicked: number; properties_connect: { [key: string]: string }; properties_info: { [key: string]: string } }; +