letterboxd

package
v0.0.0-...-14f3064 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIBaseURL is used to create a client
	APIBaseURL = "https://api.letterboxd.com/api/v0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

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

AccessToken holds information to sign every request with a valid access token data provided by the getAccessToken() function

type Builder

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

Builder helps facilitate a new request object

func (*Builder) APIKey

func (b *Builder) APIKey(a string) *Builder

APIKey sets the request api key

func (*Builder) Body

func (b *Builder) Body(d string) *Builder

Body sets the body struct field for requests that require it

func (*Builder) Build

func (b *Builder) Build(c *Client) LbxdReq

Build creates all non-user input fields, generates a request signature, and returns the completed request object

func (*Builder) Data

func (b *Builder) Data(d string) *Builder

Data sets the request data field, added to the URL

func (*Builder) Endpoint

func (b *Builder) Endpoint(e string) *Builder

Endpoint sets the request endpoint

func (*Builder) Method

func (b *Builder) Method(m string) *Builder

Method sets the request method

type Client

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

Client provides a common object and plain configuration for interacting with this library

func NewClientFromKey

func NewClientFromKey(apiKey string, apiSecret string) *Client

NewClientFromKey creates a letterboxd API client from an auth token

func (*Client) GetAuthToken

func (c *Client) GetAuthToken(u string, p string) (AccessToken, error)

GetAuthToken returns an access token from provided username and password

func (*Client) GetMe

func (c *Client) GetMe(at string) (MemberAccount, error)

GetMe retrieves information from the /me endpoint

func (*Client) NewRequest

func (c *Client) NewRequest(m string, e string, d string) LbxdReq

NewRequest creates a letterboxd API request with all required metadata m Method e.g. "GET", "POST" e Endpoint e.g. "/auth/token" b Body e.g. "{"field": "value"}"

type LbxdReq

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

LbxdReq defines a single API request

type MemberAccount

type MemberAccount struct {
	EmailAddress                             string        `json:"emailAddress"`
	EmailAddressValidated                    bool          `json:"emailAddressValidated"`
	PrivateAccount                           bool          `json:"privateAccount"`
	IncludeInPeopleSection                   bool          `json:"includeInPeopleSection"`
	PrivateWatchlist                         bool          `json:"privateWatchlist"`
	EmailWhenFollowed                        bool          `json:"emailWhenFollowed"`
	EmailAvailability                        bool          `json:"emailAvailability"`
	EmailBuyAvailability                     bool          `json:"emailBuyAvailability"`
	EmailRentAvailability                    bool          `json:"emailRentAvailability"`
	EmailComments                            bool          `json:"emailComments"`
	EmailNews                                bool          `json:"emailNews"`
	EmailRushes                              bool          `json:"emailRushes"`
	DevicesRegisteredForPushNotifications    []string      `json:"devicesRegisteredForPushNotifications"`
	PushNotificationsForGeneralAnnouncements bool          `json:"pushNotificationsForGeneralAnnouncements"`
	PushNotificationsForComments             bool          `json:"pushNotificationsForComments"`
	PushNotificationsForListLikes            bool          `json:"pushNotificationsForListLikes"`
	PushNotificationsForReviewLikes          bool          `json:"pushNotificationsForReviewLikes"`
	PushNotificationsForNewFollowers         bool          `json:"pushNotificationsForNewFollowers"`
	PushNotificationsForAvailability         bool          `json:"pushNotificationsForAvailability"`
	PushNotificationsForBuyAvailability      bool          `json:"pushNotificationsForBuyAvailability"`
	PushNotificationsForRentAvailability     bool          `json:"pushNotificationsForRentAvailability"`
	CanComment                               bool          `json:"canComment"`
	Suspended                                bool          `json:"suspended"`
	CanCloneLists                            bool          `json:"canCloneLists"`
	CanFilterActivity                        bool          `json:"canFilterActivity"`
	AuthorizedSharingServicesForLists        []interface{} `json:"authorizedSharingServicesForLists"`
	AuthorizedSharingServicesForReviews      []interface{} `json:"authorizedSharingServicesForReviews"`
	Member                                   struct {
		ID          string `json:"id"`
		Username    string `json:"username"`
		DisplayName string `json:"displayName"`
		ShortName   string `json:"shortName"`
		Pronoun     struct {
			ID                  string `json:"id"`
			Label               string `json:"label"`
			SubjectPronoun      string `json:"subjectPronoun"`
			ObjectPronoun       string `json:"objectPronoun"`
			PossessiveAdjective string `json:"possessiveAdjective"`
			PossessivePronoun   string `json:"possessivePronoun"`
			Reflexive           string `json:"reflexive"`
		} `json:"pronoun"`
		Avatar struct {
			Sizes []struct {
				Width  int    `json:"width"`
				Height int    `json:"height"`
				URL    string `json:"url"`
			} `json:"sizes"`
		} `json:"avatar"`
		CommentPolicy    string        `json:"commentPolicy"`
		AccountStatus    string        `json:"accountStatus"`
		MemberStatus     string        `json:"memberStatus"`
		HideAdsInContent bool          `json:"hideAdsInContent"`
		HideAds          bool          `json:"hideAds"`
		BioLbml          string        `json:"bioLbml"`
		FavoriteFilms    []interface{} `json:"favoriteFilms"`
		Links            []struct {
			Type string `json:"type"`
			ID   string `json:"id"`
			URL  string `json:"url"`
		} `json:"links"`
		PrivateWatchlist bool   `json:"privateWatchlist"`
		Bio              string `json:"bio"`
	} `json:"member"`
}

MemberAccount holds data for a Letterboxd member http://api-docs.letterboxd.com/#/definitions/MemberAccount

Jump to

Keyboard shortcuts

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