Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* [Get All Node Subnets](#get-all-node-subnets)
* [Get All Node Transactions](#get-all-node-transactions)
* [Get All Node Statements](#get-all-node-statements)
* [Generate Node Statements](#generate-node-ondemand-statement)
+ [Subnets](#subnets)
* [Create Subnet](#create-subnet)
* [Get Subnet](#get-subnet)
Expand Down Expand Up @@ -375,6 +376,19 @@ user.get_all_node_trans(node_id, page=4, per_page=10)
node_id = '594e606212e17a002f2e3251'
user.get_statements(node_id, page=4, per_page=10)
```

##### Generate Node Ondemand Statement
```python
node_id = '594e606212e17a002f2e3251'
body = {
"date_start": 1525132800000,
"date_end": 1525132800000,
"webhook": "https://wh.synapsefi.com/gen_me_statement_001"
}
user.generate_node_statements(node_id, body)
```


### Subnets
##### Create Subnet
```python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.2.11', # new version number goes here
version='1.2.12', # new version number goes here

description='SynapseFi Python Library',

Expand Down
22 changes: 22 additions & 0 deletions synapsepy/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,28 @@ def get_node_statements(self, node_id, page=None, per_page=None):
)
return response

def generate_node_statements(self, node_id, body):
'''Generates ad-hoc statements
Args:
node_id (str): ID of the from Node
body: includes the start and end date for the ondemand statement in epoch time in milliseconds
Returns:
{'node_id': '', 'status': 'Statement requested', 'success': True, 'webhook': ''}
'''
self.logger.debug("Generating on demand statements\n" + json.dumps(body, indent=2))
path = (
paths['users']
+ '/'
+ self.id
+ paths['nodes']
+ '/'
+ node_id
+ '/'
+ paths['statem']
)
response = self._do_request(self.http.post, path, body)
return response

def update_node(self, node_id, body):
'''Updates a node's info in the database
Args:
Expand Down