Closed coreyroach closed 7 years ago
This feature is useful, but... May we create new request class for delete contexts for splitting code and do its more clearly? This will simple code. Also, please, if you can, add type definition about this method to TS definition file (index.d.ts)?
Would this new class (call it DeleteContextsRequest
) extend ContextsRequest
or extend JSONApiRequest
?
I think, use JSONApiRequest. just constructor with parameters with sessionId and override one method to provide DELETE http method.
I have created a new request class and reverted the ContextsRequest class. Also, I have updated the example and TS definition.
Thank you!
I have added a prototype function to the apiai service module to delete/reset all active contexts. The update modifies the
ContextsRequest
object to accept amethod
option to pass DELETE as the method. This will default to POST if no method option is given. Theend
method also checks if the request method is POST before writing the body content.The new method is named
deleteContextsForSession
and I have included an example.