From 2067c50937497fadf540107e5502ee005e9433b8 Mon Sep 17 00:00:00 2001 From: bytedream Date: Tue, 21 Jun 2022 22:04:22 +0200 Subject: [PATCH] Add logout endpoint --- crunchyroll.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crunchyroll.go b/crunchyroll.go index 214cbe4..9c786c6 100644 --- a/crunchyroll.go +++ b/crunchyroll.go @@ -250,6 +250,16 @@ type Crunchyroll struct { cache bool } +// Logout logs the user out which invalidates the current session. +// You have to call a login method again and create a new Crunchyroll instance +// if you want to perform any further actions since this instance is not usable +// anymore after calling this. +func (c *Crunchyroll) Logout() error { + endpoint := "https://crunchyroll.com/logout" + _, err := c.request(endpoint, http.MethodGet) + return err +} + // IsCaching returns if data gets cached or not. // See SetCaching for more information. func (c *Crunchyroll) IsCaching() bool {