namespace PARR.API.Contracts.V1 { // https://tproger.ru/translations/luchshie-praktiki-razrabotki-rest-api-20-sovetov/ //----------URL должен отражать структуру вложенных ресурсов---------- // GET /shops/2/products получить список продуктов из магазина 2. // GET /shops/2/products/31 получить детали продукта 31 из магазина 2. // DELETE /shops/2/products/31 удалить продукт 31 из магазина 2. // PUT /shops/2/products/31 обновить данные о продукте 31. Используйте PUT на URL ресурса, а не коллекции. // POST /shops создать новый магазин и вернуть данные о нём.Используйте POST на URL коллекции. //---------URL должен начинаться с коллекции и заканчиваться идентификатором--------- // GET /shops/:shopId/ или GET /category/:categoryId public static class ApiRoutes { public const string Root = "api"; public const string Version = "v1"; public const string Base = Root + "/" + Version; /// /// Статистика /// public const string BaseStat = Base + "/statistics"; public static class ApiStatus { public const string Version = Base + "/version"; public const string Health = Base + "/health"; public const string Metrics = Base + "/metrics"; } public static class AgentTask { public const string GetByIp = Base + "/agent-tasks/ip"; } //public static class EsppData //{ // public const string UploadTemplates = Base + "/espp-data/templates"; //} public static class Test { public const string GetMyIp = Base + "/tests/my-ip"; public const string GetNextRun = Base + "/tests/next-run"; public const string CreateCache = Base + "/tests/cache/"; } public static class Template { public const string GetAll = Base + "/templates/"; public const string Get = Base + "/templates/" + getParam; public const string ChangeState = Base + "/templates/" + getParam + "/change-state"; //public const string SetOkStatus = Base + "/templates/" + getParam + "/status/ok"; //public const string GetByStatusCode = Base + "/templates/status/{statusCode}"; public const string getParam = "{id}"; } public static class TemplateSyncState { public const string ResetSyncErrors = Base + "/templates/" + getParam + "/reset-sync-errors"; public const string getParam = "{id}"; } public static class TemplateStatusType { public const string GetAll = Base + "/template-status-types/"; } public static class TemplateHistory { public const string GetAll = Base + "/template-histories/"; } public static class TemplateScheduleEspp { public const string Get = Base + "/templates/" + templateId + "/schedule-esppid"; public const string Create = Base + "/templates/" + templateId + "/schedule-esppid"; public const string templateId = "{templateId}"; } public static class Robot { public const string GetAll = Base + "/robots/"; } public static class RobotHistory { public const string GetAll = Base + "/robot-histories/"; public const string Create = Base + "/robot-histories/"; } public static class TaskStatus { public const string GetAll = Base + "/task-statuses/"; } public static class GeneratorTemplate { public const string Create = Base + "/generator-templates/"; } public static class Unit { public const string GetAll = Base + "/units/"; public const string Get = Base + "/units/" + getParam; public const string getParam = "{id}"; } public static class WorkGroup { public const string GetAll = Base + "/work-groups/"; public const string Get = Base + "/work-groups/" + getParam; public const string getParam = "{id}"; } public static class ResponseArea { public const string GetAll = Base + "/response-areas/"; public const string Get = Base + "/response-areas/" + getParam; public const string getParam = "{responseAreaCode}"; } public static class RobotHistoryLevel { public const string GetAll = Base + "/robot-history-levels/"; } public static class RobotTask { public const string GetByRobotAndStatusTask = Base + "/robot-tasks/robots/" + robotCode + "/statuses/" + taskStatusCode; public const string robotCode = "{robotCode}"; public const string taskStatusCode = "{taskStatusCode}"; } public static class RobotTaskRobotStatus { public const string ChangeRobotStatus = Base + "/robot-tasks/" + taskId + "/robot-status"; public const string taskId = "{taskId}"; } public static class AgentHistory { public const string GetAll = Base + "/agent-histories/"; public const string Get = Base + "/agent-histories/" + getParam; public const string Create = Base + "/agent-histories/"; public const string getParam = "{id}"; } #region User public static class User { public const string GetAll = Base + "/users/"; public const string Get = Base + "/users/" + getParam; public const string Delete = Base + "/users/" + getParam; public const string Create = Base + "/users/"; public const string Update = Base + "/users/" + getParam; public const string getParam = "{id}"; } public static class UserRoles { public const string Get = Base + "/users/" + userParam + "/roles/"; public const string AddRole = Base + "/users/" + userParam + "/roles/"; public const string DeleteRole = Base + "/users/" + userParam + "/roles/" + roleParam; public const string userParam = "{userId}"; public const string roleParam = "{roleId}"; } public static class Role { public const string GetAll = Base + "/roles/"; } public static class UserProfile { public const string Get = Base + "/user-profile/"; } #endregion #region Статистика public static class StatRobotTask { public const string Get = BaseStat + "/robot-tasks/"; public const string GetPeriodStatistics = BaseStat + "/robot-tasks/{robot}/period/"; } public static class StatRobotStatus { public const string Get = BaseStat + "/robot-statuses/"; } public static class StatRobotHistory { public const string Get = BaseStat + "/robot-histories/"; } public static class StatTemplate { public const string Get = BaseStat + "/templates/"; public const string GetForPeriod = BaseStat + "/templates/period"; } public static class StatStatusTypeTemplates { public const string Get = BaseStat + "/status-type-templates/"; } public static class StatTemplateAutoControl { public const string GetForPeriod = BaseStat + "/template-auto-controls/"; } public static class StatUnit { public const string Get = BaseStat + "/units/"; public const string GetWithTemplates = BaseStat + "/units/templates"; public const string GetForPeriod = BaseStat + "/units/period"; } public static class StatUnitFieldValues { public const string Get = BaseStat + "/unit-field-values/"; public const string GetForPeriod = BaseStat + "/unit-field-values/period"; } public static class StatOrder { public const string Get = BaseStat + "/orders/"; public const string GetForPeriod = BaseStat + "/orders/period"; public const string TaskToEspp = BaseStat + "/orders/tasks"; public const string Statuses = BaseStat + "/orders/statuses"; public const string GetStatusesLastDay = BaseStat + "/orders/statuses/last-day/{statusCode}"; } public static class StatRobotSnapshot { public const string GetAll = BaseStat + "/robot-snapshots/"; public const string Create = BaseStat + "/robot-snapshots/"; } public static class StatRabbitMq { public const string GetQueueStats = BaseStat + "/rabbitmq-queues/"; public const string GetConnectionStats = BaseStat + "/rabbitmq-connections/"; } public static class StatRobotState { public const string Get = BaseStat + "/robot-states/{robot}"; public const string Send = BaseStat + "/robot-states/"; } public static class StatAuth { public const string Get = BaseStat + "/auth"; } public static class StatTemplateDistribution { public const string Get = BaseStat + "/template-distribution/{jobGroupId}"; } public static class StatResponseAreaWorkLoad { public const string GetAll = BaseStat + "/response-area-workloads/"; public const string GetByResponseAreas = BaseStat + "/response-area-workloads/"; } public static class StatWorkGroupWorkLoad { public const string Get = BaseStat + "/work-group-workloads/{responseAreaCode}"; public const string GetByWorkGroups = BaseStat + "/work-group-workloads/"; } public static class StatWorkWorkLoad { public const string Get = BaseStat + "/work-workloads/{workGroupId}"; public const string GetByApplicationInWork = BaseStat + "/work-workloads/"; } public static class Workload { public const string Build = BaseStat + "/workload/build"; public const string WorkGroup = BaseStat + "/workload/work-groups"; public const string WorkGroupJob = BaseStat + "/workload/work-groups/{workGroup}/jobs"; public const string ResponseArea = BaseStat + "/workload/response-areas"; public const string ResponseAreaWorkGroups = BaseStat + "/workload/response-areas/{responseArea}/work-groups"; public const string ReportInfo = BaseStat + "/workload/report-info"; } public static class StatWorkloadTemplate { public const string GetWorkloadTemplateReport = BaseStat + "/workload/templates/{reportType}/{filter}/{state}/{date}"; } #endregion #region Наряды public static class Order { public const string GetAll = Base + "/orders/"; public const string Get = Base + "/orders/" + getParam; public const string getParam = "{id}"; } #endregion #region TNK public static class Process { public const string GetAll = Base + "/processes/"; public const string Get = Base + "/processes/" + getParam; public const string GetSubprcesses = Base + "/processes/" + getParam + "/subprocesses"; public const string Delete = Base + "/processes/" + getParam; public const string Create = Base + "/processes/"; public const string Update = Base + "/processes/" + getParam; public const string getParam = "{id}"; } public static class Subprocess { public const string GetAll = Base + "/subprocesses/"; public const string Get = Base + "/subprocesses/" + getParam; public const string GetTnks = Base + "/subprocesses/" + getParam + "/tnks"; public const string Delete = Base + "/subprocesses/" + getParam; public const string Create = Base + "/subprocesses/"; public const string Update = Base + "/subprocesses/" + getParam; public const string getParam = "{id}"; } public static class Tnk { public const string GetAll = Base + "/tnks/"; public const string Get = Base + "/tnks/" + getParam; public const string GetJobs = Base + "/tnks/" + getParam + "/jobs"; public const string Delete = Base + "/tnks/" + getParam; public const string Create = Base + "/tnks/"; public const string Update = Base + "/tnks/" + getParam; public const string getParam = "{id}"; } //public static class Work //{ // public const string GetAll = Base + "/works/"; // public const string Get = Base + "/works/" + getParam; // public const string Delete = Base + "/works/" + getParam; // public const string Create = Base + "/works/"; // public const string Update = Base + "/works/" + getParam; // public const string getParam = "{id}"; //} #endregion #region Job /// /// Альтернативная сущность AppliationInWork /// public static class Job { public const string GetAll = Base + "/jobs/"; public const string Get = Base + "/jobs/" + getParam; public const string Delete = Base + "/jobs/" + getParam; public const string Create = Base + "/jobs/"; public const string Update = Base + "/jobs/" + getParam; public const string getParam = "{id}"; } public static class JobGroup { public const string GetAll = Base + "/job-groups/"; public const string Get = Base + "/job-groups/" + getParam; public const string Delete = Base + "/job-groups/" + getParam; public const string Create = Base + "/job-groups/"; public const string Update = Base + "/job-groups/" + getParam; public const string getParam = "{id}"; } public static class JobGroupUpdateNextRun { public const string UpdateNextRun = Base + "/job-groups/" + getParam + "/update-next-run"; public const string getParam = "{jobGroupId}"; } public static class JobGroupType { public const string GetAll = Base + "/job-group-types/"; } public static class JobAutoControl { public const string Get = Base + "/jobs/" + appInWorkId + "/auto-control"; public const string Create = Base + "/jobs/" + appInWorkId + "/auto-control"; public const string Update = Base + "/jobs/" + appInWorkId + "/auto-control"; public const string Delete = Base + "/jobs/" + appInWorkId + "/auto-control"; public const string appInWorkId = "{applicationInWorkId}"; } /// /// Предпросмотр затрагиваемых ЭК для фильтров создаваемой или обновляемой работы /// public static class JobUnitPreview { public const string Preview = Base + "/jobs/units/preview"; } /// /// Активатор/деактиватор шаблонов/расписаний /// public static class TemplateActivator { public const string SendRequest = Base + "/templates/change-state"; //public const string SendRequest = Base + "/jobs/" + jobId + "/template-activator"; //public const string jobId = "{jobId}"; } #endregion public static class Application { public const string GetAll = Base + "/applications/"; } public static class ApplicationType { public const string GetAll = Base + "/application-types/"; } public static class EkStatus { public const string GetAll = Base + "/ek-statuses/"; public const string getParam = "{id}"; } #region UnitField public static class UnitField { public const string GetAll = Base + "/unit-fields/"; public const string Get = Base + "/unit-fields/" + getParam; // todo: этот маршрут нужно вынести в отдельны класс маршрутов public const string GetAllValues = Base + "/unit-fields/" + "{fieldId}" + "/values"; public const string getParam = "{id}"; } #endregion #region Расписание ЕСПП public static class EsppScheduleTypeSchedule { public const string GetAll = Base + "/espp-schedule-type-schedules/"; public const string Get = Base + "/espp-schedule-type-schedules/" + getParam; public const string getParam = "{id}"; } #endregion #region Distributor public static class Distributor { public const string Distribute = Base + "/distributor/"; } public static class DistributionPeriod { public const string GetAll = Base + "/distribution-periods/"; } #endregion #region SyncTask public static class SyncTask { public const string MatchTemplates = Base + "/sync-tasks/match-templates"; //public const string MatchTemplatesForJob = Base + "/sync-tasks/jobs/{jobId}/match-templates"; //public const string MatchTemplatesForJobGroup = Base + "/sync-tasks/job-groups/{jobGroupId}/match-templates"; //public const string MatchTemplatesForTemplate = Base + "/sync-tasks/templates/{templateId}/match-templates"; } #endregion public static class Weekend { public const string GetAll = Base + "/weekends/"; public const string Get = Base + "/weekends/" + getParamDate; public const string Create = Base + "/weekends/"; public const string Delete = Base + "/weekends/" + getParamDate; public const string getParam = "{id}"; public const string getParamDate = "{date}"; } public static class Shortcode { public const string GetAll = Base + "/shortcodes/"; } public static class ShortcodeApply { public const string Apply = Base + "/shortcodes/apply"; } public static class RegionalEkPtkGroup { public const string GetAll = Base + "/regional-ek-ptk-groups/"; } public static class KiiUnit { public const string GetAll = Base + "/kii-units/"; } #region Расписание - исключения public static class ScheduleExcludeType { public const string GetAll = Base + "/schedule-exclude-types/"; } public static class ScheduleExcludeTypeCalendar { public const string GetAll = Base + "/schedule-exclude-type-calendars/"; } #endregion #region Tasks public static class Tasks { public const string GetActiveTasks = Base + "/tasks/active"; } #endregion } }