ui

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package ui provides a web-based user interface for the Nylas CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUICmd

func NewUICmd() *cobra.Command

NewUICmd creates the ui command.

Types

type Application

type Application struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Environment string `json:"environment"`
}

Application represents a Nylas application.

type Command

type Command struct {
	Key         string `json:"key"`
	Title       string `json:"title"`
	Cmd         string `json:"cmd"`
	Desc        string `json:"desc"`
	ParamName   string `json:"paramName,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
}

Command represents a CLI command with metadata.

type Commands

type Commands struct {
	Auth      []Command `json:"auth"`
	Email     []Command `json:"email"`
	Calendar  []Command `json:"calendar"`
	Contacts  []Command `json:"contacts"`
	Inbound   []Command `json:"inbound"`
	Scheduler []Command `json:"scheduler"`
	Timezone  []Command `json:"timezone"`
	Webhook   []Command `json:"webhook"`
	OTP       []Command `json:"otp"`
	Admin     []Command `json:"admin"`
	Notetaker []Command `json:"notetaker"`
}

Commands holds categorized commands.

func GetDefaultCommands

func GetDefaultCommands() Commands

GetDefaultCommands returns the default command definitions.

type ConfigStatusResponse

type ConfigStatusResponse struct {
	Configured   bool   `json:"configured"`
	Region       string `json:"region"`
	ClientID     string `json:"client_id,omitempty"`
	HasAPIKey    bool   `json:"has_api_key"`
	GrantCount   int    `json:"grant_count"`
	DefaultGrant string `json:"default_grant,omitempty"`
}

type ExecRequest

type ExecRequest struct {
	Command string `json:"command"`
}

ExecRequest represents a command execution request.

type ExecResponse

type ExecResponse struct {
	Output string `json:"output,omitempty"`
	Error  string `json:"error,omitempty"`
}

ExecResponse represents a command execution response.

type Grant

type Grant struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	Provider string `json:"provider"`
}

Grant represents an authenticated account.

type GrantsResponse

type GrantsResponse struct {
	Grants       []Grant `json:"grants"`
	DefaultGrant string  `json:"default_grant"`
}

GrantsResponse represents the grants list API response.

type PageData

type PageData struct {
	Configured        bool
	DemoMode          bool
	ClientID          string
	Region            string
	HasAPIKey         bool
	DefaultGrant      string
	DefaultGrantEmail string
	Grants            []Grant
	Commands          Commands
}

PageData contains all data needed to render the page.

func (PageData) CommandsJSON

func (p PageData) CommandsJSON() template.JS

CommandsJSON returns commands as JSON for JavaScript.

func (PageData) GrantsJSON

func (p PageData) GrantsJSON() template.JS

GrantsJSON returns grants as JSON for JavaScript.

type Server

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

Server represents the web UI server.

func NewDemoServer

func NewDemoServer(addr string) *Server

NewDemoServer creates a UI server in demo mode with sample data.

func NewServer

func NewServer(addr string) *Server

NewServer creates a new UI server.

func (*Server) Start

func (s *Server) Start() error

type SetDefaultGrantRequest

type SetDefaultGrantRequest struct {
	GrantID string `json:"grant_id"`
}

SetDefaultGrantRequest represents the request to set default grant.

type SetDefaultGrantResponse

type SetDefaultGrantResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
}

SetDefaultGrantResponse represents the response for setting default grant.

type SetupRequest

type SetupRequest struct {
	APIKey string `json:"api_key"`
	Region string `json:"region"`
}

SetupRequest represents the setup API request.

type SetupResponse

type SetupResponse struct {
	Success      bool          `json:"success"`
	Message      string        `json:"message"`
	ClientID     string        `json:"client_id,omitempty"`
	Applications []Application `json:"applications,omitempty"`
	Grants       []Grant       `json:"grants,omitempty"`
	Error        string        `json:"error,omitempty"`
}

SetupResponse represents the setup API response.

Jump to

Keyboard shortcuts

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