public static bool GetRecipeFromRecipeSourceURL(string recipeSource, out RecipeInterface recipe) { //var recipeSource = this.Run.Job.Source; var isRecipe = Helper.GetRecipeFromRecipeSourceURL(recipeSource, out var recOwner, out var recName, out var recVersion); if (!isRecipe) { throw new ArgumentException($"Invalid recipe source URL {recipeSource}.\nThe correct formate should be something like:https://api.staging.pollination.cloud/registries/ladybug-tools/recipe/annual-daylight/0.2.0"); } var recApi = new RecipesApi(); recipe = recApi.GetRecipeByTag(recOwner, recName, recVersion).Manifest; return(recipe != null); }
/// <summary> /// Initializes a new instance of the <see cref="Run" /> class. /// </summary> /// <param name="id">The unique ID for this run (required).</param> /// <param name="author">author.</param> /// <param name="owner">owner.</param> /// <param name="recipe">The recipe used to generate this .</param> /// <param name="generation">The generation of this run.</param> /// <param name="status">The status of the run.</param> /// <param name="meta">Extra metadata about the run.</param> public Run ( string id, // Required parameters AccountPublic author = default, AccountPublic owner = default, RecipeInterface recipe = default, double generation = default, RunStatus status = default, RunMeta meta = default // Optional parameters ) : base() // BaseClass { // to ensure "id" is required (not null) this.Id = id ?? throw new ArgumentNullException("id is a required property for Run and cannot be null"); this.Author = author; this.Owner = owner; this.Recipe = recipe; this.Generation = generation; this.Status = status; this.Meta = meta; // Set non-required readonly properties with defaultValue this.Type = "Run"; }
/// <summary> /// Initializes a new instance of the <see cref="CloudJob" /> class. /// </summary> /// <param name="id">The unique ID for this run (required).</param> /// <param name="spec">The job specification (required).</param> /// <param name="author">author.</param> /// <param name="owner">owner.</param> /// <param name="recipe">The recipe used to generate this .</param> /// <param name="status">The status of the job.</param> public CloudJob ( string id, Job spec, // Required parameters AccountPublic author = default, AccountPublic owner = default, RecipeInterface recipe = default, JobStatus status = default // Optional parameters ) : base() // BaseClass { // to ensure "id" is required (not null) this.Id = id ?? throw new ArgumentNullException("id is a required property for CloudJob and cannot be null"); // to ensure "spec" is required (not null) this.Spec = spec ?? throw new ArgumentNullException("spec is a required property for CloudJob and cannot be null"); this.Author = author; this.Owner = owner; this.Recipe = recipe; this.Status = status; // Set non-required readonly properties with defaultValue this.Type = "CloudJob"; }