public void AddSubscription(string collectionName, string projectId)
        {
            //TODO: handle error
            var subscription = new SubscriptionRequest(projectId, new Uri("http://localhost:4567/build-event"));
            var uriSuffix    = ($"{collectionName}/_apis/hooks/subscriptions/?api-version=1.0");

            _tfsConnector.SendPost <Object>(uriSuffix, subscription.ToJson());
        }
Example #2
0
        public TfsBuild QueueNewBuild(string collectionName, string projectId, string buildDefinitionId)
        {
            //https://www.visualstudio.com/en-us/docs/integrate/api/build/builds#queueabuild
            var uriSuffix = ($"{collectionName}/{projectId}/_apis/build/builds/?api-version=2.0");
            var body      = $"{{\"definition\": {{ \"id\": {buildDefinitionId}}}}}";
            var build     = _tfsRestConnector.SendPost <TfsBuild>(uriSuffix, body);

            return(build);
        }