Mix AND with OR in typescript client

When using the typescript client with AutoQuery endpoint all queries are added as AND. I have seen in docs that I can change default of a specific property to be OR but what I am trying to do is build up queries that use both.

For instance this query I am specifying a name containing “ic” and age over 18:

const client = new JsonServiceClient(environment.apiUrl);

var r = await client.get(request, {
	AgeGreaterThan: 18,
	NameContains: "ic"
});
return r;

What if I wanted to the query to be (name.Contains("ic") AND (Age > 18 || Guardian == true). Is this possible?

So something like:

var r = await client.get(request, {
	OR: [{AgeGreaterThan: 18},{GuardianEqualTo: true}]
	NameContains: "ic"
});

What is simplest way to stack up certain conditions with OR?

You need to annotate your Services with QueryTerm.Or where you want to change the querying behavior, alternatively you can use a property with a custom OR filter.

Generally your APIs should maintain the same behavior and call semantics so you shouldn’t mix and match AND and OR queries within the same Service.

Thanks for the quick reply. I am trying to wrap all AG grid filters to AutoQuery (which match up really nicely) but AG grid supports 2 filters per column and lets user define if it should be AND/OR relationship. The custom filter template is a nice way to handle it but I was hoping to get something generic that let me quickly drop an ag grid onto an AutoQuery endpoint and all the functionality matches up which is kind of hard to do with static properties. I guess it’s not possible.

Is there a DoesNotContain implicit filter? I see Contains in the docs but not the opposite.

As a general rule behavior/features that are not documented do not exist.

OK, fair enough. It just seemed strange that it was left off is all.