kontent-ai / delivery-sdk-js

Kontent Delivery SDK for Javascript
https://kontent.ai
MIT License
50 stars 34 forks source link

Update SyncAPI SDK #363

Closed arguit closed 1 year ago

arguit commented 1 year ago

Motivation

Kontent feature SyncAPI will be released/updated soon and it should taken in to account in delivery-sdk-js as well.

Proposed solution

Update response payload format according to the introduced changes.

Additional context

New payload format - include whole item, change change_type values to deleted_item and changed_item . Remove properties that would duplicate ones in system object

Example of new payload format:

{
    "items": [
        {
            "change_type": "deleted_item",
            "timestamp": "2022-10-20T13:03:06.1310204Z",
            "data": {
                "system": {
                    "id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
                    "collection": "default",
                    "name": "My article",
                    "codename": "my_article",
                    "language": "en-US",
                    "type": "article",
                    "sitemap_locations": [],
                    "last_modified": "2019-03-27T13:21:11.38Z",
                    "workflow_step": "published"                }
            }
        },
        {
            "change_type": "changed_item",
            "timestamp": "2022-10-20T13:03:06.1310204Z",
            "data": {
                "system": {
                    "id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
                    "collection": "default",
                    "name": "My article",
                    "codename": "my_article",
                    "language": "en-US",
                    "type": "article",
                    "sitemap_locations": [],
                    "last_modified": "2019-03-27T13:21:11.38Z",
                    "workflow_step": "published"                },
                "elements": {
                   ... 
               }
            }
        }
    ]
}

Example of original payload format:

{
    "codename": "my_article",
    "id": "335d17ac-b6ba-4c6a-ae31-23c1193215cb",
    "type": "article",
    "language": "en-US",
    "collection": "default",
    "change_type": "changed",
    "timestamp": "2022-10-20T13:03:06.1310204Z"
}

Release date

2022-04-12