Documentation
¶
Overview ¶
Package api provides interfaces to interact with external services.
Index ¶
- Variables
- func AuthenticateHTTP(httpClientCtx *HTTPClientCtx, reAuth bool) error
- func ClearTokens() error
- func CreateCacheTree(blobStorage BlobEMConfigHolder) (*sync15.HashTree, error)
- func GetNodeByPath(blobStorage BlobEMConfigHolder, path string) (*model.Node, error)
- func GetNodeByPathFromCache(ct *sync15.HashTree, path string) (*model.Node, error)
- func LoadTokens() (*authToken, error)
- func SaveTree(tree *sync15.HashTree) error
- type AuthType
- type BlobEMConfigHolder
- type BlobStorage
- func (b *BlobStorage) GetBlobStorage() *BlobStorage
- func (b *BlobStorage) GetEMConfig() (*model.EMConfig, error)
- func (b *BlobStorage) GetReader(hash string) (io.ReadCloser, error)
- func (b *BlobStorage) GetRootIndex() (string, int64, error)
- func (b *BlobStorage) GetURL(hash string) (string, error)
- func (b *BlobStorage) GetURLProvider() (model.URLProvider, error)
- type BodyString
- type DocumentFetcher
- type Fetcher
- type HTTPClientCtx
- func (ctx HTTPClientCtx) Delete(authType AuthType, url string, reqBody, resp interface{}) error
- func (ctx HTTPClientCtx) Get(authType AuthType, url string, body interface{}, target interface{}) error
- func (ctx HTTPClientCtx) GetBlobStream(url string) (io.ReadCloser, int64, error)
- func (ctx *HTTPClientCtx) GetEMConfig() (*model.EMConfig, error)
- func (ctx HTTPClientCtx) GetStream(authType AuthType, url string) (io.ReadCloser, error)
- func (ctx *HTTPClientCtx) GetURLProvider() (model.URLProvider, error)
- func (ctx HTTPClientCtx) Post(authType AuthType, url string, reqBody, resp interface{}) error
- func (ctx HTTPClientCtx) Put(authType AuthType, url string, reqBody, resp interface{}) error
- func (ctx HTTPClientCtx) PutStream(authType AuthType, url string, reqBody io.Reader) error
- func (ctx HTTPClientCtx) Request(authType AuthType, verb, url string, body io.Reader) (*http.Response, error)
- type UserTokenJWT
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AuthenticateHTTP ¶
func AuthenticateHTTP(httpClientCtx *HTTPClientCtx, reAuth bool) error
func ClearTokens ¶
func ClearTokens() error
func CreateCacheTree ¶
func CreateCacheTree(blobStorage BlobEMConfigHolder) (*sync15.HashTree, error)
func GetNodeByPath ¶
func GetNodeByPath(blobStorage BlobEMConfigHolder, path string) (*model.Node, error)
func GetNodeByPathFromCache ¶
func LoadTokens ¶
func LoadTokens() (*authToken, error)
Types ¶
type BlobEMConfigHolder ¶
type BlobEMConfigHolder interface {
model.EMConfigHolder
GetBlobStorage() *BlobStorage
}
type BlobStorage ¶
type BlobStorage struct {
// contains filtered or unexported fields
}
func NewBlobStorage ¶
func NewBlobStorage(http *HTTPClientCtx) *BlobStorage
func (*BlobStorage) GetBlobStorage ¶
func (b *BlobStorage) GetBlobStorage() *BlobStorage
GetBlobStorage returns the BlobStorage instance and implements the BlobEMContextStorer interface
func (*BlobStorage) GetEMConfig ¶
func (b *BlobStorage) GetEMConfig() (*model.EMConfig, error)
GetEMConfig returns the EMConfig and implements the BlobEMContextStorer interface
func (*BlobStorage) GetReader ¶
func (b *BlobStorage) GetReader(hash string) (io.ReadCloser, error)
func (*BlobStorage) GetRootIndex ¶
func (b *BlobStorage) GetRootIndex() (string, int64, error)
func (*BlobStorage) GetURLProvider ¶
func (b *BlobStorage) GetURLProvider() (model.URLProvider, error)
GetURLProvider returns the URLProvider and implements the URLProviderHolder interface
type BodyString ¶
type BodyString struct {
Content string
}
type DocumentFetcher ¶
type DocumentFetcher struct {
// contains filtered or unexported fields
}
func (*DocumentFetcher) Fetch ¶
func (d *DocumentFetcher) Fetch(docID, dstPath string) error
type Fetcher ¶
func NewDocumentFetcher ¶
func NewDocumentFetcher(blobStorage *BlobStorage, hashTree *sync15.HashTree) Fetcher
type HTTPClientCtx ¶
func CreateHTTPClientCtx ¶
func CreateHTTPClientCtx(token *authToken, ctx context.Context) (*HTTPClientCtx, error)
func EnsureAuthenticated ¶
func EnsureAuthenticated(ctx context.Context) (*HTTPClientCtx, error)
EnsureAuthenticated ensures that the tokens are loaded, valid, and not expired. If the tokens are missing or expired, it re-authenticates.
func (HTTPClientCtx) Delete ¶
func (ctx HTTPClientCtx) Delete(authType AuthType, url string, reqBody, resp interface{}) error
func (HTTPClientCtx) Get ¶
func (ctx HTTPClientCtx) Get(authType AuthType, url string, body interface{}, target interface{}) error
func (HTTPClientCtx) GetBlobStream ¶
func (ctx HTTPClientCtx) GetBlobStream(url string) (io.ReadCloser, int64, error)
func (*HTTPClientCtx) GetEMConfig ¶
func (ctx *HTTPClientCtx) GetEMConfig() (*model.EMConfig, error)
func (HTTPClientCtx) GetStream ¶
func (ctx HTTPClientCtx) GetStream(authType AuthType, url string) (io.ReadCloser, error)
func (*HTTPClientCtx) GetURLProvider ¶
func (ctx *HTTPClientCtx) GetURLProvider() (model.URLProvider, error)
func (HTTPClientCtx) Post ¶
func (ctx HTTPClientCtx) Post(authType AuthType, url string, reqBody, resp interface{}) error
func (HTTPClientCtx) Put ¶
func (ctx HTTPClientCtx) Put(authType AuthType, url string, reqBody, resp interface{}) error
type UserTokenJWT ¶
type UserTokenJWT struct {
Auth0 struct {
UserID string
Email string
} `json:"auth0-profile"`
Scopes string
*jwt.StandardClaims
}
Click to show internal directories.
Click to hide internal directories.