@levo-so/client
Version:
<img alt="Levo" src="https://static.levocdn.com/png/Levo-Logo.png" width="50" height="50">
129 lines (128 loc) • 3.93 kB
TypeScript
import type { LevoCollectionRoot } from './generated';
export interface ClientOptions {
/**
* The API key to authenticate with the Levo API.
*/
key: string;
/**
* The workspace ID of the Levo Workspace you are working with.
* e.g.: `WABC1234`
*/
workspace: string;
/**
* The domain of the Levo Workspace you are working with, where your site is browsed.
* e.g.: `example.com`
*/
domain?: string;
/**
* Custom API endpoint in case of self-hosted
*/
endpoint?: string;
}
export type LevoTransaction = {
/**
* The identifier of the transaction.
*/
identifier: string;
/**
* The affinity cookie of the transaction.
*/
cookie: string;
};
export type HeaderType = Record<string, string | string[]>;
export type BaseOptions = {
/**
* The transaction identifier for the request.
*/
transaction?: LevoTransaction;
};
export declare namespace NotificationType {
type SendEmailInput = {
/**
* The email addresses to send the email to.
* e.g.: `['example@example.com', 'example2@example.com']`
*/
to: LevoCollectionRoot['so_levo_beacon_notification']['to'];
/**
* The subject of the email.
* e.g.: `'Hello World'`
*/
subject: LevoCollectionRoot['so_levo_beacon_notification']['subject'];
/**
* The content of the email. This can be a string or a richtext email template.
* e.g.: `'<p>This will go in a special richtext email template</p>'`
*/
content: LevoCollectionRoot['so_levo_beacon_notification']['content'];
/**
* The key of the email template to use.
*
* If the key is `'custom'`, the content will be treated as a custom email template of your workspace.
*
* If the key is `'richtext'`, the content will be used in a richtext email template from Levo.
*
* e.g.: `'richtext'`
*/
key?: 'custom' | 'richtext';
/**
* The name of the sender of the email.
* e.g.: `'Demo Foundation'`
*/
from_name?: LevoCollectionRoot['so_levo_beacon_notification']['from_name'];
/**
* The email address to send in the `cc` field of the email.
* e.g.: `['john.doe@example.com']`
*/
cc?: LevoCollectionRoot['so_levo_beacon_notification']['cc'];
/**
* The email address to send in the `bcc` field of the email.
* e.g.: `['jane.doe@example.com']`
*/
bcc?: LevoCollectionRoot['so_levo_beacon_notification']['bcc'];
/**
* The email address to reply to.
* e.g.: `'support@example.com'`
*/
reply_to?: LevoCollectionRoot['so_levo_beacon_notification']['reply_to'];
};
}
export declare namespace MembershipType {
type SignInWithPassword = {
password: string;
} & ({
email: string;
username?: undefined;
} | {
email?: undefined;
username: string;
});
type MembershipOptions = BaseOptions & {
/**
* The domain of the Levo Workspace you are working with, where your site is browsed.
* e.g.: `example.com`
*/
domain?: string;
};
type TokenResponse = {
access_token: string;
};
type RequestOtpInput = {
content: string;
medium: 'email';
};
type RequestOtpResponse = {
_id: string;
content: string;
};
type RequestMagicLinkInput = RequestOtpInput & {
redirect_uri: string;
};
type RequestMagicLinkResponse = RequestOtpResponse;
type SignInWithOtpInput = {
content: string;
code: string;
};
type SignInWithOtpResponse = {
data: LevoCollectionRoot['so_levo_membership_account'];
meta: TokenResponse;
};
}