Find Files

🚧

Preview Release

The PHP SDK is currently a preview release and is not yet generally available. Please contact [email protected](opens in new tab) if you would like early access.

The Find Method

Find Files matching your criteria.

👍

Permissions Required

You must have Find permissions to a matching file for it to be included in the results

FilesPage find(Filter $filter = null, string $pageToken = null, int $pageSize = null)
ParameterTypeDescription
$filterCatalytic\SDK\Search\FilterThe filter criteria to search by, or null to fetch all Files.
$pageTokenstringThe token of the page to fetch
$pageSizeintThe number of Instances to return per page

You can search for matches among the following attributes of the Where class.

NameTypeDescription
textstringFuzzy matches the file Name.
ownerstringSearch for Files created by a specific team member. The email
address of the owner of the Instance must match exactly, apart from casing.
pushbotIdstringFind Files attached to a specific Pushbot
instanceIdstringFind Files attached to a specific Instance
<?php
/*
 * This example demonstrates finding all Files in a specific
 * Instance uploaded by a particular user.
 * This also demonstrates paging through results to collect all
 * matches into a single list.
 */
using Catalytic.Sdk.Entities;
using System.Collections.Generic;

namespace Catalytic.Sdk.Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            var catalytic = new Catalytic.Sdk.Client(Credentials.Default);
            var files = new List<File>();
            var paging = new PagingOptions { Size = 25 };
            while(paging != null)
            {
                var result = catalytic.Instances.Find(
                    Where
                      .InstanceId.Is("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c")
                      .And.Owner.Is("[email protected]"),
                    paging
                );
                files.AddRange(result.Files);
                paging = result.NextPageOptions;
            }
            // files now contains all matching Files
        }
    }
}