client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent   = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3483.0 Safari/537.36"
	API         = "https://www.notion.so/api/v3/getCompletion"
	OpenAIModel = "openai-3"
)
View Source
const ChangeTone = "changeTone"
View Source
const ContinueWriting = "continueWriting"
View Source
const Translate = "Translate"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeToneContext

type ChangeToneContext struct {
	Text string               `json:"text"`
	Tone common.SupportedTone `json:"tone"`
	Type string               `json:"type"`
}

type ContinueWritingContext

type ContinueWritingContext struct {
	PreviousContent string `json:"previousContent"`
	Type            string `json:"type"`
}

type HelpDraftContext

type HelpDraftContext struct {
	Prompt string            `json:"prompt"`
	Type   common.PromptType `json:"type"`
}

type HelpEditContext

type HelpEditContext struct {
	Prompt       string            `json:"prompt"`
	Type         common.PromptType `json:"type"`
	SelectedText string            `json:"selectedText"`
}

type NotionAIResp

type NotionAIResp struct {
	Type       string `json:"type"`
	Completion string `json:"completion"`
}

type NotionClient

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

func NewClient

func NewClient(token, spaceID string) *NotionClient

func (*NotionClient) ChangeTone

func (cli *NotionClient) ChangeTone(tone common.SupportedTone, content string) (string, error)

ChangeTone uses specific tones to optimize content.

func (*NotionClient) ContinueWriting

func (cli *NotionClient) ContinueWriting(content string) (string, error)

ContinueWriting can generate the following content based on the given input content.

func (*NotionClient) HelpMeDraft

func (cli *NotionClient) HelpMeDraft(prompt string) (string, error)

HelpMeDraft can generate a draft based on the given prompt.

func (*NotionClient) HelpMeEdit

func (cli *NotionClient) HelpMeEdit(content, prompt string) (string, error)

HelpMeEdit can optimize content based on the given prompt.

func (*NotionClient) Post

func (cli *NotionClient) Post(req *NotionRequest) (string, error)

func (*NotionClient) Translate

func (cli *NotionClient) Translate(lang common.SupportedLanguage, content string) (string, error)

Translate will translate the content to given language

func (*NotionClient) WriteWithPrompt

func (cli *NotionClient) WriteWithPrompt(promptType common.PromptType, content string) (string, error)

WriteWithPrompt writes with special prompt, like summarize, explain_this, improve_writing

func (*NotionClient) WriteWithTopic

func (cli *NotionClient) WriteWithTopic(topic common.TopicType, prompt string) (string, error)

WriteWithTopic writes for special topic, like Blog, Essay, Todo lis

type NotionContext

type NotionContext interface{}

type NotionRequest

type NotionRequest struct {
	Context           NotionContext `json:"context"`
	ID                string        `json:"id"`
	IsSpacePermission bool          `json:"isSpacePermission"`
	Model             string        `json:"model"`
	SpaceId           string        `json:"spaceId"`
}

type PromptContext

type PromptContext struct {
	SelectedText string            `json:"selectedText"`
	Type         common.PromptType `json:"type"`
}

type TopicContext

type TopicContext struct {
	Topic string           `json:"topic"`
	Type  common.TopicType `json:"type"`
}

type TranslateContext

type TranslateContext struct {
	Text     string                   `json:"text"`
	Language common.SupportedLanguage `json:"language"`
	Type     string                   `json:"type"`
}

Jump to

Keyboard shortcuts

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