Hierarchy

Methods

  • Upsert Views

    const viewDefinition = {
    "externalId": "string",
    "space": "string",
    "name": "string",
    "description": "string",
    "filter": {
    "and": []
    },
    "implements": [
    {
    "type": "view",
    "space": "string",
    "externalId": "string",
    "version": "string"
    }
    ],
    "version": "string",
    "properties": {}
    };

    const response = await client.views.upsert([
    viewDefinition
    ]);

    // A view becomes a record view by setting streamId. Do not send usedFor:
    // it is read-only and returned as 'record' when the view is retrieved.
    const recordViewDefinition = {
    "externalId": "my_record_view",
    "space": "my_space",
    "version": "1",
    "streamId": ["my_stream"],
    "properties": {
    "temperature": {
    "container": {
    "type": "container",
    "externalId": "my_record_container",
    "space": "my_space"
    },
    "containerPropertyIdentifier": "temperature"
    }
    }
    };

    const recordResponse = await client.views.upsert([
    recordViewDefinition
    ]);

    Parameters

    Returns Promise<ViewCollectionResponse>

    The streamId of a record view version cannot be changed after it is created; publish a new view version to target another stream. A record view can only be used as a source for records in the stream it targets.