Documentation ¶
Index ¶
- type Dataset
- type ExternalInstanceID
- type InstanceChanges
- type InstanceLinkedPropertyCreate
- type InstanceLinkedPropertyDelete
- type LinkedPropertyChanges
- type ModelChanges
- type ModelCreate
- type ModelPropsCreate
- type PennsieveInstanceID
- type PennsieveSchemaID
- type PropertiesCreate
- type PropertyCreate
- type ProxyChanges
- type ProxyRecordChanges
- type RecordChanges
- type RecordCreate
- type RecordIDMap
- type RecordUpdate
- type RecordValue
- type RecordValues
- type SchemaLinkedPropertyCreate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dataset ¶
type Dataset struct { Models []ModelChanges `json:"models"` LinkedProperties []LinkedPropertyChanges `json:"linked_properties"` Proxies *ProxyChanges `json:"proxies"` ExistingModelIDMap map[string]PennsieveSchemaID `json:"existing_model_id_map"` RecordIDMaps []RecordIDMap `json:"record_id_maps"` }
type ExternalInstanceID ¶
type ExternalInstanceID string
ExternalInstanceID is an ID that the user supplies, or we can calculate from the values a user supplies. It identifies an instance, so that two instances with the same ID should be considered the same.
type InstanceChanges ¶
type InstanceChanges struct { Create []InstanceLinkedPropertyCreate `json:"create"` Delete []InstanceLinkedPropertyDelete `json:"delete"` }
type InstanceLinkedPropertyCreate ¶
type InstanceLinkedPropertyCreate struct { FromExternalID ExternalInstanceID `json:"from_external_id"` ToExternalID ExternalInstanceID `json:"to_external_id"` }
InstanceLinkedPropertyCreate will have to be translated to a POST /models/datasets/<dataset id>/concepts/<model id>/instances/<from record id>/linked request with body {"schemaLinkedPropertyId": <linked property schema id>, "to": <to record id>} once those id values are known (The LinkedProperty schema and/or from and to records may not yet exist when instances of this struct are created
type InstanceLinkedPropertyDelete ¶
type InstanceLinkedPropertyDelete struct { FromRecordID PennsieveInstanceID `json:"from_record_id"` InstanceLinkedPropertyID PennsieveInstanceID `json:"instance_linked_property_id"` }
InstanceLinkedPropertyDelete contains the additional info needed to call DELETE /models/datasets/{dataset id}/concepts/{model Id}/instances/{record id}/linked/{link instance id} No payload required
type LinkedPropertyChanges ¶
type LinkedPropertyChanges struct { // FromModelName is the name of the model that plays the "from" role in this link. // It will be needed to look up the schema id of the model as well as instance ids of "from" records FromModelName string `json:"from_model_name"` // ToModelName is the name of the model that plays the "to" role in this link. // It will be needed to look up instance ids of "to" records ToModelName string `json:"to_model_name"` // The ID of the LinkedProperty in the schema. Can be empty or missing if the linkedProperty does not exist. // In this case, Create below should be non-nil ID PennsieveSchemaID `json:"id,omitempty"` // If Create is non-nil, the link schema should be created in the model schema Create *SchemaLinkedPropertyCreate `json:"create,omitempty"` // Instances contains the create and delete info for link instances Instances InstanceChanges `json:"instances"` }
LinkedPropertyChanges represents a changeset for a particular LinkedProperty, optionally creating the link in the metadata schema. Executing the changeset will depend on other models and records existing, so it should only be executed once those model changesets have been executed.
type ModelChanges ¶
type ModelChanges struct { // The ID of the model. Can be empty or missing if the model does not exist. // In this case, Create below should be non-nil ID PennsieveSchemaID `json:"id,omitempty"` // If Create is non-nil, the model should be created Create *ModelPropsCreate `json:"create,omitempty"` // Records describes the changes to the records of this model type Records RecordChanges `json:"records"` }
type ModelCreate ¶
type ModelCreate struct { Name string `json:"name"` DisplayName string `json:"displayName"` Description string `json:"description"` Locked bool `json:"locked"` }
ModelCreate can be used as a payload for POST /models/datasets/<dataset id>/concepts to create a model
type ModelPropsCreate ¶
type ModelPropsCreate struct { Model ModelCreate `json:"model"` Properties PropertiesCreate `json:"properties"` }
type PennsieveInstanceID ¶
type PennsieveInstanceID string
PennsieveInstanceID is the internal ID of the record or other instance in Pennsieve. Not usually seen by user, but needed for API calls
type PennsieveSchemaID ¶
type PennsieveSchemaID string
PennsieveSchemaID is the internal ID of a model or other schema object in Pennsieve. Not usually seen by user, but needed for API calls
func (PennsieveSchemaID) String ¶
func (i PennsieveSchemaID) String() string
type PropertiesCreate ¶
type PropertiesCreate []PropertyCreate
PropertiesCreate can be uses as a payload for PUT /models/datasets/<dataset id>/concepts/<model id>/properties to add properties to a model
type PropertyCreate ¶
type PropertyCreate struct { DisplayName string `json:"displayName"` Name string `json:"name"` DataType json.RawMessage `json:"dataType"` ConceptTitle bool `json:"conceptTitle"` Default bool `json:"default"` Required bool `json:"required"` IsEnum bool `json:"isEnum"` IsMultiValue bool `json:"isMultiValue"` Value string `json:"value"` Locked bool `json:"locked"` Description string `json:"description"` }
func (*PropertyCreate) SetDataType ¶
func (pc *PropertyCreate) SetDataType(dataType any) error
type ProxyChanges ¶
type ProxyChanges struct { CreateProxyRelationshipSchema bool `json:"create_proxy_relationship_schema"` RecordChanges []ProxyRecordChanges `json:"record_changes"` }
ProxyChanges contains all the changes to package proxies. If CreateProxyRelationshipSchema is true we send POST /models/datasets/<dataset id>/relationships the body {"name":"belongs_to","displayName":"Belongs To","description":"","schema":[]} to create the special relationship schema used by all package proxies regardless of record or pacakge type.
func (ProxyChanges) Summary ¶
func (pc ProxyChanges) Summary() (createCount int, deleteCount int)
type ProxyRecordChanges ¶
type ProxyRecordChanges struct { // ModelName is the name of the model for this record // Together ModelName and RecordExternalID can be used to look up the ID we really need, the // Record's ID in Pennsieve ModelName string `json:"model_name"` // RecordExternalID is the external ID of the record. Will have to be used along with ModelName to look up the Pennsieve // instance ID when executing the changes RecordExternalID ExternalInstanceID `json:"record_external_id"` // NodeIDCreates The package node ids that should be linked to this record NodeIDCreates []string `json:"node_id_creates"` // InstanceIDDeletes the proxy instance ids to delete for this record InstanceIDDeletes []PennsieveInstanceID `json:"instance_id_deletes"` }
ProxyRecordChanges holds the changes to the package proxies of one Pennsieve record Creates will use POST /models/datasets/<dataset id>/proxy/package/instances with body
{ "externalId": <package node id>, "targets": [ { "direction": "FromTarget", "linkTarget": { "ConceptInstance": { "id": <record id> } }, "relationshipType": "belongs_to", "relationshipData": [] } ] }
Deletes will use DELETE /models/datasets/<dataset id>/proxy/package/instances/bulk with body
{ "sourceRecordId": <record id>, "proxyInstanceIds": [ <proxy id>, <proxy id> ] }
type RecordChanges ¶
type RecordChanges struct { // A list of RecordIDs to delete Delete []PennsieveInstanceID `json:"delete"` // Create are records that should be created Create []RecordCreate `json:"create"` // Update are records that should be updated Update []RecordUpdate `json:"update"` }
type RecordCreate ¶
type RecordCreate struct { ExternalID ExternalInstanceID `json:"external_id"` RecordValues }
RecordCreate wraps a RecordValues that can be used as a payload for POST /models/datasets/<dataset id>/concepts/<model id>/instances to create a new record. The ExternalID is not part of the payload, but is a non-pennsieve identifier for the record that can be used to map this record to the eventual PennsieveInstanceID needed for links or package proxies
type RecordIDMap ¶
type RecordIDMap struct { ModelName string `json:"model_name"` ExternalToPennsieve map[ExternalInstanceID]PennsieveInstanceID `json:"external_to_pennsieve"` }
func NewRecordIDMap ¶
func NewRecordIDMap(modelName string) RecordIDMap
type RecordUpdate ¶
type RecordUpdate struct { PennsieveID PennsieveInstanceID `json:"pennsieve_id"` RecordValues }
RecordUpdate wraps a RecordValues that can be used as a payload for PUT /models/datasets/<dataset id>/concepts/<model id>/instances/<record id> to update values in record Include both changed and unchanged values The PennsieveID is not part of the payload, but is the record id needed as a request path parameter
type RecordValue ¶
type RecordValues ¶
type RecordValues struct {
Values []RecordValue `json:"values"`
}
type SchemaLinkedPropertyCreate ¶
type SchemaLinkedPropertyCreate struct { // Name is the name of the linked property in the schema of the parent model Name string `json:"name"` // DisplayName is the display name of the linked property in the schema of the parent model DisplayName string `json:"display_name"` // Position is the position of the linked property in the schema of the parent model. (?) Position int `json:"position"` }
SchemaLinkedPropertyCreate will have to be translated to a POST /models/datasets/<dataset id>/concepts/<from model id>/linked/bulk request with body [{"name": Name,"displayName": DisplayName,"to": <to model id>,"position": Position}] once to and from model id values are known. (These models may not exist when instances of this struct are created by clients.)