/// <summary> /// Returns an API Client from the underlying connection /// </summary> /// <param name="scope">The scope from which to retrieve the client. Supported scopes are Server, Collection</param> /// <param name="parameters">If specified, the values in this parameter will override the values originally supplied to the this</param> /// <typeparam name="T">The type of the API client</typeparam> /// <returns>An instance of the requested API client</returns> private protected virtual T GetClient <T>(ClientScope scope = ClientScope.Collection, ParameterDictionary parameters = null) where T : VssHttpClientBase { var pd = new ParameterDictionary(parameters) { ["ConnectionType"] = scope }; return(Provider.GetDataService <Models.Connection>(this, pd).GetItem().GetClient <T>()); }
/// <summary> /// Merges this instance with another one. Only parameters present in the other collection /// that are also missing from this one are merged, i.e conflicting properties are skipped. /// </summary> public void Merge(ParameterDictionary other) { if (other == null || other.Count == 0) { return; } foreach (var kvp in other.Where(kvp => !ContainsKey(kvp.Key))) { Add(kvp.Key, kvp.Value); } }
/// <summary> /// Log the parameters passed to the cmdlet /// </summary> protected void LogParameters() { if (!this.IsVerbose) { return; } var parms = new ParameterDictionary(this); if (parms.ContainsKey("Password") && parms["Password"] != null) { parms["Password"] = "******"; } Log($"Running cmdlet with parameter set '{parms.Get<string>("ParameterSetName")}' and the following arguments:"); Log(JObject.FromObject(parms) .ToString(Formatting.None) .Replace("\":", "\" = ") .Replace(",\"", "; \"") .Trim('{', '}') ); }
/// <summary> /// Returns a tuple containing a "collection" Connectionn, a TeamProject and a WebApiTeam objects, built from the arguments /// currently supplied to this cmdlet /// </summary> /// <param name="parameters">If specified, the values in this parameter will override the values originally supplied to the this</param> /// <returns>A tuple consisting of an instance of Connection (containing either a TfsTeamProjectCollection (Windows) /// or VssConnection (Core) object), an instance of TeamProject and an instance of WebApiTeam</returns> internal virtual (Models.Connection, WebApiTeamProject, WebApiTeam) GetCollectionProjectAndTeam(ParameterDictionary parameters = null) { return(Provider.GetCollectionProjectAndTeam(this, parameters)); }
/// <summary> /// Returns a "collection" Connection object built from the arguments currently supplied to this cmdlet /// </summary> /// <param name="parameters">If specified, the values in this parameter will override the values originally supplied to the this</param> /// <returns>An instance of Connection containing either a TfsTeamProjectCollection (Windows) or VssConnection (Core) object</returns> internal virtual Models.Connection GetCollection(ParameterDictionary parameters = null) { return(Provider.GetCollection(this, parameters)); }