|
| 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]` |
0 commit comments