Skip to main content
Client for lists operations This client provides methods for interacting with the lists endpoints of the X API. It handles authentication, request formatting, and response parsing for all lists related operations.

Constructors

constructor

new ListsClient(client): ListsClient Creates a new lists client instance

Parameters

NameTypeDescription
clientClientThe main X API client instance

Returns

ListsClient

Defined in

lists/client.ts:294

Methods

getFollowers

getFollowers(id, options): Promise<Response> Get List followers Retrieves a list of Users who follow a specific List by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List.
optionsGetFollowersOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:339 getFollowers(id, options?): Promise<Get2ListsIdFollowersResponse>

Parameters

NameType
idstring
options?GetFollowersOptions

Returns

Promise<Get2ListsIdFollowersResponse>

Defined in

lists/client.ts:352

create

create(options): Promise<Response> Create List Creates a new List for the authenticated user.

Parameters

NameType
optionsCreateOptions & { requestOptions: { raw: true } }

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:560 create(options?): Promise<ListCreateResponse>

Parameters

NameType
options?CreateOptions

Returns

Promise<ListCreateResponse>

Defined in

lists/client.ts:569

getMembers

getMembers(id, options): Promise<Response> Get List members Retrieves a list of Users who are members of a specific List by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List.
optionsGetMembersOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:665 getMembers(id, options?): Promise<Get2ListsIdMembersResponse>

Parameters

NameType
idstring
options?GetMembersOptions

Returns

Promise<Get2ListsIdMembersResponse>

Defined in

lists/client.ts:678

addMember

addMember(id, options): Promise<Response> Add List member Adds a User to a specific List by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List for which to add a member.
optionsAddMemberOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:890 addMember(id, options?): Promise<ListMutateResponse>

Parameters

NameType
idstring
options?AddMemberOptions

Returns

Promise<ListMutateResponse>

Defined in

lists/client.ts:903

getPosts

getPosts(id, options): Promise<Response> Get List Posts Retrieves a list of Posts associated with a specific List by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List.
optionsGetPostsOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:1011 getPosts(id, options?): Promise<Get2ListsIdTweetsResponse>

Parameters

NameType
idstring
options?GetPostsOptions

Returns

Promise<Get2ListsIdTweetsResponse>

Defined in

lists/client.ts:1024

removeMemberByUserId

removeMemberByUserId(id, userId, options): Promise<Response> Remove List member Removes a User from a specific List by its ID and the User’s ID.

Parameters

NameTypeDescription
idstringThe ID of the List to remove a member.
userIdstringThe ID of User that will be removed from the List.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:1303 removeMemberByUserId(id, userId): Promise<ListMutateResponse>

Parameters

NameType
idstring
userIdstring

Returns

Promise<ListMutateResponse>

Defined in

lists/client.ts:1320

getById

getById(id, options): Promise<Response> Get List by ID Retrieves details of a specific List by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List.
optionsGetByIdOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:1423 getById(id, options?): Promise<Get2ListsIdResponse>

Parameters

NameType
idstring
options?GetByIdOptions

Returns

Promise<Get2ListsIdResponse>

Defined in

lists/client.ts:1436

update

update(id, options): Promise<Response> Update List Updates the details of a specific List owned by the authenticated user by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List to modify.
optionsUpdateOptions & { requestOptions: { raw: true } }-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:1610 update(id, options?): Promise<ListUpdateResponse>

Parameters

NameType
idstring
options?UpdateOptions

Returns

Promise<ListUpdateResponse>

Defined in

lists/client.ts:1623

delete

delete(id, options): Promise<Response> Delete List Deletes a specific List owned by the authenticated user by its ID.

Parameters

NameTypeDescription
idstringThe ID of the List to delete.
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

Returns

Promise<Response> Promise resolving to the API response, or raw Response if requestOptions.raw is true

Defined in

lists/client.ts:1731 delete(id): Promise<ListDeleteResponse>

Parameters

NameType
idstring

Returns

Promise<ListDeleteResponse>

Defined in

lists/client.ts:1744