goodreads

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	UserIdPassword struct {
		UserId   string `json:"user_id"`
		Password string `json:"password"`
	} `json:"user_id_password"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) GetCurrentUserData

func (c *Client) GetCurrentUserData(ctx context.Context) (*CurrentUserDataResponse, error)

func (*Client) GetCurrentUserShelves

func (c *Client) GetCurrentUserShelves(ctx context.Context) (*CurrentUserShelvesResponse, error)

func (*Client) GetReviews

func (c *Client) GetReviews(ctx context.Context, shelfName string) (*ReviewsResponse, error)

func (*Client) Register

func (c *Client) Register(ctx context.Context, email, password string) (*RegisterResponse, error)

func (*Client) Token

func (c *Client) Token(ctx context.Context) (*TokenResponse, error)

func (*Client) UpdateUserStatus

func (c *Client) UpdateUserStatus(ctx context.Context, bookId, page, percent, body string) error

type Cookies

type Cookies struct {
	WebsiteCookies []string `json:"website_cookies"`
	Domain         string   `json:"domain"`
}

type CurrentUserDataResponse

type CurrentUserDataResponse struct {
	XMLName xml.Name `xml:"GoodreadsResponse"`

	CurrentUser struct {
		User struct {
			ID string `xml:"id"`
		} `xml:"user"`

		CurrentlyReading []struct {
			Title   string `xml:"title"`
			Authors []struct {
				Name string `xml:"name"`
			} `xml:"authors>author"`
		} `xml:"currently_reading>book"`
	} `xml:"current_user"`
}

type CurrentUserShelvesResponse

type CurrentUserShelvesResponse struct {
	XMLName xml.Name `xml:"GoodreadsResponse"`

	CurrentUser struct {
		UserShelves []struct {
			Name          string `xml:"name"`
			BookCount     string `xml:"book_count"`
			ExclusiveFlag string `xml:"exclusive_flag"`
		} `xml:"user_shelves>user_shelf"`
	} `xml:"current_user"`
}

type RegisterRequest

type RegisterRequest struct {
	RequestedExtensions []string `json:"requested_extensions"`

	Cookies          Cookies          `json:"cookies"`
	RegistrationData RegistrationData `json:"registration_data"`
	AuthData         AuthData         `json:"auth_data"`

	UserContextMap struct {
		Frc string `json:"frc"`
	} `json:"user_context_map"`

	RequestedTokenType []string `json:"requested_token_type"`
}

type RegisterResponse

type RegisterResponse struct {
	Response struct {
		Success struct {
			Tokens struct {
				Bearer struct {
					AccessToken  string `json:"access_token"`
					RefreshToken string `json:"refresh_token"`
					ExpiresIn    string `json:"expires_in"`
				} `json:"bearer"`
			} `json:"tokens"`
		} `json:"success"`
	} `json:"response"`
}

type RegistrationData

type RegistrationData struct {
	Domain          string `json:"domain"`
	AppVersion      string `json:"app_version"`
	DeviceType      string `json:"device_type"`
	OsVersion       string `json:"os_version"`
	DeviceSerial    string `json:"device_serial"`
	DeviceModel     string `json:"device_model"`
	AppName         string `json:"app_name"`
	SoftwareVersion string `json:"software_version"`
}

type ReviewsResponse

type ReviewsResponse struct {
	XMLName xml.Name `xml:"GoodreadsResponse"`

	Reviews []struct {
		ID   string `xml:"id"`
		Book struct {
			Title           string `xml:"title"`
			PublicationYear string `xml:"publication_year"`
			Authors         []struct {
				Name string `xml:"name"`
			} `xml:"authors>author"`
		} `xml:"book"`
	} `xml:"reviews>review"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL