public static Models.UserDefinedFunctionCreate ToUserDefinedFunctionCreate(this UserDefinedFunctionDescription description, Guid spaceId, IEnumerable <string> matcherIds) => new Models.UserDefinedFunctionCreate() { Name = description.name, SpaceId = spaceId.ToString(), Matchers = matcherIds, };
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); } }
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, };