diff --git a/docs/restapi/apis/conversationManagement/getOwnerConversation.mdx b/docs/restapi/apis/conversationManagement/getOwnerConversation.mdx new file mode 100644 index 0000000000..a5ed720911 --- /dev/null +++ b/docs/restapi/apis/conversationManagement/getOwnerConversation.mdx @@ -0,0 +1,470 @@ +--- +sidebar_position: 8 +title: 获取当前用户的分页会话列表 +hide_title: true +--- + +
+ +## 获取当前用户的分页会话列表 + +
+ +### 简要描述 +- 获取当前用户的分页会话列表 +### 请求方式 +- `post` +### 请求URL +- `http://x.x.x.x:10002/conversation/get_owner_conversation` + + +### Header +|header名|示例值|选填|类型|说明| +|:---- |:------- |:--- |---|------ | +|operationID|1646445464564|必填|string|operationID用于全局链路追踪| +|token|eyJhbxxxx3Xs|必填|string|管理员token| + + + +### 请求参数示例 + + +```json +{ + "userID": "1008432211", + "pagination": { + "pageNumber": 1, + "showNumber": 20 + } +} +``` +|字段名|选填|类型|说明| +|:---- |:------- |:--- |---| +|userID|必填|string|当前用户ID| +|pagination|必填|object|分页参数结构体| +|pagination.pageNumber|必填|string|当前页码,从1开始| +|pagination.showNumber|必填|string|当前页请求数量| +### 成功返回示例 + + +```json +{ + "errCode": 0, + "errMsg": "", + "errDlt": "", + "data": { + "total": 38, + "conversations": [ + { + "ownerUserID": "1008432211", + "conversationID": "sg_1012900607", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1012900607", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 0, + "minSeq": 0, + "maxSeq": 184, + "msgDestructTime": 0, + "latestMsgDestructTime": -62135596800000, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_1084800774", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1084800774", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695265099982, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_1300152726", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1300152726", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1700464579733, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_1760150676", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1760150676", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1694565537524, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_1959004809", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1959004809", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1693526134219, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_198075251", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "198075251", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 0, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 0, + "latestMsgDestructTime": -62135596800000, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_198617661", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "198617661", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 0, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 0, + "latestMsgDestructTime": -62135596800000, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_2211210937", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "2211210937", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1698321453986, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_2338619613", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "2338619613", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 4, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 268, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695175479581, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_2590740935", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "2590740935", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1694565650924, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_2849984129", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "2849984129", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695175496783, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_2978362440", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "2978362440", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 5, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1694569026129, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3140024257", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3140024257", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695175468085, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3179761042", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3179761042", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1693525753518, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3187706596", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3187706596", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 4, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1693364218123, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3327367899", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3327367899", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1694375242097, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3419642055", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3419642055", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1700445790936, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3561750878", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3561750878", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695175484281, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3710129094", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3710129094", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 3, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1697081735129, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_3905809684", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "3905809684", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 2, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695622938140, + "isMsgDestruct": false + } + ] + } +} +``` +### 成功返回示例的参数说明 + + +|参数名|类型|说明| +|:---- |:------- |:--- | +|errCode|int|错误码,0表示成功| +|errMsg|string|错误简要信息,无错误时为空| +|errDlt|errDlt|错误详细信息,无错误时为空| +|data|object|通用数据对象,具体结构见下方| +|total|string|会话总数| +|conversations|array|[会话](docs/restapi/commonFields.mdx#conversationinfo)列表| +### 失败返回示例 + + +```json +{ + "errCode": 1004, + "errMsg": "RecordNotFoundError", + "errDlt": ": [1004]RecordNotFoundError" +} +``` +### 失败返回示例的参数说明 + + +|参数名|类型|说明| +|:---- |:------- |:--- | +|errCode|int|错误码,具体查看全局错误码文档| +|errMsg|string|错误简要信息| +|errDlt|errDlt|错误详细信息| diff --git a/docs/restapi/apis/conversationManagement/setConversations.mdx b/docs/restapi/apis/conversationManagement/setConversations.mdx new file mode 100644 index 0000000000..1d298211fd --- /dev/null +++ b/docs/restapi/apis/conversationManagement/setConversations.mdx @@ -0,0 +1,98 @@ +--- +sidebar_position: 7 +title: 多个用户对同一会话设置字段 +hide_title: true +--- + +
+ +## 多个用户对同一会话设置字段 + +
+ +### 简要描述 +- 多个用户对同一会话可选择性的设置字段。 +### 请求方式 +- `post` +### 请求URL +- `http://x.x.x.x:10002/conversation/set_conversations` + + +### Header +|header名|示例值|选填|类型|说明| +|:---- |:------- |:--- |---|------ | +|operationID|1646445464564|必填|string|operationID用于全局链路追踪| +|token|eyJhbxxxx3Xs|必填|string|管理员token| + + +### 请求参数示例 + + +```json +{ + "userIDs": [ + "6965946400" + ], + "conversation": { + "conversationID": "si_4365007572_6965946400", + "conversationType": 1, + "userID": "4365007572", + "groupID": "", + "recvMsgOpt": 0, + "isPinned": false, + "isPrivateChat": true, + "ex": "", + "burnDuration": 30 + } +} +``` +|字段名|选填|类型|说明| +|:---- |:------- |:--- |---| +|userIDs|必填|array|要设置会话字段的用户ID列表| +|conversation|必填|object|会话对象| +|conversation.conversationID|必填|string|会话ID| +|conversation.conversationType|必填|int|会话类型,单聊为1,群聊为3| +|conversation.userID|选填|string|会话类型为单聊时必填| +|conversation.groupID|选填|string|会话类型为群聊时必填| +|conversation.recvMsgOpt|选填|int|会话免打扰状态| +|conversation.isPinned|选填|boolean|会话是否置顶| +|conversation.isPrivateChat|选填|boolean|是否开启阅后即焚| +|conversation.ex|选填|string|会话扩展字段| +|conversation.burnDuration|选填|string|设置会话阅后即焚时间,单位秒| +### 成功返回示例 + + +```json +{ + "errCode": 0, + "errMsg": "", + "errDlt": "" +} +``` +### 成功返回示例的参数说明 + + +|参数名|类型|说明| +|:---- |:------- |:--- | +|errCode|int|错误码,0表示成功| +|errMsg|string|错误简要信息,无错误时为空| +|errDlt|errDlt|错误详细信息,无错误时为空| +|data|object|通用数据对象,具体结构见下方| +### 失败返回示例 + + +```json +{ + "errCode": 1004, + "errMsg": "RecordNotFoundError", + "errDlt": ": [1004]RecordNotFoundError" +} +``` +### 失败返回示例的参数说明 + + +|参数名|类型|说明| +|:---- |:------- |:--- | +|errCode|int|错误码,具体查看全局错误码文档| +|errMsg|string|错误简要信息| +|errDlt|errDlt|错误详细信息| diff --git a/docs/restapi/apis/friendsManagement/getSentApplication.mdx b/docs/restapi/apis/friendsManagement/getSentApplication.mdx index 8331feaf03..9aca92454e 100644 --- a/docs/restapi/apis/friendsManagement/getSentApplication.mdx +++ b/docs/restapi/apis/friendsManagement/getSentApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 9 +sidebar_position: 13 title: 获取发起的好友申请 hide_title: true --- diff --git a/docs/restapi/apis/friendsManagement/importFriend.mdx b/docs/restapi/apis/friendsManagement/importFriend.mdx index 04f9e90b8a..52d508a84c 100644 --- a/docs/restapi/apis/friendsManagement/importFriend.mdx +++ b/docs/restapi/apis/friendsManagement/importFriend.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 7 +sidebar_position: 11 title: 导入好友 hide_title: true --- diff --git a/docs/restapi/apis/friendsManagement/processApplication.mdx b/docs/restapi/apis/friendsManagement/processApplication.mdx index bd7945ff7b..20281408d0 100644 --- a/docs/restapi/apis/friendsManagement/processApplication.mdx +++ b/docs/restapi/apis/friendsManagement/processApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 8 +sidebar_position: 12 title: 处理好友申请 hide_title: true --- diff --git a/docs/restapi/apis/friendsManagement/sendApplication.mdx b/docs/restapi/apis/friendsManagement/sendApplication.mdx index 028810254a..c56f410f0d 100644 --- a/docs/restapi/apis/friendsManagement/sendApplication.mdx +++ b/docs/restapi/apis/friendsManagement/sendApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 6 +sidebar_position: 10 title: 发起好友申请 hide_title: true --- diff --git a/docs/restapi/apis/friendsManagement/updateFriendRemark.mdx b/docs/restapi/apis/friendsManagement/updateFriendRemark.mdx index f1b399e3fb..d63f2517a7 100644 --- a/docs/restapi/apis/friendsManagement/updateFriendRemark.mdx +++ b/docs/restapi/apis/friendsManagement/updateFriendRemark.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 5 +sidebar_position: 9 title: 修改好友备注 hide_title: true --- diff --git a/docs/restapi/commonFields.mdx b/docs/restapi/commonFields.mdx index 4a62f9a3e9..92c02685e5 100644 --- a/docs/restapi/commonFields.mdx +++ b/docs/restapi/commonFields.mdx @@ -4,18 +4,18 @@ title: 常用结构体说明 --- ## 通用字段说明 -| 字段名 | 类型 | 字符串长度限制 | 说明 | 取值说明 | -|------------------|----------|--------------------|--------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| secret | string | 32 | OpenIM 秘钥,服务端config/share.yml 的 secret 字段 | 字符串 | -| platformID | int | | 用户登录时的终端类型 | iOS 1, Android 2, Windows 3, OSX 4, WEB 5, 小程序 6,linux 7, AndroidPad 8, IPad 9, Admin 10 | -| userID | string | 64 | 用户 ID,保证 IM 内唯一 | 字符串 | -| nickname | string | 255 | 昵称 | 字符串 | -| faceURL | string | 255 | 头像链接地址 | URL链接 | -| ex | string | 1024 | 扩展字段,可自行扩展,建议封装成 JSON 字符串 | 字符串/JSON | -| operationID | string | | 操作 ID,用于定位问题,保持唯一,建议用当前时间、随机数和userID | 字符串 | -| operatorUserID | string | 64 | 操作者,具体含义视上下文而定 | 字符串 | -| groupID | string | 64 | 群 ID ,保证 IM 内唯一 | 字符串 | +| 字段名 | 类型 | 字符串长度限制 | 说明 | 取值说明 | +| -------------- | ------ | -------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| secret | string | 32 | OpenIM 秘钥,服务端 config/share.yml 的 secret 字段 | 字符串 | +| platformID | int | | 用户登录时的终端类型 | iOS 1, Android 2, Windows 3, OSX 4, WEB 5, 小程序 6,linux 7, AndroidPad 8, IPad 9, Admin 10 | +| userID | string | 64 | 用户 ID,保证 IM 内唯一 | 字符串 | +| nickname | string | 255 | 昵称 | 字符串 | +| faceURL | string | 255 | 头像链接地址 | URL 链接 | +| ex | string | 1024 | 扩展字段,可自行扩展,建议封装成 JSON 字符串 | 字符串/JSON | +| operationID | string | | 操作 ID,用于定位问题,保持唯一,建议用当前时间、随机数和 userID | 字符串 | +| operatorUserID | string | 64 | 操作者,具体含义视上下文而定 | 字符串 | +| groupID | string | 64 | 群 ID ,保证 IM 内唯一 | 字符串 | ## PublicUserInfo @@ -23,30 +23,30 @@ title: 常用结构体说明 | 字段名 | 类型 | 最大字符串长度限制 | 说明 | | -------- | ------ | ------------------ | -------- | -| userID | string | 64 | 用户 ID | -| nickname | string | 255 | 用户名 | -| faceURL | string | 255 | 用户头像 | -| ex | string | 1024 | 扩展字段 | +| userID | string | 64 | 用户 ID | +| nickname | string | 255 | 用户名 | +| faceURL | string | 255 | 用户头像 | +| ex | string | 1024 | 扩展字段 | ## UserInfo > 用户信息对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | ---------------- | ------ | ------------------ | -------------------- | ------------------ | | userID | string | | 用户 ID | | | nickname | string | | 用户名 | | | faceURL | string | | 用户头像 | | | ex | string | | 扩展字段 | | | createTime | int | | 创建时间 | | -| appMangerLevel | int | | 内部字段,可忽略 | | +| appMangerLevel | int | | 内部字段,可忽略 | | | globalRecvMsgOpt | int | | 全局是否接收离线推送 | 0:接收、2:不接收 | ## FriendInfo > 好友信息对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | -------------- | --------------------- | ------------------ | ------------ | -------- | | ownerUserID | string | | 用户 ID | | | remark | string | | 备注 | | @@ -60,20 +60,20 @@ title: 常用结构体说明 > 黑名单信息对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | -------------- | --------------------------------- | ------------------ | -------------- | -------- | | ownerUserID | string | | 用户 ID | | | createTime | int | | 拉黑时间 | | | blackUserInfo | [PublicUserInfo](#publicuserinfo) | | 被拉黑用户信息 | | | addSource | int | | 拉黑来源 | | | operatorUserID | string | | 操作者 ID | | -| ex | string | | 扩展字段 | | +| ex | string | | 扩展字段 | | ## GroupInfo > 群信息对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | ---------------------- | ------ | ------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------- | | groupID | string | | 群 ID | | | groupName | string | | 群名称 | | @@ -97,26 +97,26 @@ title: 常用结构体说明 > 群成员信息对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | -| -------------- | ------ | ------------------ | ---------------------- | ------------------------------------------------------ | -| groupID | string | | 群 ID | | -| userID | string | | 群成员 ID | | -| roleLevel | int | | 群成员等级 | 100:群主、60:管理员、20:普通成员 | -| joinTime | int | | 群成员加群时间 | | -| nickname | string | | 群成员群昵称 | | -| faceURL | string | | 群成员群头像 | | -| appMangerLevel | int | | 内部字段,可忽略 | | -| joinSource | int | | 加群来源 | 1:管理员邀请、2:群成员邀请、3:搜索加入、4:扫码加入 | -| operatorUserID | string | | 操作加群的用户 ID | | -| ex | string | | 群成员扩展字段 | | -| muteEndTime | int | | 封禁结束时间 | | -| inviterUserID | string | | 邀请进群的人的 ID | | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| -------------- | ------ | ------------------ | ----------------- | ------------------------------------------------------ | +| groupID | string | | 群 ID | | +| userID | string | | 群成员 ID | | +| roleLevel | int | | 群成员等级 | 100:群主、60:管理员、20:普通成员 | +| joinTime | int | | 群成员加群时间 | | +| nickname | string | | 群成员群昵称 | | +| faceURL | string | | 群成员群头像 | | +| appMangerLevel | int | | 内部字段,可忽略 | | +| joinSource | int | | 加群来源 | 1:管理员邀请、2:群成员邀请、3:搜索加入、4:扫码加入 | +| operatorUserID | string | | 操作加群的用户 ID | | +| ex | string | | 群成员扩展字段 | | +| muteEndTime | int | | 封禁结束时间 | | +| inviterUserID | string | | 邀请进群的人的 ID | | ## FriendRequestInfo > 好友申请对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | ------------- | ------ | ------------------ | ------------------- | ---------------------------- | | fromUserID | string | | 发出申请者的用户 ID | | | fromNickname | string | | 发出申请者的用户名 | | @@ -136,7 +136,7 @@ title: 常用结构体说明 > 入群申请对象 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值说明 | | ------------- | --------------------------------- | ------------------ | ------------------ | ------------------------------------------------------ | | userInfo | [PublicUserInfo](#publicuserinfo) | | 申请加群的用户信息 | | | groupInfo | [GroupInfo](#groupinfo) | | 群组信息 | | @@ -154,10 +154,34 @@ title: 常用结构体说明 > 图片基本信息 -| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值范围 | -| ------------- | --------------------------------- | ------------------ | ------------------ | ------------------------------------------------------ | -| uuid| string | | 图片唯一uuid| -| type| string | | 图片类型 | -| size| int | | 图片大小 | -| width| int | | 图片宽度 | -| height| int | | 图片高度 | \ No newline at end of file +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值范围 | +| ------ | ------ | ------------------ | ------------- | -------- | +| uuid | string | | 图片唯一 uuid | +| type | string | | 图片类型 | +| size | int | | 图片大小 | +| width | int | | 图片宽度 | +| height | int | | 图片高度 | + +## ConversationInfo + +> 会话信息 + +| 字段名 | 类型 | 最大字符串长度限制 | 说明 | 取值范围 | +| --------------------- | ------- | ------------------ | ------------------------------------------------------------------------- | -------- | +| ownerUserID | string | | 会话的拥有者用户 ID | +| conversationID | string | | 会话 ID | +| recvMsgOpt | int | | 接收消息参数,0 为接收消息,1 为不接收消息,2 为接收消息但不提醒 | +| conversationType | int | | 会话类型,1 为单聊,3 为群聊 | +| userID | string | | 会话用户 ID,当会话类型为 1 时,此字段生效 | +| groupID | string | | 会话的群 ID,当会话类型为 3 时,此字段生效 | +| isPinned | boolean | | 会话是否置顶 | +| attachedInfo | string | | openIM 使用的拓展字段 | +| isPrivateChat | boolean | | 是否开启阅后即焚 | +| groupAtType | int | | 群会话公告强提示类型,群公告有人**@ownerUserID** , **@全体** 的特殊标识符 | +| ex | string | | 用户使用的拓展字段 | +| burnDuration | int | | 阅后即焚消息持续时间 | +| minSeq | int | | 该用户在该会话能拉取到的最小 seq | +| maxSeq | int | | 该用户在该会话能拉取到的最大 seq | +| msgDestructTime | int | | 消息销毁间隔时间 | +| latestMsgDestructTime | int | | 消息最后销毁时间 | +| isMsgDestruct | boolean | | 是否开启消息定时销毁 | diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/getOwnerConversation.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/getOwnerConversation.mdx new file mode 100644 index 0000000000..55bd13a6dc --- /dev/null +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/getOwnerConversation.mdx @@ -0,0 +1,127 @@ +--- +sidebar_position: 8 +title: get_owner_conversation +hide_title: true +--- + +
+ +## Get Paginated Conversation List for the Current User + +
+ +### Brief Description +- Retrieve the paginated list of conversations for the current user. + +### Request Method +- `post` + +### Request URL +- `http://x.x.x.x:10002/conversation/get_owner_conversation` + +### Header +| Header Name | Example Value | Required | Type | Description | +|:---- |:------- |:--- |---|------ | +| operationID | 1646445464564 | Required | string | The operationID is used for global tracing. | +| token | eyJhbxxxx3Xs | Required | string | Admin token | + +### Request Parameter Example + +```json +{ + "userID": "1008432211", + "pagination": { + "pageNumber": 1, + "showNumber": 20 + } +} +``` + +| Field Name | Required | Type | Description | +|:---- |:------- |:--- |---| +| userID | Required | string | Current user ID. | +| pagination | Required | object | Pagination parameters structure. | +| pagination.pageNumber | Required | string | Current page number, starting from 1. | +| pagination.showNumber | Required | string | Number of records per page. | + +### Successful Response Example + +```json +{ + "errCode": 0, + "errMsg": "", + "errDlt": "", + "data": { + "total": 38, + "conversations": [ + { + "ownerUserID": "1008432211", + "conversationID": "sg_1012900607", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1012900607", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 0, + "minSeq": 0, + "maxSeq": 184, + "msgDestructTime": 0, + "latestMsgDestructTime": -62135596800000, + "isMsgDestruct": false + }, + { + "ownerUserID": "1008432211", + "conversationID": "sg_1084800774", + "recvMsgOpt": 0, + "conversationType": 3, + "userID": "", + "groupID": "1084800774", + "isPinned": false, + "attachedInfo": "", + "isPrivateChat": false, + "groupAtType": 0, + "ex": "", + "burnDuration": 30, + "minSeq": 0, + "maxSeq": 0, + "msgDestructTime": 604800, + "latestMsgDestructTime": 1695265099982, + "isMsgDestruct": false + } + ] + } +} +``` + +### Successful Response Parameters Description + +| Parameter Name | Type | Description | +|:---- |:------- |:--- | +| errCode | int | Error code, 0 indicates success. | +| errMsg | string | Brief error message, empty if there is no error. | +| errDlt | string | Detailed error message, empty if there is no error. | +| data | object | Common data object, see below for the specific structure. | +| total | string | Total number of conversations. | +| conversations | array | List of [conversations](/restapi/commonFields#conversationinfo). | + +### Failed Response Example + +```json +{ + "errCode": 1004, + "errMsg": "RecordNotFoundError", + "errDlt": ": [1004]RecordNotFoundError" +} +``` + +### Failed Response Parameters Description + +| Parameter Name | Type | Description | +|:---- |:------- |:--- | +| errCode | int | Error code, refer to the global error code documentation for details. | +| errMsg | string | Brief error message. | +| errDlt | string | Detailed error message. | \ No newline at end of file diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/setConversations.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/setConversations.mdx new file mode 100644 index 0000000000..bdbbd3dfc5 --- /dev/null +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/conversationManagement/setConversations.mdx @@ -0,0 +1,98 @@ +--- +sidebar_position: 7 +title: set_conversations +hide_title: true +--- + +
+ +## Set Fields for Multiple Users in the Same Conversation + +
+ +### Brief Description +- Allows multiple users to selectively set fields for the same conversation. + +### Request Method +- `post` + +### Request URL +- `http://x.x.x.x:10002/conversation/set_conversations` + +### Header +| Header Name | Example Value | Required | Type | Description | +|:---- |:------- |:--- |---|------ | +| operationID | 1646445464564 | Required | string | The operationID is used for global tracing. | +| token | eyJhbxxxx3Xs | Required | string | Admin token | + +### Request Parameter Example + +```json +{ + "userIDs": [ + "6965946400" + ], + "conversation": { + "conversationID": "si_4365007572_6965946400", + "conversationType": 1, + "userID": "4365007572", + "groupID": "", + "recvMsgOpt": 0, + "isPinned": false, + "isPrivateChat": true, + "ex": "", + "burnDuration": 30 + } +} +``` + +| Field Name | Required | Type | Description | +|:---- |:------- |:--- |---| +| userIDs | Required | array | List of user IDs for whom the conversation fields will be set. | +| conversation | Required | object | Conversation object. | +| conversation.conversationID | Required | string | Conversation ID. | +| conversation.conversationType | Required | int | Conversation type, 1 for single chat, 3 for group chat. | +| conversation.userID | Optional | string | Required if the conversation type is single chat. | +| conversation.groupID | Optional | string | Required if the conversation type is group chat. | +| conversation.recvMsgOpt | Optional | int | Conversation do-not-disturb status. | +| conversation.isPinned | Optional | boolean | Whether the conversation is pinned. | +| conversation.isPrivateChat | Optional | boolean | Whether the private chat (self-destructing messages) feature is enabled. | +| conversation.ex | Optional | string | Conversation extension field. | +| conversation.burnDuration | Optional | string | Set the self-destruct timer for the conversation, in seconds. | + +### Successful Response Example + +```json +{ + "errCode": 0, + "errMsg": "", + "errDlt": "" +} +``` + +### Successful Response Parameters Description + +| Parameter Name | Type | Description | +|:---- |:------- |:--- | +| errCode | int | Error code, 0 indicates success. | +| errMsg | string | Brief error message, empty if there is no error. | +| errDlt | string | Detailed error message, empty if there is no error. | +| data | object | Common data object, see below for the specific structure. | + +### Failed Response Example + +```json +{ + "errCode": 1004, + "errMsg": "RecordNotFoundError", + "errDlt": ": [1004]RecordNotFoundError" +} +``` + +### Failed Response Parameters Description + +| Parameter Name | Type | Description | +|:---- |:------- |:--- | +| errCode | int | Error code, refer to the global error code documentation for details. | +| errMsg | string | Brief error message. | +| errDlt | string | Detailed error message. | \ No newline at end of file diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/getSentApplication.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/getSentApplication.mdx index e037c96b58..ec141482d5 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/getSentApplication.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/getSentApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 9 +sidebar_position: 13 title: get_self_friend_apply_list hide_title: true --- diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/importFriend.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/importFriend.mdx index 911f0f8fab..5536c9cfea 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/importFriend.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/importFriend.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 7 +sidebar_position: 11 title: import_friend hide_title: true --- diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/processApplication.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/processApplication.mdx index 1e1ab092ab..8b23f4e82a 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/processApplication.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/processApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 8 +sidebar_position: 12 title: add_friend_response hide_title: true --- diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/sendApplication.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/sendApplication.mdx index 93e88c2884..517533b647 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/sendApplication.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/sendApplication.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 6 +sidebar_position: 10 title: add_friend hide_title: true --- diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/updateFriendRemark.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/updateFriendRemark.mdx index 527aa97f60..a9ab6ea64b 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/updateFriendRemark.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/apis/friendsManagement/updateFriendRemark.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 5 +sidebar_position: 9 title: set_friend_remark hide_title: true --- diff --git a/i18n/en/docusaurus-plugin-content-docs-restapi/current/commonFields.mdx b/i18n/en/docusaurus-plugin-content-docs-restapi/current/commonFields.mdx index 0552b1db4e..7274ce0db5 100644 --- a/i18n/en/docusaurus-plugin-content-docs-restapi/current/commonFields.mdx +++ b/i18n/en/docusaurus-plugin-content-docs-restapi/current/commonFields.mdx @@ -161,3 +161,27 @@ title: Common Struct Descriptions | size | int | | Picture Size | | | width | int | | Picture Width | | | height | int | | Picture Height | | + +## ConversationInfo + +> Conversation Information + +| Field Name | Type | Maximum String Length | Description | Range | +| --------------------- | ------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----- | +| ownerUserID | string | | Owner user ID of the conversation | +| conversationID | string | | Conversation ID | +| recvMsgOpt | int | | Receive message options: 0 to receive messages, 1 to not receive messages, 2 to receive messages but not notify | +| conversationType | int | | Conversation type: 1 for single chat, 3 for group chat | +| userID | string | | User ID of the conversation, valid when the conversation type is 1 | +| groupID | string | | Group ID of the conversation, valid when the conversation type is 3 | +| isPinned | boolean | | Whether the conversation is pinned | +| attachedInfo | string | | Extended field used by openIM | +| isPrivateChat | boolean | | Whether self-destructing messages are enabled | +| groupAtType | int | | Group conversation announcement strong alert type, special identifier for group announcements **@ownerUserID**, **@all** | +| ex | string | | Extended field used by the user | +| burnDuration | int | | Duration of self-destructing messages | +| minSeq | int | | Minimum sequence number the user can retrieve in the conversation | +| maxSeq | int | | Maximum sequence number the user can retrieve in the conversation | +| msgDestructTime | int | Message destruction interval | +| latestMsgDestructTime | int | Latest message destruction time | +| isMsgDestruct | boolean | Whether timed message destruction is enabled | diff --git a/scripts/githooks/commit-msg.sh b/scripts/githooks/commit-msg.sh deleted file mode 100644 index d2d96645bc..0000000000 --- a/scripts/githooks/commit-msg.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# Copyright © 2023 OpenIMSDK. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============================================================================== -# -# Store this file as .git/hooks/commit-msg in your repository in order to -# enforce checking for proper commit message format before actual commits. -# You may need to make the scripts executable by 'chmod +x .git/hooks/commit-msg'. - -# commit-msg use go-gitlint tool, install go-gitlint via `go get github.com/llorllale/go-gitlint/cmd/go-gitlint` -# go-gitlint --msg-file="$1" - -# An example hook scripts to check the commit log message. -# Called by "git commit" with one argument, the name of the file -# that has the commit message. The hook should exit with non-zero -# status after issuing an appropriate message if it wants to stop the -# commit. The hook is allowed to edit the commit message file. - -YELLOW="\e[93m" -GREEN="\e[32m" -RED="\e[31m" -ENDCOLOR="\e[0m" - -printMessage() { - printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n" -} - -printSuccess() { - printf "${GREEN}OpenIM : $1${ENDCOLOR}\n" -} - -printError() { - printf "${RED}OpenIM : $1${ENDCOLOR}\n" -} - -printMessage "Running the OpenIM commit-msg hook." - -# This example catches duplicate Signed-off-by lines. - -test "" = "$(grep '^Signed-off-by: ' "$1" | -sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { -echo >&2 Duplicate Signed-off-by lines. -exit 1 -} - -# TODO: go-gitlint dir set -OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. -GITLINT_DIR="$OPENIM_ROOT/_output/tools/go-gitlint" - -$GITLINT_DIR \ ---msg-file=$1 \ ---subject-regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test)(.*)?:\s?.*" \ ---subject-maxlen=150 \ ---subject-minlen=10 \ ---body-regex=".*" \ ---max-parents=1 - -if [ $? -ne 0 ] -then -if ! command -v $GITLINT_DIR &>/dev/null; then - printError "$GITLINT_DIR not found. Please run 'make tools' OR 'make tools.verify.go-gitlint' make verto install it." -fi -printError "Please fix your commit message to match kubecub coding standards" -printError "https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md" -exit 1 -fi - -### Add Sign-off-by line to the end of the commit message -# Get local git config -NAME=$(git config user.name) -EMAIL=$(git config user.email) - -# Check if the commit message contains a sign-off line -grep -qs "^Signed-off-by: " "$1" -SIGNED_OFF_BY_EXISTS=$? - -# Add "Signed-off-by" line if it doesn't exist -if [ $SIGNED_OFF_BY_EXISTS -ne 0 ]; then -echo -e "\nSigned-off-by: $NAME <$EMAIL>" >> "$1" -fi \ No newline at end of file diff --git a/scripts/githooks/pre-commit.sh b/scripts/githooks/pre-commit.sh deleted file mode 100644 index d8396b5605..0000000000 --- a/scripts/githooks/pre-commit.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash -# Copyright © 2023 OpenIMSDK. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============================================================================== -# This is a pre-commit hook that ensures attempts to commit files that are -# are larger than $limit to your _local_ repo fail, with a helpful error message. - -# You can override the default limit of 2MB by supplying the environment variable: -# GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB" -# -# ============================================================================== -# - -LC_ALL=C - -local_branch="$(git rev-parse --abbrev-ref HEAD)" -valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|bot|refactor|revert|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" - -YELLOW="\e[93m" -GREEN="\e[32m" -RED="\e[31m" -ENDCOLOR="\e[0m" - -printMessage() { - printf "${YELLOW}openim : $1${ENDCOLOR}\n" -} - -printSuccess() { - printf "${GREEN}openim : $1${ENDCOLOR}\n" -} - -printError() { - printf "${RED}openim : $1${ENDCOLOR}\n" -} - -printMessage "Running local openim pre-commit hook." - -# flutter format . -# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694#file-githook-md -# TODO! GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB" -# Maximum file size limit in bytes -limit=${GIT_FILE_SIZE_LIMIT:-2000000} # Default 2MB -limitInMB=$(( $limit / 1000000 )) - -function file_too_large(){ - filename=$0 - filesize=$(( $1 / 2**20 )) - - cat < /dev/null 2>&1 -then - against=HEAD -else - against="$empty_tree" -fi - -# Set split so that for loop below can handle spaces in file names by splitting on line breaks -IFS=' -' - -shouldFail=false -for file in $( git diff-index --cached --name-only $against ); do - file_size=$(([ ! -f $file ] && echo 0) || (ls -la $file | awk '{ print $5 }')) - if [ "$file_size" -gt "$limit" ]; then - printError "File $file is $(( $file_size / 10**6 )) MB, which is larger than our configured limit of $limitInMB MB" - shouldFail=true - fi -done - -if $shouldFail -then - printMessage "If you really need to commit this file, you can override the size limit by setting the GIT_FILE_SIZE_LIMIT environment variable, e.g. GIT_FILE_SIZE_LIMIT=42000000 for 42MB. Or, commit with the --no-verify switch to skip the check entirely." - printError "Commit aborted" - exit 1; -fi - -if [[ ! $local_branch =~ $valid_branch_regex ]] -then - printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. -Your commit will be rejected. You should rename your branch to a valid name(feat/name OR fix/name) and try again." - printError "For more on this, read on: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694" - exit 1 -fi \ No newline at end of file diff --git a/scripts/githooks/pre-push.sh b/scripts/githooks/pre-push.sh deleted file mode 100644 index 9bd9389158..0000000000 --- a/scripts/githooks/pre-push.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env bash -# Copyright © 2023 OpenIMSDK. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============================================================================== -# - -YELLOW="\e[93m" -GREEN="\e[32m" -RED="\e[31m" -ENDCOLOR="\e[0m" - -local_branch="$(git rev-parse --abbrev-ref HEAD)" -valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" - -printMessage() { - printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n" -} - -printSuccess() { - printf "${GREEN}OpenIM : $1${ENDCOLOR}\n" -} - -printError() { - printf "${RED}OpenIM : $1${ENDCOLOR}\n" -} - -printMessage "Running local OpenIM pre-push hook." - -if [[ $(git status --porcelain) ]]; then - printError "This scripts needs to run against committed code only. Please commit or stash you changes." - exit 1 -fi - -COLOR_SUFFIX="\033[0m" - -BLACK_PREFIX="\033[30m" -RED_PREFIX="\033[31m" -GREEN_PREFIX="\033[32m" -BACKGROUND_GREEN="\033[33m" -BLUE_PREFIX="\033[34m" -PURPLE_PREFIX="\033[35m" -SKY_BLUE_PREFIX="\033[36m" -WHITE_PREFIX="\033[37m" -BOLD_PREFIX="\033[1m" -UNDERLINE_PREFIX="\033[4m" -ITALIC_PREFIX="\033[3m" - -# Function to print colored text -print_color() { - local text=$1 - local color=$2 - echo -e "${color}${text}${COLOR_SUFFIX}" -} - -# Function to print section separator -print_separator() { - print_color "==========================================================" ${PURPLE_PREFIX} -} - -# Get current time -time=$(date +"%Y-%m-%d %H:%M:%S") - -# Print section separator -print_separator - -# Print time of submission -print_color "PTIME: ${time}" "${BOLD_PREFIX}${CYAN_PREFIX}" -echo "" -author=$(git config user.name) -repository=$(basename -s .git $(git config --get remote.origin.url)) - -# Print additional information if needed -print_color "Repository: ${repository}" "${BLUE_PREFIX}" -echo "" - -print_color "Author: ${author}" "${PURPLE_PREFIX}" - -# Print section separator -print_separator - -file_list=$(git diff --name-status HEAD @{u}) -added_files=$(grep -c '^A' <<< "$file_list") -modified_files=$(grep -c '^M' <<< "$file_list") -deleted_files=$(grep -c '^D' <<< "$file_list") - -print_color "Added Files: ${added_files}" "${BACKGROUND_GREEN}" -print_color "Modified Files: ${modified_files}" "${BACKGROUND_GREEN}" -print_color "Deleted Files: ${deleted_files}" "${BACKGROUND_GREEN}" - -if [[ ! $local_branch =~ $valid_branch_regex ]] -then - printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. -Your commit will be rejected. You should rename your branch to a valid name(feat/name OR fix/name) and try again." - printError "For more on this, read on: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694" - exit 1 -fi - -# -#printMessage "Running the Flutter analyzer" -#flutter analyze -# -#if [ $? -ne 0 ]; then -# printError "Flutter analyzer error" -# exit 1 -#fi -# -#printMessage "Finished running the Flutter analyzer"