Skip to content

Commit

Permalink
docs: update api doc (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgz5689 authored Oct 8, 2024
1 parent 2ad595e commit 4b0b405
Show file tree
Hide file tree
Showing 18 changed files with 1,318 additions and 223 deletions.
132 changes: 132 additions & 0 deletions docs/sdks/api/conversation/changeInputStates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,145 @@ Future changeInputStates({

<TabItem value="Web">

### 函数原型

```ts showLineNumbers
IMSDK.changeInputStates({
conversationID: string,
focus: boolean,
}, operationID?: string): Promise<WsResponse>
```

### 输入参数

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

### 返回结果

| 参数名称 | 参数类型 | 描述 |
| --------------- | ---------------------------------------------------- | ------------ |
| Promise.then() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用成功回调 |
| Promise.catch() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

```js showLineNumbers
import { getSDK } from '@openim/wasm-client-sdk';
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.changeInputStates({
conversationID: 'conversationID',
focus: true,
})
.then(() => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>

<TabItem value="uni-app">

### 函数原型

```ts showLineNumbers
IMSDK.asyncApi('changeInputStates', operationID: string, {
conversationID: string,
focus: boolean,
}): Promise<void>
```

### 输入参数

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

### 返回结果

> 通过`openim-uniapp-polyfill`包将函数 Promise 化,调用时需要使用`then``catch`判断并处理成功和失败回调。
| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------- | ------------ |
| Promise.then() | Promise<void\> | 调用成功回调 |
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

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

IMSDK.asyncApi('changeInputStates', IMSDK.uuid(), {
conversationID: 'conversationID',
focus: true,
})
.then(() => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>

<TabItem value="React-Native">
### 函数原型

```ts showLineNumbers
OpenIMSDKRN.changeInputStates({
conversationID: string,
focus: boolean,
}, operationID: string): Promise<void>
```

### 输入参数

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

### 返回结果
| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------- | ------------ |
| Promise.then() | Promise<void\> | 调用成功回调 |
| Promise.catch() | Promise<[Response](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

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

OpenIMSDKRN.changeInputStates({
conversationID: 'conversationID',
focus: true,
}, 'operationID')
.then(() => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```

</TabItem>

Expand Down
134 changes: 134 additions & 0 deletions docs/sdks/api/conversation/getInputStates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,149 @@ Future getInputstates({

<TabItem value="Web">

### 函数原型

```ts showLineNumbers
IMSDK.getInputstates({
conversationID: string,
userID: string,
}, operationID?: string): Promise<WsResponse<number[]>>
```

### 输入参数

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

### 返回结果

| 参数名称 | 参数类型 | 描述 |
| --------------- | ---------------------------------------------------- | ------------ |
| Promise.then() | Promise<[WsResponse](docs/sdks/class/response.mdx)<number[]>\> | 调用成功回调 |
| Promise.catch() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

```js showLineNumbers
import { getSDK } from '@openim/wasm-client-sdk';
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.getInputstates({
conversationID: 'conversationID',
userID: 'userID',
})
.then(() => {
// 调用成功
})
.catch(({ errCode, errMsg }) => {
// 调用失败
});
```


</TabItem>

<TabItem value="uni-app">

### 函数原型

```ts showLineNumbers
IMSDK.asyncApi('getInputstates', operationID: string, {
conversationID: string,
userID: string,
}): Promise<number[]>
```

### 输入参数

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

### 返回结果

> 通过`openim-uniapp-polyfill`包将函数 Promise 化,调用时需要使用`then``catch`判断并处理成功和失败回调。
| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------- | ------------ |
| Promise.then() | Promise<number[]\> | 调用成功回调 |
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

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

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


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

### 函数原型

```ts showLineNumbers
OpenIMSDKRN.getInputstates({
conversationID: string,
userID: string,
}, operationID: string): Promise<number[]>
```

### 输入参数

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

### 返回结果
| 参数名称 | 参数类型 | 描述 |
| --------------- | ------------------------------------------------------- | ------------ |
| Promise.then() | Promise<number[]\> | 调用成功回调 |
| Promise.catch() | Promise<[Response](docs/sdks/class/response.mdx)\> | 调用失败回调 |

### 代码示例

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

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


</TabItem>

<TabItem value="Unity">
Expand Down
47 changes: 33 additions & 14 deletions docs/sdks/api/group/getJoinedGroupListPage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,19 @@ OpenIMClient.getInstance().groupManager.getJoinedGroupList(new OnBase<List<Group
### 函数原型

```ts showLineNumbers
IMSDK.getJoinedGroupList(operationID?: string): Promise<WsResponse<GroupItem[]>>
IMSDK.getJoinedGroupList({
offset: number;
count: number;
}, operationID?: string): Promise<WsResponse<GroupItem[]>>
```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------- | -------- | ------- |
| offset | number || 分页拉取起始下标 |
| count | number || 一页拉取的数量 |
| operationID | string || 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |

### 返回结果

Expand All @@ -177,7 +184,7 @@ const IMSDK = getSDK();
// import { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();

IMSDK.getJoinedGroupList()
IMSDK.getJoinedGroupList({ offset: 0, count: 1000 })
.then(({ data }) => {
// 调用成功
})
Expand All @@ -193,15 +200,19 @@ IMSDK.getJoinedGroupList()
### 函数原型

```ts showLineNumbers
IMSDK.asyncApi('getJoinedGroupList', operationID: string): Promise<GroupItem[]>
IMSDK.asyncApi('getJoinedGroupList', operationID: string, {
offset: number;
count: number;
}): Promise<GroupItem[]>
```

### 输入参数

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

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------- | -------- | ------- |
| offset | number || 分页拉取起始下标 |
| count | number || 一页拉取的数量 |
| operationID | string || 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |
### 返回结果

> 通过`openim-uniapp-polyfill`包将函数 Promise 化,调用时需要使用`then``catch`判断并处理成功和失败回调。
Expand All @@ -216,7 +227,7 @@ IMSDK.asyncApi('getJoinedGroupList', operationID: string): Promise<GroupItem[]>
```js showLineNumbers
import IMSDK from 'openim-uniapp-polyfill';

IMSDK.asyncApi('getJoinedGroupList', IMSDK.uuid())
IMSDK.asyncApi('getJoinedGroupList', IMSDK.uuid(), { offset: 0, count: 1000 })
.then((data) => {
// 调用成功
})
Expand All @@ -231,14 +242,19 @@ IMSDK.asyncApi('getJoinedGroupList', IMSDK.uuid())
### 函数原型

```ts showLineNumbers
OpenIMSDKRN.getJoinedGroupList(operationID: string): Promise<GroupItem[]>
OpenIMSDKRN.getJoinedGroupList({
offset: number;
count: number;
}, operationID: string): Promise<GroupItem[]>
```

### 输入参数

| 参数名称 | 参数类型 | 是否必填 | 描述 |
| ----------- | -------- | -------- | ------------------------------------------------------- |
| operationID | string || 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |
| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------- | -------- | ------- |
| offset | number || 分页拉取起始下标 |
| count | number || 一页拉取的数量 |
| operationID | string || 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |

### 返回结果

Expand All @@ -252,7 +268,10 @@ OpenIMSDKRN.getJoinedGroupList(operationID: string): Promise<GroupItem[]>
```js showLineNumbers
import OpenIMSDKRN from "open-im-sdk-rn";

OpenIMSDKRN.getJoinedGroupList('operationID')
OpenIMSDKRN.getJoinedGroupList({
offset: 0;
count: 1000;
}, 'operationID')
.then((data) => {
// 调用成功
})
Expand Down
Loading

0 comments on commit 4b0b405

Please sign in to comment.