Skip to content

Commit 459c3f2

Browse files
authored
docs: update docs contents. (#243)
1 parent ec363ea commit 459c3f2

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

docs/guides/solution/developNewFeatures.mdx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,13 @@ func (f *FriendMgo) AddFriendCategory(ctx context.Context, ownerUserID, friendUs
306306

307307
## SDK Core 接口添加
308308

309-
{/* 先定义访问的 Server 的 API 请求方法,在 server_api,然后再定义 api ,sdkevent 来 wrap 一下,最后 api 再调用 server_api。 */}
310-
{/* 定义 notification 通知的触发,Listener 的回调 就是定义 Listener */}
311-
312309
### 定义 Server API 接口
313310

314311
如果新增的方法需要调用服务端的接口,需要在 `server_api` 中定义对应的接口方法。
315312

316313
例如我们定义的 `AddFriendCategory` 接口,需添加对应内容:
317314

318-
-`pkg/api/api.go` 中定义对应的调用方法变量
315+
-`pkg/api/api.go` 中定义对应的 Server API 调用变量
319316

320317
```go
321318
// relation
@@ -337,14 +334,11 @@ func (r *Relation) AddFriendCategory(ctx context.Context, req *relation.AddFrien
337334
}
338335
```
339336

340-
将这个接口定义到 `bindings/base/api_registry.go` 中,以便 SDK 调用。
337+
将这个接口定义到 `open_im_sdk/relation.go` 中,以便下游 SDK 调用。
341338

342339
```go
343-
var FuncMap = map[sdkevent.FuncRequestEventName]callFunc{
344-
sdkevent.FuncRequestEventName_AddFriend: wrapFunc(open_im_sdk.IMUserContext.Relation().AddFriend),
345-
// ...
346-
// 添加 AddFriendCategory 接口
347-
sdkevent.FuncRequestEventName_AddFriendCategory: wrapFunc(open_im_sdk.IMUserContext.Relation().AddFriendCategory),
340+
func AddFriendCategory(callback open_im_sdk_callback.Base, operationID string, req string){
341+
call(callback, operationID, UserForSDK.Relation().AddFriendCategory, req)
348342
}
349343
```
350344

0 commit comments

Comments
 (0)