Skip to content

Commit 1888536

Browse files
committed
📄 docs: update readme
1 parent bd8736a commit 1888536

File tree

1 file changed

+53
-37
lines changed

1 file changed

+53
-37
lines changed

‎README.md‎

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,55 @@ You can find specific documentation on a per-product basis below.
3535
## SDK Documentation
3636
You can learn more about the Transpose SDK and how it works below.
3737

38+
39+
### SDK Classes **DEPRECATED AS OF v3.1.0**
40+
The Transpose SDK uses custom classes to represent API responses:
41+
42+
#### Error Classes
43+
<details>
44+
<summary>SDK Error Class Specifications</summary>
45+
The SDK uses the following error classes to represent API errors:
46+
47+
- ``TransposeBadRequest``
48+
- Represents a 400 Bad Request error from the Transpose API.
49+
- ``TransposeRateLimit``
50+
- Represents a 429 Rate Limit error from the Transpose API.
51+
- ``TransposeInvalidAPIKey``
52+
- Represents a 401 Unauthorized error from the Transpose API.
53+
- ``TransposeInternalServerError``
54+
- Represents a 500 Internal Server Error error from the Transpose API.
55+
- ``TransposeResourceNotFound``
56+
- Represents a 404 Not Found error from the Transpose API.
57+
58+
These errors will be raised when the SDK encounters an error from the Transpose API.
59+
</details>
60+
61+
#### Response Classes
62+
<details>
63+
<summary>Response Class Specifications</summary>
64+
65+
The SDK will always return a list of response objects from the Transpose API. For example, calling the ``ens.records_by_date`` endpoint will return a list of ``ENSRecord`` objects.
66+
67+
These response objects can be accessed in the following ways:
68+
- ``ENSRecord[0].ens_name`` will return the first record's ens_name.
69+
- ``ENSRecord[i].ens_name`` retrieves the ens_name from the i-th response
70+
71+
All response objects can also be accessed as a dictionary by calling ``.to_dict()`` on them:
72+
- ``ENSRecord[0].to_dict()`` will return the first record as a dictionary.
73+
- ``ENSRecord[i].to_dict()`` retrieves the i-th record as a dictionary.
74+
</details>
75+
76+
---
77+
78+
## SDK Options
79+
The Transpose SDK can be configured to your liking, allowing you to change the default behavior of the SDK.
80+
3881
### Updating Chain ID
82+
<details>
83+
<summary>
84+
Updating SDK Working Chain ID
85+
</summary>
86+
3987
If you want to change the chain ID of your query, you can do so by setting the `chain_id` or `chain` properties of the `Transpose` object. For example, if you want to query the Ethereum mainnet, you can do so by running the following code:
4088

4189
```python
@@ -66,9 +114,13 @@ api.set_chain(1)
66114
| :------: | :--------: |
67115
| 1 | Ethereum |
68116
| 137 | Polygon |
69-
117+
</details>
70118

71119
### Raw JSON Responses
120+
<details>
121+
<summary>
122+
Opt-in to raw JSON Responses
123+
</summary>
72124
If you wish to recieve responses in JSON format, you can set the `json` parameter to `True` when initializing the SDK. This will return all responses as JSON objects.
73125

74126
**Response classes are considered deprecated as of v3.1.0 and will be removed in v4.0.0. JSON responses will become standard in v4.0.0**
@@ -77,42 +129,6 @@ If you wish to recieve responses in JSON format, you can set the `json` paramete
77129
from transpose_sdk import Transpose
78130
api = Transpose(api_key="YOUR_API_KEY", json=True)
79131
```
80-
81-
### SDK Classes
82-
The Transpose SDK uses custom classes to represent API responses:
83-
84-
#### Error Classes
85-
<details>
86-
<summary>SDK Error Class Specifications</summary>
87-
The SDK uses the following error classes to represent API errors:
88-
89-
- ``TransposeBadRequest``
90-
- Represents a 400 Bad Request error from the Transpose API.
91-
- ``TransposeRateLimit``
92-
- Represents a 429 Rate Limit error from the Transpose API.
93-
- ``TransposeInvalidAPIKey``
94-
- Represents a 401 Unauthorized error from the Transpose API.
95-
- ``TransposeInternalServerError``
96-
- Represents a 500 Internal Server Error error from the Transpose API.
97-
- ``TransposeResourceNotFound``
98-
- Represents a 404 Not Found error from the Transpose API.
99-
100-
These errors will be raised when the SDK encounters an error from the Transpose API.
101-
</details>
102-
103-
#### Response Classes
104-
<details>
105-
<summary>Response Class Specifications</summary>
106-
107-
The SDK will always return a list of response objects from the Transpose API. For example, calling the ``ens.records_by_date`` endpoint will return a list of ``ENSRecord`` objects.
108-
109-
These response objects can be accessed in the following ways:
110-
- ``ENSRecord[0].ens_name`` will return the first record's ens_name.
111-
- ``ENSRecord[i].ens_name`` retrieves the ens_name from the i-th response
112-
113-
All response objects can also be accessed as a dictionary by calling ``.to_dict()`` on them:
114-
- ``ENSRecord[0].to_dict()`` will return the first record as a dictionary.
115-
- ``ENSRecord[i].to_dict()`` retrieves the i-th record as a dictionary.
116132
</details>
117133

118134
### Pagination

0 commit comments

Comments
 (0)