|
1 | 1 | nylas-python Changelog |
2 | 2 | ====================== |
3 | 3 |
|
| 4 | +v3.0.0 |
| 5 | +------ |
| 6 | + |
| 7 | +## Large changes |
| 8 | + |
| 9 | +* The Nylas Python SDK now fully supports both Python 2.7 and Python 3.3+. |
| 10 | +* The SDK has a new dependency: the |
| 11 | + [URLObject](https://pypi.python.org/pypi/URLObject) library. |
| 12 | + This dependency will be automatically installed when you upgrade. |
| 13 | +* The SDK now automatically converts between timestamps and Python datetime |
| 14 | + objects. These automatic conversions are opt-in: your existing code should |
| 15 | + continue to work unmodified. See the "Timestamps and Datetimes" |
| 16 | + section of this document for more information. |
| 17 | + |
| 18 | +## Small changes |
| 19 | + |
| 20 | +* The SDK now has over 95% automated test coverage. |
| 21 | +* Previously, trying to access the following model properties would raise an error: |
| 22 | + `Folder.threads`, `Folder.messages`, `Label.threads`, `Label.messages`. |
| 23 | + These properties should now work as expected. |
| 24 | +* The `Thread` model now exposes the `last_message_received_timestamp` and |
| 25 | + `last_message_sent_timestamp` properties, obtained from the Nylas API. |
| 26 | +* Previously, if you created a `Draft` object, saved it, and then |
| 27 | + deleted it without modifying it further, the deletion would fail silently. |
| 28 | + Now, the SDK will actually attempt to delete a newly-saved `Draft` object, |
| 29 | + and will raise an error if it is unable to do so. |
| 30 | +* Previously, you could initialize an `APIClient` with an `api_server` |
| 31 | + value set to an `http://` URL. Now, `APIClient` will verify that the |
| 32 | + `api_server` value starts with `https://`, and will raise an error if it |
| 33 | + does not. |
| 34 | +* The `APIClient` constructor no longers accepts the `auth_server` argument, |
| 35 | + as it was never used for anything. |
| 36 | +* The `nylas.client.util.url_concat` and `nylas.client.util.generate_id` |
| 37 | + functions have been removed. These functions were meant for internal use, |
| 38 | + and were never documented or expected to be used by others. |
| 39 | +* You can now pass a `state` argument to `APIClient.authentication_url`, |
| 40 | + as per the OAuth 2.0 spec. |
| 41 | + |
| 42 | +## Timestamps and Datetimes |
| 43 | + |
| 44 | +Some properties in the Nylas API use timestamp integers to represent a specific |
| 45 | +moment in time, such as `Message.date`. The Python SDK now exposes new properties |
| 46 | +that have converted these existing properties from integers to Python datetime |
| 47 | +objects. You can still access the existing properties to get the timestamp |
| 48 | +integer -- these new properties are just a convenient way to access Python |
| 49 | +datetime objects, if you want them. |
| 50 | + |
| 51 | +This table summarizes the new datetime properties, and which existing timestamp |
| 52 | +properties they match up with. |
| 53 | + |
| 54 | +| New Property (datetime) | Existing Property (timestamp) | |
| 55 | +| --------------------------------- | ---------------------------------------- | |
| 56 | +| `Message.received_at` | `Message.date` | |
| 57 | +| `Thread.first_message_at` | `Thread.first_message_timestamp` | |
| 58 | +| `Thread.last_message_at` | `Thread.last_message_timestamp` | |
| 59 | +| `Thread.last_message_received_at` | `Thread.last_message_received_timestamp` | |
| 60 | +| `Thread.last_message_sent_at` | `Thread.last_message_sent_timestamp` | |
| 61 | +| `Draft.last_modified_at` | `Draft.date` | |
| 62 | +| `Event.original_start_at` | `Event.original_start_time` | |
| 63 | + |
| 64 | +You can also use datetime objects when filtering on models with the `.where()` |
| 65 | +method. For example, if you wanted to find all messages that were received |
| 66 | +before Jan 1, 2015, previously you would run this code: |
| 67 | + |
| 68 | +```python |
| 69 | +client.messages.where(received_before=1420070400).all() |
| 70 | +``` |
| 71 | + |
| 72 | +That code will still work, but if you prefer, you can run this code instead: |
| 73 | + |
| 74 | +```python |
| 75 | +from datetime import datetime |
| 76 | + |
| 77 | +client.messages.where(received_before=datetime(2015, 1, 1)).all() |
| 78 | +``` |
| 79 | + |
| 80 | +You can now use datetimes with the following filters: |
| 81 | + |
| 82 | +* `client.messages.where(received_before=datetime())` |
| 83 | +* `client.messages.where(received_after=datetime())` |
| 84 | +* `client.threads.where(last_message_before=datetime())` |
| 85 | +* `client.threads.where(last_message_after=datetime())` |
| 86 | +* `client.threads.where(started_before=datetime())` |
| 87 | +* `client.threads.where(started_after=datetime())` |
| 88 | + |
| 89 | + |
| 90 | +[Full Changelog](https://github.com/nylas/nylas-ruby/compare/v2.0.0...v3.0.0) |
| 91 | + |
| 92 | + |
4 | 93 | v2.0.0 |
5 | 94 | ------ |
6 | 95 |
|
|
0 commit comments