@vincentt-sdks/campaign-sdk
Version:
Campaign SDK by Vincentt
53 lines (52 loc) • 2.99 kB
TypeScript
import { CampaignsOptions, ClaimCouponParams, CreateEntryParams, CreateFormEntryParams, FetchEntryParams, Session, UpdateEntryParams, UpdateUserParams, UploadImageParams } from '../../types';
export declare class CampaignSDK {
private readonly options;
private static instance;
private readonly logger;
private storageKeyPrefix;
private apiKey;
private campaignId;
private session?;
static initialize(opts: CampaignsOptions): CampaignSDK;
static getInstance(): CampaignSDK;
private constructor();
createWebUser(): Promise<import("../../types").CreateUserResponse>;
createExternalUser({ name, type, externalUserId, }: {
name: string;
type: string;
externalUserId: string;
}): Promise<import("../../types").CreateUserResponse>;
getUser(): Promise<import("../../types").User | null>;
updateUser(params: UpdateUserParams): Promise<import("../../types").User | null>;
createEntry(params: CreateEntryParams): Promise<import("../../types").Entry | null>;
fetchEntiesByCurrentUser(params?: FetchEntryParams): Promise<import("../../types").Entry[] | null>;
updateEntry(params: UpdateEntryParams): Promise<import("../../types").Entry | null>;
createFormEntry(params: CreateFormEntryParams): Promise<import("../../types").FormEntry | null>;
uploadImage(params: UploadImageParams): Promise<import("../../types").UploadImageResponse | null>;
drawCoupon(): Promise<import("../../types").Coupon | null>;
createSession(): Promise<Session>;
claimCoupon(params: ClaimCouponParams): Promise<{
success: boolean;
}>;
}
/**
* Exposed function for making requests to public api routes
*/
export declare const createWebUser: () => Promise<import("../../types").CreateUserResponse>;
export declare const createExternalUser: (params: {
name: string;
type: string;
externalUserId: string;
}) => Promise<import("../../types").CreateUserResponse>;
export declare const getUser: () => Promise<import("../../types").User | null>;
export declare const updateUser: (params: UpdateUserParams) => Promise<import("../../types").User | null>;
export declare const createEntry: (params: CreateEntryParams) => Promise<import("../../types").Entry | null>;
export declare const updateEntry: (params: UpdateEntryParams) => Promise<import("../../types").Entry | null>;
export declare const fetchEntriesByCurrentUser: (params?: FetchEntryParams) => Promise<import("../../types").Entry[] | null>;
export declare const createFormEntry: (params: CreateFormEntryParams) => Promise<import("../../types").FormEntry | null>;
export declare const uploadImage: (params: UploadImageParams) => Promise<import("../../types").UploadImageResponse | null>;
export declare const drawCoupon: () => Promise<import("../../types").Coupon | null>;
export declare const createSession: () => Promise<Session>;
export declare const claimCoupon: (params: ClaimCouponParams) => Promise<{
success: boolean;
}>;