Documentation ¶
Index ¶
- Constants
- Variables
- type FileManager
- type Metadata
- func (r *Metadata) Add(moduleID common.ModuleID, ...)
- func (r *Metadata) LookupArrayFieldName(moduleID common.ModuleID, objectName string) string
- func (r *Metadata) LookupModuleURLPath(moduleID common.ModuleID) string
- func (r *Metadata) LookupURLPath(moduleID common.ModuleID, objectName string) (string, error)
- func (r *Metadata) ModuleRegistry() common.Modules
- func (r *Metadata) ObjectNames() datautils.UniqueLists[common.ModuleID, string]
- func (r *Metadata) Select(moduleID common.ModuleID, objectNames []string) (*common.ListObjectMetadataResult, error)
- func (r *Metadata) SelectOne(moduleID common.ModuleID, objectName string) (*common.ObjectMetadata, error)
- type Module
- type Object
Constants ¶
const RootModuleID common.ModuleID = "root"
const SchemasFile = "schemas.json"
Variables ¶
var ErrObjectNotFound = errors.New("object not found")
Functions ¶
This section is empty.
Types ¶
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
FileManager operates on schema.json file.
func NewFileManager ¶
func NewFileManager(schemas []byte, locator fileconv.FileLocator) *FileManager
func (FileManager) MustLoadSchemas ¶
func (m FileManager) MustLoadSchemas() *Metadata
MustLoadSchemas parses static schema file and returns Metadata for deep connector.
func (FileManager) SaveSchemas ¶
func (m FileManager) SaveSchemas(schemas *Metadata) error
SaveSchemas is useful method when creating or updating static schema file.
type Metadata ¶
type Metadata struct { // Modules is a map of object names to object metadata Modules map[common.ModuleID]Module `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() *Metadata
NewMetadata constructs empty Metadata. To populate it with data use Metadata.Add method.
func (*Metadata) Add ¶
func (r *Metadata) Add( moduleID common.ModuleID, objectName, objectDisplayName, fieldName, urlPath, responseKey string, docsURL *string, )
Add will appropriately store the data, abiding to data structure rules. NOTE: empty module id is treated as root module.
func (*Metadata) 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) LookupModuleURLPath ¶
func (*Metadata) 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) ModuleRegistry ¶
ModuleRegistry returns the list of API modules from static schema.
func (*Metadata) ObjectNames ¶
ObjectNames provides a registry of object names grouped by module.
type Object ¶
type Object 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"` // FieldsMap is a map of field names to field display names FieldsMap map[string]string `json:"fields"` // DocsURL points to docs endpoint. Optional. DocsURL *string `json:"docs,omitempty"` }