-
Notifications
You must be signed in to change notification settings - Fork 91
/
PodComponent.cs
42 lines (33 loc) · 1.22 KB
/
PodComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using System.Collections.Generic;
using PackageUrl;
public class PodComponent : TypedComponent
{
private PodComponent()
{
/* Reserved for deserialization */
}
public PodComponent(string name, string version, string specRepo = "")
{
this.Name = this.ValidateRequiredInput(name, nameof(this.Name), nameof(ComponentType.Pod));
this.Version = this.ValidateRequiredInput(version, nameof(this.Version), nameof(ComponentType.Pod));
this.SpecRepo = specRepo;
}
public string Name { get; set; }
public string Version { get; set; }
public string SpecRepo { get; set; }
public override ComponentType Type => ComponentType.Pod;
public override string Id => $"{this.Name} {this.Version} - {this.Type}";
public override PackageURL PackageUrl
{
get
{
var qualifiers = new SortedDictionary<string, string>();
if (!string.IsNullOrWhiteSpace(this.SpecRepo))
{
qualifiers.Add("repository_url", this.SpecRepo);
}
return new PackageURL("cocoapods", null, this.Name, this.Version, qualifiers, null);
}
}
}