UNPKG

magicbell

Version:
156 lines (155 loc) 6.98 kB
import { type FromSchema } from 'json-schema-to-ts'; import { type IterablePromise } from '../client/method.js'; import { Resource } from '../client/resource.js'; import { type RequestOptions } from '../client/types.js'; import * as schemas from '../schemas/users.js'; import { UsersNotifications } from './users/notifications.js'; import { UsersPushSubscriptions } from './users/push-subscriptions.js'; type CreateUsersResponse = FromSchema<typeof schemas.CreateUsersResponseSchema>; type CreateUsersPayload = FromSchema<typeof schemas.CreateUsersPayloadSchema>; type ListUsersResponse = FromSchema<typeof schemas.ListUsersResponseSchema>; type ListUsersPayload = FromSchema<typeof schemas.ListUsersPayloadSchema>; type GetUsersResponse = FromSchema<typeof schemas.GetUsersResponseSchema>; type UpdateUsersResponse = FromSchema<typeof schemas.UpdateUsersResponseSchema>; type UpdateUsersPayload = FromSchema<typeof schemas.UpdateUsersPayloadSchema>; type UpdateByEmailUsersResponse = FromSchema<typeof schemas.UpdateByEmailUsersResponseSchema>; type UpdateByEmailUsersPayload = FromSchema<typeof schemas.UpdateByEmailUsersPayloadSchema>; type UpdateByExternalIdUsersResponse = FromSchema<typeof schemas.UpdateByExternalIdUsersResponseSchema>; type UpdateByExternalIdUsersPayload = FromSchema<typeof schemas.UpdateByExternalIdUsersPayloadSchema>; export declare class Users extends Resource { path: string; entity: string; notifications: UsersNotifications; pushSubscriptions: UsersPushSubscriptions; /** * Create a user. Please note that you must provide the user's email or the * external id so MagicBell can uniquely identify the user. * * The external id, if provided, must be unique to the user. * * @param options - override client request options. * @returns **/ create(options?: RequestOptions): Promise<CreateUsersResponse>; /** * Create a user. Please note that you must provide the user's email or the * external id so MagicBell can uniquely identify the user. * * The external id, if provided, must be unique to the user. * * @param data * @param options - override client request options. * @returns **/ create(data: CreateUsersPayload, options?: RequestOptions): Promise<CreateUsersResponse>; /** * Fetches users for the project identified by the auth keys. Supports filtering, * ordering, and pagination. * * @param options - override client request options. * @returns **/ list(options?: RequestOptions): IterablePromise<ListUsersResponse>; /** * Fetches users for the project identified by the auth keys. Supports filtering, * ordering, and pagination. * * @param data * @param options - override client request options. * @returns **/ list(data: ListUsersPayload, options?: RequestOptions): IterablePromise<ListUsersResponse>; /** * Fetch a user by id, for the project identified by the auth keys. * * @param userId - The user id is the MagicBell user id. Accepts a UUID * @param options - override client request options. * @returns **/ get(userId: string, options?: RequestOptions): Promise<GetUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param userId - The user id is the MagicBell user id. Alternatively, provide an * id like `email:theusersemail@example.com` or `external_id:theusersexternalid` as * the user id. * @param options - override client request options. * @returns **/ update(userId: string, options?: RequestOptions): Promise<UpdateUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param userId - The user id is the MagicBell user id. Alternatively, provide an * id like `email:theusersemail@example.com` or `external_id:theusersexternalid` as * the user id. * @param data * @param options - override client request options. * @returns **/ update(userId: string, data: UpdateUsersPayload, options?: RequestOptions): Promise<UpdateUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param userEmail * @param options - override client request options. * @returns **/ updateByEmail(userEmail: string, options?: RequestOptions): Promise<UpdateByEmailUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param userEmail * @param data * @param options - override client request options. * @returns **/ updateByEmail(userEmail: string, data: UpdateByEmailUsersPayload, options?: RequestOptions): Promise<UpdateByEmailUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param externalId * @param options - override client request options. * @returns **/ updateByExternalId(externalId: string, options?: RequestOptions): Promise<UpdateByExternalIdUsersResponse>; /** * Update a user's data. If you identify users by their email addresses, you need * to update the MagicBell data, so this user can still access their notifications. * * @param externalId * @param data * @param options - override client request options. * @returns **/ updateByExternalId(externalId: string, data: UpdateByExternalIdUsersPayload, options?: RequestOptions): Promise<UpdateByExternalIdUsersResponse>; /** * Immediately deletes a user. * * @param userId - The user id is the MagicBell user id. Alternatively, provide an * id like `email:theusersemail@example.com` or `external_id:theusersexternalid` as * the user id. * @param options - override client request options. **/ delete(userId: string, options?: RequestOptions): Promise<void>; /** * Immediately deletes a user. * * @param userEmail * @param options - override client request options. **/ deleteByEmail(userEmail: string, options?: RequestOptions): Promise<void>; /** * Immediately deletes a user. * * @param externalId * @param options - override client request options. **/ deleteByExternalId(externalId: string, options?: RequestOptions): Promise<void>; } export {};