Documentation
¶
Overview ¶
Package apidocs provides search functionality over a pre-processed index of Microsoft Graph API documentation, including per-endpoint permissions, query parameters, and per-resource property details.
Index ¶
- func BuildFTSDatabase(idx *Index, dbPath string) error
- func FormatEndpointResults(results []FTSEndpointResult) interface{}
- func FormatResourceResults(results []FTSResourceResult) interface{}
- type EndpointDoc
- type EndpointResult
- type FTSEndpointResult
- type FTSIndex
- type FTSResourceResult
- type Index
- type Permissions
- type PropertyDoc
- type ResourceDoc
- type ResourceResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFTSDatabase ¶ added in v1.0.14
BuildFTSDatabase creates a SQLite FTS5 database from the API docs index. The database contains content tables for both endpoints and resources, plus FTS5 virtual tables for full-text search with Porter stemming.
func FormatEndpointResults ¶ added in v1.0.14
func FormatEndpointResults(results []FTSEndpointResult) interface{}
FormatEndpointResults converts FTS endpoint results to the standard JSON output.
func FormatResourceResults ¶ added in v1.0.14
func FormatResourceResults(results []FTSResourceResult) interface{}
FormatResourceResults converts FTS resource results to the standard JSON output.
Types ¶
type EndpointDoc ¶
type EndpointDoc struct {
Path string `json:"path"`
Method string `json:"method"`
Permissions Permissions `json:"permissions"`
QueryParams []string `json:"queryParams,omitempty"`
RequiredHeaders []string `json:"requiredHeaders,omitempty"`
DefaultProperties []string `json:"defaultProperties,omitempty"`
Notes []string `json:"notes,omitempty"`
}
EndpointDoc represents a single API endpoint with documentation details.
type EndpointResult ¶
type EndpointResult struct {
EndpointDoc
MatchReason string `json:"matchReason"`
}
EndpointResult wraps an endpoint doc with a match reason.
type FTSEndpointResult ¶ added in v1.0.14
type FTSEndpointResult struct {
Path string `json:"path"`
Method string `json:"method"`
DelegatedWork []string `json:"delegatedWork,omitempty"`
DelegatedPersonal []string `json:"delegatedPersonal,omitempty"`
Application []string `json:"application,omitempty"`
QueryParams []string `json:"queryParams,omitempty"`
RequiredHeaders []string `json:"requiredHeaders,omitempty"`
DefaultProperties []string `json:"defaultProperties,omitempty"`
Notes []string `json:"notes,omitempty"`
MatchReason string `json:"matchReason"`
Score float64 `json:"score,omitempty"`
}
FTSEndpointResult contains an endpoint search result.
type FTSIndex ¶ added in v1.0.14
type FTSIndex struct {
// contains filtered or unexported fields
}
FTSIndex provides full-text search over a SQLite FTS5 database containing API documentation data (both endpoints and resources).
func LoadFTSIndex ¶ added in v1.0.14
LoadFTSIndex opens a SQLite FTS database for searching. Callers must call Close() when done.
func (*FTSIndex) SearchEndpoints ¶ added in v1.0.14
func (idx *FTSIndex) SearchEndpoints(endpoint, method, query string, limit int) []FTSEndpointResult
SearchEndpoints finds endpoint docs matching the given criteria using FTS5.
func (*FTSIndex) SearchResources ¶ added in v1.0.14
func (idx *FTSIndex) SearchResources(resource, query string, limit int) []FTSResourceResult
SearchResources finds resource docs matching the given criteria using FTS5.
type FTSResourceResult ¶ added in v1.0.14
type FTSResourceResult struct {
Name string `json:"name"`
Properties string `json:"properties,omitempty"`
MatchReason string `json:"matchReason"`
Score float64 `json:"score,omitempty"`
}
FTSResourceResult contains a resource search result.
type Index ¶
type Index struct {
Version string `json:"version"`
Generated string `json:"generated"`
EndpointCount int `json:"endpointCount"`
ResourceCount int `json:"resourceCount"`
Endpoints []EndpointDoc `json:"endpoints"`
Resources []ResourceDoc `json:"resources"`
}
Index holds the full searchable API docs index.
func (*Index) SearchEndpoints ¶
func (idx *Index) SearchEndpoints(endpoint, method, query string, limit int) []EndpointResult
SearchEndpoints finds endpoint docs matching the given criteria.
func (*Index) SearchResources ¶
func (idx *Index) SearchResources(resource, query string, limit int) []ResourceResult
SearchResources finds resource docs matching the given criteria. Results are sorted: exact name match first, then prefix matches, then substring matches.
type Permissions ¶
type Permissions struct {
DelegatedWork []string `json:"delegatedWork,omitempty"`
DelegatedPersonal []string `json:"delegatedPersonal,omitempty"`
Application []string `json:"application,omitempty"`
}
Permissions holds the required permission scopes split by auth type.
type PropertyDoc ¶
type PropertyDoc struct {
Name string `json:"name"`
Type string `json:"type"`
Filter []string `json:"filter,omitempty"`
Default bool `json:"default,omitempty"`
Notes string `json:"notes,omitempty"`
}
PropertyDoc describes a single property of a resource.
type ResourceDoc ¶
type ResourceDoc struct {
Name string `json:"name"`
Properties []PropertyDoc `json:"properties,omitempty"`
}
ResourceDoc represents a resource type with its properties.
type ResourceResult ¶
type ResourceResult struct {
ResourceDoc
MatchReason string `json:"matchReason"`
}
ResourceResult wraps a resource doc with a match reason.