Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store status when creating distinct conversation #18

Open
kushkella opened this issue Mar 28, 2016 · 1 comment
Open

Store status when creating distinct conversation #18

kushkella opened this issue Mar 28, 2016 · 1 comment

Comments

@kushkella
Copy link

Using layer api when we try to create a distinct conversation, it can either return an existing conversation or create a new one. If it returns an existing conversation status is 200 and when it creates one the status is 201. We've a unique requirement where we want to know if the conversation was created or returned. And based on that we need to add metadata. Is it possible to expose this attribute on the Layer::Conversation object?

@benedikt
Copy link
Owner

benedikt commented Apr 1, 2016

Hi @kushkella,

Unfortunately, that's not possible right now. I also feel like having an attribute like this on the conversation object is kind of weird. What about this instead:

Right now, the Layer::Client just returns the JSON hash of the request. I think returning a proper response object that behaves like the JSON hash but also stores other information about the response would make sense. In your use case, you could just use the client directly to create new conversations within Layer and pass the response to Layer::Conversation.from_response.

What do you think about that?

Benedikt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants