From 215974ca4ab038e487343cde12bd8ffd71cb58fc Mon Sep 17 00:00:00 2001 From: Eoin Motherway <25342760+YuKitsune@users.noreply.github.com> Date: Thu, 14 Jul 2022 13:55:10 +1000 Subject: [PATCH] Rename FeedIdOrName to FeedId --- source/.DS_Store | Bin 0 -> 8196 bytes .../HostServices/Model/PackageReference.cs | 35 +++++++++--------- .../Model/PackageReferenceCollection.cs | 10 ----- 3 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 source/.DS_Store diff --git a/source/.DS_Store b/source/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..81205d233926f47857cb6097f1c8b5bbdcedd16a GIT binary patch literal 8196 zcmeHMze@u#6n<${DiskeSX?~+0ipf@dX^RuhYEESv{qDTJ+W349d2@RaB@;`6dc9D zP4tg&cM=@kbn(j%YOeKctsn(oAo)V_z9jFv+=Z7TB9X2ZQ$$H3iXlrJh@|N6<`He0akz&U8uT?PD#p~&gD_NKLJXnl=y#+!&^735)N~S> zPQuJAOoSrT?BF@doP?{9OICmtXjDMP?%gy_8&ss#`uKgg8tg55nM|SN70?=cITv&9 z&-c^y7R4qOTkG}>fe$(jQkM2;2lH=I1uH2amyma8pBB(sL9JrnEQp!ogI0O=nkR31 zFCKFba?LHxS@u4?`6<`-Q{?V2B_${iZ?F7(LD82wL6Zj$M#cvesMxQ|F+g-YxCQ&0y;(2snrji zJnZ}`_WK5En>Yh!)q7D6?th}_HT3w_-uC /// The package-reference name. /// The package ID or a variable-expression - /// The feed ID or a variable-expression + /// The feed ID or a variable-expression /// The location the package should be acquired - public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrName, PackageAcquisitionLocation acquisitionLocation) - : this(name, packageId, feedIdOrName, acquisitionLocation.ToString()) + public PackageReference(string? name, string packageId, FeedId feedId, PackageAcquisitionLocation acquisitionLocation) + : this(name, packageId, feedId, acquisitionLocation.ToString()) { } @@ -40,14 +40,14 @@ public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrNam /// /// The package-reference name. /// The package ID or a variable-expression - /// The feed ID or a variable-expression + /// The feed ID or a variable-expression /// The location the package should be acquired. /// May be one or a variable-expression. - public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrName, string acquisitionLocation) + public PackageReference(string? name, string packageId, FeedId feedId, string acquisitionLocation) : this(null, name, packageId, - feedIdOrName, + feedId, acquisitionLocation) { } @@ -59,14 +59,14 @@ public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrNam public PackageReference(string? id, string? name, string packageId, - FeedIdOrName feedIdOrName, + FeedId feedId, string acquisitionLocation) : this() { if (!string.IsNullOrEmpty(id)) Id = id; PackageId = packageId; - FeedIdOrName = feedIdOrName; + FeedId = feedId; AcquisitionLocation = acquisitionLocation; Name = name ?? string.Empty; } @@ -74,24 +74,24 @@ public PackageReference(string? id, /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName, PackageAcquisitionLocation acquisitionLocation) - : this(null, packageId, feedIdOrName, acquisitionLocation) + public PackageReference(string packageId, FeedId feedId, PackageAcquisitionLocation acquisitionLocation) + : this(null, packageId, feedId, acquisitionLocation) { } /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName, string acquisitionLocation) - : this(null, packageId, feedIdOrName, acquisitionLocation) + public PackageReference(string packageId, FeedId feedId, string acquisitionLocation) + : this(null, packageId, feedId, acquisitionLocation) { } /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName) - : this(packageId, feedIdOrName, PackageAcquisitionLocation.Server) + public PackageReference(string packageId, FeedId feedId) + : this(packageId, feedId, PackageAcquisitionLocation.Server) { } @@ -110,7 +110,7 @@ public PackageReference() { Id = Guid.NewGuid().ToString(); Properties = new Dictionary(); - FeedIdOrName = "feeds-builtin".ToFeedIdOrName(); + FeedId = "feeds-builtin".ToFeedId(); } public string Id { get; } @@ -132,9 +132,8 @@ public PackageReference() /// /// Feed ID, name or a variable-expression /// - [JsonProperty("FeedId")] // This is named FeedId for backward-compatibility as we don't yet want to change the underlying database JSON/schema. [OclName("feed")] - public FeedIdOrName FeedIdOrName { get; set; } + public FeedId FeedId { get; set; } /// /// The package-acquisition location. @@ -160,7 +159,7 @@ public PackageReference Clone() return new PackageReference(Id, Name, PackageId, - FeedIdOrName, + FeedId, AcquisitionLocation) { Properties = new Dictionary(Properties), diff --git a/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs b/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs index e1b0176b..9e09e1e1 100644 --- a/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs +++ b/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs @@ -96,15 +96,5 @@ public IResult TryGetById(string id) { return idMap.ContainsKey(id) ? (IResult)Result.Success(idMap[id]) : Result.Failed("Id not found"); } - - public IResult TryGetByIdOrName(string idOrName) - { - var result = TryGetById(idOrName); - if (result is Result) - return result; - - result = TryGetByName(idOrName); - return result; - } } } \ No newline at end of file