mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Added context to the crunchyroll struct
This commit is contained in:
parent
a6c14cb6c9
commit
ac7904668f
3 changed files with 12 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ package crunchyroll
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -32,6 +33,8 @@ const (
|
|||
type Crunchyroll struct {
|
||||
// Client is the http.Client to perform all requests over
|
||||
Client *http.Client
|
||||
// Context can be used to stop requests with Client and is context.Background by default
|
||||
Context context.Context
|
||||
// Locale specifies in which language all results should be returned / requested
|
||||
Locale LOCALE
|
||||
// SessionID is the crunchyroll session id which was used for authentication
|
||||
|
|
@ -88,6 +91,7 @@ func LoginWithCredentials(user string, password string, locale LOCALE, client *h
|
|||
func LoginWithSessionID(sessionID string, locale LOCALE, client *http.Client) (*Crunchyroll, error) {
|
||||
crunchy := &Crunchyroll{
|
||||
Client: client,
|
||||
Context: context.Background(),
|
||||
Locale: locale,
|
||||
SessionID: sessionID,
|
||||
cache: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue