client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client defines the consumer-side IServ interface used by CLI commands and the interactive TUI, along with the production adapter over iserv.Client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FriendlyError

func FriendlyError(err error) error

FriendlyError converts an *iserv.Error or sentinel into a concise user-facing message.

Types

type ConnectFunc

type ConnectFunc func(ctx context.Context, domain, username, password string) (IServClient, error)

ConnectFunc authenticates against an IServ server and returns an IServClient.

func NewConnector

func NewConnector(timeout time.Duration, allowInsecureHTTP bool, logger *slog.Logger) ConnectFunc

NewConnector builds a ConnectFunc configured with timeout, TLS policy, and logger.

type IServClient

type IServClient interface {
	Domain() string
	BaseURL() string
	Username() string
	Close(ctx context.Context) error

	GetProfile(ctx context.Context) (*iserv.Profile, error)
	GetAvatar(ctx context.Context) (*iserv.Avatar, error)
	ListFolders(ctx context.Context) ([]iserv.Folder, error)
	ListEmails(ctx context.Context, opts iserv.EmailListOptions) (*iserv.EmailPage, error)
	GetEmail(ctx context.Context, folder, uid string) (*iserv.EmailDetail, error)
	ListFiles(ctx context.Context, path string) ([]iserv.FileEntry, error)
	DownloadFile(ctx context.Context, path string) (*iserv.FileDownload, error)
	ListGroups(ctx context.Context) ([]iserv.Group, error)
	GetGroup(ctx context.Context, id string) (*iserv.GroupDetail, error)
	ListCalendars(ctx context.Context) ([]iserv.CalendarSource, error)
	ListEvents(ctx context.Context, opts iserv.CalendarEventsOptions) ([]iserv.CalendarEvent, error)
	ListTasks(ctx context.Context, status iserv.TaskStatus) ([]iserv.TaskSummary, error)
	GetTask(ctx context.Context, id string) (*iserv.TaskDetail, error)
	ListNotifications(ctx context.Context) ([]iserv.Notification, error)
	MarkNotificationRead(ctx context.Context, id string) error
	MarkAllNotificationsRead(ctx context.Context) error
	SearchUsers(ctx context.Context, query string) ([]iserv.DirectoryUser, error)
}

IServClient abstracts *iserv.Client at the consumer boundary for clean testing and decoupling between CLI/TUI presentation and HTTP transport.

type SDKAdapter

type SDKAdapter struct {
	Client *iserv.Client
}

SDKAdapter adapts *iserv.Client to IServClient.

func (*SDKAdapter) BaseURL

func (a *SDKAdapter) BaseURL() string

BaseURL implements IServClient.

func (*SDKAdapter) Close

func (a *SDKAdapter) Close(ctx context.Context) error

Close implements IServClient.

func (*SDKAdapter) Domain

func (a *SDKAdapter) Domain() string

Domain implements IServClient.

func (*SDKAdapter) DownloadFile

func (a *SDKAdapter) DownloadFile(ctx context.Context, path string) (*iserv.FileDownload, error)

DownloadFile implements IServClient.

func (*SDKAdapter) GetAvatar

func (a *SDKAdapter) GetAvatar(ctx context.Context) (*iserv.Avatar, error)

GetAvatar implements IServClient.

func (*SDKAdapter) GetEmail

func (a *SDKAdapter) GetEmail(ctx context.Context, folder, uid string) (*iserv.EmailDetail, error)

GetEmail implements IServClient.

func (*SDKAdapter) GetGroup

func (a *SDKAdapter) GetGroup(ctx context.Context, id string) (*iserv.GroupDetail, error)

GetGroup implements IServClient.

func (*SDKAdapter) GetProfile

func (a *SDKAdapter) GetProfile(ctx context.Context) (*iserv.Profile, error)

GetProfile implements IServClient.

func (*SDKAdapter) GetTask

func (a *SDKAdapter) GetTask(ctx context.Context, id string) (*iserv.TaskDetail, error)

GetTask implements IServClient.

func (*SDKAdapter) ListCalendars

func (a *SDKAdapter) ListCalendars(ctx context.Context) ([]iserv.CalendarSource, error)

ListCalendars implements IServClient.

func (*SDKAdapter) ListEmails

func (a *SDKAdapter) ListEmails(ctx context.Context, opts iserv.EmailListOptions) (*iserv.EmailPage, error)

ListEmails implements IServClient.

func (*SDKAdapter) ListEvents

ListEvents implements IServClient.

func (*SDKAdapter) ListFiles

func (a *SDKAdapter) ListFiles(ctx context.Context, path string) ([]iserv.FileEntry, error)

ListFiles implements IServClient.

func (*SDKAdapter) ListFolders

func (a *SDKAdapter) ListFolders(ctx context.Context) ([]iserv.Folder, error)

ListFolders implements IServClient.

func (*SDKAdapter) ListGroups

func (a *SDKAdapter) ListGroups(ctx context.Context) ([]iserv.Group, error)

ListGroups implements IServClient.

func (*SDKAdapter) ListNotifications

func (a *SDKAdapter) ListNotifications(ctx context.Context) ([]iserv.Notification, error)

ListNotifications implements IServClient.

func (*SDKAdapter) ListTasks

func (a *SDKAdapter) ListTasks(ctx context.Context, status iserv.TaskStatus) ([]iserv.TaskSummary, error)

ListTasks implements IServClient.

func (*SDKAdapter) MarkAllNotificationsRead

func (a *SDKAdapter) MarkAllNotificationsRead(ctx context.Context) error

MarkAllNotificationsRead implements IServClient.

func (*SDKAdapter) MarkNotificationRead

func (a *SDKAdapter) MarkNotificationRead(ctx context.Context, id string) error

MarkNotificationRead implements IServClient.

func (*SDKAdapter) SearchUsers

func (a *SDKAdapter) SearchUsers(ctx context.Context, query string) ([]iserv.DirectoryUser, error)

SearchUsers implements IServClient.

func (*SDKAdapter) Username

func (a *SDKAdapter) Username() string

Username implements IServClient.

Jump to

Keyboard shortcuts

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