research

package
v0.0.0-...-ccfc996 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTitleNotFound = errors.New("title not found")
View Source
var TagNeedsEdit = "needs edit"

Functions

func FixRedisEntries

func FixRedisEntries(ctx context.Context, rdb *redis.Client, log *logrus.Logger)

func GetPDFTitleFromFile

func GetPDFTitleFromFile(inFile string) (string, error)

func GetPDFTitleFromReadSeeker

func GetPDFTitleFromReadSeeker(rs io.ReadSeeker) (string, error)

func IsPDF

func IsPDF(filePath string) bool

Types

type CloudFile

type CloudFile struct {
	FileID   string
	Title    string
	URL      string
	Tags     []string
	Provider string
}

CloudFile represents a file that is stored in the cloud.

func (CloudFile) GetKey

func (c CloudFile) GetKey() string

type CloudFileSyncer

type CloudFileSyncer interface {
	Sync(ctx context.Context, c *CloudFile) (*NotionPage, error)
}

CloudFileSyncer synchronizes the given CloudFile within Notion.

type CloudFileSyncerImpl

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

func NewCloudFileSyncerImpl

func NewCloudFileSyncerImpl(nh *NotionHandler, rdb *redis.Client, log *logrus.Logger) *CloudFileSyncerImpl

func (*CloudFileSyncerImpl) Sync

type CloudUploader

type CloudUploader interface {
	Upload(cloudFilePath string, content io.Reader) (*CloudFile, error)
}

type DropboxHandler

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

DropboxHandler handles Dropbox API.

func NewDropboxHandler

func NewDropboxHandler(token string, log *logrus.Logger) *DropboxHandler

func (*DropboxHandler) ListFolder

func (dh *DropboxHandler) ListFolder(path string, cursor string) ([]files.IsMetadata, string, error)

func (*DropboxHandler) Upload

func (dh *DropboxHandler) Upload(path string, content io.Reader) (*CloudFile, error)

type DropboxSynchronizer

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

DropboxSynchronizer ensures that all files inside a Dropbox folder are synchronized with Notion.

func NewDropboxSynchronizer

func NewDropboxSynchronizer(dh *DropboxHandler, ch CloudFileSyncer, rdb *redis.Client, log *logrus.Logger) *DropboxSynchronizer

func (*DropboxSynchronizer) SyncFolder

func (ds *DropboxSynchronizer) SyncFolder(ctx context.Context, path string) ([]*NotionPage, error)

type DropboxWebhookHandler

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

func NewDropboxWebhookHandler

func NewDropboxWebhookHandler(path string, ds *DropboxSynchronizer, log *logrus.Logger) *DropboxWebhookHandler

func (*DropboxWebhookHandler) HandleFuncs

func (dwh *DropboxWebhookHandler) HandleFuncs(router *mux.Router)

type DummyCloudFileSyncer

type DummyCloudFileSyncer struct{}

func (DummyCloudFileSyncer) Sync

type NotionHandler

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

func NewNotionHandler

func NewNotionHandler(token string, databaseID string) *NotionHandler

func (*NotionHandler) CreatePage

func (nh *NotionHandler) CreatePage(ctx context.Context, c *CloudFile) (*NotionPage, error)

func (*NotionHandler) ListPages

func (nh *NotionHandler) ListPages(ctx context.Context) ([]*NotionPage, error)

func (*NotionHandler) UpdatePage

func (nh *NotionHandler) UpdatePage(ctx context.Context, c *CloudFile, pageID string) (*NotionPage, error)

type NotionPage

type NotionPage struct {
	ID   string
	Name string
	Type string
	URL  string
}

func NewNotionPage

func NewNotionPage(page *notionapi.Page) *NotionPage

type NotionSyncer

type NotionSyncer interface {
	SyncDatabase(ctx context.Context) ([]*CloudFile, error)
}

type NotionSyncerImpl

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

func NewNotionSyncerImpl

func NewNotionSyncerImpl(path string, nh *NotionHandler, cu CloudUploader, rdb *redis.Client, log *logrus.Logger) *NotionSyncerImpl

func (*NotionSyncerImpl) SyncDatabase

func (ns *NotionSyncerImpl) SyncDatabase(ctx context.Context) ([]*CloudFile, error)

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriterWrapper

func NewResponseWriterWrapper(rww http.ResponseWriter) *ResponseWriterWrapper

func (*ResponseWriterWrapper) Status

func (rww *ResponseWriterWrapper) Status() int

func (*ResponseWriterWrapper) WriteHeader

func (rww *ResponseWriterWrapper) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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