RequestType Enumeration
Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository.Common
Summary
Specifies what a request to the Rule Repository asks for. A host sees it in the message of a RepositoryPermissionException and in the responses it forwards.
Syntax
public enum RequestType
{
None = 0,
// A page of records
GetRecords = 1,
// One record with its detail
GetRecord = 2,
// The options of a dropdown
GetLookup = 3,
// Inserts or updates a record
SaveRecord = 4,
// Deletes a record
DeleteRecord = 5,
// Retired, never answered. The number is not reused
[Obsolete] SaveVersion = 6,
// Retired, never answered. The number is not reused
[Obsolete] RestoreVersion = 7,
// Runs a test
TestRule = 8,
// A connectivity check that does not touch the database
Ping = 9,
// The first request of the client, sent once per page
Init = 10,
// The data for the rule editor of a dialog
GetRuleEditor = 11,
// Makes a version live or takes it offline
SetLive = 12,
// Requests, grants, or declines approval of a rule version
SetApproval = 13,
// Turns a draft into a rule version
ConvertDraft = 14,
// The items of a data source
GetDataSourceItems = 15,
// Evaluation counts per period
GetEvaluationCounts = 16,
// The values that the constructors of a source version's classes set
GetTestStartValues = 17,
// Runs a batch of tests
RunTests = 18,
// One step of an AI Assistant or AI Rule Editor turn
AssistantStep = 19,
// An attachment of an AI Assistant conversation
AssistantFile = 20
}
The repository client and the server exchange these numbers, so they are permanent: a member is never renumbered, and new ones are only added. Your application does not choose these values; the repository client sets them on the request it sends. 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 (ObjectType), 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 Type properties of this type. None marks a response to a request that could not be read.
Ping is answered with "Pong" without touching the database and without a permission check, so it proves that the client, your endpoint, and the repository are connected and nothing more.
SaveVersion and RestoreVersion are marked obsolete. A server never answers them. A new rule version is written by SaveRecord, and an earlier version is put back by making it live with SetLive.
Example
using System;
using CodeEffects.Rule.Repository;
using CodeEffects.Rule.Repository.Common;
// A health check for your endpoint
var ping = new Request { Type = RequestType.Ping, ObjectType = ObjectType.None };
Response pong = Context.GetResponse(config, dbProvider, ping);
Console.WriteLine(pong.Message);