Ejemplo n.º 1
0
        /// <summary>
        ///     Gets the work item type categories.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns>Task&lt;IList&lt;JsonCategory&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonWorkItemTypeCategory> > GetWorkItemTypeCategories(string project)
        {
            var exchange = StructuredHttpExchange.Get(WitRestCalls.WorkItemTypeCategories);
            IReadOnlyList <JsonWorkItemTypeCategory> result = await ProcessProjectRequest(project, exchange, o => JsonParsers.ValuesToObjects(o, JsonWorkItemTypeCategory.FromToken));

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Gets the relation types.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;IRelationType&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonRelationType> > GetRelationTypes()
        {
            var exchange = StructuredHttpExchange.Get(WitRestCalls.WorkItemRelationTypes);
            IReadOnlyList <JsonRelationType> result = await ProcessCollectionRequest <IReadOnlyList <JsonRelationType> >(exchange, o => JsonParsers.ValuesToObjects(o, JsonRelationType.FromToken));

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Gets the work item types.
        /// </summary>
        /// <typeparam name="TWorkItemType">The type of the t work item type.</typeparam>
        /// <param name="project">The project.</param>
        /// <param name="fromToken">From token.</param>
        /// <returns>Task&lt;IReadOnlyDictionary&lt;System.String, TWorkItemType&gt;&gt;.</returns>
        public async Task <IReadOnlyDictionary <string, TWorkItemType> > GetWorkItemTypes <TWorkItemType>(string project, Func <JToken, TWorkItemType> fromToken) where TWorkItemType : JsonWorkItemType
        {
            var exchange = StructuredHttpExchange.Get(WitRestCalls.WorkItemTypes);
            IReadOnlyList <TWorkItemType> result = await ProcessProjectRequest(project, exchange, o => JsonParsers.ValuesToObjects(o, fromToken));

            return((IReadOnlyDictionary <string, TWorkItemType>)result.ToDictionary(entry => entry.Name));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the links for work item revision.
        /// </summary>
        /// <typeparam name="TLinkCollection">The type of the t link collection.</typeparam>
        /// <param name="id">The identifier.</param>
        /// <param name="rev">The rev.</param>
        /// <param name="fromToken">From token.</param>
        /// <returns>Task&lt;TLinkCollection&gt;.</returns>
        public async Task <TLinkCollection> GetLinksForWorkItemRevision <TLinkCollection>(int id, int rev, Func <JArray, TLinkCollection> fromToken)
            where TLinkCollection : JsonLinkCollection
        {
            var exchange = StructuredHttpExchange.Get(WitRestCalls.Revision);

            exchange.SetRoute("{id}", id);
            exchange.SetRoute("{revisionNumber}", rev);
            exchange.SetQuery("$expand", "relations");


            TLinkCollection result = await ProcessCollectionRequest(exchange, o =>
            {
                JProperty rootToken = o.Properties().FirstOrDefault(p => p.Name == "relations");
                JArray values;
                if (rootToken != null)
                {
                    values = (JArray)rootToken.Value;
                }
                else
                {
                    values = new JArray();
                }
                TLinkCollection collection = JsonParsers.JArrayToInstance(values, fromToken);
                return(collection);
            });

            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Gets the items.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonVersionControlItem> > GetItems()
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.Items);
            IReadOnlyList <JsonVersionControlItem> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonVersionControlItem.FromToken));

            return(result);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the proxies.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonProxy> > GetProxies()
        {
            StructuredHttpExchange    exchange = StructuredHttpExchange.Get(CoreRestCalls.Proxies);
            IReadOnlyList <JsonProxy> result   = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonProxy.FromToken));

            return(result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the details.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetDetails()
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(CoreRestCalls.ConnectedServices);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Gets the team rooms.
        /// </summary>
        /// <returns>Task&lt;IList&lt;ITeamRoom&gt;&gt;.</returns>
        public async Task <IReadOnlyList <ITeamRoom> > GetTeamRooms()
        {
            var exchange = StructuredHttpExchange.Get("/chat/rooms");
            IReadOnlyList <ITeamRoom> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, TeamRoomImpl.FromToken));

            return(result);
        }
Ejemplo n.º 9
0
        public async Task <IReadOnlyList <TProject> > GetProjects <TProject>(Func <JToken, TProject> fromToken)  where TProject : JsonProject
        {
            var exchange = StructuredHttpExchange.Get("/projects/");
            IReadOnlyList <TProject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, fromToken));

            return(result);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Gets the changesets.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonChangeSet> > GetChangesets()
        {
            StructuredHttpExchange        exchange = StructuredHttpExchange.Get(TfvcRestCalls.Changesets);
            IReadOnlyList <JsonChangeSet> result   = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonChangeSet.FromToken));

            return(result);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Gets the summaries.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetSummaries()
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(CodelensRestCalls.Filesummaries);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///     Gets all project information.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonProjectInfo&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonProjectInfo> > GetAllProjectInfo()
        {
            StructuredHttpExchange          exchange = StructuredHttpExchange.Get(TfvcRestCalls.AllProjectInfo);
            IReadOnlyList <JsonProjectInfo> result   = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonProjectInfo.FromToken));

            return(result);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     Gets the fields.
        /// </summary>
        /// <returns>Task&lt;IList&lt;JsonFieldDefinition&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonFieldDefinition> > GetFieldDefinitions()
        {
            var exchange = StructuredHttpExchange.Get(WitRestCalls.FieldDefinitions);
            IReadOnlyList <JsonFieldDefinition> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonFieldDefinition.FromToken));

            return(result);
        }
Ejemplo n.º 14
0
        public async Task <IReadOnlyList <JsonBuildRequest> > GetRequests(string project)
        {
            StructuredHttpExchange           exchange = StructuredHttpExchange.Get(BuildRestCalls.Requests);
            IReadOnlyList <JsonBuildRequest> result   = await ProcessProjectRequest(project, exchange, o => JsonParsers.ValuesToObjects(o, JsonBuildRequest.FromToken));

            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     Gets the item batch.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetItemBatch()
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.ItemBatch);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 16
0
        public async Task <IReadOnlyList <JsonBuildQuality> > GetQualities(string project)
        {
            StructuredHttpExchange           exchange = StructuredHttpExchange.Get(BuildRestCalls.Qualities);
            IReadOnlyList <JsonBuildQuality> result   = await ProcessProjectRequest(project, exchange, o => JsonParsers.JArrayToObjects(o["value"].Value <JArray>(), JsonBuildQuality.FromToken));

            return(result);
        }
Ejemplo n.º 17
0
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetBacklogs()
        {
            var exchange = StructuredHttpExchange.Get(AgileRestCalls.Backlogs);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Gets the changeset work items.
        /// </summary>
        /// <param name="changeSetId">The change set identifier.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetChangesetWorkItems(int changeSetId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.ChangesetWorkItems);

            exchange.SetRoute("{id}", changeSetId);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 19
0
        public async Task <JsonBuildDefinition> GetDefinition(string project, int definitionId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(BuildRestCalls.Definition);

            exchange.SetRoute("{definitionId}", definitionId);
            JsonBuildDefinition result = await ProcessProjectRequest(project, exchange, JsonBuildDefinition.FromToken);

            return(result);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///     Gets the project teams.
        /// </summary>
        /// <param name="projectId">The project identifier.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonProjectTeam&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonProjectTeam> > GetProjectTeams(Guid projectId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(ProjectRestCalls.ProjectTeams);

            exchange.SetRoute("{projectId}", projectId);
            IReadOnlyList <JsonProjectTeam> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonProjectTeam.FromToken));

            return(result);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Gets the label items.
        /// </summary>
        /// <param name="labelId">The label identifier.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonTfvcLabelItem&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonTfvcLabelItem> > GetLabelItems(int labelId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.LabelItems);

            exchange.SetRoute("{labelId}", labelId);
            IReadOnlyList <JsonTfvcLabelItem> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonTfvcLabelItem.FromToken));

            return(result);
        }
Ejemplo n.º 22
0
        public async Task <JsonBuildQueue> GetQueue(int queueId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(BuildRestCalls.Queue);

            exchange.SetRoute("{queueId}", queueId);
            JsonBuildQueue result = await ProcessCollectionRequest(exchange, JsonBuildQueue.FromToken);

            return(result);
        }
Ejemplo n.º 23
0
        public async Task <JsonBuildQuality> GetQuality(string project, int qualityId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(BuildRestCalls.Quality);

            exchange.SetRoute("{qualityId}", qualityId);
            JsonBuildQuality result = await ProcessProjectRequest(project, exchange, JsonBuildQuality.FromToken);

            return(result);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets the identity MRU.
        /// </summary>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonGeneralPurposeObject&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonGeneralPurposeObject> > GetIdentityMru()
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(CoreRestCalls.IdentityMru);

            exchange.SetRoute("{mruName}", String.Empty);
            IReadOnlyList <JsonGeneralPurposeObject> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonGeneralPurposeObject.FromToken));

            return(result);
        }
Ejemplo n.º 25
0
        /// <summary>
        ///     Gets the project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <returns>Task&lt;JsonProject&gt;.</returns>
        public async Task <JsonProject> GetProject(string projectName)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(ProjectRestCalls.ProjectByName);

            exchange.SetRoute("{projectName}", projectName);
            JsonProject result = await ProcessCollectionRequest(exchange, JsonProject.FromToken);

            return(result);
        }
Ejemplo n.º 26
0
        public async Task <JsonBuild> GetBuild(string project, int buildId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(BuildRestCalls.Build);

            exchange.SetRoute("{buildId}", buildId);
            JsonBuild result = await ProcessProjectRequest(project, exchange, JsonBuild.FromToken);

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Gets the project specific information.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonProjectInfo&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonProjectInfo> > GetProjectSpecificInfo(string project)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.ProjectSpecificInfo);

            exchange.SetRoute("{projectId}", project);
            IReadOnlyList <JsonProjectInfo> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonProjectInfo.FromToken));

            return(result);
        }
Ejemplo n.º 28
0
        public async Task <IReadOnlyList <JsonBuildDetails> > GetBuildDetails(string project, int buildId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(BuildRestCalls.BuildDetails);

            exchange.SetRoute("{buildId}", buildId);
            IReadOnlyList <JsonBuildDetails> result = await ProcessProjectRequest(project, exchange, o => JsonParsers.ValuesToObjects(o, JsonBuildDetails.FromToken));

            return(result);
        }
Ejemplo n.º 29
0
        /// <summary>
        ///     Gets the shelveset work items.
        /// </summary>
        /// <param name="shelvesetId">The shelveset identifier.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonWorkItem&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonWorkItem> > GetShelvesetWorkItems(string shelvesetId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(TfvcRestCalls.ShelvesetWorkItems);

            exchange.SetRoute("{shelvesetId}", shelvesetId);
            IReadOnlyList <JsonWorkItem> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonWorkItem.FromToken));

            return(result);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Gets the users.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <returns>Task&lt;IReadOnlyList&lt;JsonRoomMember&gt;&gt;.</returns>
        public async Task <IReadOnlyList <JsonRoomMember> > GetUsers(string roomId)
        {
            StructuredHttpExchange exchange = StructuredHttpExchange.Get(ChatRestCalls.Users);

            exchange.SetRoute("{roomId}", roomId);
            IReadOnlyList <JsonRoomMember> result = await ProcessCollectionRequest(exchange, o => JsonParsers.ValuesToObjects(o, JsonRoomMember.FromToken));

            return(result);
        }