UNPKG

tickethead-sdk

Version:

SDK for the Tickethead API

376 lines 14.4 kB
import { AxiosInstance } from 'axios'; import { User, Wallet, NewUser, Organizer, UserInvite, UserUpdate, OrganizerId, NewOrganizer, EnrollmentId, SeatsWorkspace, PublicUserData, UserPermissions, UserPermissionChange, Email, MarketRuleset, Fee, FeeUpdate, FeeCreate, MarketRulesetCreate, MarketRulesetUpdate, MarketRulesetListQuery, GetOrganizerRequest, UserQuery, KYCLevel, ListQuery, Currency, ListUserQuery, OnboardStripePayload, OnboardStripeResponse, OnboardStripeStatus, OrganizerDomain, OrganizerDomainCreate, OrganizerDomainUpdate, OrganizerDomainQuery, NewsletterUpdate, Newsletter, NewsletterCreate, FeeQuery, VerificationCode, PasswordResetRequest, ReportParams, ReportResponse, OrganizerBrandingData, OrganizerBrandingResponse } from './types'; import { HealthStatus, IdParam, QRCodePayload, StatusResponse, StringIdParam } from '../common/types'; import { UserPassword } from 'src/auth'; /** * Service class for account API calls. */ export declare class AccountService { readonly client: AxiosInstance; readonly version: string; constructor(client: AxiosInstance, version: string); /** * Returns true if the service is reachable * * @returns Services' online status */ health(): Promise<HealthStatus>; /** * Returns the organizer with the given name or id. * Currently an organizer only has one workspace. * * @param req name of the organizer * @returns Seats workspaces for the organizer * @throws `NotFoundError` */ getSeatsWorkspacesForOrganizer(req: OrganizerId): Promise<SeatsWorkspace[]>; /** * List all organizers * * @returns array of Organizer objects */ listOrganizers(query?: ListQuery): Promise<Organizer[]>; /** * Returns the organizer with the given name or id. * * @param req id or name of the organizer * @returns Organizer object * @throws `NotFoundError` */ getOrganizer(req: GetOrganizerRequest): Promise<Organizer>; /** * Create an organizer * * @param org New organizer data * @returns Organizer object * @throws `BadRequestError` */ createOrganizer(org: NewOrganizer): Promise<Organizer>; /** * Updates an organizer * * @param id.id name or id of the organizer * @param org updated organizer data * @returns Organizer object */ updateOrganizer(id: OrganizerId, org: Partial<Organizer>): Promise<Organizer>; /** * Returns the user with the given id. * * @param req id of the user * @returns User object * @throws `NotFoundError` */ getUser(req: IdParam): Promise<User>; /** * Returns the user with the given email. * * @param email email of the user * @returns User object * @throws `NotFoundError` */ getUserByEmail(email: Email): Promise<PublicUserData>; /** * Creates a new user * * @param user User data * @returns User object * @throws `BadRequestError` */ createUser(user: NewUser): Promise<User>; /** * Creates and adds an user to an organizer * * @param user User data and permissions * @returns User object * @throws `BadRequestError` */ inviteUser(user: UserInvite): Promise<User>; /** * Update a user * If a new email is sent, it needs to be confirmed * * @param user User data * @returns User object * @throws `BadRequestError`, `NotFoundError` */ updateUser(id: IdParam, user: UserUpdate): Promise<User>; /** * Initiate password reset process for a given email (i.e. user) * * @param email of the user which wants to reset the password */ resetUserPassword(email: Email): Promise<StatusResponse>; /** * Complete the password reset process * * @param data reset code and the new password */ confirmPasswordReset(data: PasswordResetRequest): Promise<StatusResponse>; /** * Resend the verification link to an unverified user. * * @param email Email of the user for which the verification link should be resent. If unspecified, resend the link for the current user. * @throws `BadRequestError` if the user is already verified. * ForbiddenError if the user without correct privileges tries to resend an email for another user * @deprecated replace with resendEmailVerification in-place */ resendUserVerification(email?: Email): Promise<void>; /** * Resend the verification link to an unverified user. * * @param email Email of the user for which the verification link should be resent. If unspecified, resend the link for the current user. * @throws `BadRequestError` if the user is already verified. * ForbiddenError if the user without correct privileges tries to resend an email for another user */ resendEmailVerification(email?: Email): Promise<void>; /** * Verifies the email of the user with the verification code received by email * * @param code An object containing the email verification code * @throws `NotFoundError` if the code does not exist * @throws `BadRequestError` if the code has expired */ verifyEmail(code: VerificationCode): Promise<void>; /** * Sends a phone verification SMS to the currently authorized user * * @throws `BadRequestError` if the phone number is not in the correct format (E164) * @throws `BadRequestError` if the user is already verified * @throws `BadRequestError` if it is too soon to send a new code * @throws `NotFoundError` if the authorization is for a user which was deleted * */ sendPhoneVerification(): Promise<void>; /** * The verification code is delivered to the user's phone. * You can request it again with the `sendPhoneVerification` method. * The user doesn't have to be logged in to verify their account. * * @param code An object containing the code the user received on their phone * @param credentials Optionally, if the user hasn't logged in, you can verify the phone by providing the credentials here. * @throws `BadRequestError` if you don't provide authorization or credentials * @throws `NotFoundError` if the user does not exist * */ verifyPhone(code: VerificationCode, credentials?: UserPassword): Promise<StatusResponse>; /** * Deletes a user * * @param id ID of the user to delete * @throws `NotFoundError` */ deleteUser(id: IdParam): Promise<void>; /** * List users belonging to a specific organizer. * * @param id.id Id or name of the organizer * @param query Additional fields that should be fetched with the users. */ listUsersInOrganization(id: OrganizerId, query?: UserQuery): Promise<User[]>; /** * Use this method to list the users. * @param query.email Query the users by the email * @param query.deleted Only returns deleted users */ listUsers(query?: ListUserQuery): Promise<User[]>; /** * Gets public info for a user with the enrollment id * * @param id enrollment ID of the user * @throws `NotFoundError` */ checkEnrollment(id: EnrollmentId): Promise<PublicUserData>; /** * Set a user's permissions. * The caller need to have the `*.change_permission` permission for each class of permissions which are granted. * * @param id Id of the user * @param perms Set of new permissions for the user * @returns User object * @throws `BadRequestError`, `NotFoundError`, `ForbiddenError` */ setPermissions(id: IdParam, perms: UserPermissions): Promise<UserPermissionChange>; /** * Creates a new certificate and private key for a user. * If there is no authorization, a new user and their wallet will be created. * * @returns User IDs, certificate and private key */ createWallet(): Promise<Wallet>; /** * Renews the certificate and private key for a user. * * @returns User IDs, certificate and private key */ renewWallet(): Promise<Wallet>; /** * Revoke the user's certificate. * * @returns User IDs, certificate and private key * @throws `BadRequestError` if the certificate revocation failed * @throws `NotFoundError` if the user hasn't created a wallet */ revokeWallet(data: EnrollmentId): Promise<StatusResponse>; /** * Return the market rules for the given ruleset * @param marketRulesetId * @returns */ getMarketControlSettings(marketRulesetId: StringIdParam): Promise<MarketRuleset>; /** * Create a secondary market ruleset for an organizer * @param marketRuleset Ruleset data */ createMarketControlSettings(marketRuleset: MarketRulesetCreate): Promise<MarketRuleset>; /** * Update a secondary market ruleset * @param id Id of the ruleset * @param marketRuleset Updated ruleset data */ updateMarketControlSettings(id: StringIdParam, marketRuleset: MarketRulesetUpdate): Promise<MarketRuleset>; /** * Delete a secondary market ruleset * @param id Id of the ruleset */ deleteMarketControlSettings(id: StringIdParam): Promise<void>; /** * Fetch QR code data for publishing the ruleset on the chain * @param id Id of the ruleset */ getMarketControlSettingsQRCodePayload(id: StringIdParam): Promise<QRCodePayload>; /** * List the secondary market rulesets */ listMarketControlSettings(query?: MarketRulesetListQuery): Promise<MarketRuleset[]>; /** * Get fee by id * @param id Id of the fee */ getFee(id: IdParam): Promise<Fee>; /** * List fees * @param query search parameters */ listFees(query: FeeQuery): Promise<Fee[]>; /** * Create a fee for the organizer. Requires administrative rights. * @param fee Fee data */ createFee(fee: FeeCreate): Promise<Fee>; /** * Update fee data. Requires administrative rights. * @param id Id of the fee * @param fee Updated fee data */ updateFee(id: IdParam, fee: FeeUpdate): Promise<Fee>; /** * List all registered KYC levels */ listKycLevels(query?: ListQuery): Promise<KYCLevel[]>; /** * List all registered currencies */ listCurrencies(query?: ListQuery): Promise<Currency[]>; /** * Starts the onboarding process for the payment provider * * @param id.id name or id of the organizer * @param onboardPayload return and refresh urls * @returns redirect url */ onboardStripeConnect(id: OrganizerId, onboardPayload: OnboardStripePayload): Promise<OnboardStripeResponse>; /** * Gets the onboarding status for the payment provider * * @param id.id name or id of the organizer * @returns data about the completeness of the onboarding process */ getStripeConnectStatus(id: OrganizerId): Promise<OnboardStripeStatus>; /** * Returns a guest access token for our reporting dashboard * * @param req parameters for the dashboard token * @returns token used for accessing the dashboard */ getReportingToken(req: ReportParams): Promise<ReportResponse>; /** * Get a domain by its ID * @param id Id of the domain */ getDomain(id: IdParam): Promise<OrganizerDomain>; /** * Lists or searches for domains. Returns associated organizers for each domain. */ listDomains(queryReq: OrganizerDomainQuery): Promise<OrganizerDomain[]>; /** * Create a domain for the organizer. Requires permissions for that organizer. * @param domain Domain name and either the organizer ID or the organizer name */ createDomain(domain: OrganizerDomainCreate): Promise<OrganizerDomain>; /** * Update domain data. Requires permissions for that organizer. * @param id Id of the domain * @param domain Updated domain name */ updateDomain(id: IdParam, domain: OrganizerDomainUpdate): Promise<OrganizerDomain>; /** * Delete a domain. Requires permissions for that organizer. * @param id Id of the domain */ deleteDomain(id: IdParam): Promise<void>; /** * Get a newsletter by its ID */ getNewsletter(id: IdParam): Promise<Newsletter>; /** * Lists all newsletters */ listNewsletters(queryReq: OrganizerDomainQuery): Promise<Newsletter[]>; /** * Create a newsletter. Requires permissions for the main organizer. * @param newsletter Subject and content. It will be put in the `info` email template. */ createNewsletter(newsletter: NewsletterCreate): Promise<Newsletter>; /** * Update newsletter content. Requires permissions for the main organizer. * @param id ID of the newsletter * @param newsletter Updated content */ updateNewsletter(id: IdParam, newsletter: NewsletterUpdate): Promise<Newsletter>; /** * Delete a newsletter. Requires permissions for the main organizer. */ deleteNewsletter(id: IdParam): Promise<void>; /** * Sends out the emails containing the newsletter content. * Requires permissions for the main organizer. * The newsletter will be marked as sent, but it can still be updated and resent. * * @param id ID of the newsletter to send */ sendNewsletter(id: IdParam): Promise<Newsletter>; /** * Creates new branding settings for the organizer. * @param id.id organizer id * @param brandingData branding data */ createBrandingSettings(id: OrganizerId, brandingData: OrganizerBrandingData): Promise<OrganizerBrandingResponse>; /** * Updates branding settings for the organizer. * @param id.id organizer id * @param brandingData updated branding data */ updateBrandingSettings(id: OrganizerId, brandingData: OrganizerBrandingData): Promise<OrganizerBrandingResponse>; /** * Returns branding settings for the organizer. * @param id.id organizer id */ getBrandingSettings(id: OrganizerId): Promise<OrganizerBrandingResponse>; /** * Deletes branding settings for the organizer. * @param id.id organizer id */ deleteBrandingSettings(id: OrganizerId): Promise<void>; } //# sourceMappingURL=service.d.ts.map