Skip to content

Implement function to get Context Preview when a Piece is selected #94

Description

@shivaypiece

The user should be able to view the contextual information based on the selected snippet.

import * as pieces from '@pieces.app/pieces-os-client';

async function main() {
    const assetsApi = new pieces.AssetsApi();
    const assetApi = new pieces.AssetApi();

    const indicies = await assetsApi.assetsIdentifiersSnapshot({});

    const firstAssetId = indicies.iterable?.[0].id;

    // this should only happen if u got no assets saved
    if (!firstAssetId) return;

    const asset = await assetApi.assetSnapshot({asset: firstAssetId})

    const websites = asset.websites?.iterable;

    const tags = asset.websites?.iterable;

    console.log('WEBSITES!', JSON.stringify(websites, undefined, 2));

    console.log('TAGS!', JSON.stringify(tags, undefined, 2));
}
main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers in the OSP Community.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions