names

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package names provides name resolution for projects, people, and todolists. It implements fuzzy matching with the following priority: 1. Numeric ID passthrough 2. Exact match (case-sensitive) 3. Case-insensitive match 4. Partial match (contains)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Person

type Person struct {
	ID             int64  `json:"id"`
	Name           string `json:"name"`
	Email          string `json:"email_address"`
	PersonableType string `json:"personable_type,omitempty"` // e.g., "User", "Client"
}

Person represents a Basecamp person for name resolution.

type Project

type Project struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Project represents a Basecamp project for name resolution.

type Resolver

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

Resolver resolves names to IDs for projects, people, and todolists.

func NewResolver

func NewResolver(sdkClient *basecamp.Client, authMgr *auth.Manager, accountID string) *Resolver

NewResolver creates a new name resolver. The accountID is used to configure the SDK client for account-scoped API calls.

func (*Resolver) ClearCache

func (r *Resolver) ClearCache()

ClearCache clears the session cache.

func (*Resolver) GetPeople

func (r *Resolver) GetPeople(ctx context.Context) ([]Person, error)

GetPeople returns all people (useful for pickers).

func (*Resolver) GetProjects

func (r *Resolver) GetProjects(ctx context.Context) ([]Project, error)

GetProjects returns all projects (useful for pickers).

func (*Resolver) GetTodolists

func (r *Resolver) GetTodolists(ctx context.Context, projectID string) ([]Todolist, error)

GetTodolists returns all todolists for a project (useful for pickers).

func (*Resolver) ResolvePerson

func (r *Resolver) ResolvePerson(ctx context.Context, input string) (string, string, error)

ResolvePerson resolves a person name, email, or ID to an ID. Special case: "me" resolves to the current user. Returns the ID and the person's name for display.

func (*Resolver) ResolveProject

func (r *Resolver) ResolveProject(ctx context.Context, input string) (string, string, error)

ResolveProject resolves a project name or ID to an ID. Returns the ID and the project name for display.

func (*Resolver) ResolveTodolist

func (r *Resolver) ResolveTodolist(ctx context.Context, input, projectID string) (string, string, error)

ResolveTodolist resolves a todolist name or ID within a project. Returns the ID and the todolist name for display.

func (*Resolver) SetAccountID

func (r *Resolver) SetAccountID(accountID string)

SetAccountID updates the account ID used by the resolver. This clears the cache since cached data is account-specific.

type Todolist

type Todolist struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

Todolist represents a Basecamp todolist for name resolution.

Jump to

Keyboard shortcuts

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