HubSpot / slack-client

An asynchronous HTTP client for Slack's web API
Apache License 2.0
115 stars 53 forks source link

Fix purpose and topic response models #162

Closed omotnyk closed 4 years ago

omotnyk commented 4 years ago

As it turns out, Slack documentation is outdated and these APIs return another response format so we fail to parse JSON response to java model. I removed topic and description to be able to parse the response successfully.

Response format specified in docs:

{
    "ok": true,
    "purpose": "I didn't set this purpose on purpose!"
}

Actual response format:

{
    "ok": true,
    "channel": {
        "id": "XXXXXX",
        "name": "xxx",
        "is_channel": true,
        "is_group": false,
        "is_im": false,
        "created": 1586792508,
        "is_archived": false,
        "is_general": false,
        "unlinked": 0,
        "name_normalized": "xxxx",
        "is_shared": false,
        "parent_conversation": null,
        "creator": "XXXXXX",
        "is_ext_shared": false,
        "is_org_shared": false,
        "shared_team_ids": [
            "XXXXXX"
        ],
        "pending_shared": [],
        "pending_connected_team_ids": [],
        "is_pending_ext_shared": false,
        "is_member": true,
        "is_private": false,
        "is_mpim": false,
        "last_read": "1586802670.001900",
        "topic": {
            "value": "something",
            "creator": "XXXXX",
            "last_set": 1586803927
        },
        "purpose": {
            "value": "something",
            "creator": "XXXX",
            "last_set": 1586803925
        },
        "previous_names": [
            "demo"
        ]
    }
}