From e38e8df0e4f1aa3ef8491622875b279a70105157 Mon Sep 17 00:00:00 2001 From: Yuuki Enomoto Date: Mon, 5 Sep 2022 14:50:25 +0900 Subject: [PATCH] Implement Close() method to close the session --- session.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/session.go b/session.go index 6ebe0d5..6748e62 100644 --- a/session.go +++ b/session.go @@ -178,3 +178,13 @@ func (c *Session) Get(method string, params interface{}, v interface{}) error { return nil } + +// Close calls "user.logout" API to close the session. +func (c *Session) Close() error { + _, err := c.Do(NewRequest("user.logout", nil)) + if err != nil { + return err + } + + return nil +}