Skip to content

Commit

Permalink
Merge pull request #9 from wsjcpp/version-0.0.4
Browse files Browse the repository at this point in the history
Version 0.0.4
  • Loading branch information
sea-kg authored Oct 8, 2020
2 parents 75d20c4 + d6d37ae commit a39c931
Show file tree
Hide file tree
Showing 50 changed files with 2,678 additions and 813 deletions.
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ set(EXECUTABLE_OUTPUT_PATH ${wsjcpp-jsonrpc20_SOURCE_DIR})

# include header dirs
list (APPEND WSJCPP_INCLUDE_DIRS "src")
list (APPEND WSJCPP_INCLUDE_DIRS "src/app")

list (APPEND WSJCPP_SOURCES "src/main.cpp")
# package
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20.h")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20.cpp")

list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_base.h")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_base.cpp")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_python.h")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_python.cpp")

# examples
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_game_create.h")
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_game_create.cpp")
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_auth.h")
list (APPEND WSJCPP_SOURCES "./src/examples/wsjcpp_json_rpc20_handler_auth.cpp")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_webjs.h")
list (APPEND WSJCPP_SOURCES "src/wsjcpp_jsonrpc20_export_cli_webjs.cpp")

# app
list (APPEND WSJCPP_SOURCES "src/app/main.cpp")
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_game_create.h")
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_game_create.cpp")
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_auth.h")
list (APPEND WSJCPP_SOURCES "./src/app/wsjcpp_json_rpc20_handler_auth.cpp")

#### BEGIN_WSJCPP_APPEND
#### END_WSJCPP_APPEND
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Evgenii Sopov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# wsjcpp-jsonrpc20

[![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)
[![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)

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

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)
But used not all standart

## Features

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

## Integration

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

* src.wsjcpp/nlohmann_json/json.hpp
* src.wsjcpp/wsjcpp_core.h
* src.wsjcpp/wsjcpp_core/wsjcpp_core.h
* src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp
* src.wsjcpp/wsjcpp_validators/wsjcpp_validators.h
* src.wsjcpp/wsjcpp_validators/wsjcpp_validators.cpp
* src/wsjcpp_jsonrpc20.h
Expand Down
4 changes: 2 additions & 2 deletions example-of-exported/py3/API.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SomeClient Python Library

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

Example connect/disconnect:
```
Expand Down
7 changes: 4 additions & 3 deletions example-of-exported/py3/libwsjcppjson20client/SomeClient.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
### This file was automatically generated by wsjcpp-jsonrpc20
### Version: v0.0.3
### Date: Fri, 18 Sep 2020 03:27:31 GMT
### Version: v0.0.4
### Date: Wed, 07 Oct 2020 17:03:09 GMT

import asyncio
import websocket
Expand All @@ -13,7 +13,7 @@
class SomeClient:
__ws = None
__url = None
__cli_version = 'v0.0.3'
__cli_version = 'v0.0.4'
__loop = None
__token = None
__connecting = False
Expand Down Expand Up @@ -44,6 +44,7 @@ def hasConnection(self):

def getToken(self):
return self.__token

def setToken(self, token):
if self.__token is None:
self.__token = token
Expand Down
2 changes: 1 addition & 1 deletion example-of-exported/py3/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='libwsjcppjson20client',
version='v0.0.3',
version='v0.0.4',
packages=['libwsjcppjson20client'],
install_requires=['websocket-client>=0.56.0', 'requests>=2.21.0'],
keywords=['wsjcpp-jsonrpc20', 'wsjcpp', 'wsjcpp-jsonrpc20', 'example-python-client'],
Expand Down
185 changes: 185 additions & 0 deletions example-of-exported/webjs/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# libwsjcppjson20client

Automatically generated by wsjcpp-jsonrpc20.
* Version: v0.0.4
* Date: 07 Oct 2020

Include script ```dist/libwsjcppjson20client.js```
Example connect:
```
var client = new SomeClient();
client.bind('server', function(data) { console.log('server', data)})
client.bind('notify', function(data) { console.log('notify', data)})
client.bind('chat', function(data) { console.log('chat', data)})
client.bind('connected', function(data) { console.log('connected', data)})
client.bind('reconnecting', function(data) { console.log('reconnecting', data)})
client.bind('disconnected', function(data) { console.log('disconnected', data)})
client.bind('broken', function(data) { console.log('broken', data)})
client.bind('userdata', function(data) { console.log('userdata', data)})
client.bind('connected', function(data) { console.log('connected', data)})
// connect
client.init({'baseUrl': 'ws://localhost:1234/'})
// disconnect
client.deinit()
```

<details>
<summary>auth_login</summary>

## auth_login

Auth by login and password

Access: unauthorized - **yes**, user - **no**, tester - **no**, admin - **no**

#### Input params

* login - string, required; User Login
* password - string, required; User Password
* client_app_name - string, optional; Client app name
* client_app_version - string, optional; Client app version


#### example call method

```
client.auth_login({
"login": "",
"password": "",
"client_app_name": "",
"client_app_version": ""
}).done(function(r) {
console.log('Success: ', r);
}).fail(function(err) {
console.error('Error:', err);
});
```

</details>

<details>
<summary>auth_logoff</summary>

## auth_logoff

Logoff

Access: unauthorized - **no**, user - **yes**, tester - **yes**, admin - **yes**

#### Input params



#### example call method

```
client.auth_logoff({
}).done(function(r) {
console.log('Success: ', r);
}).fail(function(err) {
console.error('Error:', err);
});
```

</details>

<details>
<summary>auth_token</summary>

## auth_token

Auth by token

Access: unauthorized - **yes**, user - **no**, tester - **no**, admin - **no**

#### Input params

* token - string, required; Token
* client_app_name - string, optional; Client app name
* client_app_version - string, optional; Client app version


#### example call method

```
client.auth_token({
"token": "",
"client_app_name": "",
"client_app_version": ""
}).done(function(r) {
console.log('Success: ', r);
}).fail(function(err) {
console.error('Error:', err);
});
```

</details>

<details>
<summary>game_create</summary>

## game_create

Some example of description

Access: unauthorized - **no**, user - **yes**, tester - **yes**, admin - **yes**

#### Input params

* uuid - string, required; object uuid
* name - string, optional; Name of object
* cost - integer, required; Name of object
* age - integer, optional; Name of object
* public - boolean, required; True if object is public
* activated - boolean, optional; If object can handle
* custom - json, optional; Some custom json


#### example call method

```
client.game_create({
"uuid": "",
"name": "",
"cost": 0,
"age": 0,
"public": "",
"activated": "",
"custom": ""
}).done(function(r) {
console.log('Success: ', r);
}).fail(function(err) {
console.error('Error:', err);
});
```

</details>

<details>
<summary>server_api</summary>

## server_api

This method Will be return list of all handlers

Access: unauthorized - **yes**, user - **yes**, tester - **yes**, admin - **yes**

#### Input params



#### example call method

```
client.server_api({
}).done(function(r) {
console.log('Success: ', r);
}).fail(function(err) {
console.error('Error:', err);
});
```

</details>

Loading

0 comments on commit a39c931

Please sign in to comment.