Skip to content

Commit 3b266d8

Browse files
committed
doc: Add doc for v2 lists
1 parent 3711139 commit 3b266d8

File tree

2 files changed

+182
-1
lines changed

2 files changed

+182
-1
lines changed

doc/v2.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ For streaming API, see [Streaming part](./streaming.md).
4747
* [Mute someone](#Mutesomeone)
4848
* [Unmute someone](#Unmutesomeone)
4949
* [Get users that are muted by you](#Getusersthataremutedbyyou)
50+
* [Lists](#Lists)
51+
* [Create a list](#Createalist)
52+
* [Update list metadata](#Updatelistmetadata)
53+
* [Delete list](#Deletelist)
54+
* [Add list member](#Addlistmember)
55+
* [Remove list member](#Removelistmember)
56+
* [Subscribe to a list](#Subscribetoalist)
57+
* [Unsubscribe of a list](#Unsubscribeofalist)
58+
* [Pin a list](#Pinalist)
59+
* [Unpin a list](#Unpinalist)
5060
* [Spaces](#Spaces)
5161
* [Space by ID](#SpacebyID)
5262
* [Spaces by ID](#SpacesbyID)
@@ -703,6 +713,177 @@ for await (const mutedUser of mutedPaginator) {
703713
}
704714
```
705715

716+
## <a name='Lists'></a>Lists
717+
718+
### <a name='Createalist'></a>Create a list
719+
720+
**Method**: `.createList()`
721+
722+
**Endpoint**: `lists`
723+
724+
**Right level**: `Read-write`
725+
726+
**Arguments**:
727+
- `options: ListCreateV2Params`
728+
729+
**Returns**: `ListCreateV2Result`
730+
731+
**Example**
732+
```ts
733+
const myNewList = await client.v2.createList({ name: 'cats', private: true });
734+
```
735+
736+
### <a name='Updatelistmetadata'></a>Update list metadata
737+
738+
**Method**: `.updateList()`
739+
740+
**Endpoint**: `lists/:id`
741+
742+
**Right level**: `Read-write`
743+
744+
**Arguments**:
745+
- `listId: string`
746+
- `options: ListUpdateV2Params`
747+
748+
**Returns**: `ListUpdateV2Result`
749+
750+
**Example**
751+
```ts
752+
const updatedList = await client.v2.updateList('128492', { private: true });
753+
```
754+
755+
### <a name='Deletelist'></a>Delete list
756+
757+
**Method**: `.removeList()`
758+
759+
**Endpoint**: `lists/:id`
760+
761+
**Right level**: `Read-write`
762+
763+
**Arguments**:
764+
- `listId: string`
765+
766+
**Returns**: `ListDeleteV2Result`
767+
768+
**Example**
769+
```ts
770+
await client.v2.removeList('128492');
771+
```
772+
773+
### <a name='Addlistmember'></a>Add list member
774+
775+
**Method**: `.addListMember()`
776+
777+
**Endpoint**: `users/:id/members`
778+
779+
**Right level**: `Read-write`
780+
781+
**Arguments**:
782+
- `listId: string`
783+
- `userId: string`
784+
785+
**Returns**: `ListMemberV2Result`
786+
787+
**Example**
788+
```ts
789+
await client.v2.addListMember('12', '128492');
790+
```
791+
792+
### <a name='Removelistmember'></a>Remove list member
793+
794+
**Method**: `.removeListMember()`
795+
796+
**Endpoint**: `users/:id/members/:list_id`
797+
798+
**Right level**: `Read-write`
799+
800+
**Arguments**:
801+
- `listId: string`
802+
- `userId: string`
803+
804+
**Returns**: `ListMemberV2Result`
805+
806+
**Example**
807+
```ts
808+
await client.v2.removeListMember('128492', '12');
809+
```
810+
811+
### <a name='Subscribetoalist'></a>Subscribe to a list
812+
813+
**Method**: `.subscribeToList()`
814+
815+
**Endpoint**: `users/:id/followed_lists`
816+
817+
**Right level**: `Read-write`
818+
819+
**Arguments**:
820+
- `loggedUserId: string`
821+
- `listId: string`
822+
823+
**Returns**: `ListFollowV2Result`
824+
825+
**Example**
826+
```ts
827+
await client.v2.subscribeToList('12', '128492');
828+
```
829+
830+
### <a name='Unsubscribeofalist'></a>Unsubscribe of a list
831+
832+
**Method**: `.unsubscribeOfList()`
833+
834+
**Endpoint**: `users/:id/followed_lists/:list_id`
835+
836+
**Right level**: `Read-write`
837+
838+
**Arguments**:
839+
- `loggedUserId: string`
840+
- `listId: string`
841+
842+
**Returns**: `ListFollowV2Result`
843+
844+
**Example**
845+
```ts
846+
await client.v2.unsubscribeOfList('12', '128492');
847+
```
848+
849+
### <a name='Pinalist'></a>Pin a list
850+
851+
**Method**: `.pinList()`
852+
853+
**Endpoint**: `users/:id/pinned_lists`
854+
855+
**Right level**: `Read-write`
856+
857+
**Arguments**:
858+
- `loggedUserId: string`
859+
- `listId: string`
860+
861+
**Returns**: `ListPinV2Result`
862+
863+
**Example**
864+
```ts
865+
await client.v2.pinList('12', '128492');
866+
```
867+
868+
### <a name='Unpinalist'></a>Unpin a list
869+
870+
**Method**: `.unpinList()`
871+
872+
**Endpoint**: `users/:id/pinned_lists/:list_id`
873+
874+
**Right level**: `Read-write`
875+
876+
**Arguments**:
877+
- `loggedUserId: string`
878+
- `listId: string`
879+
880+
**Returns**: `ListPinV2Result`
881+
882+
**Example**
883+
```ts
884+
await client.v2.unpinList('12', '128492');
885+
```
886+
706887
## <a name='Spaces'></a>Spaces
707888

708889
### <a name='SpacebyID'></a>Space by ID

src/types/v2/list.v2.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataV2 } from "./shared.v2.types";
1+
import { DataV2 } from './shared.v2.types';
22

33
export interface ListCreateV2Params {
44
name: string;

0 commit comments

Comments
 (0)