service

package
v0.0.0-...-70d0519 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOTION_URL       = "https://www.notion.so/"
	NOTION_OAUTH_URL = "https://api.notion.com/v1/oauth/token"

	ErrCancel       = "internal server error caused by user cancellation"
	ErrOAuthGrant   = "internal server error caused by oauth grant content"
	ErrMissingToken = "internal server error caused by missing oauth token"
	ErrTokenRequest = "internal server error caused by oauth request to Notion API"
	ErrTokenDecode  = "internal server error caused by decoding oauth token response"
	ErrImportSTIX   = "internal server error caused by importing STIX data to Notion"
)

Variables

View Source
var (
	ErrValueTooLong = "cookie value too long"
	ErrInvalidValue = "invalid cookie value"
)

Functions

This section is empty.

Types

type HomeData

type HomeData struct {
	IntegrationURL string
	Authenticated  bool
}

type OAuthAccessToken

type OAuthAccessToken struct {
	AccessToken          string `json:"access_token,omitempty"`
	WorkspaceID          string `json:"workspace_id,omitempty"`
	WorkspaceName        string `json:"workspace_name,omitempty"`
	WorkspaceIcon        string `json:"workspace_icon,omitempty"`
	BotID                string `json:"bot_id,omitempty"`
	DuplicatedTemplateID string `json:"duplicated_template_id,omitempty"`
}

type OAuthGrant

type OAuthGrant struct {
	GrantType   string `json:"grant_type,omitempty"`
	Code        string `json:"code,omitempty"`
	RedirectURI string `json:"redirect_uri,omitempty"`
}

type Service

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

Service represents a service that handles integration setup and other operations.

func New

func New(repo notionstix.Repository, redirectURI string, oauthClientID string, oauthClientSecret string, cookieSecret string, store notionstix.Store) *Service

New creates a new instance of the Service.

func (*Service) Connect

func (s *Service) Connect(w http.ResponseWriter, r *http.Request, params api.ConnectParams) *api.Response

Connect handles the connection request from the client. The access token is then used to redirect the client to the Notion URL. If any errors occur during the process, appropriate error responses are returned.

func (*Service) GetEvents

func (s *Service) GetEvents(w http.ResponseWriter, r *http.Request) *api.Response

func (*Service) GetHomePage

func (s *Service) GetHomePage(w http.ResponseWriter, r *http.Request) *api.Response

func (*Service) ImportSTIX

func (s *Service) ImportSTIX(w http.ResponseWriter, r *http.Request) *api.Response

Jump to

Keyboard shortcuts

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