slack-rs / slack-rs-api

Rust interface for the Slack Web API
Apache License 2.0
109 stars 66 forks source link

Serialize support on types #70

Open CKarper opened 5 years ago

CKarper commented 5 years ago

Is there a reason none of the types derive Serialize? It would be nice to build messages with these structs, but then I can't turn them into JSON using serde.

dten commented 5 years ago

https://docs.rs/slack_api/0.21.0/slack_api/chat/fn.post_message.html

The structs are intended for use with the api functions

CKarper commented 5 years ago

I was hoping to use them for building Dialogflow message objects in response to slack sourced events.

My bot routes responses both through DF, and directly using the API. What would be the lift to add the Serialization annotations to the fields? I'm new to Rust, so I can't jump in and effectively PR yet.

dten commented 5 years ago

the post_messsage function i linked currently handles the serialisation and for PostRequest and just deriving Serialize would not produce the same json. Extracting that serialising code to be called by itself would be an option