public static void SetActivities(Pipeline pipeline, PropertyJson propertyJson) { if (pipeline.PipelineProperties?.Activities != null) { List <ActivityJson> activities = new(); foreach (Activity activity in pipeline.PipelineProperties.Activities) { ActivityJson activityJson = new(); activityJson.Name = activity.Name; activityJson.Type = activity.Type.ToString(); SetActivityInputsOutputs(activity, activityJson); SetActivityPolicy(activity, activityJson); SetActivityDependencies(activity, activityJson); SetActivityLinkedServiceReference(activity, activityJson); SetActivityTypeProperties(activity, activityJson); SetActivityInputs(activity, activityJson); SetActivityOutputs(activity, activityJson); activities.Add(activityJson); } propertyJson.Activities = activities; } }
public static void SetVariables(Pipeline pipeline, PropertyJson propertyJson) { if (pipeline.PipelineProperties.Variables != null) { propertyJson.Variables = new List <VariableJson>(); foreach (Variable variable in pipeline.PipelineProperties.Variables) { VariableJson variableJson = new() { Name = variable.Name, Type = variable.Type, DefaultValue = variable.DefaultValue }; propertyJson.Variables.Add(variableJson); } if (propertyJson.Variables.Count == 0) { propertyJson.Variables = null; } } } }
public static PropertiesResultJson Properties(string accountNameKey, List <PropertyModel> propertiesIn, string filter = null) { var propertyJsonOut = new PropertiesResultJson(); propertyJsonOut.properties = new List <PropertyJson>(); foreach (PropertyModel property in propertiesIn) { var propertyJson = new PropertyJson { propertyName = property.PropertyName, propertyNameKey = property.PropertyNameKey, propertyType = property.PropertyTypeNameKey, searchField = property.SearchFieldName }; if (property.PropertyTypeNameKey == "number" && property.Symbol != null) { propertyJson.symbol = new PropertySymbolJson { value = property.Symbol, placement = property.SymbolPlacement }; } if (property.PropertyTypeNameKey == "swatch" && property.Swatches != null) { propertyJson.swatches = new List <PropertySwatchesJson>(); foreach (PropertySwatchModel swatch in property.Swatches) { propertyJson.swatches.Add(new PropertySwatchesJson { label = swatch.PropertySwatchLabel, image = swatch.PropertySwatchImage, imageMedium = swatch.PropertySwatchImageMedium, imageSmall = swatch.PropertySwatchImageSmall }); } } if (filter == "listingsOnly" && property.Listing) { propertyJsonOut.properties.Add(propertyJson); } else if (filter == null) { propertyJsonOut.properties.Add(propertyJson); } } propertyJsonOut.count = propertyJsonOut.properties.Count(); return(propertyJsonOut); }
public static PropertyResultJson Property(string accountNameKey, PropertyModel propertyIn) { var propertyJsonOut = new PropertyResultJson(); propertyJsonOut.property = new PropertyJson(); var propertyJson = new PropertyJson { propertyName = propertyIn.PropertyName, propertyNameKey = propertyIn.PropertyNameKey, propertyType = propertyIn.PropertyTypeNameKey, searchField = propertyIn.SearchFieldName }; if (propertyIn.PropertyTypeNameKey == "number" && propertyIn.Symbol != null) { propertyJson.symbol = new PropertySymbolJson { value = propertyIn.Symbol, placement = propertyIn.SymbolPlacement }; } if (propertyIn.PropertyTypeNameKey == "swatch" && propertyIn.Swatches != null) { propertyJson.swatches = new List <PropertySwatchesJson>(); foreach (PropertySwatchModel swatch in propertyIn.Swatches) { propertyJson.swatches.Add(new PropertySwatchesJson { label = swatch.PropertySwatchLabel, image = swatch.PropertySwatchImage, imageMedium = swatch.PropertySwatchImageMedium, imageSmall = swatch.PropertySwatchImageSmall }); } } propertyJsonOut.property = (propertyJson); return(propertyJsonOut); }
public static void SetParameters(Pipeline pipeline, PropertyJson propertyJson) { if (pipeline.PipelineProperties.Parameters != null) { propertyJson.Parameters = new List <ParameterJson>(); foreach (Parameter parameter in pipeline.PipelineProperties.Parameters) { ParameterJson parameterJson = new() { Name = parameter.Name, Type = parameter.Type }; propertyJson.Parameters.Add(parameterJson); } if (propertyJson.Parameters.Count == 0) { propertyJson.Parameters = null; } } }