Skip to content

Commit 8173f35

Browse files
committed
Add Chat Session Query Support.
1 parent 3b5f67f commit 8173f35

12 files changed

+607
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.36.2102
1+
1.36.2103

lingmou/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ set(lingmou_public_header
2121
include/alibabacloud/lingmou/LingMouExport.h )
2222

2323
set(lingmou_public_header_model
24+
include/alibabacloud/lingmou/model/CloseChatInstanceSessionsRequest.h
25+
include/alibabacloud/lingmou/model/CloseChatInstanceSessionsResult.h
2426
include/alibabacloud/lingmou/model/CreateChatSessionRequest.h
25-
include/alibabacloud/lingmou/model/CreateChatSessionResult.h )
27+
include/alibabacloud/lingmou/model/CreateChatSessionResult.h
28+
include/alibabacloud/lingmou/model/QueryChatInstanceSessionsRequest.h
29+
include/alibabacloud/lingmou/model/QueryChatInstanceSessionsResult.h )
2630

2731
set(lingmou_src
2832
src/LingMouClient.cc
33+
src/model/CloseChatInstanceSessionsRequest.cc
34+
src/model/CloseChatInstanceSessionsResult.cc
2935
src/model/CreateChatSessionRequest.cc
30-
src/model/CreateChatSessionResult.cc )
36+
src/model/CreateChatSessionResult.cc
37+
src/model/QueryChatInstanceSessionsRequest.cc
38+
src/model/QueryChatInstanceSessionsResult.cc )
3139

3240
add_library(lingmou ${LIB_TYPE}
3341
${lingmou_public_header}

lingmou/include/alibabacloud/lingmou/LingMouClient.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
#include <alibabacloud/core/EndpointProvider.h>
2323
#include <alibabacloud/core/RoaServiceClient.h>
2424
#include "LingMouExport.h"
25+
#include "model/CloseChatInstanceSessionsRequest.h"
26+
#include "model/CloseChatInstanceSessionsResult.h"
2527
#include "model/CreateChatSessionRequest.h"
2628
#include "model/CreateChatSessionResult.h"
29+
#include "model/QueryChatInstanceSessionsRequest.h"
30+
#include "model/QueryChatInstanceSessionsResult.h"
2731

2832

2933
namespace AlibabaCloud
@@ -33,17 +37,29 @@ namespace AlibabaCloud
3337
class ALIBABACLOUD_LINGMOU_EXPORT LingMouClient : public RoaServiceClient
3438
{
3539
public:
40+
typedef Outcome<Error, Model::CloseChatInstanceSessionsResult> CloseChatInstanceSessionsOutcome;
41+
typedef std::future<CloseChatInstanceSessionsOutcome> CloseChatInstanceSessionsOutcomeCallable;
42+
typedef std::function<void(const LingMouClient*, const Model::CloseChatInstanceSessionsRequest&, const CloseChatInstanceSessionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CloseChatInstanceSessionsAsyncHandler;
3643
typedef Outcome<Error, Model::CreateChatSessionResult> CreateChatSessionOutcome;
3744
typedef std::future<CreateChatSessionOutcome> CreateChatSessionOutcomeCallable;
3845
typedef std::function<void(const LingMouClient*, const Model::CreateChatSessionRequest&, const CreateChatSessionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateChatSessionAsyncHandler;
46+
typedef Outcome<Error, Model::QueryChatInstanceSessionsResult> QueryChatInstanceSessionsOutcome;
47+
typedef std::future<QueryChatInstanceSessionsOutcome> QueryChatInstanceSessionsOutcomeCallable;
48+
typedef std::function<void(const LingMouClient*, const Model::QueryChatInstanceSessionsRequest&, const QueryChatInstanceSessionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryChatInstanceSessionsAsyncHandler;
3949

4050
LingMouClient(const Credentials &credentials, const ClientConfiguration &configuration);
4151
LingMouClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
4252
LingMouClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
4353
~LingMouClient();
54+
CloseChatInstanceSessionsOutcome closeChatInstanceSessions(const Model::CloseChatInstanceSessionsRequest &request)const;
55+
void closeChatInstanceSessionsAsync(const Model::CloseChatInstanceSessionsRequest& request, const CloseChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
56+
CloseChatInstanceSessionsOutcomeCallable closeChatInstanceSessionsCallable(const Model::CloseChatInstanceSessionsRequest& request) const;
4457
CreateChatSessionOutcome createChatSession(const Model::CreateChatSessionRequest &request)const;
4558
void createChatSessionAsync(const Model::CreateChatSessionRequest& request, const CreateChatSessionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
4659
CreateChatSessionOutcomeCallable createChatSessionCallable(const Model::CreateChatSessionRequest& request) const;
60+
QueryChatInstanceSessionsOutcome queryChatInstanceSessions(const Model::QueryChatInstanceSessionsRequest &request)const;
61+
void queryChatInstanceSessionsAsync(const Model::QueryChatInstanceSessionsRequest& request, const QueryChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
62+
QueryChatInstanceSessionsOutcomeCallable queryChatInstanceSessionsCallable(const Model::QueryChatInstanceSessionsRequest& request) const;
4763

4864
private:
4965
std::shared_ptr<EndpointProvider> endpointProvider_;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_
18+
#define ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_
19+
20+
#include <alibabacloud/lingmou/LingMouExport.h>
21+
#include <alibabacloud/core/RoaServiceRequest.h>
22+
#include <string>
23+
#include <vector>
24+
#include <map>
25+
26+
namespace AlibabaCloud {
27+
namespace LingMou {
28+
namespace Model {
29+
class ALIBABACLOUD_LINGMOU_EXPORT CloseChatInstanceSessionsRequest : public RoaServiceRequest {
30+
public:
31+
CloseChatInstanceSessionsRequest();
32+
~CloseChatInstanceSessionsRequest();
33+
std::string getInstanceId() const;
34+
void setInstanceId(const std::string &instanceId);
35+
std::string getSessionIds() const;
36+
void setSessionIds(const std::string &sessionIds);
37+
38+
private:
39+
std::string instanceId_;
40+
std::string sessionIds_;
41+
};
42+
} // namespace Model
43+
} // namespace LingMou
44+
} // namespace AlibabaCloud
45+
#endif // !ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSREQUEST_H_
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_
18+
#define ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <utility>
23+
#include <alibabacloud/core/ServiceResult.h>
24+
#include <alibabacloud/lingmou/LingMouExport.h>
25+
26+
namespace AlibabaCloud
27+
{
28+
namespace LingMou
29+
{
30+
namespace Model
31+
{
32+
class ALIBABACLOUD_LINGMOU_EXPORT CloseChatInstanceSessionsResult : public ServiceResult
33+
{
34+
public:
35+
struct DataItem
36+
{
37+
long createdAt;
38+
std::string sessionId;
39+
long mainAccountId;
40+
};
41+
42+
43+
CloseChatInstanceSessionsResult();
44+
explicit CloseChatInstanceSessionsResult(const std::string &payload);
45+
~CloseChatInstanceSessionsResult();
46+
std::vector<DataItem> getdata()const;
47+
std::string getRequestId()const;
48+
std::string getMessage()const;
49+
int getHttpStatusCode()const;
50+
std::string getCode()const;
51+
bool getSuccess()const;
52+
53+
protected:
54+
void parse(const std::string &payload);
55+
private:
56+
std::vector<DataItem> data_;
57+
std::string requestId_;
58+
std::string message_;
59+
int httpStatusCode_;
60+
std::string code_;
61+
bool success_;
62+
63+
};
64+
}
65+
}
66+
}
67+
#endif // !ALIBABACLOUD_LINGMOU_MODEL_CLOSECHATINSTANCESESSIONSRESULT_H_
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_
18+
#define ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_
19+
20+
#include <alibabacloud/lingmou/LingMouExport.h>
21+
#include <alibabacloud/core/RoaServiceRequest.h>
22+
#include <string>
23+
#include <vector>
24+
#include <map>
25+
26+
namespace AlibabaCloud {
27+
namespace LingMou {
28+
namespace Model {
29+
class ALIBABACLOUD_LINGMOU_EXPORT QueryChatInstanceSessionsRequest : public RoaServiceRequest {
30+
public:
31+
QueryChatInstanceSessionsRequest();
32+
~QueryChatInstanceSessionsRequest();
33+
std::string getInstanceId() const;
34+
void setInstanceId(const std::string &instanceId);
35+
std::string getSessionIds() const;
36+
void setSessionIds(const std::string &sessionIds);
37+
38+
private:
39+
std::string instanceId_;
40+
std::string sessionIds_;
41+
};
42+
} // namespace Model
43+
} // namespace LingMou
44+
} // namespace AlibabaCloud
45+
#endif // !ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSREQUEST_H_
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_
18+
#define ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_
19+
20+
#include <string>
21+
#include <vector>
22+
#include <utility>
23+
#include <alibabacloud/core/ServiceResult.h>
24+
#include <alibabacloud/lingmou/LingMouExport.h>
25+
26+
namespace AlibabaCloud
27+
{
28+
namespace LingMou
29+
{
30+
namespace Model
31+
{
32+
class ALIBABACLOUD_LINGMOU_EXPORT QueryChatInstanceSessionsResult : public ServiceResult
33+
{
34+
public:
35+
struct DataItem
36+
{
37+
long createdAt;
38+
std::string sessionId;
39+
long mainAccountId;
40+
};
41+
42+
43+
QueryChatInstanceSessionsResult();
44+
explicit QueryChatInstanceSessionsResult(const std::string &payload);
45+
~QueryChatInstanceSessionsResult();
46+
std::vector<DataItem> getdata()const;
47+
std::string getRequestId()const;
48+
std::string getMessage()const;
49+
int getHttpStatusCode()const;
50+
std::string getCode()const;
51+
bool getSuccess()const;
52+
53+
protected:
54+
void parse(const std::string &payload);
55+
private:
56+
std::vector<DataItem> data_;
57+
std::string requestId_;
58+
std::string message_;
59+
int httpStatusCode_;
60+
std::string code_;
61+
bool success_;
62+
63+
};
64+
}
65+
}
66+
}
67+
#endif // !ALIBABACLOUD_LINGMOU_MODEL_QUERYCHATINSTANCESESSIONSRESULT_H_

lingmou/src/LingMouClient.cc

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,42 @@ LingMouClient::LingMouClient(const std::string & accessKeyId, const std::string
5151
LingMouClient::~LingMouClient()
5252
{}
5353

54+
LingMouClient::CloseChatInstanceSessionsOutcome LingMouClient::closeChatInstanceSessions(const CloseChatInstanceSessionsRequest &request) const
55+
{
56+
auto endpointOutcome = endpointProvider_->getEndpoint();
57+
if (!endpointOutcome.isSuccess())
58+
return CloseChatInstanceSessionsOutcome(endpointOutcome.error());
59+
60+
auto outcome = makeRequest(endpointOutcome.result(), request);
61+
62+
if (outcome.isSuccess())
63+
return CloseChatInstanceSessionsOutcome(CloseChatInstanceSessionsResult(outcome.result()));
64+
else
65+
return CloseChatInstanceSessionsOutcome(outcome.error());
66+
}
67+
68+
void LingMouClient::closeChatInstanceSessionsAsync(const CloseChatInstanceSessionsRequest& request, const CloseChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
69+
{
70+
auto fn = [this, request, handler, context]()
71+
{
72+
handler(this, request, closeChatInstanceSessions(request), context);
73+
};
74+
75+
asyncExecute(new Runnable(fn));
76+
}
77+
78+
LingMouClient::CloseChatInstanceSessionsOutcomeCallable LingMouClient::closeChatInstanceSessionsCallable(const CloseChatInstanceSessionsRequest &request) const
79+
{
80+
auto task = std::make_shared<std::packaged_task<CloseChatInstanceSessionsOutcome()>>(
81+
[this, request]()
82+
{
83+
return this->closeChatInstanceSessions(request);
84+
});
85+
86+
asyncExecute(new Runnable([task]() { (*task)(); }));
87+
return task->get_future();
88+
}
89+
5490
LingMouClient::CreateChatSessionOutcome LingMouClient::createChatSession(const CreateChatSessionRequest &request) const
5591
{
5692
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -87,3 +123,39 @@ LingMouClient::CreateChatSessionOutcomeCallable LingMouClient::createChatSession
87123
return task->get_future();
88124
}
89125

126+
LingMouClient::QueryChatInstanceSessionsOutcome LingMouClient::queryChatInstanceSessions(const QueryChatInstanceSessionsRequest &request) const
127+
{
128+
auto endpointOutcome = endpointProvider_->getEndpoint();
129+
if (!endpointOutcome.isSuccess())
130+
return QueryChatInstanceSessionsOutcome(endpointOutcome.error());
131+
132+
auto outcome = makeRequest(endpointOutcome.result(), request);
133+
134+
if (outcome.isSuccess())
135+
return QueryChatInstanceSessionsOutcome(QueryChatInstanceSessionsResult(outcome.result()));
136+
else
137+
return QueryChatInstanceSessionsOutcome(outcome.error());
138+
}
139+
140+
void LingMouClient::queryChatInstanceSessionsAsync(const QueryChatInstanceSessionsRequest& request, const QueryChatInstanceSessionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
141+
{
142+
auto fn = [this, request, handler, context]()
143+
{
144+
handler(this, request, queryChatInstanceSessions(request), context);
145+
};
146+
147+
asyncExecute(new Runnable(fn));
148+
}
149+
150+
LingMouClient::QueryChatInstanceSessionsOutcomeCallable LingMouClient::queryChatInstanceSessionsCallable(const QueryChatInstanceSessionsRequest &request) const
151+
{
152+
auto task = std::make_shared<std::packaged_task<QueryChatInstanceSessionsOutcome()>>(
153+
[this, request]()
154+
{
155+
return this->queryChatInstanceSessions(request);
156+
});
157+
158+
asyncExecute(new Runnable([task]() { (*task)(); }));
159+
return task->get_future();
160+
}
161+

0 commit comments

Comments
 (0)