operator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArweaveOperator

type ArweaveOperator struct {
	ArseedSdk   *sdk.SDK
	PayCurrency string
}

func CreateArweaveOperator

func CreateArweaveOperator(priKey, payCurrency string) *ArweaveOperator

func (*ArweaveOperator) LoadPage

func (a *ArweaveOperator) LoadPage(arTxId string) (content string, err error)

LoadPage load a page content from arweave using arseeding @Param arTxId, tx id on arweave @Return content, return "" if content tag not found

func (*ArweaveOperator) SavePage

func (a *ArweaveOperator) SavePage(content string) (txId string, err error)

SavePage upload page to arweave using arseeding @Param content, page content @Return txId, return by Arweave

type IArweaveOperator

type IArweaveOperator interface {
	// Load
	// @Return content, json format
	LoadPage(arTxId string) (content string, err error)
	LoadDatabase(arTxId string) (content string, err error)
	LoadImage(arTxId string) (content string, err error)

	// Save
	SavePage(content string) (txId string, err error)
	SaveDatabase(content string) (txId string, err error)
	SaveImage(content string) (txId string, err error)
}

IArweaveOperator

type IContentAnalyzer

type IContentAnalyzer interface {
	// Covert2UploadContent Converting content from arweave to upload format
	CovertPage2UploadContent(srcContent string) (dstContent string, err error)
}

IContentAnalyzer

type INotionOperator

type INotionOperator interface {
	// Fetch
	// !MUST support recursive
	// @Pararm uuid,
	// @Return string, txId return by Arweave
	FetchPage(uuid string) (content string, err error)
	FetchDatabase(uuid string) (content string, err error)
	FetchImage(uuid string) (content string, err error)
	// Level 2 func
	// FetchChildBlocks, get subblocks
	FetchChildBlocks(parentId string) (content string, err error)

	// Upload content to notion
	// @Pararm parentId, uuid of parent page
	// @Return uuid, new uuid
	// @Return content, json format page content
	UploadPage(parentId, content string) (uuid string, err error)
	UploadDatabase(parentId, content string) (uuid string, err error)
	UploadImage(content string) (uuid string, err error)
}

INotionOperator

type IOperator

type IOperator interface {
	// Save2Ar fetch content from notion and upload to arweave
	// !MUST support recursive
	// @Pararm uuid,
	// @Return string, txId return by Arweave
	SavePage2Ar(uuid string) (arTxId string, err error)
	SaveDatabase2Ar(uuid string) (arTxId string, err error)
	SaveImage2Ar(uuid string) (arTxId string, err error)

	// LoadFromAr get content from arweave and upload to notion
	// @Pararm parentId, uuid of parent page
	// @Return uuid, new uuid
	// @Return content, json format page content
	LoadPageFromAr(parentId, arTxId string) (uuid string, err error)
	LoadDatabaseFromAr(parentId, arTxId string) (uuid string, err error)
	LoadImageFromAr(parentId, arTxId string) (uuid string, err error)
}

type NotionOperator

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

NotionOperator inherite INotionOperator

func CreateNotionOperator

func CreateNotionOperator(auth string) *NotionOperator

Implementation of Notion interaction Inheritance INotionOperator

CreateNotionOperator

func (*NotionOperator) FetchPage

func (n *NotionOperator) FetchPage(uuid string) (content string, err error)

Fetch page from notion, upload to arweave4 @Pararm uuid, page uuid @Return txId, txId return by Arweave

func (*NotionOperator) UploadPage

func (n *NotionOperator) UploadPage(parentId string, page *types.ArweavePage) (uuid string, err error)

UploadPage uploading page content to notion @Pararm parentId, parent page uuid, where new page to be loaded @Pararm content, page content ,need convert to upload format @Return uuid, uuid of new page @Return content, new page content

type Operator

type Operator struct {
	NotionOpter *NotionOperator
	ArOpter     *ArweaveOperator
}

Operator inherite IOperator

func CreateOperator

func CreateOperator(notionAuth, priKey, payCurrency string) *Operator

func (*Operator) LoadPageFromAr

func (o *Operator) LoadPageFromAr(parentId, arTxId string) (uuid string, err error)

LoadPageFromAr get page from arweave and upload to notion

func (*Operator) SavePage2Ar

func (o *Operator) SavePage2Ar(uuid string) (arTxId string, err error)

SavePage2Ar fetch page from notion and upload to arweave

Jump to

Keyboard shortcuts

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