Show examples in:
    Update a filter

    Parameters

    name  string  Optional

    The name of the filter

    columns  Array<object>, null  Optional

    The columns to show with this filter

    order_by  string, null  Optional

    The ordering to apply with this filter, or null for the default model ordering. It follows the form of the order_by query parameter of the List all records endpoint.

    shared  boolean  Optional

    Whether it's a shared filter or not

    filter  object  Optional

    The actual filter. It follows the form of the filter query parameter of the List all records endpoint.

    item_type  { type: "item_type", id: item_type.id }  Optional

    Model associated with the filter

    Returns

    Returns a item_type_filter resource object.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const itemTypeFilterId = '34';
    const itemTypeFilter = await client.itemTypeFilters.update(itemTypeFilterId, {
    name: 'Draft posts',
    columns: [
    {
    name: '_preview',
    width: 0.6
    },
    {
    name: 'slug',
    width: 0.1
    },
    {
    name: '_status',
    width: 0.1
    },
    {
    name: '_updated_at',
    width: 0.2
    }
    ],
    order_by: '_updated_at_ASC',
    shared: true,
    filter: {
    query: 'foo bar',
    fields: {
    _status: {
    eq: 'draft'
    },
    title: {
    matches: {
    pattern: 'qux',
    case_sensitive: 'false',
    regexp: 'false'
    }
    }
    }
    },
    item_type: {
    type: 'item_type',
    id: '44'
    }
    });
    console.log(itemTypeFilter);
    }
    run();
    Returned output:
    {
    id: '34',
    name: 'Draft posts',
    filter: {
    query: 'foo bar',
    fields: {
    _status: {
    eq: 'draft'
    },
    title: {
    matches: {
    pattern: 'qux',
    case_sensitive: 'false',
    regexp: 'false'
    }
    }
    }
    },
    columns: [
    {
    name: '_preview',
    width: 0.6
    },
    {
    name: 'slug',
    width: 0.1
    },
    {
    name: '_status',
    width: 0.1
    },
    {
    name: '_updated_at',
    width: 0.2
    }
    ],
    order_by: '_updated_at_ASC',
    shared: true,
    item_type: {
    type: 'item_type',
    id: '44'
    }
    }