profiler

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIProfile

type APIProfile struct {
	HighVolume       bool
	NeedsSearch      bool
	HasRealtime      bool
	OfflineValuable  bool
	ComplexResources bool
	HasLifecycles    bool
	HasDependencies  bool
	HasChronological bool
	HasFileOps       bool
	CRUDResources    int
	ListEndpoints    int
	TotalEndpoints   int
	ReadRatio        float64

	SyncableResources      []SyncableResource
	DependentSyncResources []DependentResource
	SearchableFields       map[string][]string

	// SearchEndpointPath is the API path for live search (e.g., "/search", "/users/search").
	// Empty if the API has no search endpoint.
	SearchEndpointPath string
	// SearchQueryParam is the query parameter name for the search endpoint (e.g., "q", "query").
	// Defaults to "q" if a search endpoint exists but no recognized param is found.
	SearchQueryParam string
	// SearchEndpointMethod is the HTTP method for the search endpoint (GET or POST).
	SearchEndpointMethod string
	// SearchBodyFields holds additional body fields (beyond the query param) needed for POST
	// search endpoints. Each entry has name, default value, and type. The search template
	// uses these to construct the full POST body at generation time.
	SearchBodyFields []SearchBodyField

	Domain     DomainSignals
	Pagination PaginationProfile
}

APIProfile describes the shape of an API and what power-user features it warrants.

func Profile

func Profile(s *spec.APISpec) *APIProfile

func (*APIProfile) RecommendedFeatures

func (p *APIProfile) RecommendedFeatures() []string

func (*APIProfile) SyncableResourceNames

func (p *APIProfile) SyncableResourceNames() []string

SyncableResourceNames returns the names of the syncable resources.

func (*APIProfile) ToVisionaryPlan

func (p *APIProfile) ToVisionaryPlan(apiName string) *vision.VisionaryPlan

type APIType

type APIType string
const (
	APITypeREST    APIType = "rest"
	APITypeGraphQL APIType = "graphql"
	APITypeGRPC    APIType = "grpc"
	APITypeUnknown APIType = "unknown"
)

func DetectAPIType

func DetectAPIType(specPath string) APIType

DetectAPIType determines the API type from a spec file path or URL.

type DependentResource

type DependentResource struct {
	Name           string // child resource name, e.g. "messages"
	ParentResource string // parent resource name, e.g. "channels"
	ParentIDParam  string // path param name, e.g. "channel_id"
	Path           string // full path template, e.g. "/channels/{channel_id}/messages"
}

DependentResource describes a child resource that requires iterating a parent to sync (e.g., /channels/{channelId}/messages depends on channels).

type DomainArchetype

type DomainArchetype string
const (
	ArchetypeCommunication     DomainArchetype = "communication"
	ArchetypeProjectMgmt       DomainArchetype = "project-management"
	ArchetypePayments          DomainArchetype = "payments"
	ArchetypeInfrastructure    DomainArchetype = "infrastructure"
	ArchetypeContent           DomainArchetype = "content"
	ArchetypeCRM               DomainArchetype = "crm"
	ArchetypeDeveloperPlatform DomainArchetype = "developer-platform"
	ArchetypeGeneric           DomainArchetype = "generic"
)

type DomainSignals

type DomainSignals struct {
	Archetype        DomainArchetype
	HasAssignees     bool
	HasDueDates      bool
	HasPriority      bool
	HasThreading     bool
	HasTransactions  bool
	HasSubscriptions bool
	HasMedia         bool
	HasTeams         bool
	HasLabels        bool
	HasEstimates     bool
}

type PaginationProfile

type PaginationProfile struct {
	CursorParam     string `json:"cursor_param"`      // most common cursor param name (after, cursor, page_token, offset)
	PageSizeParam   string `json:"page_size_param"`   // most common page size param (limit, per_page, page_size, first)
	SinceParam      string `json:"since_param"`       // temporal filter param (since, updated_after, modified_since)
	DateRangeParam  string `json:"date_range_param"`  // date-range filter param (dates, date_range, dateRange)
	ItemsKey        string `json:"items_key"`         // response array key (data, results, items, or "" for root array)
	DefaultPageSize int    `json:"default_page_size"` // detected or default 100
}

PaginationProfile describes the detected pagination patterns across the API.

type SearchBodyField

type SearchBodyField struct {
	Name     string `json:"name"`
	Type     string `json:"type"`    // string, integer, boolean, array
	Default  any    `json:"default"` // default value from spec, or synthesized from enum
	Required bool   `json:"required"`
}

SearchBodyField describes an additional body field needed for POST search endpoints.

type SyncableResource

type SyncableResource struct {
	Name string
	Path string
}

SyncableResource describes a resource that supports list sync (paginated or single-page).

Jump to

Keyboard shortcuts

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