ObjectType Enumeration
Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository.Common
Summary
Specifies the kind of record that a request to the Rule Repository is about. A host sees it in the message of a RepositoryPermissionException and in the responses it forwards.
Syntax
public enum ObjectType
{
None = 0,
// A source object
Source = 1,
// A version of a source object
SourceVersion = 2,
// A rule
Rule = 3,
// A version of a rule
RuleVersion = 4,
// An evaluation
Evaluation = 5,
// An entry of an activity log
Activity = 6,
// A test
Test = 7,
// A working note on another record
Note = 8,
// A rule or rule version that is not finished yet
RuleDraft = 9,
// A source version's saved test values
ValueTemplate = 10,
// An AI Assistant or AI Rule Editor conversation
Conversation = 11
}
The client and the server of the repository exchange these numbers, so they are permanent: a member is never renumbered, and new ones are only added. Your application does not build requests or choose these values; the repository client does. You pass the request through to Context.GetResponse(..) and send back the answer.
The enumeration reaches your code in two ways:
- When the current user's permission set does not allow a request,
Context.GetResponse(..) throws a RepositoryPermissionException. Its message names the request type and the kind of record, for example "the SetLive request for a RuleVersion", which is what you log. The ResponseJson of the exception carries the same two values back to the client.
- The
Request that you may deserialize yourself before you call Context.GetResponse(..), and the Response that comes back, have ObjectType properties of this type. None means the request is not about a kind of record, such as a connectivity check. A request about a Note also names the record the note belongs to in Request.ParentType, which holds one of Source, SourceVersion, Rule, RuleVersion, Test, or RuleDraft.
Example
using System;
using CodeEffects.Rule.Repository;
using CodeEffects.Rule.Repository.Common;
try
{
return Context.GetResponse(config, dbProvider, requestJson);
}
catch(RepositoryPermissionException ex)
{
// "The current user does not have the permission ... which the SetLive request for a RuleVersion needs."
Console.WriteLine($"Denied {ex.Action}: {ex.Message}");
return ex.ResponseJson;
}