1
0
Fork 0

Added expire after feature

master
WolverinDEV 2021-02-19 21:55:20 +01:00
parent adc942154e
commit 1774b52504
2 changed files with 15 additions and 12 deletions

View File

@ -21,14 +21,15 @@ export class ClientServiceInvite {
this.handle = handle; this.handle = handle;
} }
async createInviteLink(connectProperties: {[key: string]: string}, infoProperties: {[key: string]: string}, createNew: boolean) : Promise<ActionResult<{ linkId: string, adminToken: string }>> { async createInviteLink(connectProperties: {[key: string]: string}, infoProperties: {[key: string]: string}, createNew: boolean, expire_timestamp: number) : Promise<ActionResult<{ linkId: string, adminToken: string }>> {
const connection = this.handle.getConnection(); const connection = this.handle.getConnection();
const notify = connection.catchNotify("NotifyInviteCreated"); const notify = connection.catchNotify("NotifyInviteCreated");
const result = await connection.executeCommand("InviteCreate", { const result = await connection.executeCommand("InviteCreate", {
new_link: createNew, new_link: createNew,
properties_connect: connectProperties, properties_connect: connectProperties,
properties_info: infoProperties properties_info: infoProperties,
timestamp_expired: expire_timestamp
}); });
const notifyResult = notify(); const notifyResult = notify();

View File

@ -1,7 +1,7 @@
/* Basic message declarations */ /* Basic message declarations */
export type Message = export type Message =
| { type: "Command"; token: string; command: MessageCommand } | { type: "Command"; token: string; command: MessageCommand }
| { type: "CommandResult"; token: string | null; result: MessageCommandResult } | { type: "CommandResult"; token: string | null; result: MessageCommandResult }
| { type: "Notify"; notify: MessageNotify }; | { type: "Notify"; notify: MessageNotify };
export type MessageCommand = export type MessageCommand =
@ -21,7 +21,7 @@ export type MessageCommandResult =
| { type: "ServerInternalError" } | { type: "ServerInternalError" }
| { type: "ParameterInvalid"; parameter: string } | { type: "ParameterInvalid"; parameter: string }
| { type: "CommandParseError"; error: string } | { type: "CommandParseError"; error: string }
| { type: "CommandEnqueueError"; fields: string } | { type: "CommandEnqueueError"; error: string }
| { type: "CommandNotFound" } | { type: "CommandNotFound" }
| { type: "CommandNotImplemented" } | { type: "CommandNotImplemented" }
| { type: "SessionAlreadyInitialized" } | { type: "SessionAlreadyInitialized" }
@ -31,8 +31,9 @@ export type MessageCommandResult =
| { type: "SessionInvalidType" } | { type: "SessionInvalidType" }
| { type: "InviteSessionNotInitialized" } | { type: "InviteSessionNotInitialized" }
| { type: "InviteSessionAlreadyInitialized" } | { type: "InviteSessionAlreadyInitialized" }
| { type: "InviteKeyInvalid"; fields: string } | { type: "InviteKeyInvalid"; error: string }
| { type: "InviteKeyNotFound" }; | { type: "InviteKeyNotFound" }
| { type: "InviteKeyExpired" };
export type MessageCommandErrorResult = Exclude<MessageCommandResult, { type: "Success" }>; export type MessageCommandErrorResult = Exclude<MessageCommandResult, { type: "Success" }>;
@ -51,19 +52,20 @@ export enum ClientSessionType {
/* All commands */ /* All commands */
export type CommandSessionInitialize = { anonymize_ip: boolean }; 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 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 */ /* 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 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 } };