Documentation ¶
Index ¶
- Constants
- func ParseRecipe(htmlFile io.Reader, fileID recipes.RecipeID) (*recipes.Recipe, map[string]*recipes.RecipePicture, error)
- type API
- type DefaultSources
- func (s *DefaultSources) Add(sourceMeta *SourceDescription, source SourceClient) error
- func (s *DefaultSources) Client(id SourceID) (SourceClient, error)
- func (s *DefaultSources) Description(id SourceID) (*SourceDescription, error)
- func (s *DefaultSources) JSON() ([]byte, error)
- func (s *DefaultSources) List() (map[SourceID]*SourceDescription, error)
- func (s *DefaultSources) Remove(source *SourceDescription) error
- func (s *DefaultSources) RemoveByID(id SourceID) error
- type DriveClient
- func (c *DriveClient) ConnectOAuth(code string) (err error)
- func (c *DriveClient) Connected() bool
- func (c *DriveClient) ID() SourceID
- func (c *DriveClient) Name() string
- func (c *DriveClient) OAuthLoginConfig() (*oauth2.Config, error)
- func (c *DriveClient) Recipes() recipes.Recipes
- func (c *DriveClient) Refresh() (err error)
- func (c *DriveClient) Version() string
- type Source
- type SourceClient
- type SourceDescription
- type SourceID
- type SourceOAuthConnectResponse
- type SourceResponse
- type Sources
Constants ¶
const ( //SOURCEREDIRECT represents the host address configuration name SOURCEREDIRECT = "source.redirect" //REDIRECT represents a query parameter that can be set to change source.redirect REDIRECT = "redirect" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API related sourceDescription data
func NewSourceAPI ¶
NewSourceAPI creates the API for sources
type DefaultSources ¶
type DefaultSources struct {
// contains filtered or unexported fields
}
DefaultSources is the default implementation of a sourceClient repository
func (*DefaultSources) Add ¶
func (s *DefaultSources) Add(sourceMeta *SourceDescription, source SourceClient) error
Add a sourceClient to the default sourceClient
func (*DefaultSources) Client ¶
func (s *DefaultSources) Client(id SourceID) (SourceClient, error)
Client by id returns the corresponding sourceClient implementations
func (*DefaultSources) Description ¶
func (s *DefaultSources) Description(id SourceID) (*SourceDescription, error)
Description will return a sourceClient's SourceDescription
func (*DefaultSources) JSON ¶
func (s *DefaultSources) JSON() ([]byte, error)
JSON returns all sources as JSON
func (*DefaultSources) List ¶
func (s *DefaultSources) List() (map[SourceID]*SourceDescription, error)
List all sources and the corresponding sourceDescription information
func (*DefaultSources) Remove ¶
func (s *DefaultSources) Remove(source *SourceDescription) error
Remove will delete the given element from the repository. The deletion will use the sourceClient's id for this purpose.
func (*DefaultSources) RemoveByID ¶
func (s *DefaultSources) RemoveByID(id SourceID) error
RemoveByID will delete the element with ID id from the repository
type DriveClient ¶
type DriveClient struct {
// contains filtered or unexported fields
}
DriveClient is handling the interaction with Drive
func OpenNewGoogleDriveConnection ¶
func OpenNewGoogleDriveConnection() *DriveClient
OpenNewGoogleDriveConnection with an empty cache of recipes
func (*DriveClient) ConnectOAuth ¶
func (c *DriveClient) ConnectOAuth(code string) (err error)
ConnectOAuth gets a new initial Token
func (*DriveClient) Connected ¶
func (c *DriveClient) Connected() bool
Connected returns true if there is a connection established to Drive
func (*DriveClient) OAuthLoginConfig ¶
func (c *DriveClient) OAuthLoginConfig() (*oauth2.Config, error)
OAuthLoginConfig returns the configuration for the Authentication endpoint
func (*DriveClient) Recipes ¶
func (c *DriveClient) Recipes() recipes.Recipes
Recipes of this SourceClient
func (*DriveClient) Refresh ¶
func (c *DriveClient) Refresh() (err error)
Refresh cleans the internal cache of recipes and refreshes the token from file
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source struct that combines SourceDescriptions with the SourceClient implementation
type SourceClient ¶
type SourceClient interface { ConnectOAuth(code string) error Connected() bool Recipes() recipes.Recipes OAuthLoginConfig() (*oauth2.Config, error) }
SourceClient interface
type SourceDescription ¶
type SourceDescription struct { ID SourceID `json:"id"` Name string `json:"name"` Connected bool `json:"connected"` Version string `json:"version"` OAuthConfig *oauth2.Config `json:"-"` }
SourceDescription describes the sourceClient in detail
func NewInvalidSourceDescription ¶
func NewInvalidSourceDescription() *SourceDescription
NewInvalidSourceDescription returns a SourceDescription with all fields set to invalid values
func NewSourceDescription ¶
func NewSourceDescription(id SourceID, name string, version string, oauthConfig *oauth2.Config) *SourceDescription
NewSourceDescription is the designated way to create a SourceDescription
type SourceID ¶
type SourceID uuid.UUID
SourceID represents a unique id of a sourceClient
func SourceIDFromString ¶
SourceIDFromString represents a unique id of a sourceClient
type SourceOAuthConnectResponse ¶
SourceOAuthConnectResponse informs about the oAuth url
type SourceResponse ¶
type SourceResponse struct { ID string `json:"id"` Name string `json:"name"` Connected bool `json:"connected"` Version string `json:"version"` }
SourceResponse describes a sourceClient in detail
type Sources ¶
type Sources interface { JSON() ([]byte, error) List() (map[SourceID]*SourceDescription, error) Add(sourceMeta *SourceDescription, source SourceClient) error RemoveByID(id SourceID) error Remove(source *SourceDescription) error Description(id SourceID) (*SourceDescription, error) Client(id SourceID) (SourceClient, error) }
Sources is the interface for all sourceClient repository implementations
func NewSources ¶
func NewSources() Sources
NewSources creates and returns a new sourceClient repository