Files
parr_api/PARR.API/Contracts/V1/ApiRoutes.cs

185 lines
6.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Runtime.InteropServices;
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;
/// <summary>
/// Статистика
/// </summary>
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 GetNextScheduleDate = Base + "/tests/next-schedule-date/" + paramApplicationInWorkId + "/" + paramDate;
public const string GetNextSchedule = Base + "/tests/next-schedule/" + paramApplicationInWorkId + "/" + paramDate;
public const string CreateCache = Base + "/tests/cache/";
public const string paramDate = "{lastRunDate}";
public const string paramApplicationInWorkId = "{applicationInWorkId}";
}
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 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 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 Host
{
public const string GetAll = Base + "/hosts/";
}
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 static class StatRobotStatus
{
public const string Get = BaseStat + "/robot-statuses/";
}
#endregion
}
}