Hi Sebastian,
Currently the Asset Event enrichment looks like this:
{
"id": "123...", // Id of the asset
"actor": { "type": "subject", "id": "123..." }, // Id of the user
"appId": { "name": "my-app", "id": "123..." }, // App name and id
"created": "2018-01-01T12:00:00Z",
"createdBy": "subject:123",
"fileName": "Avatar.png",
"fileSize:": 512000,
"fileVersion": 1,
"isImage": true,
"lastModified": "2018-01-01T12:00:00Z",
"lastModifiedBy": { "type": "subject", "id": "123..." },
"mimeType": "image/png",
"pixelHeight": 600,
"pixelWidth": 800,
"timestamp": "2018-01-01T12:00:00Z",
"type": "Created", // The type of the event.
"user": { // User information
"id": "123...",
"name": "John Doe",
"email": "john@email.com"
},
"version": 1 // Version of the asset, increased with any operation
}
Link to docs: Rules | Squidex
Would it be possible to add url
to this structure? It should look like this:
{
"id": "123...", // Id of the asset
"actor": { "type": "subject", "id": "123..." }, // Id of the user
"appId": { "name": "my-app", "id": "123..." }, // App name and id
"created": "2018-01-01T12:00:00Z",
"createdBy": "subject:123",
"url": "http://localhost:5000/api/assets/my-app/38d92943-4558-49cb-b1d0-b845c6b5e543/" // Add new url property here
"fileName": "Avatar.png",
"fileSize:": 512000,
"fileVersion": 1,
"isImage": true,
"lastModified": "2018-01-01T12:00:00Z",
"lastModifiedBy": { "type": "subject", "id": "123..." },
"mimeType": "image/png",
"pixelHeight": 600,
"pixelWidth": 800,
"timestamp": "2018-01-01T12:00:00Z",
"type": "Created", // The type of the event.
"user": { // User information
"id": "123...",
"name": "John Doe",
"email": "john@email.com"
},
"version": 1 // Version of the asset, increased with any operation
}
The url should look exactly like it does when you run the following GraphQL query (http://localhost:5000/api/assets/my-app/38d92943-4558-49cb-b1d0-b845c6b5e543/
):
{
findAsset(id: "38d92943-4558-49cb-b1d0-b845c6b5e543") {
url
}
}
{
"data": {
"findAsset": {
"url": "http://localhost:5000/api/assets/my-app/38d92943-4558-49cb-b1d0-b845c6b5e543/"
}
},
"extensions": {
"tracing": {
"version": 1,
"startTime": "2024-04-09T16:20:04.00942Z",
"endTime": "2024-04-09T16:20:04.0109231Z",
"duration": 1503100,
"parsing": {
"startOffset": 1000,
"duration": 17700
},
"validation": {
"startOffset": 20000,
"duration": 222100
},
"execution": {
"resolvers": []
}
}
}
}
Then I can use it like this in my Liquid syntax:
// Input
{% for id in event.data.assets.iv %}
{% asset 'ref', id %}
Text: {{ ref.fileName }} {{ ref.id }} {{ ref.url }}
{% endfor %}
// Output
Text: Asset1_FileName Asset1_ID http://localhost:5000/api/assets/my-app/38d92943-4558-49cb-b1d0-b845c6b5e543/
Text: Asset2_FileName Asset2_ID http://localhost:5000/api/assets/my-app/55d92943-4558-49cb-b1d0-b845c6b5e599/
Please let me know if the spec is not clear enough.
Thanks!