@sumup/sdk
Version:
The official TypeScript SDK for the SumUp API
187 lines • 5.61 kB
TypeScript
import * as Core from "../../core.js";
/**
* The status of the membership.
*/
export type MembershipStatus = "accepted" | "pending" | "expired" | "disabled" | "unknown";
/**
* Invite
*
* Pending invitation for membership.
*/
export type Invite = {
/**
* Email address of the invited user.
*/
email: string;
expires_at: string;
};
/**
* Set of user-defined key-value pairs attached to the object. Partial updates are not supported. When updating, always submit whole metadata.
*/
export type Metadata = Record<string, Record<string, unknown>>;
/**
* Object attributes that modifiable only by SumUp applications.
*/
export type Attributes = Record<string, Record<string, unknown>>;
/**
* Classic identifiers of the user.
*
* @deprecated
*/
export type MembershipUserClassic = {
user_id: number;
};
/**
* Information about the user associated with the membership.
*/
export type MembershipUser = {
/**
* Identifier for the End-User (also called Subject).
*/
id: string;
/**
* End-User's preferred e-mail address. Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. The RP MUST NOT rely upon this value being unique, for unique identification use ID instead.
*/
email: string;
/**
* True if the user has enabled MFA on login.
*/
mfa_on_login_enabled: boolean;
/**
* True if the user is a virtual user (operator).
*/
virtual_user: boolean;
/**
* True if the user is a service account.
*/
service_account_user: boolean;
/**
* Time when the user has been disabled. Applies only to virtual users (`virtual_user: true`).
*/
disabled_at?: string;
/**
* User's preferred name. Used for display purposes only.
*/
nickname?: string;
/**
* URL of the End-User's profile picture. This URL refers to an image file (for example, a PNG, JPEG, or GIF image file), rather than to a Web page containing an image.
*/
picture?: string;
classic?: MembershipUserClassic;
};
/**
* Member
*
* A member is user within specific resource identified by resource id, resource type, and associated roles.
*/
export type Member = {
/**
* ID of the member.
*/
id: string;
/**
* User's roles.
*/
roles: string[];
/**
* User's permissions.
*/
permissions: string[];
/**
* The timestamp of when the member was created.
*/
created_at: string;
/**
* The timestamp of when the member was last updated.
*/
updated_at: string;
user?: MembershipUser;
invite?: Invite;
status: MembershipStatus;
metadata?: Metadata;
attributes?: Attributes;
};
export type ListMerchantMembersQueryParams = {
offset?: number;
limit?: number;
scroll?: boolean;
email?: string;
status?: MembershipStatus;
roles?: string[];
};
export type ListMerchantMembersResponse = {
items: Member[];
total_count?: number;
};
export type CreateMerchantMemberParams = {
/**
* True if the user is managed by the merchant. In this case, we'll created a virtual user with the provided password and nickname.
*/
is_managed_user?: boolean;
/**
* True if the user is a service account. It can later be used to create OAuth2 clients.
*/
is_service_account?: boolean;
/**
* Email address of the member to add.
*/
email: string;
/**
* Password of the member to add. Only used if `is_managed_user` is true. In the case of service accounts, the password is not used and can not be defined by the caller.
*/
password?: string;
/**
* Nickname of the member to add. Only used if `is_managed_user` is true. Used for display purposes only.
*/
nickname?: string;
/**
* List of roles to assign to the new member. In the case of service accounts, the roles are predefined.
*/
roles: string[];
metadata?: Metadata;
attributes?: Attributes;
};
export type UpdateMerchantMemberParams = {
roles?: string[];
metadata?: Metadata;
attributes?: Attributes;
/**
* Allows you to update user data of managed users.
*/
user?: {
/**
* User's preferred name. Used for display purposes only.
*/
nickname?: string;
/**
* Password of the member to add. Only used if `is_managed_user` is true.
*/
password?: string;
};
};
export declare class Members extends Core.APIResource {
/**
* List members
*/
list(merchantCode: string, query?: ListMerchantMembersQueryParams, params?: Core.FetchParams): Core.APIPromise<ListMerchantMembersResponse>;
/**
* Create a member
*/
create(merchantCode: string, body: CreateMerchantMemberParams, params?: Core.FetchParams): Core.APIPromise<Member>;
/**
* Retrieve a member
*/
get(merchantCode: string, memberId: string, params?: Core.FetchParams): Core.APIPromise<Member>;
/**
* Update a member
*/
update(merchantCode: string, memberId: string, body: UpdateMerchantMemberParams, params?: Core.FetchParams): Core.APIPromise<Member>;
/**
* Delete a member
*/
delete(merchantCode: string, memberId: string, params?: Core.FetchParams): Core.APIPromise<void>;
}
export declare namespace Members {
export type { Attributes, CreateMerchantMemberParams, Invite, ListMerchantMembersQueryParams, Member, MembershipStatus, MembershipUser, MembershipUserClassic, Metadata, UpdateMerchantMemberParams, };
}
//# sourceMappingURL=index.d.ts.map