Documentation
¶
Index ¶
- Constants
- type FieldMetadata
- type FieldMetadataMap
- type FieldMetadataMapV1
- type FieldMetadataMapV2
- type FieldValue
- type FieldValues
- type FileManager
- type Metadata
- func (m *Metadata[F]) Add(moduleID common.ModuleID, ...)
- func (m *Metadata[F]) LookupArrayFieldName(moduleID common.ModuleID, objectName string) string
- func (m *Metadata[F]) LookupModuleURLPath(moduleID common.ModuleID) string
- func (m *Metadata[F]) LookupURLPath(moduleID common.ModuleID, objectName string) (string, error)
- func (m *Metadata[F]) ModuleRegistry() common.Modules
- func (m *Metadata[F]) ObjectNames() datautils.UniqueLists[common.ModuleID, string]
- func (m *Metadata[F]) Select(moduleID common.ModuleID, objectNames []string) (*common.ListObjectMetadataResult, error)
- func (m *Metadata[F]) SelectOne(moduleID common.ModuleID, objectName string) (*common.ObjectMetadata, error)
- type Module
- type Object
Constants ¶
const RootModuleID common.ModuleID = "root"
const SchemasFile = "schemas.json"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldMetadata ¶
type FieldMetadataMap ¶
type FieldMetadataMap interface { FieldMetadataMapV1 | FieldMetadataMapV2 }
type FieldMetadataMapV1 ¶
type FieldMetadataMapV2 ¶
type FieldMetadataMapV2 map[string]FieldMetadata
type FieldValue ¶
type FieldValues ¶
type FieldValues []FieldValue
type FileManager ¶
type FileManager[F FieldMetadataMap] struct { // contains filtered or unexported fields }
FileManager operates on schema.json file.
func NewFileManager ¶
func NewFileManager[F FieldMetadataMap](schemas []byte, locator fileconv.FileLocator) *FileManager[F]
func (FileManager[F]) MustLoadSchemas ¶
func (m FileManager[F]) MustLoadSchemas() *Metadata[F]
MustLoadSchemas parses static schema file and returns Metadata for deep connector.
func (FileManager[F]) SaveSchemas ¶
func (m FileManager[F]) SaveSchemas(schemas *Metadata[F]) error
SaveSchemas is useful method when creating or updating static schema file.
type Metadata ¶
type Metadata[F FieldMetadataMap] struct { // Modules is a map of object names to object metadata Modules map[common.ModuleID]Module[F] `json:"modules"` }
Metadata is data that is saved in the static file.
This structure offers the following main methods: Metadata.ObjectNames - registry of object names by modules. Metadata.LookupURLPath - resolves URL given object name. Metadata.Select - produces output suitable for connectors.ObjectMetadataConnector.
func NewMetadata ¶
func NewMetadata[F FieldMetadataMap]() *Metadata[F]
NewMetadata constructs empty Metadata. To populate it with data use Metadata.Add method.
func (*Metadata[F]) Add ¶
func (m *Metadata[F]) Add( moduleID common.ModuleID, objectName, objectDisplayName, urlPath, responseKey string, fieldMetadataMap F, docsURL *string, )
Add will appropriately store the data, abiding to data structure rules. NOTE: empty module id is treated as root module.
func (*Metadata[F]) LookupArrayFieldName ¶
LookupArrayFieldName will give you the field name which holds the array of objects in provider response. Ex: CustomerSubscriptions is located under field name subscriptions => { "subscriptions": [{},{},{}] }.
func (*Metadata[F]) LookupModuleURLPath ¶
func (*Metadata[F]) LookupURLPath ¶
LookupURLPath will give you the URL path for the object located under the module. NOTE: empty module id is treated as root module.
func (*Metadata[F]) ModuleRegistry ¶
ModuleRegistry returns the list of API modules from static schema.
func (*Metadata[F]) ObjectNames ¶
ObjectNames provides a registry of object names grouped by module.
func (*Metadata[F]) Select ¶
func (m *Metadata[F]) Select( moduleID common.ModuleID, objectNames []string, ) (*common.ListObjectMetadataResult, error)
Select will look for object names under the module and will return metadata result for those objects. NOTE: empty module id is treated as root module.
type Object ¶
type Object[F FieldMetadataMap] struct { // Provider's display name for the object DisplayName string `json:"displayName"` // This is the endpoint URLPath to this REST API resource/object. // It can be used to make request to "list objects". URLPath string `json:"path"` // A field name where the object is located within provider response. ResponseKey string `json:"responseKey"` // Fields is a map of field names to either field display names or extended field metadata. Fields F `json:"fields"` // DocsURL points to docs endpoint. Optional. DocsURL *string `json:"docs,omitempty"` }