|
| 1 | +# Upgrade Guide |
| 2 | + |
| 3 | +This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md). |
| 4 | + |
| 5 | +## 0.7.0 |
| 6 | + |
| 7 | +### Services |
| 8 | + |
| 9 | +Services now provide a list of capabilities, instead of just a single capability. You will need to explicitly set your capability's `capability_name` property, and will provide a list of Capabilities to the Service instead of a single capability. So you will need to change former code which looks like this: |
| 10 | + |
| 11 | +```python |
| 12 | +from intersect_sdk import IntersectBaseCapabilityImplementation, IntersectService, intersect_message |
| 13 | + |
| 14 | +class MyCapabilityImplementation(IntersectBaseCapabilityImplementation): |
| 15 | + |
| 16 | + @intersect_message |
| 17 | + def my_endpoint(self, param: str) -> str: |
| 18 | + # ... implementation |
| 19 | + |
| 20 | +if __name__ == '__main__': |
| 21 | + # etc. |
| 22 | + capability = MyCapabilityImplementation() |
| 23 | + service = IntersectService(capability, |
| 24 | + # ... other params |
| 25 | + ) |
| 26 | +``` |
| 27 | + |
| 28 | +to this: |
| 29 | + |
| 30 | +```python |
| 31 | +from intersect_sdk import IntersectBaseCapabilityImplementation, IntersectService, intersect_message |
| 32 | + |
| 33 | +class MyCapabilityImplementation(IntersectBaseCapabilityImplementation): |
| 34 | + |
| 35 | + @intersect_message |
| 36 | + def my_endpoint(self, param: str) -> str: |
| 37 | + # ... implementation |
| 38 | + |
| 39 | +if __name__ == '__main__': |
| 40 | + # etc. |
| 41 | + capability = MyCapabilityImplementation() |
| 42 | + capability.capability_name = 'MyCapability' |
| 43 | + service = IntersectService([capability], |
| 44 | + # ... other params |
| 45 | + ) |
| 46 | +``` |
| 47 | + |
| 48 | +Additionally, this reserves the `intersect_sdk_call_service` function - if you are using this function as a name, **you must change its name**. (You should avoid starting your functions with `__intersect_sdk_`, `_intersect_sdk_`, or `intersect_sdk` - these functions could potentially be reserved by the BaseCapability in the future.) |
| 49 | + |
| 50 | +### Clients |
| 51 | + |
| 52 | +When calling another Service's operation, the namespacing has changed from `<function_name>` to `<capability_name>.<function_name>` . So for example, if we were calling `my_endpoint` in the above Service example, the code would change from: |
| 53 | + |
| 54 | +```python |
| 55 | +params = IntersectClientMessageParams( |
| 56 | + operation='my_endpoint', |
| 57 | + # ... other parameters unchanged |
| 58 | +) |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +to |
| 63 | + |
| 64 | +```python |
| 65 | +params = IntersectClientMessageParams( |
| 66 | + operation='MyCapability.my_endpoint', |
| 67 | + # ... other parameters unchanged |
| 68 | +) |
| 69 | + |
| 70 | +``` |
0 commit comments