Пример #1
0
 public static Models.UserDefinedFunctionCreate ToUserDefinedFunctionCreate(this UserDefinedFunctionDescription description, Guid spaceId, IEnumerable <string> matcherIds)
 => new Models.UserDefinedFunctionCreate()
 {
     Name     = description.name,
     SpaceId  = spaceId.ToString(),
     Matchers = matcherIds,
 };
Пример #2
0
        private static async Task CreateOrPatchUserDefinedFunction(
            HttpClient httpClient,
            ILogger logger,
            UserDefinedFunctionDescription description,
            string js,
            Guid spaceId,
            IEnumerable <Models.Matcher> matchers)
        {
            var userDefinedFunction = await Api.FindUserDefinedFunction(httpClient, logger, description.name, spaceId);

            if (userDefinedFunction != null)
            {
                await Api.UpdateUserDefinedFunction(
                    httpClient,
                    logger,
                    description.ToUserDefinedFunctionUpdate(userDefinedFunction.Id, spaceId, matchers.Select(m => m.Id)),
                    js);
            }
            else
            {
                await Api.CreateUserDefinedFunction(
                    httpClient,
                    logger,
                    description.ToUserDefinedFunctionCreate(spaceId, matchers.Select(m => m.Id)),
                    js);
            }
        }
Пример #3
0
 public static Models.UserDefinedFunction ToUserDefinedFunction(this UserDefinedFunctionDescription description, string Id, Guid spaceId, IEnumerable <Models.Matcher> matchers)
 => new Models.UserDefinedFunction()
 {
     Id       = Id,
     Name     = description.name,
     SpaceId  = spaceId.ToString(),
     Matchers = matchers,
 };