-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dylan <[email protected]>
- Loading branch information
Showing
38 changed files
with
9,081 additions
and
6,889 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* @file v2_node_nim_passthrough_service.cpp | ||
* @author Dylan ([email protected]) | ||
* @brief | ||
* @date 2024/10/29 | ||
*/ | ||
|
||
#include "v2_node_nim_passthrough_service.h" | ||
|
||
namespace node_nim { | ||
|
||
Napi::Object V2NodeNIMPassthroughService::Init(Napi::Env env, Napi::Object exports) { | ||
// clang-format off | ||
return InternalInit("V2NIMPassthroughService", env, exports, { | ||
RegApi("httpProxy", &V2NIMPassthroughService::httpProxy) | ||
}); | ||
// clang-format on | ||
} | ||
|
||
V2NodeNIMPassthroughService::V2NodeNIMPassthroughService(const Napi::CallbackInfo& info) | ||
: BizService("V2NIMPassthroughService", info) { | ||
service_instance_ = &v2::V2NIMClient::get().getPassthroughService(); | ||
initEventHandler(); | ||
} | ||
|
||
void V2NodeNIMPassthroughService::initEventHandler() { | ||
auto& passthrough_service = v2::V2NIMClient::get().getPassthroughService(); | ||
V2NIMPassthroughListener listener; | ||
listener.onProxyNotify = MakeNotifyCallback<nstd::function<void(const V2NIMProxyNotify& time)>>("proxyNotify"); | ||
passthrough_service.addPassthroughListener(listener); | ||
} | ||
|
||
} // namespace node_nim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @file v2_node_nim_passthrough_service.h | ||
* @author Dylan ([email protected]) | ||
* @brief | ||
* @date 2024/10/29 | ||
*/ | ||
|
||
#ifndef V2_NODE_NIM_PASSTHROUGH_SERVICE_H | ||
#define V2_NODE_NIM_PASSTHROUGH_SERVICE_H | ||
|
||
#include <napi.h> | ||
#include "service_base.h" | ||
|
||
namespace node_nim { | ||
|
||
class V2NodeNIMPassthroughService : public BizService<V2NodeNIMPassthroughService> { | ||
public: | ||
static Napi::Object Init(Napi::Env env, Napi::Object exports); | ||
explicit V2NodeNIMPassthroughService(const Napi::CallbackInfo& info); | ||
void initEventHandler(); | ||
}; | ||
|
||
} // namespace node_nim | ||
|
||
#endif // V2_NODE_NIM_PASSTHROUGH_SERVICE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* @file v2_node_nim_chatroom_queue_service.cpp | ||
* @author Dylan ([email protected]) | ||
* @brief | ||
* @date 2024/10/28 | ||
*/ | ||
|
||
#include "v2_node_nim_chatroom_queue_service.h" | ||
|
||
namespace node_nim { | ||
|
||
Napi::Object V2NodeNIMChatroomQueueService::Init(Napi::Env env, Napi::Object exports) { | ||
// clang-format off | ||
return InternalInit("V2NIMChatroomQueueService", env, exports,{ | ||
RegApi("queueInit", &V2NIMChatroomQueueService::queueInit), | ||
RegApi("queueDrop", &V2NIMChatroomQueueService::queueDrop), | ||
RegApi("queueOffer", &V2NIMChatroomQueueService::queueOffer), | ||
RegApi("queuePoll", &V2NIMChatroomQueueService::queuePoll), | ||
RegApi("queuePeek", &V2NIMChatroomQueueService::queuePeek), | ||
RegApi("queueList", &V2NIMChatroomQueueService::queueList), | ||
RegApi("queueBatchUpdate", &V2NIMChatroomQueueService::queueBatchUpdate), | ||
}); | ||
// clang-format on | ||
} | ||
|
||
V2NodeNIMChatroomQueueService::V2NodeNIMChatroomQueueService(const Napi::CallbackInfo& info) | ||
: BizService("V2NIMChatroomQueueService", info) { | ||
if (info.Length() != 2 || !info[1].IsNumber()) { | ||
Napi::Error::New(info.Env(), "V2NIMChatroomQueueService: constructor: bad arguments").ThrowAsJavaScriptException(); | ||
return; | ||
} | ||
auto instance_id = info[1].As<Napi::Number>().Int64Value(); | ||
auto instance = v2::V2NIMChatroomClient::getInstance(instance_id); | ||
v2::V2NIMChatroomQueueListener listener; | ||
listener.onChatroomQueueOffered = MakeNotifyCallback<nstd::function<void(const V2NIMChatroomQueueElement& element)>>("chatroomQueueOffered"); | ||
listener.onChatroomQueuePolled = MakeNotifyCallback<nstd::function<void(const V2NIMChatroomQueueElement& element)>>("chatroomQueuePolled"); | ||
listener.onChatroomQueueDropped = MakeNotifyCallback<nstd::function<void()>>("chatroomQueueDropped"); | ||
listener.onChatroomQueuePartCleared = | ||
MakeNotifyCallback<nstd::function<void(const nstd::vector<V2NIMChatroomQueueElement>& keyValues)>>("chatroomQueuePartCleared"); | ||
listener.onChatroomQueueBatchUpdated = | ||
MakeNotifyCallback<nstd::function<void(const nstd::vector<V2NIMChatroomQueueElement>& keyValues)>>("chatroomQueueBatchUpdated"); | ||
listener.onChatroomQueueBatchOffered = | ||
MakeNotifyCallback<nstd::function<void(const nstd::vector<V2NIMChatroomQueueElement>& keyValues)>>("chatroomQueueBatchOffered"); | ||
auto& chatroom_queue_service = instance->getChatroomQueueService(); | ||
chatroom_queue_service.addQueueListener(listener); | ||
service_instance_ = &chatroom_queue_service; | ||
} | ||
|
||
} // namespace node_nim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @file v2_node_nim_chatroom_queue_service.h | ||
* @author Dylan ([email protected]) | ||
* @brief | ||
* @date 2024/10/28 | ||
*/ | ||
|
||
#ifndef V2_NODE_NIM_CHATROOM_QUEUE_SERVICE_H | ||
#define V2_NODE_NIM_CHATROOM_QUEUE_SERVICE_H | ||
|
||
#include <napi.h> | ||
#include "service_base.h" | ||
|
||
namespace node_nim { | ||
|
||
class V2NodeNIMChatroomQueueService : public BizService<V2NodeNIMChatroomQueueService> { | ||
public: | ||
static Napi::Object Init(Napi::Env env, Napi::Object exports); | ||
explicit V2NodeNIMChatroomQueueService(const Napi::CallbackInfo& info); | ||
}; | ||
|
||
} // namespace node_nim | ||
|
||
#endif // V2_NODE_NIM_CHATROOM_QUEUE_SERVICE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.