Skip to content

Commit 839e00f

Browse files
authored
Merge pull request #10 from apideck-libraries/samz/migration-guide
doc: migration guide
2 parents 5264642 + c143021 commit 839e00f

File tree

2 files changed

+147
-4
lines changed

2 files changed

+147
-4
lines changed

MIGRATION.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Migration Guide
2+
3+
This guide helps you migrate from the previous apideck SDK to the new apideck-unify SDK.
4+
5+
## Key Changes
6+
7+
1. ** Package Name and Installation **
8+
9+
```sh
10+
# Old package
11+
pip install apideck
12+
13+
# New package
14+
pip install apideck-unify
15+
```
16+
17+
Now you will have to import apideck_unify:
18+
19+
```
20+
from apideck_unify import Apideck
21+
```
22+
23+
24+
2. **Method Naming Changes**
25+
26+
```
27+
# Old SDK
28+
from apideck.api import crm_api
29+
30+
api_instance = crm_api.CrmApi(api_client)
31+
response = api_instance.contacts_all(
32+
raw=False,
33+
consumer_id="test-consumer",
34+
app_id="app-id",
35+
service_id="salesforce"
36+
)
37+
38+
# New SDK
39+
from apideck_unify import Apideck
40+
41+
client = Apideck(
42+
api_key="your-api-key",
43+
app_id="app-id",
44+
consumer_id="test-consumer"
45+
)
46+
47+
response = client.crm.contacts.list()
48+
```
49+
50+
3. **Response Structure**
51+
52+
The new SDK wraps all responses in a typed response object that includes both the API response and HTTP metadata:
53+
54+
```
55+
# Old SDK
56+
response = api_instance.contacts_all()
57+
print(response.data[0].id)
58+
59+
# New SDK
60+
61+
## Access data payload
62+
result = client.crm.contacts.list()
63+
print(result.get_contacts_response.data[0].id)
64+
65+
# Access HTTP metadata
66+
print(result.http_meta.status_code)
67+
print(result.http_meta.headers)
68+
```
69+
70+
4. **Method Naming Convention Changes**
71+
72+
```
73+
| Old Method | New Method |
74+
|------------|------------|
75+
| contacts_all | contacts.list |
76+
| contacts_add | contacts.create |
77+
| contacts_one | contacts.get |
78+
| contacts_update | contacts.update |
79+
| contacts_delete | contacts.delete |
80+
...
81+
```
82+
83+
5. **Configuration and Authentication**
84+
85+
```
86+
# Old SDK
87+
import apideck
88+
from apideck.api import crm_api
89+
90+
configuration = apideck.Configuration()
91+
configuration.api_key['apiKey'] = 'YOUR_API_KEY'
92+
configuration.api_key_prefix['apiKey'] = 'Bearer'
93+
94+
with apideck.ApiClient(configuration) as api_client:
95+
api_instance = crm_api.CrmApi(api_client)
96+
97+
# New SDK
98+
from apideck_unify import Apideck
99+
100+
client = Apideck(
101+
api_key="your-api-key",
102+
app_id="your-app-id",
103+
consumer_id="test-consumer"
104+
)
105+
```
106+
107+
6. ** Error Handling**
108+
109+
```
110+
# Old SDK
111+
try:
112+
response = api_instance.contacts_all()
113+
except apideck.ApiException as e:
114+
print("Exception when calling CrmApi->contacts_all: %s\n" % e)
115+
116+
# New SDK
117+
from apideck_unify.errors import ApiError, ValidationError
118+
119+
try:
120+
result = client.crm.contacts.list()
121+
except ValidationError as e:
122+
print("Validation error:", e.message)
123+
except ApiError as e:
124+
print("API error:", e.message, e.status_code)
125+
```
126+
127+
For more information about error handling, please check our [documentation](https://github.com/apideck-libraries/sdk-python?tab=readme-ov-file#error-handling)
128+
129+
## Breaking Changes
130+
131+
- Package name has changed from `apideck` to `apideck-unify`
132+
- All API method names have been restructured for consistency
133+
- Configuration and client initialization has been simplified
134+
- Response structure now includes typed response wrappers and HTTP metadata
135+
- Error handling has been improved with specific error types
136+
- Some property names in request/response objects may have changed to follow Python naming conventions
137+
138+
139+
## Need help?
140+
141+
If you encounter any issues during migration:
142+
143+
1. Checkout out our [documentation](https://github.com/apideck-libraries/sdk-python?tab=readme-ov-file#apideck-unify)
144+
2. Open an issue on our [GitHub repository](https://github.com/apideck-libraries/sdk-python/issues)
145+
3. Contact our support at `[email protected]`

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,13 +1065,11 @@ You can also enable a default debug logger by setting an environment variable `A
10651065

10661066
## Maturity
10671067

1068-
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
1068+
There may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
10691069
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
10701070
looking for the latest version.
10711071

10721072
## Contributions
10731073

10741074
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
1075-
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
1076-
1077-
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=apideck-unify&utm_campaign=python)
1075+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

0 commit comments

Comments
 (0)