Skip to content

Commit a39c931

Browse files
authored
Merge pull request #9 from wsjcpp/version-0.0.4
Version 0.0.4
2 parents 75d20c4 + d6d37ae commit a39c931

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2678
-813
lines changed

CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@ set(EXECUTABLE_OUTPUT_PATH ${wsjcpp-jsonrpc20_SOURCE_DIR})
99

1010
# include header dirs
1111
list (APPEND WSJCPP_INCLUDE_DIRS "src")
12+
list (APPEND WSJCPP_INCLUDE_DIRS "src/app")
1213

13-
list (APPEND WSJCPP_SOURCES "src/main.cpp")
14+
# package
1415
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20.h")
1516
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20.cpp")
16-
17+
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_base.h")
18+
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_base.cpp")
1719
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_python.h")
1820
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_python.cpp")
19-
20-
# examples
21-
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_game_create.h")
22-
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_game_create.cpp")
23-
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_auth.h")
24-
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_auth.cpp")
21+
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_webjs.h")
22+
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_webjs.cpp")
23+
24+
# app
25+
list (APPEND WSJCPP_SOURCES "src/app/main.cpp")
26+
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_game_create.h")
27+
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_game_create.cpp")
28+
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_auth.h")
29+
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_auth.cpp")
2530

2631
#### BEGIN_WSJCPP_APPEND
2732
#### END_WSJCPP_APPEND

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Evgenii Sopov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# wsjcpp-jsonrpc20
22

3-
[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-jsonrpc20.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-jsonrpc20) [![Total alerts](https://img.shields.io/lgtm/alerts/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:cpp) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:python)
3+
[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-jsonrpc20.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-jsonrpc20) [![Total alerts](https://img.shields.io/lgtm/alerts/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:cpp) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:python) [![deepcode](https://www.deepcode.ai/api/gh/badge?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF0Zm9ybTEiOiJnaCIsIm93bmVyMSI6IndzamNwcCIsInJlcG8xIjoid3NqY3BwLWpzb25ycGMyMCIsImluY2x1ZGVMaW50IjpmYWxzZSwiYXV0aG9ySWQiOjE1NjQxLCJpYXQiOjE2MDE2MTM0MTh9.gErsnFaMiBhySNjNeNqAjFgxFP41QJZVYeJJffWmaDw)](https://www.deepcode.ai/app/gh/wsjcpp/wsjcpp-jsonrpc20/_/dashboard?utm_content=gh%2Fwsjcpp%2Fwsjcpp-jsonrpc20)
44

55
C++ Implementation for JsonRPC 2.0 (oriented on websockets)
66

7+
Got information about this protocol here [https://www.simple-is-better.org/json-rpc/jsonrpc20.html](https://www.simple-is-better.org/json-rpc/jsonrpc20.html)
8+
But used not all standart
9+
710
## Features
811

912
* Collect all handlers for jsonrpc20
1013
* Including system of define validators
14+
* Can generate client library on python (Include control pypi files)
1115

1216
## Integration
1317

@@ -20,7 +24,8 @@ $ wsjcpp install https://github.com/wsjcpp/wsjcpp-jsonrpc20:master
2024
### Include files
2125

2226
* src.wsjcpp/nlohmann_json/json.hpp
23-
* src.wsjcpp/wsjcpp_core.h
27+
* src.wsjcpp/wsjcpp_core/wsjcpp_core.h
28+
* src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp
2429
* src.wsjcpp/wsjcpp_validators/wsjcpp_validators.h
2530
* src.wsjcpp/wsjcpp_validators/wsjcpp_validators.cpp
2631
* src/wsjcpp_jsonrpc20.h

example-of-exported/py3/API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SomeClient Python Library
22

33
Automatically generated by wsjcpp-jsonrpc20.
4-
* Version: v0.0.3
5-
* Date: Fri, 18 Sep 2020 03:27:31 GMT
4+
* Version: v0.0.4
5+
* Date: Wed, 07 Oct 2020 17:03:09 GMT
66

77
Example connect/disconnect:
88
```

example-of-exported/py3/libwsjcppjson20client/SomeClient.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
### This file was automatically generated by wsjcpp-jsonrpc20
4-
### Version: v0.0.3
5-
### Date: Fri, 18 Sep 2020 03:27:31 GMT
4+
### Version: v0.0.4
5+
### Date: Wed, 07 Oct 2020 17:03:09 GMT
66

77
import asyncio
88
import websocket
@@ -13,7 +13,7 @@
1313
class SomeClient:
1414
__ws = None
1515
__url = None
16-
__cli_version = 'v0.0.3'
16+
__cli_version = 'v0.0.4'
1717
__loop = None
1818
__token = None
1919
__connecting = False
@@ -44,6 +44,7 @@ def hasConnection(self):
4444

4545
def getToken(self):
4646
return self.__token
47+
4748
def setToken(self, token):
4849
if self.__token is None:
4950
self.__token = token

example-of-exported/py3/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='libwsjcppjson20client',
8-
version='v0.0.3',
8+
version='v0.0.4',
99
packages=['libwsjcppjson20client'],
1010
install_requires=['websocket-client>=0.56.0', 'requests>=2.21.0'],
1111
keywords=['wsjcpp-jsonrpc20', 'wsjcpp', 'wsjcpp-jsonrpc20', 'example-python-client'],

example-of-exported/webjs/API.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# libwsjcppjson20client
2+
3+
Automatically generated by wsjcpp-jsonrpc20.
4+
* Version: v0.0.4
5+
* Date: 07 Oct 2020
6+
7+
Include script ```dist/libwsjcppjson20client.js```
8+
Example connect:
9+
```
10+
var client = new SomeClient();
11+
client.bind('server', function(data) { console.log('server', data)})
12+
client.bind('notify', function(data) { console.log('notify', data)})
13+
client.bind('chat', function(data) { console.log('chat', data)})
14+
client.bind('connected', function(data) { console.log('connected', data)})
15+
client.bind('reconnecting', function(data) { console.log('reconnecting', data)})
16+
client.bind('disconnected', function(data) { console.log('disconnected', data)})
17+
client.bind('broken', function(data) { console.log('broken', data)})
18+
client.bind('userdata', function(data) { console.log('userdata', data)})
19+
client.bind('connected', function(data) { console.log('connected', data)})
20+
// connect
21+
client.init({'baseUrl': 'ws://localhost:1234/'})
22+
// disconnect
23+
client.deinit()
24+
```
25+
26+
<details>
27+
<summary>auth_login</summary>
28+
29+
## auth_login
30+
31+
Auth by login and password
32+
33+
Access: unauthorized - **yes**, user - **no**, tester - **no**, admin - **no**
34+
35+
#### Input params
36+
37+
* login - string, required; User Login
38+
* password - string, required; User Password
39+
* client_app_name - string, optional; Client app name
40+
* client_app_version - string, optional; Client app version
41+
42+
43+
#### example call method
44+
45+
```
46+
client.auth_login({
47+
"login": "",
48+
"password": "",
49+
"client_app_name": "",
50+
"client_app_version": ""
51+
}).done(function(r) {
52+
console.log('Success: ', r);
53+
}).fail(function(err) {
54+
console.error('Error:', err);
55+
});
56+
```
57+
58+
</details>
59+
60+
<details>
61+
<summary>auth_logoff</summary>
62+
63+
## auth_logoff
64+
65+
Logoff
66+
67+
Access: unauthorized - **no**, user - **yes**, tester - **yes**, admin - **yes**
68+
69+
#### Input params
70+
71+
72+
73+
#### example call method
74+
75+
```
76+
client.auth_logoff({
77+
78+
}).done(function(r) {
79+
console.log('Success: ', r);
80+
}).fail(function(err) {
81+
console.error('Error:', err);
82+
});
83+
```
84+
85+
</details>
86+
87+
<details>
88+
<summary>auth_token</summary>
89+
90+
## auth_token
91+
92+
Auth by token
93+
94+
Access: unauthorized - **yes**, user - **no**, tester - **no**, admin - **no**
95+
96+
#### Input params
97+
98+
* token - string, required; Token
99+
* client_app_name - string, optional; Client app name
100+
* client_app_version - string, optional; Client app version
101+
102+
103+
#### example call method
104+
105+
```
106+
client.auth_token({
107+
"token": "",
108+
"client_app_name": "",
109+
"client_app_version": ""
110+
}).done(function(r) {
111+
console.log('Success: ', r);
112+
}).fail(function(err) {
113+
console.error('Error:', err);
114+
});
115+
```
116+
117+
</details>
118+
119+
<details>
120+
<summary>game_create</summary>
121+
122+
## game_create
123+
124+
Some example of description
125+
126+
Access: unauthorized - **no**, user - **yes**, tester - **yes**, admin - **yes**
127+
128+
#### Input params
129+
130+
* uuid - string, required; object uuid
131+
* name - string, optional; Name of object
132+
* cost - integer, required; Name of object
133+
* age - integer, optional; Name of object
134+
* public - boolean, required; True if object is public
135+
* activated - boolean, optional; If object can handle
136+
* custom - json, optional; Some custom json
137+
138+
139+
#### example call method
140+
141+
```
142+
client.game_create({
143+
"uuid": "",
144+
"name": "",
145+
"cost": 0,
146+
"age": 0,
147+
"public": "",
148+
"activated": "",
149+
"custom": ""
150+
}).done(function(r) {
151+
console.log('Success: ', r);
152+
}).fail(function(err) {
153+
console.error('Error:', err);
154+
});
155+
```
156+
157+
</details>
158+
159+
<details>
160+
<summary>server_api</summary>
161+
162+
## server_api
163+
164+
This method Will be return list of all handlers
165+
166+
Access: unauthorized - **yes**, user - **yes**, tester - **yes**, admin - **yes**
167+
168+
#### Input params
169+
170+
171+
172+
#### example call method
173+
174+
```
175+
client.server_api({
176+
177+
}).done(function(r) {
178+
console.log('Success: ', r);
179+
}).fail(function(err) {
180+
console.error('Error:', err);
181+
});
182+
```
183+
184+
</details>
185+

0 commit comments

Comments
 (0)