Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update sdk docs to v3.8.0 #153

Merged
merged 7 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 290 additions & 0 deletions docs/sdks/api/friend/getFriendListPage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
---
sidebar_position: 4
toc_min_heading_level: 2
toc_max_heading_level: 2
---

# getFriendListPage

# TODO!Need Update. Only write info and title.
## 功能介绍

:::info 说明

分页获取指定数量好友的列表。offset为获取时的偏移量, count为获取数量

:::

:::caution 注意

count数不要过大, 否则请求时长会过长


:::
<Tabs
groupId="sdks-language"
values={[
{ label: 'iOS', value: 'iOS', },
{ label: 'Android', value: 'Android', },
{ label: 'Flutter', value: 'Flutter', },
{ label: 'uni-app', value: 'uni-app', },
{ label: 'Browser/Electron/MiniProgram', value: 'Web', },
{ label: 'React-Native', value: 'React-Native', },
{ label: 'Unity', value: 'Unity', },
]
}>

<TabItem value="Flutter">

### 函数原型

```dart showLineNumbers
Future<List<FullUserInfo>> getFriendList({String? operationID})
```

### 输入参数


### 返回结果

| 参数名称 | 参数类型 | 描述 |
| -------- | --------------------------------------------------- | -------- |
| ~ | List< [FullUserInfo](docs/sdks/class/user/fullUserInfo.mdx) \* > | 成功返回 |

### 代码示例

```dart showLineNumbers
List<FullUserInfo> list = await OpenIM.iMManager.friendshipManager.getFriendList();
// todo
```

</TabItem>

<TabItem value="iOS">

### 函数原型

```swift showLineNumbers

- (void)getFriendListWithOnSuccess:(nullable OIMFullUsersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

```

### 输入参数


### 返回结果

| 参数名称 | 参数类型 | 描述 |
| --------- | -------------------------------------------------------------------- | -------- |
| onSuccess | NSArray< [OIMFullUserInfo](docs/sdks/class/user/fullUserInfo.mdx) \* > | 成功返回 |
| onFailure | OIMFailureCallback | 失败返回 |

### 代码示例

```swift showLineNumbers

[OIMManager.manager getFriendListWithOnSuccess:^(NSArray<OIMFullUserInfo *> * _Nullable userInfos) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];

```

</TabItem>

<TabItem value="Android">

### 函数原型

```java showLineNumbers

public void getFriendList(OnBase<List<UserInfo>> callBack)

```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------------------------------------------------------------------------------------------- | -------- | -------- |
| callBack | [OnBase](docs/sdks/callback/onBase.mdx)<List<[UserInfo](docs/sdks/class/user/userInfo.mdx)>> | 是 | 回调接口 |

### 返回结果

| 参数名称 | 参数类型 | 描述 |
| -------- | --------------------------------------------------- | -------- |
| data | List<[UserInfo](docs/sdks/class/user/userInfo.mdx)> | 成功返回 |

### 代码示例

```java showLineNumbers

OpenIMClient.getInstance().friendshipManager.getFriendList(new OnBase<List<UserInfo>>(){
@Override
public void onError(int code, String error) {

}

@Override
public void onSuccess(List<UserInfo> data) {

}
})

```

</TabItem>

<TabItem value="Web">

### 函数原型

```ts showLineNumbers
IMSDK.getFriendList(operationID?: string): Promise<WsResponse<FullUserItem[]>>
```

### 输入参数


### 返回结果

| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------------------------------- | ---------------- |
| Promise.then() | Promise<WsResponse<[FullUserItem](docs/sdks/class/user/fullUserInfo.mdx)[]>\> | 好友信息对象列表 |
| Promise.catch() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

```js showLineNumbers
import { getSDK } from 'open-im-sdk-wasm';
const IMSDK = getSDK();

// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();

// use in mini program
// import { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();

IMSDK.getFriendList()
.then(({ data }) => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>

<TabItem value="uni-app">

### 函数原型

```ts showLineNumbers
IMSDK.asyncApi('getFriendList', operationID: string): Promise<FullUserItem[]>
```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| ----------- | -------- | -------- | ------------------------------------------------------- |
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |

### 返回结果

> 通过`openim-uniapp-polyfill`包将函数 Promise 化,调用时需要使用`then`和`catch`判断并处理成功和失败回调。

| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------------------- | ---------------- |
| Promise.then() | Promise<[FriendUserItem](docs/sdks/class/friend/friendInfo.mdx)[]\> | 好友信息对象列表 |
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

```js showLineNumbers
import IMSDK from 'openim-uniapp-polyfill';

IMSDK.asyncApi('getFriendList', IMSDK.uuid())
.then((data) => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>
<TabItem value="React-Native">

### 函数原型

```ts showLineNumbers
OpenIMSDKRN.getFriendList(operationID: string): Promise<FullUserItem[]>
```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| ----------- | -------- | -------- | ------------------------------------------------------- |
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |

### 返回结果

| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------------------- | ---------------- |
| Promise.then() | Promise<[FriendUserItem](docs/sdks/class/friend/friendInfo.mdx)[]\> | 好友信息对象列表 |
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

```js showLineNumbers
import OpenIMSDKRN from "open-im-sdk-rn";

OpenIMSDKRN.getFriendList('operationID')
.then((data) => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>

<TabItem value="Unity">

### 函数原型

```C# showLineNumbers

public static void GetFriendList(OnFullUserInfoList cb)

```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------------------------------------------------------------------------------------------- | -------- | -------- |
| cb | [OnFullUserInfoList](docs/sdks/callback/OnFullUserInfoList.mdx) | 是 | 回调接口 |


### 代码示例

```C# showLineNumbers

IMSDK.GetFriendList((list,errCode,errMsg)=>{

});

```

</TabItem>



</Tabs>
3 changes: 2 additions & 1 deletion docs/sdks/api/friend/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ toc_max_heading_level: 2
| [refuseFriendApplication](docs/sdks/api/friend/refuseFriendApplication.mdx) | 拒绝好友申请 |
| [addBlack](docs/sdks/api/friend/addBlack.mdx) | 加入黑名单 |
| [getBlackList](docs/sdks/api/friend/getBlackList.mdx) | 获取黑名单 |
| [removeBlack](docs/sdks/api/friend/removeBlack.mdx) | 移除好名单 |
| [removeBlack](docs/sdks/api/friend/removeBlack.mdx) | 移除黑名单 |
| [getFriendListPage](docs/sdks/api/friend/getFriendListPage.mdx) | 分页获取自己指定数量好友的列表。 |
Loading
Loading