/** * Member operations for Managed Runtime. * * Handles listing, adding, updating, and removing project members. * * @module operations/mrt/member */ import type { AuthStrategy } from '../../auth/types.js'; import type { components } from '../../clients/mrt.js'; /** * Member type from API. */ export type MrtMember = components['schemas']['APIProjectMember']; /** * Patched member for updates. */ export type PatchedMrtMember = components['schemas']['PatchedAPIProjectMember']; /** * Member role values. * 0 = Admin, 1 = Developer, 2 = Marketer, 3 = Read Only */ export type MemberRoleValue = 0 | 1 | 2 | 3; /** * Member role names. */ export declare const MEMBER_ROLES: Record; /** * Options for listing members. */ export interface ListMembersOptions { /** * The project slug. */ projectSlug: string; /** * Maximum number of results to return. */ limit?: number; /** * Offset for pagination. */ offset?: number; /** * Filter by role value. */ role?: MemberRoleValue; /** * Search term for filtering. */ search?: string; /** * Field to order results by. */ ordering?: string; /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Result of listing members. */ export interface ListMembersResult { /** * Total count of members. */ count: number; /** * URL for next page of results. */ next: string | null; /** * URL for previous page of results. */ previous: string | null; /** * Array of members. */ members: MrtMember[]; } /** * Lists members for an MRT project. * * @param options - List options including project slug * @param auth - Authentication strategy (ApiKeyStrategy) * @returns Paginated list of members * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { listMembers } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const result = await listMembers({ * projectSlug: 'my-storefront' * }, auth); * * for (const member of result.members) { * console.log(`${member.user}: ${member.role?.name}`); * } * ``` */ export declare function listMembers(options: ListMembersOptions, auth: AuthStrategy): Promise; /** * Options for adding a member. */ export interface AddMemberOptions { /** * The project slug. */ projectSlug: string; /** * Email address of the user to add. */ email: string; /** * Role value for the member. * 0 = Admin, 1 = Developer, 2 = Marketer, 3 = Read Only */ role: MemberRoleValue; /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Adds a member to an MRT project. * * @param options - Add member options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns The created member * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { addMember } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const member = await addMember({ * projectSlug: 'my-storefront', * email: 'user@example.com', * role: 1 // Developer * }, auth); * ``` */ export declare function addMember(options: AddMemberOptions, auth: AuthStrategy): Promise; /** * Options for getting a member. */ export interface GetMemberOptions { /** * The project slug. */ projectSlug: string; /** * Email address of the member. */ email: string; /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Gets a member from an MRT project. * * @param options - Get member options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns The member * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { getMember } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const member = await getMember({ * projectSlug: 'my-storefront', * email: 'user@example.com' * }, auth); * * console.log(`Role: ${member.role?.name}`); * ``` */ export declare function getMember(options: GetMemberOptions, auth: AuthStrategy): Promise; /** * Options for updating a member. */ export interface UpdateMemberOptions { /** * The project slug. */ projectSlug: string; /** * Email address of the member to update. */ email: string; /** * New role value for the member. * 0 = Admin, 1 = Developer, 2 = Marketer, 3 = Read Only */ role: MemberRoleValue; /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Updates a member's role in an MRT project. * * @param options - Update member options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns The updated member * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { updateMember } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const member = await updateMember({ * projectSlug: 'my-storefront', * email: 'user@example.com', * role: 0 // Promote to Admin * }, auth); * ``` */ export declare function updateMember(options: UpdateMemberOptions, auth: AuthStrategy): Promise; /** * Options for removing a member. */ export interface RemoveMemberOptions { /** * The project slug. */ projectSlug: string; /** * Email address of the member to remove. */ email: string; /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Removes a member from an MRT project. * * @param options - Remove member options * @param auth - Authentication strategy (ApiKeyStrategy) * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { removeMember } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * await removeMember({ * projectSlug: 'my-storefront', * email: 'user@example.com' * }, auth); * * console.log('Member removed'); * ``` */ export declare function removeMember(options: RemoveMemberOptions, auth: AuthStrategy): Promise;