Skip to content

Commit

Permalink
[AP-478] - enable client overrides, anchors, and receipts (#22)
Browse files Browse the repository at this point in the history
* client-overrides

* Update identities.md

* Update api_info.md

* Update chains.md

* Update chains.md

* Update api_info.md

* Update README.md

* Update README.md

* client-overrides

* client-overrides

* Update identities.md

* Update chains.md

* Update api_info.md

* Update README.md

* Apply kwargs for achors and receipts client

* gitignore updates, fixed formatting issues in docs
  • Loading branch information
hieumt2 authored and dorono committed May 22, 2019
1 parent af84b27 commit 4336d94
Show file tree
Hide file tree
Showing 21 changed files with 507 additions and 268 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ coverage.xml
.env
.venv
env/
test_env
venv/
ENV/
env.bak/
Expand All @@ -50,3 +51,4 @@ venv.bak/
cover/
.idea
.DS_Store
.vscode
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ certain message that you see in your chain.
Now that you have initialized the SDK, you can use the SDK's Methods,
which will execute the necessary REST API calls on your behalf.

**Note:** The SDK requires to pass all optional parameters with `**kwargs` added as final arguments. Please refer to [**Methods**](#METHODS) section to get the correct parameter names.

Patterns to utilize the Factom SDK:
```python
# Return a JSON chain object as is from the API.
Expand All @@ -135,6 +137,47 @@ entry = factom_client.chains.entries.get('5dc94c605769d8e9dac1423048f8e5a1182e57
'e0e2b7f7920ce25c20cf98c13ae454566e7cda7bb815b8a9ca568320d7bdeb93')
```

**Note:** The SDK allows for override values that were set in the instatiation of the SDK on a per-method call basis. To override desired parameters that were set in the instantiated SDK class, you may specify any of the following properties in the calls where these properties apply:

- `app_id`
- `app_key`
- `base_url`
- `automatic_signing`

Example:

```python
# Create a chain with automatic_signing turned off for one call
create_chain_response = factom_client.chains.create(
'TestOverrides',
external_ids = ['TestOverrides', 'CustomerChain', 'cust123'],
automatic_signing = False
)

# Return a JSON chain object as is from the API with new app_id, app_key and base_url.
chain = factom_client.chains.get('5dc94c605769d8e9dac1423048f8e5a1182e575aab6d923207a3a8d15771ad63',
base_url = 'https://ephemeral.api.factom.com/v1',
app_id = '4db6b007',
app_key = 'ec0c88e3c5bb57cd7303d070ad838260'
)

# Return JSON entries array as is from API with new app_id, app_key and base_url.
entries = factom_client.chains.entries.list('5dc94c605769d8e9dac1423048f8e5a1182e575aab6d923207a3a8d15771ad63',
base_url = 'https://ephemeral.api.factom.com/v1',
app_id = '4db6b007',
app_key = 'ec0c88e3c5bb57cd7303d070ad838260'
)

# Return a JSON single entry object as is from the API with new app_id, app_key and base_url.
entry = factom_client.chains.entries.get('5dc94c605769d8e9dac1423048f8e5a1182e575aab6d923207a3a8d15771ad63',
'e0e2b7f7920ce25c20cf98c13ae454566e7cda7bb815b8a9ca568320d7bdeb93',
base_url = 'https://ephemeral.api.factom.com/v1',
app_id = '4db6b007',
app_key = 'ec0c88e3c5bb57cd7303d070ad838260'
)
```



<a name="license"></a>License
-------
Expand Down
13 changes: 11 additions & 2 deletions documentation/api_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@ Gets general information about the Connect API.
```python
factom_client.api_info.get()
```
**Parameters**

| **Name** | **Type** | **Description** | **SDK Error Message & Description** |
|--------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| `app_id` | optional | string</br> This is the override parameter that allows user to specify a different API Application ID (which you can see by clicking on any of the applications in the application list that you see upon logging into https://account.factom.com). |
| `app_key ` | optional | string </br> This is the override parameter that allows user to specify a different API Application Key (which you can see by clicking on any of the applications in the application list that you see upon logging into https://account.factom.com). |
| `base_url ` | optional | string </br> This is the override parameter that allows user to specify a different API Base URL for your application (which you can see by clicking on any of the applications in the application list the you see upon logging into https://account.factom.com). |


**Returns**</br>

**Response:** OK
- **version:** string </br> Current version of the Connect API.
- **links**: object </br> Links to internal paths of the application.
- **links.chains:** string </br> The link to chain API.
```python
{
{
'version':'1.0.17',
'links':{
'links':{
'chains':'/v1/chains'
}
}
Expand Down
92 changes: 63 additions & 29 deletions documentation/chains.md

Large diffs are not rendered by default.

Loading

0 comments on commit 4336d94

Please sign in to comment.