Find Instances
Finds Instances matching your criteria.
Permissions Required
Matching Instances will only be included in the results if you have Find permissions to that Instance. Instances that you do not have permissions to will be excluded from the results.
Method Signature
InstancesPage Find(Search.Filter filter = null, PagingOptions pagingOptions = null);
async Task<InstancesPage> FindAsync(Search.Filter filter = null, PagingOptions pagingOptions = null);
Parameters
Parameter | Type | Description |
---|---|---|
filter | Search.Filter | The filter criteria to search by, or null to fetch all Instances. |
pagingOptions | PagingOptions | paging options including Size and PageToken |
returns | InstancesPage | The requested page of Instances |
You can search for matches among the following attributes of the Where
class.
Name | Type | Description |
---|---|---|
Text | string | Fuzzy matches text attributes of an Instance, including Name and Description. |
Owner | string | Search for Instances owned by a specific team member. The email address of the owner of the Instance must match exactly, apart from casing. |
Status | InstanceStatus :- Running - Completed - Cancelled | Find Instances with a specific status |
WorkflowId | Guid | Find Instances of a specific Workflow |
Example
/*
* This example demonstrates finding all Instances of a specific
* Workflow owned by a particular user that are still running.
* 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.CatalyticClient(Credentials.Default);
var instances = new List<Instance>();
var paging = new PagingOptions { Size = 25 };
while(paging != null)
{
var result = catalytic.Instances.Find(
Where
.WorkflowId.Is("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c")
.And.Text.Matches("SDK Example")
.And.Owner.Is("[email protected]")
.And.Status.Is(Status.Running),
paging
);
instances.AddRange(result.Instances);
paging = result.NextPageOptions;
}
// instances now contains all matching Instances
}
}
}
Updated almost 4 years ago