Exemplo n.º 1
0
 public void Add(Models.Connection connection)
 {
     lock (_locker)
     {
         _connections.Add(connection);
     }
 }
Exemplo n.º 2
0
        Task <HttpResponseMessage> IRestApiService.InvokeAsync(Models.Connection connection, string path,
                                                               string method,
                                                               string body,
                                                               string requestContentType,
                                                               string responseContentType,
                                                               Dictionary <string, string> additionalHeaders,
                                                               Dictionary <string, string> queryParameters,
                                                               string apiVersion,
                                                               string serviceHostName)
        {
            var conn = connection.InnerConnection;

            path = path.TrimStart('/');

            if (!string.IsNullOrEmpty(serviceHostName))
            {
                if (!serviceHostName.Contains("."))
                {
                    Logger.Log($"Converting service prefix {serviceHostName} to {serviceHostName}.dev.azure.com");
                    serviceHostName += ".dev.azure.com";
                }

                Logger.Log($"Using service host {serviceHostName}");
                GenericHttpClient.UseHost(serviceHostName);
            }

            _client = conn.GetClient <GenericHttpClient>();

            var task = _client.InvokeAsync(new HttpMethod(method), path, body,
                                           requestContentType, responseContentType, additionalHeaders, queryParameters,
                                           apiVersion);

            return(task);
        }
Exemplo n.º 3
0
        private WebApiBoard FindBoard(string workItemType, Models.Connection tpc, WebApiTeamProject tp, WebApiTeam team)
        {
            var boards = GetItems <WebApiBoard>(new
            {
                Board      = "*",
                Team       = team,
                Project    = tp,
                Collection = tpc
            }).ToList();

            foreach (WebApiBoard b in boards)
            {
                var keys = b.AllowedMappings.Values.SelectMany(o => o.Keys).ToList();

                if (keys.Any(t => t.Equals(workItemType, StringComparison.OrdinalIgnoreCase)))
                {
                    return(b);
                }
            }

            throw new Exception("Unable to find a board belonging to team " +
                                $"'{team.Name}' that contains a mapping to the work item type '{workItemType}'");
        }
Exemplo n.º 4
0
 Task <OperationReference> IRestApiService.QueueOperationAsync(
     Models.Connection connection,
     string path,
     string method,
     string body,
     string requestContentType,
     string responseContentType,
     Dictionary <string, string> additionalHeaders,
     Dictionary <string, string> queryParameters,
     string apiVersion,
     string serviceHostName)
 {
     return(((IRestApiService)this).InvokeAsync <OperationReference>(
                connection,
                path,
                method,
                body,
                requestContentType,
                responseContentType,
                additionalHeaders,
                queryParameters,
                apiVersion,
                serviceHostName));
 }
Exemplo n.º 5
0
 protected bool ShouldProcess(Models.Connection target, string action)
 {
     return(Cmdlet.ShouldProcess($"Team Project Collection '{target.DisplayName}'", action));
 }