diff --git a/src/Sdk/BuildWebApi/Api/AgentTargetExecutionType.cs b/src/Sdk/BuildWebApi/Api/AgentTargetExecutionType.cs deleted file mode 100644 index b2dc96d56..000000000 --- a/src/Sdk/BuildWebApi/Api/AgentTargetExecutionType.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi { - - [GenerateAllConstants] - public static class AgentTargetExecutionType { - public const Int32 Normal = 0; - public const Int32 VariableMultipliers = 1; - public const Int32 MultipleAgents = 2; - } -} diff --git a/src/Sdk/BuildWebApi/Api/ArtifactResourceTypes.cs b/src/Sdk/BuildWebApi/Api/ArtifactResourceTypes.cs index c9480e87f..8da1793cb 100644 --- a/src/Sdk/BuildWebApi/Api/ArtifactResourceTypes.cs +++ b/src/Sdk/BuildWebApi/Api/ArtifactResourceTypes.cs @@ -1,76 +1,14 @@ using System; -using System.ComponentModel; using GitHub.Services.Common; namespace GitHub.Build.WebApi { - [Obsolete("Use ArtifactResourceTypes instead.")] - [EditorBrowsable(EditorBrowsableState.Never)] - public static class WellKnownArtifactResourceTypes - { - public const String FilePath = ArtifactResourceTypes.FilePath; - public const String SymbolStore = ArtifactResourceTypes.SymbolStore; - public const String VersionControl = ArtifactResourceTypes.VersionControl; - public const String Container = ArtifactResourceTypes.Container; - public const String GitRef = ArtifactResourceTypes.GitRef; - public const String TfvcLabel = ArtifactResourceTypes.TfvcLabel; - public const String SymbolRequest = ArtifactResourceTypes.SymbolRequest; - } - - [GenerateAllConstants] public static class ArtifactResourceTypes { - /// - /// UNC or local folder path - /// E.g. \\vscsstor\CIDrops\CloudU.Gated\140317.115955 or file://vscsstor/CIDrops/CloudU.Gated/140317.115955 - /// - public const String FilePath = "FilePath"; - - /// - /// Symbol store UNC path - /// E.g. \\symbolstore - /// - public const String SymbolStore = "SymbolStore"; - - /// - /// TF VC server folder path - /// E.g. $/Dev1/Drops/CloudU.Gated/140317.115955 - /// - public const String VersionControl = "VersionControl"; - /// /// Build container reference /// E.g. #/2121/drop /// public const String Container = "Container"; - - /// - /// Git ref - /// E.g. refs/tags/MyCIDefinition.Buildable - /// - public const String GitRef = "GitRef"; - - /// - /// TFVC label - /// - public const String TfvcLabel = "TfvcLabel"; - - /// - /// Symbol store URL - /// E.g. https://mseng.artifacts.visualstudio.com/... - /// - public const String SymbolRequest = "SymbolRequest"; - - /// - /// Dedup Drop (old name fo PipelineArtifact) - /// E.g. drop1 - /// - public const String Drop = "Drop"; - - /// - /// Dedup'ed pipeline artifact - /// E.g. artifact1 - /// - public const String PipelineArtifact = "PipelineArtifact"; } } diff --git a/src/Sdk/BuildWebApi/Api/BuildDefinitionExtensions.cs b/src/Sdk/BuildWebApi/Api/BuildDefinitionExtensions.cs deleted file mode 100644 index 756d38922..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildDefinitionExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - public static class BuildDefinitionExtensions - { - public static T GetProcess( - this BuildDefinition definition) where T : BuildProcess - { - ArgumentUtility.CheckForNull(definition, nameof(definition)); - ArgumentUtility.CheckForNull(definition.Process, nameof(definition.Process)); - ArgumentUtility.CheckType(definition.Process, nameof(definition.Process), nameof(T)); - - return definition.Process as T; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildDefinitionHelpers.cs b/src/Sdk/BuildWebApi/Api/BuildDefinitionHelpers.cs deleted file mode 100644 index c323b003b..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildDefinitionHelpers.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.IO; -using System.Text; -using GitHub.Build.WebApi.Internals; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - public static class BuildDefinitionHelpers - { - public static BuildDefinition Deserialize( - String definitionString) - { - var definition = JsonUtility.FromString(definitionString); - if (definition?.Process == null) - { - var legacyDefinition = JsonConvert.DeserializeObject(definitionString); - definition = legacyDefinition.ToBuildDefinition(); - } - - return definition; - } - - public static BuildDefinitionTemplate GetTemplateFromStream( - Stream stream) - { - String templateString; - using (var reader = new StreamReader(stream, Encoding.UTF8, false, 1024, true)) - { - templateString = reader.ReadToEnd(); - } - - var template = JsonConvert.DeserializeObject(templateString); - if (template?.Template?.Process == null) - { - var legacyTemplate = JsonConvert.DeserializeObject(templateString); - template = legacyTemplate.ToBuildDefinitionTemplate(); - } - - return template; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildHttpClient.cs b/src/Sdk/BuildWebApi/Api/BuildHttpClient.cs index f5f1f9014..ec76a5dde 100644 --- a/src/Sdk/BuildWebApi/Api/BuildHttpClient.cs +++ b/src/Sdk/BuildWebApi/Api/BuildHttpClient.cs @@ -57,1433 +57,5 @@ namespace GitHub.Build.WebApi : base(baseUrl, pipeline, disposeHandler) { } - - /// - /// [Preview API] Creates a new definition. - /// - /// The definition. - /// - /// - /// - /// The cancellation token to cancel operation. - // this is just a convenient helper that uses the project id from the definition to call the API - public virtual Task CreateDefinitionAsync( - BuildDefinition definition, - Int32? definitionToCloneId = null, - Int32? definitionToCloneRevision = null, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - ArgumentUtility.CheckForNull(definition, "definition"); - ArgumentUtility.CheckForNull(definition.Project, "definition.Project"); - return base.CreateDefinitionAsync(definition, definition.Project.Id, definitionToCloneId, definitionToCloneRevision, userState, cancellationToken); - } - - /// - /// [Preview API] Updates an existing definition. - /// - /// The new version of the defintion. - /// - /// - /// - /// The cancellation token to cancel operation. - // this is just a convenient helper that uses the project id from the definition to call the API - public Task UpdateDefinitionAsync( - BuildDefinition definition, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - return base.UpdateDefinitionAsync(definition, definition.Project.Id, definition.Id, null, null, userState, cancellationToken); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - // this is just a convenient helper that uses the project id from the build to call the API - public virtual Task QueueBuildAsync( - Build build, - Boolean? ignoreWarnings = null, - String checkInTicket = null, - Int32? sourceBuildId = null, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - ArgumentUtility.CheckForNull(build, "build"); - ArgumentUtility.CheckForNull(build.Project, "build.Project"); - return base.QueueBuildAsync(build, build.Project.Id, ignoreWarnings, checkInTicket, sourceBuildId, userState, cancellationToken); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateBuildAsync( - Build build, - bool? retry = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - // the client generator produces methods with projectId and buildId parameters - // since we can get those from the build, they're redundant and potentially ambiguous (who wins?) - // so we generate it with protected access and provide this version that only accepts the Build - ArgumentUtility.CheckForNull(build, "build"); - ArgumentUtility.CheckForNull(build.Project, "build.Project"); - return base.UpdateBuildAsync(build, build.Project.Id, build.Id, retry, userState, cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - return base.GetDefinitionsAsync( - project, - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename, - userState, - cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - return base.GetDefinitionsAsync( - project, - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename, - userState, - cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync2( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync2( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetDefinitionsAsync2(string) instead.")] - public virtual Task> GetDefinitionsAsync2( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetFullDefinitionsAsync(string) instead.")] - public virtual Task> GetFullDefinitionsAsync( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync2( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync2( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetFullDefinitionsAsync2(string) instead.")] - public virtual Task> GetFullDefinitionsAsync2( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true, // includeAllProperties - includeLatestBuilds, - taskIdFilter, - processType, - yamlFilename); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets builds - /// - /// Project ID - /// A comma-delimited list of definition ids - /// A comma-delimited list of queue ids - /// - /// - /// - /// - /// - /// - /// - /// A comma-delimited list of tags - /// A comma-delimited list of properties to include in the results - /// The maximum number of builds to retrieve - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public override Task> GetBuildsAsync( - Guid project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - string repositoryId = null, - string repositoryType = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - object routeValues = new { project = project }; - - List> queryParams = GetBuildsQueryParams( - definitions: definitions, - queues: queues, - buildNumber: buildNumber, - minTime: minFinishTime, - maxTime: maxFinishTime, - requestedFor: requestedFor, - reasonFilter: reasonFilter, - statusFilter: statusFilter, - resultFilter: resultFilter, - tagFilters: tagFilters, - properties: properties, - top: top, - continuationToken: continuationToken, - maxBuildsPerDefinition: maxBuildsPerDefinition, - deletedFilter: deletedFilter, - queryOrder: queryOrder, - branchName: branchName, - buildIds: buildIds, - repositoryId: repositoryId, - repositoryType: repositoryType, - userState: userState, - cancellationToken: cancellationToken); - - return SendAsync>( - httpMethod, - s_getBuildsLocationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - public override Task> GetBuildsAsync( - string project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - string repositoryId = null, - string repositoryType = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - object routeValues = new { project = project }; - - List> queryParams = GetBuildsQueryParams( - definitions: definitions, - queues: queues, - buildNumber: buildNumber, - minTime: minFinishTime, - maxTime: maxFinishTime, - requestedFor: requestedFor, - reasonFilter: reasonFilter, - statusFilter: statusFilter, - resultFilter: resultFilter, - tagFilters: tagFilters, - properties: properties, - top: top, - continuationToken: continuationToken, - maxBuildsPerDefinition: maxBuildsPerDefinition, - deletedFilter: deletedFilter, - queryOrder: queryOrder, - branchName: branchName, - buildIds: buildIds, - repositoryId: repositoryId, - repositoryType: repositoryType, - userState: userState, - cancellationToken: cancellationToken); - - return SendAsync>( - httpMethod, - s_getBuildsLocationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets builds - /// - /// Project ID - /// A comma-delimited list of definition ids - /// A comma-delimited list of queue ids - /// - /// - /// - /// - /// - /// - /// - /// A comma-delimited list of tags - /// A comma-delimited list of properties to include in the results - /// The maximum number of builds to retrieve - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync2( - Guid project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - object routeValues = new { project = project }; - - List> queryParams = GetBuildsQueryParams( - definitions: definitions, - queues: queues, - buildNumber: buildNumber, - minTime: minFinishTime, - maxTime: maxFinishTime, - requestedFor: requestedFor, - reasonFilter: reasonFilter, - statusFilter: statusFilter, - resultFilter: resultFilter, - tagFilters: tagFilters, - properties: properties, - top: top, - continuationToken: continuationToken, - maxBuildsPerDefinition: maxBuildsPerDefinition, - deletedFilter: deletedFilter, - queryOrder: queryOrder, - branchName: branchName, - buildIds: buildIds, - userState: userState, - cancellationToken: cancellationToken); - - return SendAsync>( - httpMethod, - s_getBuildsLocationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - public virtual Task> GetBuildsAsync2( - string project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - object routeValues = new { project = project }; - - List> queryParams = GetBuildsQueryParams( - definitions: definitions, - queues: queues, - buildNumber: buildNumber, - minTime: minFinishTime, - maxTime: maxFinishTime, - requestedFor: requestedFor, - reasonFilter: reasonFilter, - statusFilter: statusFilter, - resultFilter: resultFilter, - tagFilters: tagFilters, - properties: properties, - top: top, - continuationToken: continuationToken, - maxBuildsPerDefinition: maxBuildsPerDefinition, - deletedFilter: deletedFilter, - queryOrder: queryOrder, - branchName: branchName, - buildIds: buildIds, - userState: userState, - cancellationToken: cancellationToken); - - return SendAsync>( - httpMethod, - s_getBuildsLocationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets builds - /// - /// A comma-delimited list of definition ids - /// A comma-delimited list of queue ids - /// - /// - /// - /// - /// - /// - /// - /// A comma-delimited list of tags - /// A comma-delimited list of properties to include in the results - /// The maximum number of builds to retrieve - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync2( - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - - List> queryParams = GetBuildsQueryParams( - definitions: definitions, - queues: queues, - buildNumber: buildNumber, - minTime: minFinishTime, - maxTime: maxFinishTime, - requestedFor: requestedFor, - reasonFilter: reasonFilter, - statusFilter: statusFilter, - resultFilter: resultFilter, - tagFilters: tagFilters, - properties: properties, - top: top, - continuationToken: continuationToken, - maxBuildsPerDefinition: maxBuildsPerDefinition, - deletedFilter: deletedFilter, - queryOrder: queryOrder, - branchName: branchName, - buildIds: buildIds, - userState: userState, - cancellationToken: cancellationToken); - - return SendAsync>( - httpMethod, - s_getBuildsLocationId, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - - /// - /// [Preview API] The changes associated with a build - /// - /// Project ID or project name - /// - /// - /// The maximum number of changes to return - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildChangesAsync2( - string project, - int buildId, - string continuationToken = null, - int? top = null, - bool? includeSourceChange = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54572c7b-bbd3-45d4-80dc-28be08941620"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (includeSourceChange != null) - { - queryParams.Add("includeSourceChange", includeSourceChange.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_ChangesApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList); - } - - /// - /// [Preview API] The changes associated with a build - /// - /// Project ID - /// - /// - /// The maximum number of changes to return - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildChangesAsync2( - Guid project, - int buildId, - string continuationToken = null, - int? top = null, - bool? includeSourceChange = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54572c7b-bbd3-45d4-80dc-28be08941620"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (includeSourceChange != null) - { - queryParams.Add("includeSourceChange", includeSourceChange.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_ChangesApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList); - } - - // this method does a compat check to see whether the server uses "minFinishTime" and "maxFinishTime" vs. "minTime" and "maxTime" - private List> GetBuildsQueryParams( - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minTime = null, - DateTime? maxTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - string repositoryId = null, - string repositoryType = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - List> queryParams = new List>(); - - // default to false to keep the existing behavior - Boolean version4_1IsNotAvailable = true; - - // get latest version available on server - // note we could await here and change all methods to async, however just for this one call, async/await overhead is probably not worth it, reconsider if we have more async calls - ApiResourceLocation location = GetResourceLocationAsync(s_getBuildsLocationId, userState, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); - if (location != null) - { - if (location.MaxVersion >= s_BuildsApiVersion.ApiVersion) - { - // server has client's requested version 4.1 or greater - version4_1IsNotAvailable = false; - } - } - - // in case the server doesn't support 3.x yet - queryParams.Add("type", DefinitionType.Build.ToString()); - - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (!string.IsNullOrEmpty(buildNumber)) - { - queryParams.Add("buildNumber", buildNumber); - } - - if (version4_1IsNotAvailable) - { - if (minTime != null) - { - AddDateTimeToQueryParams(queryParams, "minFinishTime", minTime.Value); - } - if (maxTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxFinishTime", maxTime.Value); - } - } - else - { - if (minTime != null) - { - AddDateTimeToQueryParams(queryParams, "minTime", minTime.Value); - } - if (maxTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxTime", maxTime.Value); - } - } - - if (!string.IsNullOrEmpty(requestedFor)) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (!string.IsNullOrEmpty(branchName)) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - - return queryParams; - } - - private string NormalizeJsonPatchPath(string key) - { - const string JsonPatchPathStartString = "/"; - if (key.StartsWith(JsonPatchPathStartString)) - { - return key; - } - - return string.Format("{0}{1}", JsonPatchPathStartString, key); - } - - private static readonly ApiResourceVersion s_ChangesApiVersion = new ApiResourceVersion("4.1-preview.2"); - private static readonly Guid s_getBuildsLocationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); } } diff --git a/src/Sdk/BuildWebApi/Api/BuildHttpClientCompatBase.cs b/src/Sdk/BuildWebApi/Api/BuildHttpClientCompatBase.cs deleted file mode 100644 index 7b83a7236..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildHttpClientCompatBase.cs +++ /dev/null @@ -1,2463 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using GitHub.Services.Common; -using GitHub.Services.Common.Diagnostics; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - public abstract class BuildHttpClientCompatBase: VssHttpClientBase - { - public BuildHttpClientCompatBase(Uri baseUrl, VssCredentials credentials) - : base(baseUrl, credentials) - { - } - - public BuildHttpClientCompatBase(Uri baseUrl, VssCredentials credentials, VssHttpRequestSettings settings) - : base(baseUrl, credentials, settings) - { - } - - public BuildHttpClientCompatBase(Uri baseUrl, VssCredentials credentials, params DelegatingHandler[] handlers) - : base(baseUrl, credentials, handlers) - { - } - - public BuildHttpClientCompatBase(Uri baseUrl, VssCredentials credentials, VssHttpRequestSettings settings, params DelegatingHandler[] handlers) - : base(baseUrl, credentials, settings, handlers) - { - } - - public BuildHttpClientCompatBase(Uri baseUrl, HttpMessageHandler pipeline, bool disposeHandler) - : base(baseUrl, pipeline, disposeHandler) - { - } - - [Obsolete] - public virtual Task> GetBuildsAsync( - string project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (!string.IsNullOrEmpty(buildNumber)) - { - queryParams.Add("buildNumber", buildNumber); - } - if (minFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "minFinishTime", minFinishTime.Value); - } - if (maxFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxFinishTime", maxFinishTime.Value); - } - if (!string.IsNullOrEmpty(requestedFor)) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (!string.IsNullOrEmpty(branchName)) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// Project ID - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task QueueBuildAsync( - Build build, - Guid project, - bool? ignoreWarnings = null, - string checkInTicket = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (ignoreWarnings != null) - { - queryParams.Add("ignoreWarnings", ignoreWarnings.Value.ToString()); - } - if (!string.IsNullOrEmpty(checkInTicket)) - { - queryParams.Add("checkInTicket", checkInTicket); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.0-preview.4"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task QueueBuildAsync( - Build build, - bool? ignoreWarnings = null, - string checkInTicket = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (ignoreWarnings != null) - { - queryParams.Add("ignoreWarnings", ignoreWarnings.Value.ToString()); - } - if (!string.IsNullOrEmpty(checkInTicket)) - { - queryParams.Add("checkInTicket", checkInTicket); - } - - return SendAsync( - httpMethod, - locationId, - version: new ApiResourceVersion("5.0-preview.4"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// Project ID or project name - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task QueueBuildAsync( - Build build, - string project, - bool? ignoreWarnings = null, - string checkInTicket = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (ignoreWarnings != null) - { - queryParams.Add("ignoreWarnings", ignoreWarnings.Value.ToString()); - } - if (!string.IsNullOrEmpty(checkInTicket)) - { - queryParams.Add("checkInTicket", checkInTicket); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.0-preview.4"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets builds - /// - /// Project ID - /// A comma-delimited list of definition ids - /// A comma-delimited list of queue ids - /// - /// - /// - /// - /// - /// - /// - /// A comma-delimited list of tags - /// A comma-delimited list of properties to include in the results - /// The maximum number of builds to retrieve - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync( - Guid project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (!string.IsNullOrEmpty(buildNumber)) - { - queryParams.Add("buildNumber", buildNumber); - } - if (minFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "minFinishTime", minFinishTime.Value); - } - if (maxFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxFinishTime", maxFinishTime.Value); - } - if (!string.IsNullOrEmpty(requestedFor)) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (!string.IsNullOrEmpty(branchName)) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets builds - /// - /// A comma-delimited list of definition ids - /// A comma-delimited list of queue ids - /// - /// - /// - /// - /// - /// - /// - /// A comma-delimited list of tags - /// A comma-delimited list of properties to include in the results - /// The maximum number of builds to retrieve - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync( - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minFinishTime = null, - DateTime? maxFinishTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - - List> queryParams = new List>(); - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (!string.IsNullOrEmpty(buildNumber)) - { - queryParams.Add("buildNumber", buildNumber); - } - if (minFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "minFinishTime", minFinishTime.Value); - } - if (maxFinishTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxFinishTime", maxFinishTime.Value); - } - if (!string.IsNullOrEmpty(requestedFor)) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (!string.IsNullOrEmpty(branchName)) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - - return SendAsync>( - httpMethod, - locationId, - version: s_BuildsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a definition, optionally at a specific revision - /// - /// Project ID or project name - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionAsync( - string project, - int definitionId, - int? revision = null, - IEnumerable propertyFilters = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - if (propertyFilters != null && propertyFilters.Any()) - { - queryParams.Add("propertyFilters", string.Join(",", propertyFilters)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a definition, optionally at a specific revision - /// - /// Project ID - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionAsync( - Guid project, - int definitionId, - int? revision = null, - IEnumerable propertyFilters = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - if (propertyFilters != null && propertyFilters.Any()) - { - queryParams.Add("propertyFilters", string.Join(",", propertyFilters)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a definition, optionally at a specific revision - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetDefinitionAsync(string, int) instead.")] - public virtual Task GetDefinitionAsync( - int definitionId, - int? revision = null, - IEnumerable propertyFilters = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - if (propertyFilters != null && propertyFilters.Any()) - { - queryParams.Add("propertyFilters", string.Join(",", propertyFilters)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetDefinitionsAsync(string) instead.")] - public virtual Task> GetDefinitionsAsync( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetDefinitionsAsync(string) instead.")] - protected virtual Task> GetDefinitionsAsync( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of definitions. - /// - /// Project ID or project name - /// If specified, filters to definitions whose names match this pattern. - /// A repository ID. If specified, filters to definitions that use this repository. - /// If specified, filters to definitions that have a repository of this type. - /// Indicates the order in which definitions should be returned. - /// The maximum number of definitions to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list that specifies the IDs of definitions to retrieve. - /// If specified, filters to definitions under this folder. - /// If specified, filters to definitions that have builds after this date. - /// If specified, filters to definitions that do not have builds after this date. - /// Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. - /// Indicates whether to return the latest and latest completed builds for this definition. - /// If specified, filters to definitions that use the specified task. - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter != null) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.0-preview.6"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of definitions. - /// - /// Project ID - /// If specified, filters to definitions whose names match this pattern. - /// A repository ID. If specified, filters to definitions that use this repository. - /// If specified, filters to definitions that have a repository of this type. - /// Indicates the order in which definitions should be returned. - /// The maximum number of definitions to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list that specifies the IDs of definitions to retrieve. - /// If specified, filters to definitions under this folder. - /// If specified, filters to definitions that have builds after this date. - /// If specified, filters to definitions that do not have builds after this date. - /// Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. - /// Indicates whether to return the latest and latest completed builds for this definition. - /// If specified, filters to definitions that use the specified task. - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter != null) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.0-preview.6"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of definitions. - /// - /// If specified, filters to definitions whose names match this pattern. - /// A repository ID. If specified, filters to definitions that use this repository. - /// If specified, filters to definitions that have a repository of this type. - /// Indicates the order in which definitions should be returned. - /// The maximum number of definitions to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list that specifies the IDs of definitions to retrieve. - /// If specified, filters to definitions under this folder. - /// If specified, filters to definitions that have builds after this date. - /// If specified, filters to definitions that do not have builds after this date. - /// Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. - /// Indicates whether to return the latest and latest completed builds for this definition. - /// If specified, filters to definitions that use the specified task. - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = new List>(); - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter != null) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - version: new ApiResourceVersion("5.0-preview.6"), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync2( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionsAsync2( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetDefinitionsAsync2(string) instead.")] - public virtual Task> GetDefinitionsAsync2( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - false); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetFullDefinitionsAsync(string) instead.")] - public virtual Task> GetFullDefinitionsAsync( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync2( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// Project ID - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFullDefinitionsAsync2( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Gets definitions, optionally filtered by name - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use GetFullDefinitionsAsync2(string) instead.")] - public virtual Task> GetFullDefinitionsAsync2( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - - List> queryParams = GetDefinitionsQueryParams( - name, - repositoryId, - repositoryType, - queryOrder, - top, - continuationToken, - minMetricsTimeInUtc, - definitionIds, - path, - builtAfter, - notBuiltAfter, - true); - - return SendAsync>( - httpMethod, - locationId, - version: s_DefinitionsApiVersion, - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - processResponse: GetPagedList - ); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use UpdateBuildAsync(Build, bool, object, CancellationToken) instead.")] - public virtual Task UpdateBuildAsync( - Build build, - int buildId, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { buildId = buildId }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.0, 4), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// Project ID or project name - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use UpdateBuildAsync(Build, bool, object, CancellationToken) instead.")] - public virtual Task UpdateBuildAsync( - Build build, - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.0, 4), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// Project ID - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - [Obsolete("Use UpdateBuildAsync(Build, bool, object, CancellationToken) instead.")] - public virtual Task UpdateBuildAsync( - Build build, - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default(CancellationToken)) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.0, 4), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets a list of branches for the given source code repository. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListBranchesAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e05d4403-9b81-4244-8763-20fde28d1976"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.1, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of branches for the given source code repository. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListBranchesAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e05d4403-9b81-4244-8763-20fde28d1976"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.1, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - private protected List> GetDefinitionsQueryParams( - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTimeInUtc = null, - IEnumerable definitionIds = null, - String path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null) - { - List> queryParams = new List>(); - - // in case the server doesn't support 3.x yet - queryParams.Add("type", DefinitionType.Build.ToString()); - - if (!string.IsNullOrEmpty(name)) - { - queryParams.Add("name", name); - } - if (!string.IsNullOrEmpty(repositoryId)) - { - queryParams.Add("repositoryId", repositoryId); - } - if (!string.IsNullOrEmpty(repositoryType)) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(continuationToken)) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTimeInUtc != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTimeInUtc", minMetricsTimeInUtc.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (!string.IsNullOrEmpty(path)) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties ?? false) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds ?? false) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter.HasValue) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - if (processType.HasValue) - { - queryParams.Add("processType", processType.Value.ToString(CultureInfo.InvariantCulture)); - } - if (!string.IsNullOrEmpty(yamlFilename)) - { - queryParams.Add("yamlFilename", yamlFilename); - } - - return queryParams; - } - - private protected async Task> GetPagedList(HttpResponseMessage responseMessage, CancellationToken cancellationToken) - { - var continuationToken = GetContinuationToken(responseMessage); - var list = await ReadContentAsAsync>(responseMessage, cancellationToken).ConfigureAwait(false); - return new PagedList(list, continuationToken); - } - - private protected Task SendAsync( - HttpMethod method, - Guid locationId, - Object routeValues = null, - ApiResourceVersion version = null, - HttpContent content = null, - IEnumerable> queryParameters = null, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken), - Func> processResponse = null) - { - return SendAsync(method, null, locationId, routeValues, version, content, queryParameters, userState, cancellationToken, processResponse); - } - - private protected async Task SendAsync( - HttpMethod method, - IEnumerable> additionalHeaders, - Guid locationId, - Object routeValues = null, - ApiResourceVersion version = null, - HttpContent content = null, - IEnumerable> queryParameters = null, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken), - Func> processResponse = null) - { - using (VssTraceActivity.GetOrCreate().EnterCorrelationScope()) - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync(method, additionalHeaders, locationId, routeValues, version, content, queryParameters, userState, cancellationToken).ConfigureAwait(false)) - { - return await SendAsync(requestMessage, userState, cancellationToken, processResponse).ConfigureAwait(false); - } - } - - private protected async Task SendAsync( - HttpRequestMessage message, - Object userState = null, - CancellationToken cancellationToken = default(CancellationToken), - Func> processResponse = null) - { - if (processResponse == null) - { - processResponse = ReadContentAsAsync; - } - - //ConfigureAwait(false) enables the continuation to be run outside - //any captured SyncronizationContext (such as ASP.NET's) which keeps things - //from deadlocking... - using (HttpResponseMessage response = await this.SendAsync(message, userState, cancellationToken).ConfigureAwait(false)) - { - return await processResponse(response, cancellationToken).ConfigureAwait(false); - } - } - - private protected string GetContinuationToken(HttpResponseMessage responseMessage) - { - string continuationToken = null; - - IEnumerable headerValues = null; - if (responseMessage.Headers.TryGetValues("x-ms-continuationtoken", out headerValues)) - { - continuationToken = headerValues.FirstOrDefault(); - } - - return continuationToken; - } - - protected static readonly ApiResourceVersion s_BuildsApiVersion = new ApiResourceVersion("4.1-preview.3"); - protected static readonly ApiResourceVersion s_DefinitionsApiVersion = new ApiResourceVersion("4.1-preview.6"); - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildIssueKeys.cs b/src/Sdk/BuildWebApi/Api/BuildIssueKeys.cs deleted file mode 100644 index dc9181c70..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildIssueKeys.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - public static class BuildIssueKeys - { - public const String CodeCategory = "code"; - public const String SourcePath = "sourcePath"; - public const String LineNumber = "lineNumber"; - public const String Message = "message"; - } - - [Obsolete("Use BuildIssueKeys instead.")] - public static class WellKnownBuildKeys - { - public const String BuildIssueCodeCategory = BuildIssueKeys.CodeCategory; - public const String BuildIssueFileKey = BuildIssueKeys.SourcePath; - public const String BuildIssueLineNumberKey = BuildIssueKeys.LineNumber; - public const String BuildIssueMessageKey = BuildIssueKeys.Message; - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildOrchestrationType.cs b/src/Sdk/BuildWebApi/Api/BuildOrchestrationType.cs deleted file mode 100644 index ee194908b..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildOrchestrationType.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class BuildOrchestrationType - { - public const Int32 Build = 1; - public const Int32 Cleanup = 2; - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildPermissions.cs b/src/Sdk/BuildWebApi/Api/BuildPermissions.cs deleted file mode 100644 index 1f62c6d60..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildPermissions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - public static class BuildPermissions - { - public static readonly Int32 ViewBuilds = 1; - public static readonly Int32 EditBuildQuality = 2; - public static readonly Int32 RetainIndefinitely = 4; - public static readonly Int32 DeleteBuilds = 8; - public static readonly Int32 ManageBuildQualities = 16; - public static readonly Int32 DestroyBuilds = 32; - public static readonly Int32 UpdateBuildInformation = 64; - public static readonly Int32 QueueBuilds = 128; - public static readonly Int32 ManageBuildQueue = 256; - public static readonly Int32 StopBuilds = 512; - public static readonly Int32 ViewBuildDefinition = 1024; - public static readonly Int32 EditBuildDefinition = 2048; - public static readonly Int32 DeleteBuildDefinition = 4096; - public static readonly Int32 OverrideBuildCheckInValidation = 8192; - public static readonly Int32 AdministerBuildPermissions = 16384; - - public static readonly Int32 AllPermissions = - ViewBuilds | - EditBuildQuality | - RetainIndefinitely | - DeleteBuilds | - ManageBuildQualities | - DestroyBuilds | - UpdateBuildInformation | - QueueBuilds | - ManageBuildQueue | - StopBuilds | - ViewBuildDefinition | - EditBuildDefinition | - DeleteBuildDefinition | - OverrideBuildCheckInValidation | - AdministerBuildPermissions; - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildResourceIds.cs b/src/Sdk/BuildWebApi/Api/BuildResourceIds.cs index 8198272d2..03d01af20 100644 --- a/src/Sdk/BuildWebApi/Api/BuildResourceIds.cs +++ b/src/Sdk/BuildWebApi/Api/BuildResourceIds.cs @@ -1,165 +1,10 @@ using System; -using GitHub.Services.Common; namespace GitHub.Build.WebApi { - [GenerateAllConstants(alternateName: "Build2ResourceIds")] public static class BuildResourceIds { - // keep these sorted - public const String AreaId = "5D6898BB-45EC-463F-95F9-54D49C71752E"; public const String AreaName = "build"; - - public static readonly Guid Artifacts = new Guid("{1DB06C96-014E-44E1-AC91-90B2D4B3E984}"); - public const String ArtifactsResource = "artifacts"; - - public const String AttachmentLocation = "AF5122D3-3438-485E-A25A-2DBBFDE84EE6"; - public static readonly Guid Attachment = new Guid(AttachmentLocation); - - public const String AttachmentsLocation = "F2192269-89FA-4F94-BAF6-8FB128C55159"; - public static readonly Guid Attachments = new Guid(AttachmentsLocation); - public const String AttachmentsResource = "attachments"; - - public static readonly Guid BuildBadge = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003"); - public const String BuildBadgeResource = "buildbadge"; - - public const String BuildChangesLocationId = "54572C7B-BBD3-45D4-80DC-28BE08941620"; - public static readonly Guid BuildChangesBetweenBuilds = new Guid("{F10F0EA5-18A1-43EC-A8FB-2042C7BE9B43}"); - public static readonly Guid BuildChanges = new Guid(BuildChangesLocationId); - public const String BuildChangesResource = "changes"; - - public static readonly Guid BuildDefinitionBadge = new Guid("de6a4df8-22cd-44ee-af2d-39f6aa7a4261"); - public const String BuildDefinitionBadgeResource = "badge"; - - public static readonly Guid BuildDeployments = new Guid("{F275BE9A-556A-4EE9-B72F-F9C8370CCAEE}"); - public const String BuildDeploymentsResource = "deployments"; - - public static readonly Guid BuildLogs = new Guid("{35A80DAF-7F30-45FC-86E8-6B813D9C90DF}"); - public const String BuildLogsResource = "logs"; - - public const String BuildPropertiesLocationString = "0A6312E9-0627-49B7-8083-7D74A64849C9"; - public static readonly Guid BuildProperties = new Guid(BuildPropertiesLocationString); - - public static readonly Guid BuildReport = new Guid("{45BCAA88-67E1-4042-A035-56D3B4A7D44C}"); - public const String BuildReportResource = "report"; - - public static readonly Guid Builds = new Guid("{0CD358E1-9217-4D94-8269-1C1EE6F93DCF}"); - public const String BuildsResource = "builds"; - - public const String BuildTagsLocationIdString = "6E6114B2-8161-44C8-8F6C-C5505782427F"; - public static readonly Guid BuildTags = new Guid(BuildTagsLocationIdString); - public const String BuildTagsResource = "tags"; - - public const String BuildWorkItemsLocationId = "5A21F5D2-5642-47E4-A0BD-1356E6731BEE"; - public static readonly Guid BuildWorkItemsBetweenBuilds = new Guid("{52BA8915-5518-42E3-A4BB-B0182D159E2D}"); - public static readonly Guid BuildWorkItems = new Guid(BuildWorkItemsLocationId); - public const String BuildWorkItemsResource = "workitems"; - - public const String ControllersLocationString = "{FCAC1932-2EE1-437F-9B6F-7F696BE858F6}"; - public static readonly Guid Controllers = new Guid(ControllersLocationString); - public const String ControllersResource = "Controllers"; - - public const String DefinitionMetricsLocationString = "D973B939-0CE0-4FEC-91D8-DA3940FA1827"; - public static readonly Guid DefinitionMetrics = new Guid(DefinitionMetricsLocationString); - public const String DefinitionMetricsResource = "metrics"; - - public const String DefinitionPropertiesLocationString = "D9826AD7-2A68-46A9-A6E9-677698777895"; - public static readonly Guid DefinitionProperties = new Guid(DefinitionPropertiesLocationString); - - public static readonly Guid DefinitionResources = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6"); - public const String DefinitionResourcesResource = "resources"; - - public static readonly Guid DefinitionRevisions = new Guid("{7C116775-52E5-453E-8C5D-914D9762D8C4}"); - public const String DefinitionRevisionsResource = "revisions"; - - public static readonly Guid Definitions = new Guid("{DBEAF647-6167-421A-BDA9-C9327B25E2E6}"); - public const String DefinitionsResource = "definitions"; - - public const String DefinitionTagsLocationIdString = "CB894432-134A-4D31-A839-83BECEAACE4B"; - public static readonly Guid DefinitionTags = new Guid(DefinitionTagsLocationIdString); - - public static readonly Guid Folders = new Guid("{A906531B-D2DA-4F55-BDA7-F3E676CC50D9}"); - public const String FoldersResource = "folders"; - - // information nodes for XAML builds - public static readonly Guid InformationNodes = new Guid("9F094D42-B41C-4920-95AA-597581A79821"); - - public static readonly Guid InputValuesQuery = new Guid("{2182A7F0-B363-4B2D-B89E-ED0A0B721E95}"); - public const String InputValuesQueryResource = "InputValuesQuery"; - - public static readonly Guid LatestBuildLocationId = new Guid("54481611-01F4-47F3-998F-160DA0F0C229"); - public const String LatestBuildResource = "latest"; - - public static readonly Guid Metrics = new Guid("104AD424-B758-4699-97B7-7E7DA427F9C2"); - public const String MetricsResource = "Metrics"; - - public static readonly Guid Options = new Guid("{591CB5A4-2D46-4F3A-A697-5CD42B6BD332}"); - public const String OptionsResource = "options"; - - public const String ProjectMetricsLocationString = "7433FAE7-A6BC-41DC-A6E2-EEF9005CE41A"; - public static readonly Guid ProjectMetrics = new Guid(ProjectMetricsLocationString); - - public static readonly Guid ProjectAuthorizedResources = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef"); - public const String ProjectAuthorizedResourcesResource = "authorizedresources"; - - public const String PropertiesResource = "properties"; - - public static readonly Guid Queues = new Guid("{09F2A4B8-08C9-4991-85C3-D698937568BE}"); - public const String QueuesResource = "queues"; - - public static readonly Guid Settings = new Guid("{AA8C1C9C-EF8B-474A-B8C4-785C7B191D0D}"); - public const String SettingsResource = "settings"; - - public const String SourceProviderBranchesResource = "branches"; - public const String SourceProviderBranchesLocationIdString = "E05D4403-9B81-4244-8763-20FDE28D1976"; - public static readonly Guid SourceProviderBranchesLocationId = new Guid(SourceProviderBranchesLocationIdString); - - public const String SourceProviderFileContentsResource = "fileContents"; - public const String SourceProviderFileContentsLocationIdString = "29D12225-B1D9-425F-B668-6C594A981313"; - public static readonly Guid SourceProviderFileContentsLocationId = new Guid(SourceProviderFileContentsLocationIdString); - - public const String SourceProviderPathContentsResource = "pathContents"; - public const String SourceProviderPathContentsLocationIdString = "7944D6FB-DF01-4709-920A-7A189AA34037"; - public static readonly Guid SourceProviderPathContentsLocationId = new Guid(SourceProviderPathContentsLocationIdString); - - public const String SourceProviderPullRequestsResource = "pullRequests"; - public const String SourceProviderPullRequestsLocationIdString = "D8763EC7-9FF0-4FB4-B2B2-9D757906FF14"; - public static readonly Guid SourceProviderPullRequestsLocationId = new Guid(SourceProviderPullRequestsLocationIdString); - - public const String SourceProviderRepositoriesResource = "repositories"; - public const String SourceProviderRepositoriesLocationIdString = "D44D1680-F978-4834-9B93-8C6E132329C9"; - public static readonly Guid SourceProviderRepositoriesLocationId = new Guid(SourceProviderRepositoriesLocationIdString); - - public const String SourceProviderRestoreWebhooksLocationIdString = "793BCEB8-9736-4030-BD2F-FB3CE6D6B478"; - public static readonly Guid SourceProviderRestoreWebhooksLocationId = new Guid(SourceProviderRestoreWebhooksLocationIdString); - - public const String SourceProvidersResource = "sourceProviders"; - public const String SourceProvidersLocationIdString = "3CE81729-954F-423D-A581-9FEA01D25186"; - public static readonly Guid SourceProviders = new Guid(SourceProvidersLocationIdString); - - public const String SourceProviderWebhooksResource = "webhooks"; - public const String SourceProviderWebhooksLocationIdString = "8F20FF82-9498-4812-9F6E-9C01BDC50E99"; - public static readonly Guid SourceProviderWebhooksLocationId = new Guid(SourceProviderWebhooksLocationIdString); - - public const String SourcesLocationId = "56EFDCDC-CF90-4028-9D2F-D41000682202"; - public static readonly Guid Sources = new Guid(SourcesLocationId); - public const String SourcesResource = "sources"; - - public const String StatusBadgeLocationIdString = "07ACFDCE-4757-4439-B422-DDD13A2FCC10"; - public static readonly Guid StatusBadgeLocationId = new Guid(StatusBadgeLocationIdString); - public const String StatusBadgeResource = "status"; - - public const String TagsLocationIdString = "D84AC5C6-EDC7-43D5-ADC9-1B34BE5DEA09"; - public static readonly Guid Tags = new Guid(TagsLocationIdString); - - public static readonly Guid Templates = new Guid("{E884571E-7F92-4D6A-9274-3F5649900835}"); - public const String TemplatesResource = "templates"; - - public static readonly Guid Timelines = new Guid("8baac422-4c6e-4de5-8532-db96d92acffa"); - public const String TimelinesResource = "Timeline"; - - public static readonly Guid Usage = new Guid("3813d06c-9e36-4ea1-aac3-61a485d60e3d"); - public const String UsageResource = "ResourceUsage"; } } diff --git a/src/Sdk/BuildWebApi/Api/BuildTemplateCategories.cs b/src/Sdk/BuildWebApi/Api/BuildTemplateCategories.cs deleted file mode 100644 index b84871637..000000000 --- a/src/Sdk/BuildWebApi/Api/BuildTemplateCategories.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class BuildTemplateCategories - { - public static readonly String All = "All"; - public static readonly String Build = "Build"; - public static readonly String Utility = "Utility"; - public static readonly String Test = "Test"; - public static readonly String Package = "Package"; - public static readonly String Deploy = "Deploy"; - public static readonly String Tool = "Tool"; - public static readonly String Custom = "Custom"; - - public static readonly String[] AllCategories = new String[] { - All, - Build, - Utility, - Test, - Package, - Deploy, - Tool, - Custom - }; - } -} diff --git a/src/Sdk/BuildWebApi/Api/BuildVariables.cs b/src/Sdk/BuildWebApi/Api/BuildVariables.cs index 0ec79c1c6..fd690b5b4 100644 --- a/src/Sdk/BuildWebApi/Api/BuildVariables.cs +++ b/src/Sdk/BuildWebApi/Api/BuildVariables.cs @@ -1,87 +1,13 @@ using System; -using GitHub.Services.Common; namespace GitHub.Build.WebApi { - /* IMPORTANT NOTE: if you're adding a new build variable that's designed to hold PII data - (e.g. names, addresses, phone numbers, IP addresses, emails), please add a corresponding reference to `PiiVariables` at - https://github.com/Microsoft/azure-pipelines-agent/blob/master/src/Agent.Worker/Variables.cs - This is so the agent can scrub the variable value from the diagnostics log. */ - [GenerateAllConstants] public static class BuildVariables { - public const String CollectionId = "system.collectionId"; - public const String DefinitionId = "system.definitionId"; - public const String HostType = "system.hosttype"; - public const String IsFork = "system.pullRequest.isFork"; - public const String ForkSecretsRemoved= "system.pullRequest.forkSecretsRemoved"; - public const String PullRequestId = "system.pullRequest.pullRequestId"; - public const String PullRequestNumber = "system.pullRequest.pullRequestNumber"; - public const String PullRequestIterationId = "system.pullRequest.pullRequestIteration"; - public const String PullRequestSourceBranch = "system.pullRequest.sourceBranch"; - public const String PullRequestTargetBranch = "system.pullRequest.targetBranch"; - public const String PullRequestSourceRepositoryUri = "system.pullRequest.sourceRepositoryUri"; - public const String PullRequestSourceCommitId = "system.pullRequest.sourceCommitId"; - public const String PullRequestMergedAt = "system.pullRequest.mergedAt"; - public const String System = "system"; - public const String TeamProject = "system.teamProject"; public const String TeamProjectId = "system.teamProjectId"; public const String BuildId = "build.buildId"; public const String BuildNumber = "build.buildNumber"; - public const String BuildUri = "build.buildUri"; public const String ContainerId = "build.containerId"; - public const String DefinitionName = "build.definitionName"; - public const String DefinitionVersion = "build.definitionVersion"; - public const String JobAuthorizeAs = "Job.AuthorizeAs"; - public const String JobAuthorizeAsId = "Job.AuthorizeAsId"; - public const String QueuedBy = "build.queuedBy"; - public const String QueuedById = "build.queuedById"; - public const String Reason = "build.reason"; - public const String RepoUri = "build.repository.uri"; - public const String RequestedFor = "build.requestedFor"; - public const String RequestedForEmail = "build.requestedForEmail"; - public const String RequestedForId = "build.requestedForId"; - public const String SourceBranch = "build.sourceBranch"; - public const String SourceBranchName = "build.sourceBranchName"; - public const String SourceTfvcShelveset = "build.sourceTfvcShelveset"; - public const String SourceVersion = "build.sourceVersion"; - public const String SourceVersionAuthor = "build.sourceVersionAuthor"; - public const String SourceVersionMessage = "build.sourceVersionMessage"; - public const String SyncSources = "build.syncSources"; - } - - [Obsolete("Use BuildVariables instead.")] - public static class WellKnownBuildVariables - { - public const String System = BuildVariables.System; - public const String CollectionId = BuildVariables.CollectionId; - public const String TeamProject = BuildVariables.TeamProject; - public const String TeamProjectId = BuildVariables.TeamProjectId; - public const String DefinitionId = BuildVariables.DefinitionId; - public const String HostType = BuildVariables.HostType; - public const String IsFork = BuildVariables.IsFork; - public const String DefinitionName = BuildVariables.DefinitionName; - public const String DefinitionVersion = BuildVariables.DefinitionVersion; - public const String QueuedBy = BuildVariables.QueuedBy; - public const String QueuedById = BuildVariables.QueuedById; - public const String Reason = BuildVariables.Reason; - public const String RequestedFor = BuildVariables.RequestedFor; - public const String RequestedForId = BuildVariables.RequestedForId; - public const String RequestedForEmail = BuildVariables.RequestedForEmail; - public const String SourceBranch = BuildVariables.SourceBranch; - public const String SourceBranchName = BuildVariables.SourceBranchName; - public const String SourceVersion = BuildVariables.SourceVersion; - public const String SourceVersionAuthor = BuildVariables.SourceVersionAuthor; - public const String SourceVersionMessage = BuildVariables.SourceVersionMessage; - public const String SourceTfvcShelveset = BuildVariables.SourceTfvcShelveset; - public const String BuildId = BuildVariables.BuildId; - public const String BuildUri = BuildVariables.BuildUri; - public const String BuildNumber = BuildVariables.BuildNumber; - public const String ContainerId = BuildVariables.ContainerId; - public const String SyncSources = BuildVariables.SyncSources; - public const String JobAuthorizeAs = BuildVariables.JobAuthorizeAs; - public const String JobAuthorizeAsId = BuildVariables.JobAuthorizeAsId; - public const String RepoUri = BuildVariables.RepoUri; } } diff --git a/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueue.cs b/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueue.cs deleted file mode 100644 index 0385ffaa7..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueue.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.Common; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a queue for running builds. - /// - [DataContract] -#pragma warning disable 618 - public class AgentPoolQueue : ShallowReference, ISecuredObject -#pragma warning restore 618 - { - public AgentPoolQueue() - { - } - - internal AgentPoolQueue( - ISecuredObject securedObject) - { - this.m_securedObject = securedObject; - } - - /// - /// The ID of the queue. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new Int32 Id - { - get - { - return base.Id; - } - set - { - base.Id = value; - } - } - - /// - /// The name of the queue. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new String Name - { - get - { - return base.Name; - } - set - { - base.Name = value; - } - } - - /// - /// The full http link to the resource. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new String Url - { - get - { - return base.Url; - } - set - { - base.Url = value; - } - } - - /// - /// The pool used by this queue. - /// - [DataMember] - public TaskAgentPoolReference Pool - { - get; - set; - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - - #region ISecuredObject implementation - - [IgnoreDataMember] - Guid ISecuredObject.NamespaceId - { - get - { - ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject)); - return m_securedObject.NamespaceId; - } - } - - [IgnoreDataMember] - Int32 ISecuredObject.RequiredPermissions - { - get - { - ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject)); - return m_securedObject.RequiredPermissions; - } - } - - String ISecuredObject.GetToken() - { - ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject)); - return m_securedObject.GetToken(); - } - - private ISecuredObject m_securedObject; - - #endregion - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueueTarget.cs b/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueueTarget.cs deleted file mode 100644 index 01776936f..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/AgentPoolQueueTarget.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Describes how a phase should run against an agent queue. - /// - [DataContract] - public class AgentPoolQueueTarget : PhaseTarget - { - public AgentPoolQueueTarget() - : this(null) - { - } - - internal AgentPoolQueueTarget( - ISecuredObject securedObject) - : base(PhaseTargetType.Agent, securedObject) - { - } - - /// - /// The queue. - /// - [DataMember(EmitDefaultValue = false)] - public AgentPoolQueue Queue - { - get; - set; - } - - /// - /// Agent specification of the target. - /// - [DataMember(EmitDefaultValue = false)] - public AgentSpecification AgentSpecification - { - get; - set; - } - - /// - /// The list of demands required for the queue. - /// - public List Demands - { - get - { - if (m_demands == null) - { - m_demands = new List(); - } - - return m_demands; - } - set - { - m_demands = new List(value); - } - } - - /// - /// The execution options. - /// - [DataMember] - public AgentTargetExecutionOptions ExecutionOptions - { - get; - set; - } - - /// - /// Enables scripts and other processes launched while executing phase to access the OAuth token - /// - [DataMember] - public Boolean AllowScriptsAuthAccessOption - { - get; - set; - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_demands, ref m_serializedDemands); - } - - [DataMember(Name = "Demands", EmitDefaultValue = false)] - private List m_serializedDemands; - - private List m_demands; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/AgentSpecification.cs b/src/Sdk/BuildWebApi/Api/Contracts/AgentSpecification.cs deleted file mode 100644 index 98becf487..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/AgentSpecification.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Specification of the agent defined by the pool provider. - /// - [DataContract] - public class AgentSpecification: BaseSecuredObject - { - public AgentSpecification() - { - } - - public AgentSpecification(ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Agent specification unique identifier. - /// - [DataMember(EmitDefaultValue = false)] - public String Identifier { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptions.cs deleted file mode 100644 index 0c271105b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptions.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Additional options for running phases against an agent queue. - /// - [DataContract] - [KnownType(typeof(MultipleAgentExecutionOptions))] - [KnownType(typeof(VariableMultipliersAgentExecutionOptions))] - [JsonConverter(typeof(AgentTargetExecutionOptionsJsonConverter))] - public class AgentTargetExecutionOptions : BaseSecuredObject - { - public AgentTargetExecutionOptions() - : this(AgentTargetExecutionType.Normal) - { - } - - protected AgentTargetExecutionOptions(Int32 type) - : this(type, null) - { - } - - internal AgentTargetExecutionOptions( - ISecuredObject securedObject) - : this(AgentTargetExecutionType.Normal, securedObject) - { - } - - internal AgentTargetExecutionOptions( - Int32 type, - ISecuredObject securedObject) - : base(securedObject) - { - this.Type = type; - } - - /// - /// Indicates the type of execution options. - /// - [DataMember(EmitDefaultValue = true)] - public Int32 Type - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptionsJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptionsJsonConverter.cs deleted file mode 100644 index 7d416d90a..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/AgentTargetExecutionOptionsJsonConverter.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - internal sealed class AgentTargetExecutionOptionsJsonConverter : TypePropertyJsonConverter - { - protected override AgentTargetExecutionOptions GetInstance(Type objectType) - { - if (objectType == typeof(AgentTargetExecutionType)) - { - return new AgentTargetExecutionOptions(); - } - else if (objectType == typeof(VariableMultipliersAgentExecutionOptions)) - { - return new VariableMultipliersAgentExecutionOptions(); - } - else if (objectType == typeof(MultipleAgentExecutionOptions)) - { - return new MultipleAgentExecutionOptions(); - } - else - { - return base.GetInstance(objectType); - } - } - - protected override AgentTargetExecutionOptions GetInstance(Int32 targetType) - { - switch (targetType) - { - case AgentTargetExecutionType.Normal: - return new AgentTargetExecutionOptions(); - case AgentTargetExecutionType.VariableMultipliers: - return new VariableMultipliersAgentExecutionOptions(); - case AgentTargetExecutionType.MultipleAgents: - return new MultipleAgentExecutionOptions(); - default: - return null; - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/ArtifactResource.cs b/src/Sdk/BuildWebApi/Api/Contracts/ArtifactResource.cs index 550ace133..74b5f427d 100644 --- a/src/Sdk/BuildWebApi/Api/Contracts/ArtifactResource.cs +++ b/src/Sdk/BuildWebApi/Api/Contracts/ArtifactResource.cs @@ -50,46 +50,5 @@ namespace GitHub.Build.WebApi get; set; } - - /// - /// The full http link to the resource. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Url - { - get; - set; - } - - /// - /// A link to download the resource. - /// - /// - /// This might include things like query parameters to download as a zip file. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String DownloadUrl - { - get; - set; - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; } } diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Attachment.cs b/src/Sdk/BuildWebApi/Api/Contracts/Attachment.cs deleted file mode 100644 index d79a726fc..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Attachment.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an attachment to a build. - /// - [DataContract] - public class Attachment : BaseSecuredObject - { - public Attachment() - { - } - - internal Attachment( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The name of the attachment. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Build.cs b/src/Sdk/BuildWebApi/Api/Contracts/Build.cs deleted file mode 100644 index 4b21bd46c..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Build.cs +++ /dev/null @@ -1,605 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Runtime.Serialization; -using GitHub.Core.WebApi; -//using GitHub.Core.WebApi; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Data representation of a build. - /// - [DataContract] - public class Build : ISecuredObject - { - public Build() - { - Reason = BuildReason.Manual; - Priority = QueuePriority.Normal; - } - - #region BuildReference members - // these are also present in BuildReference. ideally this class would inherit from that. - // however, moving them to a base class changes the order in which they are serialized to xml - // which breaks compat with subscribers (like RM) who may not be on the same milestone - // TODO: remove these when we figure out how to version service bus events - - /// - /// The ID of the build. - /// - [DataMember(EmitDefaultValue = false)] - [Key] - public Int32 Id - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The build number/name of the build. - /// - [DataMember(EmitDefaultValue = false)] - public String BuildNumber - { - get; - set; - } - - /// - /// The status of the build. - /// - [DataMember(EmitDefaultValue = false)] - public BuildStatus? Status - { - get; - set; - } - - /// - /// The build result. - /// - [DataMember(EmitDefaultValue = false)] - public BuildResult? Result - { - get; - set; - } - - /// - /// The time that the build was queued. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? QueueTime - { - get; - set; - } - - /// - /// The time that the build was started. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? StartTime - { - get; - set; - } - - /// - /// The time that the build was completed. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? FinishTime - { - get; - set; - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - - #endregion - - /// - /// The REST URL of the build. - /// - [DataMember(EmitDefaultValue = false)] - public String Url - { - get; - set; - } - - /// - /// The definition associated with the build. - /// - [DataMember(EmitDefaultValue = false)] - public DefinitionReference Definition - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The build number revision. - /// - [DataMember(EmitDefaultValue = false)] - public Int32? BuildNumberRevision - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The team project. - /// - [DataMember(EmitDefaultValue = false)] - public TeamProjectReference Project - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The URI of the build. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Uri - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The source branch. - /// - [DataMember(EmitDefaultValue = false)] - public String SourceBranch - { - get; - set; - } - - /// - /// The source version. - /// - [DataMember(EmitDefaultValue = false)] - public String SourceVersion - { - get; - set; - } - - /// - /// The queue. This is only set if the definition type is Build. - /// - [DataMember(EmitDefaultValue = false)] - public AgentPoolQueue Queue - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The agent specification for the build. - /// - [DataMember(EmitDefaultValue = false)] - public AgentSpecification AgentSpecification - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The current position of the build in the queue. - /// - [DataMember(EmitDefaultValue = false)] - public Int32? QueuePosition - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The build's priority. - /// - [DataMember(EmitDefaultValue = false)] - public QueuePriority Priority - { - get; - set; - } - - /// - /// The reason that the build was created. - /// - [DataMember(EmitDefaultValue = false)] - public BuildReason Reason - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The identity on whose behalf the build was queued. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef RequestedFor - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The identity that queued the build. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef RequestedBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The date the build was last changed. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime LastChangedDate - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The identity representing the process or person that last changed the build. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef LastChangedBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The date the build was deleted. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? DeletedDate - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The identity of the process or person that deleted the build. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef DeletedBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The description of how the build was deleted. - /// - [DataMember(EmitDefaultValue = false)] - public String DeletedReason - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The parameters for the build. - /// - [DataMember(EmitDefaultValue = false)] - public String Parameters - { - get; - set; - } - - /// - /// A list of demands that represents the agent capabilities required by this build. - /// - [DataMember(EmitDefaultValue = false)] - public List Demands - { - get; - set; - } - - /// - /// The orchestration plan for the build. - /// - [DataMember(EmitDefaultValue = false)] - public TaskOrchestrationPlanReference OrchestrationPlan - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The list of Orchestration plans associated with the build. - /// - /// - /// The build may have plans in addition to the main plan. For example, the cleanup job may have an orchestration plan associated with it. - /// - public List Plans - { - get - { - if (m_plans == null) - { - m_plans = new List(); - } - - return m_plans; - } - set - { - m_plans = value; - } - } - - /// - /// Information about the build logs. - /// - [DataMember(EmitDefaultValue = false)] - public BuildLogReference Logs - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The repository. - /// - [DataMember(EmitDefaultValue = false)] - public BuildRepository Repository - { - get; - set; - } - - /// - /// Additional options for queueing the build. - /// - [DataMember(EmitDefaultValue = false)] - public QueueOptions QueueOptions - { - get; - set; - } - - /// - /// Indicates whether the build has been deleted. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean Deleted - { - get; - set; - } - - /// - /// A collection of properties which may be used to extend the storage fields available - /// for a given build. - /// - public PropertiesCollection Properties - { - get - { - if (m_properties == null) - { - m_properties = new PropertiesCollection(); - } - return m_properties; - } - internal set - { - m_properties = value; - } - } - - /// - /// A collection of tags associated with the build. - /// - public List Tags - { - get - { - if (m_tags == null) - { - m_tags = new List(); - } - - return m_tags; - } - internal set - { - m_tags = value; - } - } - - /// - /// The list of validation errors and warnings. - /// - public List ValidationResults - { - get - { - if (m_validationResults == null) - { - m_validationResults = new List(); - } - return m_validationResults; - } - } - - /// - /// Indicates whether the build should be skipped by retention policies. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean? KeepForever - { - get; - set; - } - - /// - /// The quality of the xaml build (good, bad, etc.) - /// - /// - /// This is only used for XAML builds. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Quality - { - get; - set; - } - - /// - /// Indicates whether the build is retained by a release. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean? RetainedByRelease - { - get; - set; - } - - /// - /// The build that triggered this build via a Build completion trigger. - /// - [DataMember] - public Build TriggeredByBuild { get; set; } - - /// - /// Trigger-specific information about the build. - /// - public IDictionary TriggerInfo - { - get - { - if (m_triggerInfo == null) - { - m_triggerInfo = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_triggerInfo; - } - internal set - { - if (value != null) - { - m_triggerInfo = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - } - - [DataMember(EmitDefaultValue = false, Name = "Properties")] - private PropertiesCollection m_properties; - - [DataMember(EmitDefaultValue = false, Name = "Tags")] - private List m_tags; - - [DataMember(EmitDefaultValue = false, Name = "ValidationResults")] - private List m_validationResults; - - /// - /// Orchestration plans associated with the build (build, cleanup) - /// - [DataMember(EmitDefaultValue = false, Name = "Plans")] - private List m_plans; - - /// - /// Sourceprovider-specific information about what triggered the build - /// - /// Added in 3.2-preview.3 - [DataMember(EmitDefaultValue = false, Name = "TriggerInfo")] - private Dictionary m_triggerInfo; - - #region ISecuredObject implementation - - Guid ISecuredObject.NamespaceId => Security.BuildNamespaceId; - - Int32 ISecuredObject.RequiredPermissions => BuildPermissions.ViewBuilds; - - String ISecuredObject.GetToken() - { - if (!String.IsNullOrEmpty(m_nestingToken)) - { - return m_nestingToken; - } - - return ((ISecuredObject)this.Definition)?.GetToken(); - } - - internal void SetNestingSecurityToken(String tokenValue) - { - // Spike: investigate imposing restrictions on the amount of information being returned - // when a nesting security token is being used. - m_nestingToken = tokenValue; - } - - private String m_nestingToken = String.Empty; - #endregion - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildBadge.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildBadge.cs deleted file mode 100644 index 411db8786..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildBadge.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a build badge. - /// - [DataContract] - public class BuildBadge - { - public BuildBadge() - { - } - - /// - /// The ID of the build represented by this badge. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 BuildId - { - get; - set; - } - - /// - /// A link to the SVG resource. - /// - [DataMember(EmitDefaultValue = false)] - public String ImageUrl - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinition.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinition.cs deleted file mode 100644 index 6afad54cb..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinition.cs +++ /dev/null @@ -1,365 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.DistributedTask.Common.Contracts; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a build definition. - /// - [DataContract] - public class BuildDefinition : BuildDefinitionReference - { - public BuildDefinition() - { - this.JobAuthorizationScope = BuildAuthorizationScope.ProjectCollection; - } - - /// - /// The build number format. - /// - [DataMember(EmitDefaultValue = false)] - public String BuildNumberFormat - { - get; - set; - } - - /// - /// A save-time comment for the definition. - /// - [DataMember(EmitDefaultValue = false)] - public String Comment - { - get; - set; - } - - /// - /// The description. - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The drop location for the definition. - /// - [DataMember(EmitDefaultValue = false)] - public String DropLocation - { - get; - set; - } - - /// - /// The job authorization scope for builds queued against this definition. - /// - [DataMember] - public BuildAuthorizationScope JobAuthorizationScope - { - get; - set; - } - - /// - /// The job execution timeout (in minutes) for builds queued against this definition. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobTimeoutInMinutes - { - get; - set; - } - - /// - /// The job cancel timeout (in minutes) for builds cancelled by user for this definition. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobCancelTimeoutInMinutes - { - get; - set; - } - - /// - /// Indicates whether badges are enabled for this definition. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean BadgeEnabled - { - get; - set; - } - - /// - /// The list of steps for this definition. - /// - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public List Steps - { - get; - } - - /// - /// The build process. - /// - [DataMember(EmitDefaultValue = false)] - public BuildProcess Process - { - get; - set; - } - - /// - /// A list of build options used by this definition. - /// - public List Options - { - get - { - if (m_options == null) - { - m_options = new List(); - } - - return m_options; - } - internal set - { - m_options = value; - } - } - - /// - /// The repository. - /// - [DataMember(EmitDefaultValue = false)] - public BuildRepository Repository - { - get; - set; - } - - /// - /// The process parameters for this definition. - /// - [DataMember(EmitDefaultValue = false)] - public ProcessParameters ProcessParameters - { - get; - set; - } - - /// - /// The list of triggers for this definition. - /// - public List Triggers - { - get - { - if (m_triggers == null) - { - m_triggers = new List(); - } - - return m_triggers; - } - internal set - { - m_triggers = value; - } - } - - /// - /// The variables used by this definition. - /// - public IDictionary Variables - { - get - { - if (m_variables == null) - { - m_variables = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_variables; - } - internal set - { - m_variables = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - /// - /// The variable groups used by this definition. - /// - public List VariableGroups - { - get - { - if (m_variableGroups == null) - { - m_variableGroups = new List(); - } - - return m_variableGroups; - } - internal set - { - m_variableGroups = value; - } - } - - /// - /// The list of demands that represents the capabilities required by all agents for this definition. - /// - public List Demands - { - get - { - if (m_demands == null) - { - m_demands = new List(); - } - - return m_demands; - } - internal set - { - m_demands = value; - } - } - - /// - /// The list of retention policies for this definition. - /// - public List RetentionRules - { - get - { - if (m_retentionRules == null) - { - m_retentionRules = new List(); - } - - return m_retentionRules; - } - internal set - { - m_retentionRules = value; - } - } - - /// - /// A collection of properties which may be used to extend the storage fields available - /// for a given definition. - /// - public PropertiesCollection Properties - { - get - { - if (m_properties == null) - { - m_properties = new PropertiesCollection(); - } - - return m_properties; - } - internal set - { - m_properties = value; - } - } - - /// - /// A collection of tags associated with the build definition. - /// - public List Tags - { - get - { - if (m_tags == null) - { - m_tags = new List(); - } - - return m_tags; - } - internal set - { - m_tags = value; - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true); - SerializationHelper.Copy(ref m_serializedTriggers, ref m_triggers, true); - SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true); - SerializationHelper.Copy(ref m_serializedVariableGroups, ref m_variableGroups, true); - SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true); - SerializationHelper.Copy(ref m_serializedRetentionRules, ref m_retentionRules, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_options, ref m_serializedOptions); - SerializationHelper.Copy(ref m_triggers, ref m_serializedTriggers); - SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase); - SerializationHelper.Copy(ref m_variableGroups, ref m_serializedVariableGroups); - SerializationHelper.Copy(ref m_demands, ref m_serializedDemands); - SerializationHelper.Copy(ref m_retentionRules, ref m_serializedRetentionRules); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedOptions = null; - m_serializedTriggers = null; - m_serializedVariables = null; - m_serializedVariableGroups = null; - m_serializedRetentionRules = null; - } - - [DataMember(Name = "Options", EmitDefaultValue = false)] - private List m_serializedOptions; - - [DataMember(Name = "Triggers", EmitDefaultValue = false)] - private List m_serializedTriggers; - - [DataMember(Name = "Variables", EmitDefaultValue = false)] - private IDictionary m_serializedVariables; - - [DataMember(Name = "VariableGroups", EmitDefaultValue = false)] - private List m_serializedVariableGroups; - - [DataMember(Name = "Demands", EmitDefaultValue = false)] - private List m_serializedDemands; - - [DataMember(Name = "RetentionRules", EmitDefaultValue = false)] - private List m_serializedRetentionRules; - - [DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Properties")] - private PropertiesCollection m_properties; - - [DataMember(EmitDefaultValue = false, Name = "Tags")] - private List m_tags; - - private List m_demands; - private List m_options; - private List m_triggers; - private List m_retentionRules; - private List m_variableGroups; - private IDictionary m_variables; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionReference.cs deleted file mode 100644 index ca2798a5b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionReference.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a build definition. - /// - [DataContract] - public class BuildDefinitionReference : DefinitionReference - { - public BuildDefinitionReference() - { - Type = DefinitionType.Build; - QueueStatus = DefinitionQueueStatus.Enabled; - } - - /// - /// The quality of the definition document (draft, etc.) - /// - [DataMember(EmitDefaultValue = false, Name = "Quality")] - public DefinitionQuality? DefinitionQuality - { - get; - set; - } - - /// - /// The author of the definition. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef AuthoredBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// A reference to the definition that this definition is a draft of, if this is a draft definition. - /// - [DataMember(EmitDefaultValue = false, Name = "draftOf")] - public DefinitionReference ParentDefinition - { - get; - set; - } - - /// - /// The list of drafts associated with this definition, if this is not a draft definition. - /// - [DataMember(EmitDefaultValue = false)] - public List Drafts - { - get - { - return m_drafts ?? (m_drafts = new List()); - } - internal set - { - m_drafts = value; - } - } - - /// - /// The default queue for builds run against this definition. - /// - [DataMember(EmitDefaultValue = false)] - public AgentPoolQueue Queue - { - get; - set; - } - - /// - /// The metrics for this definition. - /// - public List Metrics - { - get - { - return m_metrics ?? (m_metrics = new List()); - } - internal set - { - m_metrics = value; - } - } - - /// - /// The latest build for this definition. - /// - public Build LatestBuild - { - get - { - return m_latestBuild; - } - internal set - { - m_latestBuild = value; - } - } - - /// - /// The latest completed build for this definition. - /// - public Build LatestCompletedBuild - { - get - { - return m_latestCompletedBuild; - } - internal set - { - m_latestCompletedBuild = value; - } - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links => m_links ?? (m_links = new ReferenceLinks()); - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedMetrics, ref m_metrics, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_metrics, ref m_serializedMetrics); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedMetrics = null; - } - - [DataMember(Name = "Metrics", EmitDefaultValue = false)] - private List m_serializedMetrics; - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - - private List m_metrics; - - private List m_drafts; - - [DataMember(EmitDefaultValue = false, Name = "LatestBuild")] - private Build m_latestBuild; - - [DataMember(EmitDefaultValue = false, Name = "LatestCompletedBuild")] - private Build m_latestCompletedBuild; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionRevision.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionRevision.cs deleted file mode 100644 index b86265961..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionRevision.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a revision of a build definition. - /// - [DataContract] - public class BuildDefinitionRevision - { - /// - /// The revision number. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Revision - { - get; - set; - } - - /// - /// The name of the definition. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The identity of the person or process that changed the definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false, Order = 30)] - public IdentityRef ChangedBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The date and time that the definition was changed. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime ChangedDate - { - get; - set; - } - - /// - /// The change type (add, edit, delete). - /// - [DataMember(EmitDefaultValue = false)] - public AuditAction ChangeType - { - get; - set; - } - - /// - /// The comment associated with the change. - /// - [DataMember(EmitDefaultValue = false)] - public String Comment - { - get; - set; - } - - /// - /// A link to the definition at this revision. - /// - [DataMember(EmitDefaultValue = false)] - public String DefinitionUrl - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionStep.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionStep.cs deleted file mode 100644 index 3231fde46..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionStep.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.Common; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// A reference to a task definition. - /// - [DataContract] - public class TaskDefinitionReference : BaseSecuredObject - { - public TaskDefinitionReference() - { - } - - public TaskDefinitionReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the task. - /// - [DataMember(IsRequired = true)] - public Guid Id - { - get; - set; - } - - /// - /// The version of the task. - /// - [DataMember(IsRequired = true)] - public String VersionSpec - { - get; - set; - } - - /// - /// The type of task (task or task group). - /// - [DataMember(IsRequired = false)] - public String DefinitionType - { - get; - set; - } - - /// - /// A clone of this reference. - /// - /// - public TaskDefinitionReference Clone() - { - return (TaskDefinitionReference)this.MemberwiseClone(); - } - } - - /// - /// Represents a step in a build phase. - /// - [DataContract] - public class BuildDefinitionStep : BaseSecuredObject - { - public BuildDefinitionStep() - { - } - - internal BuildDefinitionStep( - ISecuredObject securedObject) - : base(securedObject) - { - } - - private BuildDefinitionStep(BuildDefinitionStep toClone) - { - ArgumentUtility.CheckForNull(toClone, nameof(toClone)); - - this.Enabled = toClone.Enabled; - this.ContinueOnError = toClone.ContinueOnError; - this.AlwaysRun = toClone.AlwaysRun; - this.DisplayName = toClone.DisplayName; - this.TimeoutInMinutes = toClone.TimeoutInMinutes; - this.Condition = toClone.Condition; - this.RefName = toClone.RefName; - - // Cloning the reference type variables since memberwiseclone does a shallow copy - if (toClone.TaskDefinition != null) - { - this.TaskDefinition = toClone.TaskDefinition.Clone(); - } - - if (toClone.m_inputs != null) - { - foreach (var property in toClone.m_inputs) - { - this.Inputs.Add(property.Key, property.Value); - } - } - - if (toClone.m_environment != null) - { - foreach (var property in toClone.m_environment) - { - this.Environment.Add(property.Key, property.Value); - } - } - } - - /// - /// The task associated with this step. - /// - [DataMember(IsRequired = true, Order = 1, Name = "Task")] - public TaskDefinitionReference TaskDefinition - { - get; - set; - } - - /// - /// The inputs used by this step. - /// - public IDictionary Inputs - { - get - { - if (m_inputs == null) - { - m_inputs = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - return m_inputs; - } - set - { - m_inputs = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - /// - /// Indicates whether the step is enabled. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean Enabled - { - get; - set; - } - - /// - /// Indicates whether the phase should continue even if this step fails. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean ContinueOnError - { - get; - set; - } - - /// - /// Indicates whether this step should run even if a previous step fails. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean AlwaysRun - { - get; - set; - } - - /// - /// The display name for this step. - /// - [DataMember(EmitDefaultValue = false)] - public String DisplayName - { - get; - set; - } - - /// - /// The time, in minutes, that this step is allowed to run. - /// - [DataMember(EmitDefaultValue = true)] - public Int32 TimeoutInMinutes - { - get; - set; - } - - /// - /// A condition that determines whether this step should run. - /// - [DataMember(EmitDefaultValue = false, IsRequired = false)] - public String Condition - { - get; - set; - } - - /// - /// The reference name for this step. - /// - [DataMember(EmitDefaultValue = false)] - public String RefName - { - get; - set; - } - - /// - /// The run-time environment for this step. - /// - public IDictionary Environment - { - get - { - if (m_environment == null) - { - m_environment = new Dictionary(StringComparer.Ordinal); - } - - return m_environment; - } - set - { - m_environment = new Dictionary(value, StringComparer.Ordinal); - } - } - - /// - /// A clone of this step. - /// - /// - public BuildDefinitionStep Clone() - { - return new BuildDefinitionStep(this); - } - - [DataMember(Name = "Environment", EmitDefaultValue = false)] - private Dictionary m_environment; - - [DataMember(Name = "Inputs", EmitDefaultValue = false, Order = 2)] - private Dictionary m_inputs; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionTemplate.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionTemplate.cs deleted file mode 100644 index 7137f663d..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionTemplate.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a template from which new build definitions can be created. - /// - [DataContract] - public class BuildDefinitionTemplate - { - - public BuildDefinitionTemplate() - { - Category = "Custom"; - } - - /// - /// The ID of the template. - /// - [DataMember(IsRequired = true)] - public String Id - { - get; - set; - } - - /// - /// The name of the template. - /// - [DataMember(IsRequired = true)] - public String Name - { - get; - set; - } - - /// - /// Indicates whether the template can be deleted. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean CanDelete - { - get; - set; - } - - /// - /// The template category. - /// - [DataMember(EmitDefaultValue = true)] - public String Category - { - get; - set; - } - - /// - /// An optional hosted agent queue for the template to use by default. - /// - [DataMember(EmitDefaultValue = true)] - public String DefaultHostedQueue - { - get; - set; - } - - /// - /// The ID of the task whose icon is used when showing this template in the UI. - /// - [DataMember(EmitDefaultValue = false)] - public Guid IconTaskId - { - get; - set; - } - - /// - /// A description of the template. - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The actual template. - /// - [DataMember(EmitDefaultValue = false)] - public BuildDefinition Template - { - get; - set; - } - - /// - /// A dictionary of media type strings to icons for this template. - /// - public IDictionary Icons - { - get - { - if (m_icons == null) - { - m_icons = new Dictionary(StringComparer.Ordinal); - } - - return m_icons; - } - internal set - { - m_icons = new Dictionary(value, StringComparer.Ordinal); - } - } - - [DataMember(EmitDefaultValue = false, Name = "Icons")] - private Dictionary m_icons; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionVariable.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionVariable.cs deleted file mode 100644 index 51f35941e..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildDefinitionVariable.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a variable used by a build definition. - /// - [DataContract] - public class BuildDefinitionVariable : BaseSecuredObject - { - public BuildDefinitionVariable() - { - } - - internal BuildDefinitionVariable( - ISecuredObject securedObject) - : base(securedObject) - { - } - - private BuildDefinitionVariable(BuildDefinitionVariable variableToClone) - { - Value = variableToClone.Value; - AllowOverride = variableToClone.AllowOverride; - IsSecret = variableToClone.IsSecret; - } - - /// - /// The value of the variable. - /// - [DataMember(EmitDefaultValue = true)] - public String Value - { - get; - set; - } - - /// - /// Indicates whether the value can be set at queue time. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean AllowOverride - { - get; - set; - } - - /// - /// Indicates whether the variable's value is a secret. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean IsSecret - { - get; - set; - } - - /// - /// A clone of this BuildDefinitionVariable. - /// - /// A new BuildDefinitionVariable - public BuildDefinitionVariable Clone() - { - return new BuildDefinitionVariable(this); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildLog.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildLog.cs deleted file mode 100644 index e8acba1cb..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildLog.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a build log. - /// - [DataContract] - public class BuildLog : BuildLogReference - { - public BuildLog() - { - } - - public BuildLog( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The number of lines in the log. - /// - [DataMember(EmitDefaultValue = false)] - public Int64 LineCount - { - get; - set; - } - - /// - /// The date and time the log was created. - /// - [DataMember] - public DateTime? CreatedOn - { - get; - set; - } - - /// - /// The date and time the log was last changed. - /// - [DataMember] - public DateTime? LastChangedOn - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildLogReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildLogReference.cs deleted file mode 100644 index a169ce688..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildLogReference.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a build log. - /// - [DataContract] - public class BuildLogReference : BaseSecuredObject - { - public BuildLogReference() - { - } - - internal BuildLogReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the log. - /// - // EmitDefaultValue is true to ensure that id = 0 is sent for XAML builds' "ActivityLog.xml" - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public Int32 Id - { - get; - set; - } - - /// - /// The type of the log location. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Type - { - get; - set; - } - - /// - /// A full link to the log resource. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Url - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildMetric.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildMetric.cs deleted file mode 100644 index 031c5554f..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildMetric.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents metadata about builds in the system. - /// - [DataContract] - public class BuildMetric : BaseSecuredObject - { - public BuildMetric() - { - } - - internal BuildMetric( - ISecuredObject securedObject) - :base(securedObject) - { - } - - /// - /// The name of the metric. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The scope. - /// - [DataMember(EmitDefaultValue = false)] - public String Scope - { - get; - set; - } - - /// - /// The value. - /// - [DataMember(EmitDefaultValue = true)] - public Int32 IntValue - { - get; - set; - } - - /// - /// The date for the scope. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? Date - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildOption.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildOption.cs deleted file mode 100644 index 46ea79f36..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildOption.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the application of an optional behavior to a build definition. - /// - [DataContract] - public class BuildOption : BaseSecuredObject - { - public BuildOption() - { - } - - internal BuildOption( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// A reference to the build option. - /// - [DataMember(IsRequired = true, Order = 1, Name = "Definition")] - public virtual BuildOptionDefinitionReference BuildOptionDefinition - { - get; - set; - } - - /// - /// The inputs that configure the behavior. - /// - public virtual IDictionary Inputs - { - get - { - if (m_inputs == null) - { - m_inputs = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_inputs; - } - internal set - { - m_inputs = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - /// - /// Indicates whether the behavior is enabled. - /// - [DataMember(EmitDefaultValue = true)] - public virtual Boolean Enabled - { - get; - set; - } - - [DataMember(Name = "Inputs", EmitDefaultValue = false, Order = 2)] - private Dictionary m_inputs; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinition.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinition.cs deleted file mode 100644 index 7aed376f9..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinition.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an optional behavior that can be applied to a build definition. - /// - [DataContract] - public class BuildOptionDefinition : BuildOptionDefinitionReference - { - public BuildOptionDefinition() - { - } - - internal BuildOptionDefinition( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// A value that indicates the relative order in which the behavior should be applied. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Ordinal - { - get; - set; - } - - /// - /// The name of the build option. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The description. - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The list of inputs defined for the build option. - /// - [DataMember(EmitDefaultValue = false)] - public IList Inputs - { - get - { - if (m_inputs == null) - { - m_inputs = new List(); - } - - return m_inputs; - } - set - { - m_inputs = new List(value); - } - } - - /// - /// The list of input groups defined for the build option. - /// - [DataMember(EmitDefaultValue = false)] - public IList Groups - { - get - { - if (m_groups == null) - { - m_groups = new List(); - } - - return m_groups; - } - set - { - m_groups = new List(value); - } - } - - private List m_inputs; - - private List m_groups; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinitionReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinitionReference.cs deleted file mode 100644 index c443bf619..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionDefinitionReference.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a build option definition. - /// - [DataContract] - public class BuildOptionDefinitionReference : BaseSecuredObject - { - public BuildOptionDefinitionReference() - { - } - - internal BuildOptionDefinitionReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the referenced build option. - /// - [DataMember(IsRequired = true, Order = 1)] - public Guid Id - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionGroupDefinition.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionGroupDefinition.cs deleted file mode 100644 index c0a02b914..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionGroupDefinition.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a group of inputs for a build option. - /// - [DataContract] - public class BuildOptionGroupDefinition : BaseSecuredObject - { - public BuildOptionGroupDefinition() - { - } - - internal BuildOptionGroupDefinition( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The internal name of the group. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The name of the group to display in the UI. - /// - [DataMember(EmitDefaultValue = false)] - public String DisplayName - { - get; - set; - } - - /// - /// Indicates whether the group is initially displayed as expanded in the UI. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean IsExpanded - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionInputDefinition.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionInputDefinition.cs deleted file mode 100644 index 3e6f40ef8..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildOptionInputDefinition.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an input for a build option. - /// - [DataContract] - public class BuildOptionInputDefinition : BaseSecuredObject - { - public BuildOptionInputDefinition() - : this(null) - { - } - - internal BuildOptionInputDefinition( - ISecuredObject securedObject) - : base(securedObject) - { - InputType = BuildOptionInputType.String; - DefaultValue = String.Empty; - Required = false; - } - - /// - /// The name of the input. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The label for the input. - /// - [DataMember(EmitDefaultValue = false)] - public String Label - { - get; - set; - } - - /// - /// The default value. - /// - [DataMember(EmitDefaultValue = false)] - public String DefaultValue - { - get; - set; - } - - /// - /// Indicates whether the input is required to have a value. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean Required - { - get; - set; - } - - /// - /// Indicates the type of the input value. - /// - [DataMember(Name = "Type")] - public BuildOptionInputType InputType - { - get; - set; - } - - /// - /// The rule that is applied to determine whether the input is visible in the UI. - /// - [DataMember(EmitDefaultValue = false)] - public String VisibleRule - { - // Typical format is "NAMEOFTHEDEPENDENTINPUT = VALUETOBEBOUND" - get; - set; - } - - /// - /// The name of the input group that this input belongs to. - /// - [DataMember(EmitDefaultValue = false)] - public String GroupName - { - get; - set; - } - - /// - /// A dictionary of options for this input. - /// - public Dictionary Options - { - get - { - if (m_Options == null) - { - m_Options = new Dictionary(); - } - return m_Options; - } - set - { - m_Options = value; - } - } - - /// - /// A dictionary of help documents for this input. - /// - public Dictionary HelpDocuments - { - get - { - if (m_HelpDocuments == null) - { - m_HelpDocuments = new Dictionary(); - } - - return m_HelpDocuments; - } - set - { - m_HelpDocuments = new Dictionary(value); - } - } - - [DataMember(Name = "Options", EmitDefaultValue = false)] - private Dictionary m_Options; - - [DataMember(Name = "Help", EmitDefaultValue = false)] - private Dictionary m_HelpDocuments; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcess.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildProcess.cs deleted file mode 100644 index f9514e43e..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcess.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a build process. - /// - [DataContract] - [KnownType(typeof(DesignerProcess))] - [KnownType(typeof(YamlProcess))] - [KnownType(typeof(DockerProcess))] - [KnownType(typeof(JustInTimeProcess))] - [JsonConverter(typeof(BuildProcessJsonConverter))] - public class BuildProcess : BaseSecuredObject - { - protected BuildProcess( - Int32 type) - { - } - - protected internal BuildProcess( - Int32 type, - ISecuredObject securedObject) - : base(securedObject) - { - this.Type = type; - } - - /// - /// The type of the process. - /// - /// - /// See for a list of valid process types. - /// - [DataMember(Name = "Type")] - public Int32 Type - { - get; - internal set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessJsonConverter.cs deleted file mode 100644 index 5f951beae..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessJsonConverter.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Newtonsoft.Json.Linq; - -namespace GitHub.Build.WebApi -{ - internal sealed class BuildProcessJsonConverter : TypePropertyJsonConverter - { - protected override BuildProcess GetInstance( - Type objectType) - { - if (objectType == typeof(DesignerProcess)) - { - return new DesignerProcess(); - } - else if (objectType == typeof(YamlProcess)) - { - return new YamlProcess(); - } - else if (objectType == typeof(DockerProcess)) - { - return new DockerProcess(); - } - else if (objectType == typeof(JustInTimeProcess)) - { - return new JustInTimeProcess(); - } - else - { - return base.GetInstance(objectType); - } - } - - protected override BuildProcess GetInstance( - Int32 targetType) - { - switch (targetType) - { - case ProcessType.Yaml: - return new YamlProcess(); - case ProcessType.Docker: - return new DockerProcess(); - case ProcessType.JustInTime: - return new JustInTimeProcess(); - case ProcessType.Designer: - default: - return new DesignerProcess(); - } - } - - protected override Boolean TryInferType( - JObject value, - out Int32 type) - { - // if it has a YamlFilename property, assume it's a YamlProcess - if (value.TryGetValue("yamlFilename", StringComparison.OrdinalIgnoreCase, out JToken yamlFilename)) - { - type = ProcessType.Yaml; - return true; - } - else - { - // default to Designer process - type = ProcessType.Designer; - return true; - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessResources.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessResources.cs deleted file mode 100644 index 6d0a910d6..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildProcessResources.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents resources used by a build process. - /// - [DataContract] - public sealed class BuildProcessResources : BaseSecuredObject - { - public BuildProcessResources() - { - } - - internal BuildProcessResources( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Information about the queues used by the process. - /// - public IList Queues - { - get - { - if (m_queues == null) - { - m_queues = new List(); - } - return m_queues; - } - set - { - m_queues = new List(value); - } - } - - /// - /// Information about the endpoints used by the process. - /// - public IList Endpoints - { - get - { - if (m_endpoints == null) - { - m_endpoints = new List(); - } - return m_endpoints; - } - set - { - m_endpoints = new List(value); - } - } - - /// - /// Information about the secure files used by the process. - /// - public IList Files - { - get - { - if (m_files == null) - { - m_files = new List(); - } - return m_files; - } - set - { - m_files = new List(value); - } - } - - /// - /// Information about the variable groups used by the process. - /// - public IList VariableGroups - { - get - { - if (m_variableGroups == null) - { - m_variableGroups = new List(); - } - return m_variableGroups; - } - set - { - m_variableGroups = new List(value); - } - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - if (m_queues?.Count == 0) - { - m_queues = null; - } - - if (m_endpoints?.Count == 0) - { - m_endpoints = null; - } - - if (m_files?.Count == 0) - { - m_files = null; - } - - if (m_variableGroups?.Count == 0) - { - m_variableGroups = null; - } - } - - [DataMember(Name = "Queues", EmitDefaultValue = false)] - private List m_queues; - - [DataMember(Name = "Endpoints", EmitDefaultValue = false)] - private List m_endpoints; - - [DataMember(Name = "Files", EmitDefaultValue = false)] - private List m_files; - - [DataMember(Name = "VariableGroups", EmitDefaultValue = false)] - private List m_variableGroups; - } - - /// - /// Represents a reference to a resource. - /// - [DataContract] - public abstract class ResourceReference : BaseSecuredObject - { - public ResourceReference() - { - } - - protected ResourceReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// An alias to be used when referencing the resource. - /// - [DataMember(EmitDefaultValue = false)] - public String Alias - { - get; - set; - } - } - - /// - /// Represents a reference to an agent queue. - /// - [DataContract] - public class AgentPoolQueueReference : ResourceReference - { - public AgentPoolQueueReference() - : this(null) - { - } - - internal AgentPoolQueueReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the queue. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Id - { - get; - set; - } - } - - /// - /// Represents a referenec to a service endpoint. - /// - [DataContract] - public class ServiceEndpointReference : ResourceReference - { - public ServiceEndpointReference() - : this(null) - { - } - - internal ServiceEndpointReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the service endpoint. - /// - [DataMember(EmitDefaultValue = false)] - public Guid Id - { - get; - set; - } - } - - /// - /// Represents a reference to a secure file. - /// - [DataContract] - public class SecureFileReference : ResourceReference - { - public SecureFileReference() - : this(null) - { - } - - internal SecureFileReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the secure file. - /// - [DataMember(EmitDefaultValue = false)] - public Guid Id - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildReference.cs deleted file mode 100644 index 18833250b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildReference.cs +++ /dev/null @@ -1,138 +0,0 @@ -using GitHub.Services.WebApi; -using System; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a build. - /// - [DataContract] - public class BuildReference : BaseSecuredObject - { - public BuildReference() - { - } - - internal BuildReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the build. - /// - [DataMember(EmitDefaultValue = false)] - [Key] - public Int32 Id - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// The build number. - /// - [DataMember(EmitDefaultValue = false)] - public String BuildNumber - { - get; - set; - } - - /// - /// The build status. - /// - [DataMember(EmitDefaultValue = false)] - public BuildStatus? Status - { - get; - set; - } - - /// - /// The build result. - /// - [DataMember(EmitDefaultValue = false)] - public BuildResult? Result - { - get; - set; - } - - /// - /// The time that the build was queued. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? QueueTime - { - get; - set; - } - - /// - /// The time that the build was started. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? StartTime - { - get; - set; - } - - /// - /// The time that the build was completed. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? FinishTime - { - get; - set; - } - - /// - /// The identity on whose behalf the build was queued. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef RequestedFor - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// Indicates whether the build has been deleted. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean Deleted - { - get; - set; - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildReportMetadata.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildReportMetadata.cs deleted file mode 100644 index e5467f9be..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildReportMetadata.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents information about a build report. - /// - [DataContract] - public class BuildReportMetadata - { - public BuildReportMetadata() - { - } - - public BuildReportMetadata(Int32 buildId, String type) - { - this.BuildId = buildId; - this.Type = type; - } - - /// - /// The Id of the build. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 BuildId - { - get; - set; - } - - /// - /// The content of the report. - /// - [DataMember(EmitDefaultValue = false)] - public String Content - { - get; - set; - } - - /// - /// The type of the report. - /// - /// - /// See for a list of supported report types. - /// - [DataMember(EmitDefaultValue = false)] - public String Type - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildRepository.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildRepository.cs deleted file mode 100644 index be2f2af5c..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildRepository.cs +++ /dev/null @@ -1,185 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a repository used by a build definition. - /// - [DataContract] - public class BuildRepository : BaseSecuredObject - { - public BuildRepository() - { - } - - internal BuildRepository( - ISecuredObject securedObject) - : base(securedObject) - { - } - - private BuildRepository( - BuildRepository toClone) - : base(toClone) - { - this.Id = toClone.Id; - this.Type = toClone.Type; - this.Name = toClone.Name; - this.Url = toClone.Url; - this.DefaultBranch = toClone.DefaultBranch; - this.RootFolder = toClone.RootFolder; - this.Clean = toClone.Clean; - this.CheckoutSubmodules = toClone.CheckoutSubmodules; - - if (toClone.m_properties != null) - { - foreach (var property in toClone.m_properties) - { - this.Properties.Add(property.Key, property.Value); - } - } - } - - /// - /// The ID of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Id - { - get; - set; - } - - /// - /// The type of the repository. - /// - [DataMember] - public String Type - { - get; - set; - } - - /// - /// The friendly name of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The URL of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Url - { - get; - set; - } - - /// - /// The name of the default branch. - /// - [DataMember(EmitDefaultValue = false)] - public String DefaultBranch - { - get; - set; - } - - /// - /// The root folder. - /// - [DataMember(EmitDefaultValue = false)] - public String RootFolder - { - get; - set; - } - - /// - /// Indicates whether to clean the target folder when getting code from the repository. - /// - /// - /// This is a String so that it can reference variables. - /// - [DataMember(EmitDefaultValue = true)] - public String Clean - { - get; - set; - } - - /// - /// Indicates whether to checkout submodules. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean CheckoutSubmodules - { - get; - set; - } - - /// - /// A dictionary that holds additional information about the repository. - /// - public IDictionary Properties - { - // Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember" - // If it's ever made a "DataMember" please be cautious, we would be leaking secrets - get - { - if (m_properties == null) - { - m_properties = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_properties; - } - internal set - { - m_properties = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - /// - /// Clones this object. - /// - /// - public BuildRepository Clone() - { - return new BuildRepository(this); - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedProperties, ref m_properties, StringComparer.OrdinalIgnoreCase, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_properties, ref m_serializedProperties, StringComparer.OrdinalIgnoreCase); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedProperties = null; - } - - [DataMember(Name = "Properties", EmitDefaultValue = false)] - private IDictionary m_serializedProperties; - - // Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember" - // If it's ever made a "DataMember" please be cautious, we would be leaking secrets - private IDictionary m_properties; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildRequestValidationResult.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildRequestValidationResult.cs deleted file mode 100644 index 6216f8cea..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildRequestValidationResult.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the result of validating a build request. - /// - [DataContract] - public class BuildRequestValidationResult : BaseSecuredObject - { - public BuildRequestValidationResult() - { - } - - public BuildRequestValidationResult( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The result. - /// - [DataMember] - public ValidationResult Result - { - get; - set; - } - - /// - /// The message associated with the result. - /// - [DataMember] - public String Message - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildResourceUsage.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildResourceUsage.cs deleted file mode 100644 index a66d6ce15..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildResourceUsage.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents information about resources used by builds in the system. - /// - [DataContract] - public sealed class BuildResourceUsage - { - internal BuildResourceUsage() - { - } - - internal BuildResourceUsage(Int32 xaml, Int32 dtAgents, Int32 paidAgentSlots, Boolean isThrottlingEnabled = false) - { - this.XamlControllers = xaml; - this.DistributedTaskAgents = dtAgents; - this.TotalUsage = this.XamlControllers + (isThrottlingEnabled ? 0 : this.DistributedTaskAgents); - this.PaidPrivateAgentSlots = paidAgentSlots; - } - - /// - /// The number of XAML controllers. - /// - [DataMember] - public Int32 XamlControllers - { - get; - internal set; - } - - /// - /// The number of build agents. - /// - [DataMember] - public Int32 DistributedTaskAgents - { - get; - internal set; - } - - /// - /// The total usage. - /// - [DataMember] - public Int32 TotalUsage - { - get; - internal set; - } - - /// - /// The number of paid private agent slots. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 PaidPrivateAgentSlots - { - get; - internal set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildSettings.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildSettings.cs deleted file mode 100644 index 9a2612747..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildSettings.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents system-wide build settings. - /// - [DataContract] - public class BuildSettings : BaseSecuredObject - { - public BuildSettings() - : this(null) - { - } - - public BuildSettings( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The default retention policy. - /// - [DataMember] - public RetentionPolicy DefaultRetentionPolicy - { - get; - set; - } - - /// - /// The maximum retention policy. - /// - [DataMember] - public RetentionPolicy MaximumRetentionPolicy - { - get; - set; - } - - /// - /// The number of days to keep records of deleted builds. - /// - [DataMember] - public Int32 DaysToKeepDeletedBuildsBeforeDestroy - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildTrigger.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildTrigger.cs deleted file mode 100644 index c7e2f9c99..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildTrigger.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a trigger for a buld definition. - /// - [DataContract] - [KnownType(typeof(ContinuousIntegrationTrigger))] - [KnownType(typeof(GatedCheckInTrigger))] - [KnownType(typeof(ScheduleTrigger))] - [KnownType(typeof(PullRequestTrigger))] - [JsonConverter(typeof(BuildTriggerJsonConverter))] - public abstract class BuildTrigger : BaseSecuredObject - { - protected BuildTrigger(DefinitionTriggerType triggerType) - : this(triggerType, null) - { - } - - protected internal BuildTrigger( - DefinitionTriggerType triggerType, - ISecuredObject securedObject) - : base(securedObject) - { - this.TriggerType = triggerType; - } - - /// - /// The type of the trigger. - /// - [DataMember] - public DefinitionTriggerType TriggerType - { - get; - private set; - } - } - - /// - /// Represents a continuous integration (CI) trigger. - /// - [DataContract] - public sealed class ContinuousIntegrationTrigger : BuildTrigger - { - public ContinuousIntegrationTrigger() - : this(null) - { - } - - internal ContinuousIntegrationTrigger( - ISecuredObject securedObject) - : base(DefinitionTriggerType.ContinuousIntegration, securedObject) - { - MaxConcurrentBuildsPerBranch = 1; - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public Int32 SettingsSourceType - { - get - { - if (m_settingsSourceType == 0) - { - m_settingsSourceType = WebApi.SettingsSourceType.Definition; - } - - return m_settingsSourceType; - } - set - { - m_settingsSourceType = value; - } - } - - /// - /// Indicates whether changes should be batched while another CI build is running. - /// - /// - /// If this is true, then changes submitted while a CI build is running will be batched and built in one new CI build when the current build finishes. - /// If this is false, then a new CI build will be triggered for each change to the repository. - /// - [DataMember] - public Boolean BatchChanges - { - get; - set; - } - - /// - /// The maximum number of simultaneous CI builds that will run per branch. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Int32 MaxConcurrentBuildsPerBranch - { - get; - set; - } - - /// - /// A list of filters that describe which branches will trigger builds. - /// - public List BranchFilters - { - get - { - if (m_branchFilters == null) - { - m_branchFilters = new List(); - } - - return m_branchFilters; - } - internal set - { - m_branchFilters = value; - } - } - - // added in 3.0 - /// - /// A list of filters that describe which paths will trigger builds. - /// - public List PathFilters - { - get - { - if (m_pathFilters == null) - { - m_pathFilters = new List(); - } - - return m_pathFilters; - } - internal set - { - m_pathFilters = value; - } - } - - /// - /// The polling interval, in seconds. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Int32? PollingInterval - { - get; - set; - } - - /// - /// The ID of the job used to poll an external repository. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Guid PollingJobId - { - // This is the ID of the polling job that polls the external repository. - // Once the build definition is saved/updated, this value is set. - get; - set; - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - if (m_settingsSourceType == WebApi.SettingsSourceType.Definition) - { - m_settingsSourceType = 0; - } - } - - [DataMember(Name = "BranchFilters", EmitDefaultValue = false)] - private List m_branchFilters; - - [DataMember(Name = "PathFilters", EmitDefaultValue = false)] - private List m_pathFilters; - - [DataMember(Name = "SettingsSourceType", EmitDefaultValue = false)] - private Int32 m_settingsSourceType; - } - - /// - /// Represents a gated check-in trigger. - /// - [DataContract] - public sealed class GatedCheckInTrigger : BuildTrigger - { - public GatedCheckInTrigger() - : this(null) - { - } - - internal GatedCheckInTrigger( - ISecuredObject securedObject) - : base(DefinitionTriggerType.GatedCheckIn, securedObject) - { - } - - /// - /// Indicates whether CI triggers should run after the gated check-in succeeds. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean RunContinuousIntegration - { - get; - set; - } - - /// - /// Indicates whether to take workspace mappings into account when determining whether a build should run. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean UseWorkspaceMappings - { - get; - set; - } - - /// - /// A list of filters that describe which paths will trigger builds. - /// - public List PathFilters - { - get - { - if (m_pathFilters == null) - { - m_pathFilters = new List(); - } - - return m_pathFilters; - } - internal set - { - m_pathFilters = value; - } - } - - [DataMember(Name = "PathFilters", EmitDefaultValue = false)] - private List m_pathFilters; - } - - /// - /// Represents a schedule trigger. - /// - [DataContract] - public sealed class ScheduleTrigger : BuildTrigger - { - public ScheduleTrigger() - : this(null) - { - } - - internal ScheduleTrigger( - ISecuredObject securedObject) - : base(DefinitionTriggerType.Schedule, securedObject) - { - } - - /// - /// A list of schedule entries that describe when builds should run. - /// - public List Schedules - { - get - { - if (m_schedules == null) - { - m_schedules = new List(); - } - - return m_schedules; - } - set - { - m_schedules = value; - } - } - - [DataMember(Name = "Schedules", EmitDefaultValue = false)] - private List m_schedules; - } - - /// - /// Represents a pull request trigger. - /// - [DataContract] - public class PullRequestTrigger : BuildTrigger - { - public PullRequestTrigger() - : this(null) - { - } - - internal PullRequestTrigger( - ISecuredObject securedObject) - : base(DefinitionTriggerType.PullRequest, securedObject) - { - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public Int32 SettingsSourceType - { - get - { - if (m_settingsSourceType == 0) - { - m_settingsSourceType = WebApi.SettingsSourceType.Definition; - } - - return m_settingsSourceType; - } - set - { - m_settingsSourceType = value; - } - } - - - /// - /// Describes if forks of a selected repository should build and use secrets. - /// - public Forks Forks - { - get - { - if (m_forks == null) - { - m_forks = new Forks(); - } - return m_forks; - } - set - { - m_forks = value; - } - } - - /// - /// A list of filters that describe which branches will trigger builds. - /// - public List BranchFilters - { - get - { - if (m_branchFilters == null) - { - m_branchFilters = new List(); - } - - return m_branchFilters; - } - set - { - m_branchFilters = value; - } - } - - /// - /// A list of filters that describe which paths will trigger builds. - /// - public List PathFilters - { - get - { - if (m_pathFilters == null) - { - m_pathFilters = new List(); - } - - return m_pathFilters; - } - set - { - m_pathFilters = value; - } - } - - /// - /// Indicates if an update to a PR should delete current in-progress builds. - /// - [DataMember(Name = "AutoCancel", EmitDefaultValue = false)] - public Boolean? AutoCancel { get; set; } - - [DataMember(Name = "RequireCommentsForNonTeamMembersOnly")] - public Boolean RequireCommentsForNonTeamMembersOnly { get; set; } - - [DataMember(Name = "IsCommentRequiredForPullRequest")] - public Boolean IsCommentRequiredForPullRequest { get; set; } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - if (m_settingsSourceType == WebApi.SettingsSourceType.Definition) - { - m_settingsSourceType = 0; - } - } - - [DataMember(Name = "SettingsSourceType", EmitDefaultValue = false)] - private Int32 m_settingsSourceType; - - [DataMember(Name = "BranchFilters", EmitDefaultValue = false)] - private List m_branchFilters; - - [DataMember(Name = "Forks", EmitDefaultValue = false)] - private Forks m_forks; - - [DataMember(Name = "PathFilters", EmitDefaultValue = false)] - private List m_pathFilters; - } - - /// - /// Represents a build completion trigger. - /// - [DataContract] - public class BuildCompletionTrigger : BuildTrigger - { - public BuildCompletionTrigger() - : this(null) - { - } - public BuildCompletionTrigger( - ISecuredObject securedObject) - : base(DefinitionTriggerType.BuildCompletion, securedObject) - { - } - - /// - /// A reference to the definition that should trigger builds for this definition. - /// - [DataMember] - public DefinitionReference Definition { get; set; } - - [DataMember] - public Boolean RequiresSuccessfulBuild { get; set; } - - [DataMember] - public List BranchFilters { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildTriggerJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildTriggerJsonConverter.cs deleted file mode 100644 index 52b754ede..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildTriggerJsonConverter.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Reflection; -using GitHub.Services.WebApi; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; - -namespace GitHub.Build.WebApi -{ - internal sealed class BuildTriggerJsonConverter : VssSecureJsonConverter - { - public override Boolean CanConvert(Type objectType) - { - return typeof(BuildTrigger).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - public override Boolean CanRead - { - get - { - return true; - } - } - - public override Boolean CanWrite - { - get - { - return false; - } - } - - public override Object ReadJson( - JsonReader reader, - Type objectType, - Object existingValue, - JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - var contract = serializer.ContractResolver.ResolveContract(objectType) as JsonObjectContract; - if (contract == null) - { - return existingValue; - } - - JsonProperty property = contract.Properties.GetClosestMatchProperty("TriggerType"); - if (property == null) - { - return existingValue; - } - - JToken itemTypeValue; - DefinitionTriggerType triggerType; - JObject value = JObject.Load(reader); - if (!value.TryGetValue(property.PropertyName, StringComparison.OrdinalIgnoreCase, out itemTypeValue)) - { - return existingValue; - } - else - { - if (itemTypeValue.Type == JTokenType.Integer) - { - triggerType = (DefinitionTriggerType)(Int32)itemTypeValue; - } - else if (itemTypeValue.Type != JTokenType.String || - !Enum.TryParse((String)itemTypeValue, true, out triggerType)) - { - return existingValue; - } - } - - Object returnValue = null; - switch (triggerType) - { - case DefinitionTriggerType.ContinuousIntegration: - returnValue = new ContinuousIntegrationTrigger(); - break; - case DefinitionTriggerType.GatedCheckIn: - returnValue = new GatedCheckInTrigger(); - break; - case DefinitionTriggerType.Schedule: - returnValue = new ScheduleTrigger(); - break; - case DefinitionTriggerType.PullRequest: - returnValue = new PullRequestTrigger(); - break; - case DefinitionTriggerType.BuildCompletion: - returnValue = new BuildCompletionTrigger(); - break; - } - - if (value != null && returnValue != null) - { - using (JsonReader objectReader = value.CreateReader()) - { - serializer.Populate(objectReader, returnValue); - } - } - - return returnValue; - } - - public override void WriteJson( - JsonWriter writer, - Object value, - JsonSerializer serializer) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/BuildWorkspace.cs b/src/Sdk/BuildWebApi/Api/Contracts/BuildWorkspace.cs deleted file mode 100644 index 00e11c4cd..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/BuildWorkspace.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an entry in a workspace mapping. - /// - [DataContract] - public class MappingDetails - { - /// - /// The server path. - /// - [DataMember(Name = "serverPath")] - public String ServerPath - { - get; - set; - } - - /// - /// The mapping type. - /// - [DataMember(Name = "mappingType")] - public String MappingType - { - get; - set; - } - - /// - /// The local path. - /// - [DataMember(Name = "localPath")] - public String LocalPath - { - get; - set; - } - } - - /// - /// Represents a workspace mapping. - /// - [DataContract] - public class BuildWorkspace - { - /// - /// The list of workspace mapping entries. - /// - public List Mappings - { - get - { - if (m_mappings == null) - { - m_mappings = new List(); - } - return m_mappings; - } - } - - [DataMember(Name = "mappings")] - private List m_mappings; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Change.cs b/src/Sdk/BuildWebApi/Api/Contracts/Change.cs deleted file mode 100644 index 7035e37f2..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Change.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a change associated with a build. - /// - [DataContract] - public class Change : BaseSecuredObject - { - public Change() - : this(null) - { - } - - internal Change( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The identifier for the change. For a commit, this would be the SHA1. For a TFVC changeset, this would be the changeset ID. - /// - [DataMember(EmitDefaultValue = false)] - public String Id - { - get; - set; - } - - /// - /// The description of the change. This might be a commit message or changeset description. - /// - [DataMember(EmitDefaultValue = false)] - public String Message - { - get; - set; - } - - /// - /// The type of change. "commit", "changeset", etc. - /// - [DataMember(EmitDefaultValue = false)] - public String Type - { - get; - set; - } - - /// - /// The author of the change. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef Author - { - get; - set; - } - - /// - /// The timestamp for the change. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? Timestamp - { - get; - set; - } - - /// - /// The location of the full representation of the resource. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Location - { - get; - set; - } - - /// - /// Indicates whether the message was truncated. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean MessageTruncated - { - get; - set; - } - - /// - /// The location of a user-friendly representation of the resource. - /// - [DataMember(EmitDefaultValue = false)] - public Uri DisplayUri - { - get; - set; - } - - /// - /// The person or process that pushed the change. - /// - [DataMember(EmitDefaultValue = false)] - public String Pusher - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DefinitionReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/DefinitionReference.cs deleted file mode 100644 index b817b2311..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DefinitionReference.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Core.WebApi; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a definition. - /// - [DataContract] - [KnownType(typeof(BuildDefinition))] - [KnownType(typeof(BuildDefinitionReference))] - [JsonConverter(typeof(DefinitionReferenceJsonConverter))] -#pragma warning disable 618 - public class DefinitionReference : ShallowReference, ISecuredObject -#pragma warning restore 618 - { - /// - /// The ID of the referenced definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new Int32 Id - { - get - { - return base.Id; - } - set - { - base.Id = value; - } - } - - /// - /// The name of the referenced definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new String Name - { - get - { - return base.Name; - } - set - { - base.Name = value; - } - } - - /// - /// The REST URL of the definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public new String Url - { - get - { - return base.Url; - } - set - { - base.Url = value; - } - } - - /// - /// The definition's URI. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Uri Uri - { - get; - set; - } - - /// - /// The folder path of the definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Path - { - get; - set; - } - - /// - /// The type of the definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public DefinitionType Type - { - get; - set; - } - - /// - /// A value that indicates whether builds can be queued against this definition. - /// - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public DefinitionQueueStatus QueueStatus - { - get; - set; - } - - /// - /// The definition revision number. - /// - [DataMember(EmitDefaultValue = false)] - public Int32? Revision - { - get; - set; - } - - /// - /// The date this version of the definition was created. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime CreatedDate - { - get; - set; - } - - /// - /// A reference to the project. - /// - [DataMember(EmitDefaultValue = false, Order = 1000)] - public TeamProjectReference Project - { - get; - set; - } - - #region ISecuredObject implementation - - Guid ISecuredObject.NamespaceId => Security.BuildNamespaceId; - - Int32 ISecuredObject.RequiredPermissions => m_requiredPermissions; - - String ISecuredObject.GetToken() - { - if (!String.IsNullOrEmpty(m_nestingSecurityToken)) - { - return m_nestingSecurityToken; - } - - return GetToken(this.Project, this.Path, this.Id); - } - - internal void SetRequiredPermissions( - Int32 newValue) - { - m_requiredPermissions = newValue; - } - - internal void SetNestingSecurityToken( - String tokenValue) - { - // For anything more detailed than a DefinitionReference, - // we don't let you use a nesting security token. - if (this is BuildDefinitionReference) - { - // Debug.Fail("Nesting security tokens is not allowed for anything more detailed than a DefinitionReference"); - m_nestingSecurityToken = String.Empty; - return; - } - - m_nestingSecurityToken = tokenValue; - } - - internal static String GetToken( - TeamProjectReference project, - String path, - Int32 definitionId) - { - return GetToken(project?.Id, path, definitionId); - } - - internal static String GetToken( - Guid? projectId, - String path, - Int32 definitionId) - { - return String.Concat(projectId?.ToString("D") ?? String.Empty, Security.GetSecurityTokenPath(path ?? String.Empty), definitionId); - } - - private Int32 m_requiredPermissions = BuildPermissions.ViewBuildDefinition; - private String m_nestingSecurityToken = String.Empty; - #endregion - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DefinitionResourceReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/DefinitionResourceReference.cs deleted file mode 100644 index f7f8c0751..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DefinitionResourceReference.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public class DefinitionResourceReference : BaseSecuredObject - { - public DefinitionResourceReference() - : this(null) - { - } - - internal DefinitionResourceReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// A friendly name for the resource. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The type of the resource. - /// - [DataMember(EmitDefaultValue = false)] - public String Type - { - get; - set; - } - - /// - /// The id of the resource. - /// - [DataMember(EmitDefaultValue = false)] - public String Id - { - get; - set; - } - - /// - /// Indicates whether the resource is authorized for use. - /// - [DataMember] - public Boolean Authorized - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Demand.cs b/src/Sdk/BuildWebApi/Api/Contracts/Demand.cs deleted file mode 100644 index 2437b4176..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Demand.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using GitHub.Services.Common; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a demand used by a definition or build. - /// - [JsonConverter(typeof(DemandJsonConverter))] - public abstract class Demand : BaseSecuredObject - { - protected Demand( - String name, - String value) - : this(name, value, null) - { - } - - protected Demand( - String name, - String value, - ISecuredObject securedObject) - : base(securedObject) - { - ArgumentUtility.CheckStringForNullOrEmpty(name, "name"); - this.Name = name; - this.Value = value; - } - - /// - /// The name of the capability referenced by the demand. - /// - public String Name - { - get; - private set; - } - - /// - /// The demanded value. - /// - public String Value - { - get; - private set; - } - - public override sealed Boolean Equals(Object obj) - { - Demand demand = obj as Demand; - return demand != null && demand.ToString().Equals(this.ToString(), StringComparison.OrdinalIgnoreCase); - } - - public override sealed Int32 GetHashCode() - { - return this.ToString().ToUpperInvariant().GetHashCode(); - } - - public override sealed String ToString() - { - return GetExpression(); - } - - /// - /// Clones this object. - /// - /// - public abstract Demand Clone(); - - protected abstract String GetExpression(); - - /// - /// Parses a string into a Demand instance. - /// - /// - /// - /// - public static Boolean TryParse( - String input, - out Demand demand) - { - demand = null; - - Match match = s_demandRegex.Match(input); - if (!match.Success) - { - return false; - } - - String name = match.Groups["name"].Value; - String opcode = match.Groups["opcode"].Value; - String value = match.Groups["value"].Value; - - if (String.IsNullOrEmpty(opcode)) - { - demand = new DemandExists(name); - } - else - { - switch (opcode) - { - case "equals": - demand = new DemandEquals(name, value); - break; - } - } - - return demand != null; - } - - private static readonly Regex s_demandRegex = new Regex(@"^(?[^ ]+)([ ]+\-(?[^ ]+)[ ]+(?.*))?$", - RegexOptions.Compiled); - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DemandEquals.cs b/src/Sdk/BuildWebApi/Api/Contracts/DemandEquals.cs deleted file mode 100644 index 14ef4dd1a..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DemandEquals.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Globalization; -using GitHub.Services.Common; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an "equals" demand. - /// - /// - /// This demand is satisfied when the value of the named capability matches the value stored in the demand. - /// - public sealed class DemandEquals : Demand - { - public DemandEquals( - String name, - String value) - : this(name, value, null) - { - } - - public DemandEquals( - String name, - String value, - ISecuredObject securedObject) - : base(name, value, securedObject) - { - ArgumentUtility.CheckStringForNullOrEmpty(value, "value"); - } - - /// - /// Clones this object. - /// - /// - public override Demand Clone() - { - return new DemandEquals(this.Name, this.Value); - } - - protected override String GetExpression() - { - return String.Format(CultureInfo.InvariantCulture, "{0} -equals {1}", this.Name, this.Value); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DemandExists.cs b/src/Sdk/BuildWebApi/Api/Contracts/DemandExists.cs deleted file mode 100644 index 35164ad93..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DemandExists.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an "exists" demand. - /// - /// - /// This demand is satisfied as long as the named capability exists, regardless of its value. - /// - public sealed class DemandExists : Demand - { - public DemandExists( - String name) - : this(name, null) - { - } - - public DemandExists( - String name, - ISecuredObject securedObject) - : base(name, null, securedObject) - { - } - - /// - /// Clones this object. - /// - /// - public override Demand Clone() - { - return new DemandExists(this.Name); - } - - protected override String GetExpression() - { - return this.Name; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DemandJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/DemandJsonConverter.cs deleted file mode 100644 index d21f3f46b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DemandJsonConverter.cs +++ /dev/null @@ -1,46 +0,0 @@ -using GitHub.Services.WebApi; -using Newtonsoft.Json; -using System; -using System.Reflection; - -namespace GitHub.Build.WebApi -{ - internal sealed class DemandJsonConverter : VssSecureJsonConverter - { - public override Boolean CanConvert(Type objectType) - { - return typeof(Demand).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - public override Object ReadJson( - JsonReader reader, - Type objectType, - Object existingValue, - JsonSerializer serializer) - { - if (existingValue == null && reader.TokenType == JsonToken.String) - { - Demand demand; - if (Demand.TryParse((String)reader.Value, out demand)) - { - existingValue = demand; - } - } - - return existingValue; - } - - public override void WriteJson( - JsonWriter writer, - Object value, - JsonSerializer serializer) - { - base.WriteJson(writer, value, serializer); - - if (value != null) - { - writer.WriteValue(value.ToString()); - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Dependency.cs b/src/Sdk/BuildWebApi/Api/Contracts/Dependency.cs deleted file mode 100644 index d4dadfc5e..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Dependency.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a dependency. - /// - [DataContract] - public class Dependency : BaseSecuredObject - { - public Dependency() - { - } - - internal Dependency( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The scope. This names the object referenced by the dependency. - /// - [DataMember] - public String Scope - { - get; - set; - } - - /// - /// The event. The dependency is satisfied when the referenced object emits this event. - /// - [DataMember] - public String Event - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinition3_2.cs b/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinition3_2.cs deleted file mode 100644 index c0073b4a9..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinition3_2.cs +++ /dev/null @@ -1,441 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.DistributedTask.Common.Contracts; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Internals -{ - /// - /// For back-compat with extensions that use the old Steps format instead of Process and Phases - /// - [DataContract] - [EditorBrowsable(EditorBrowsableState.Never)] - public class BuildDefinition3_2 : BuildDefinitionReference3_2 - { - public BuildDefinition3_2() - { - this.JobAuthorizationScope = BuildAuthorizationScope.ProjectCollection; - } - - /// - /// The build number format - /// - [DataMember(EmitDefaultValue = false)] - public String BuildNumberFormat - { - get; - set; - } - - /// - /// The comment entered when saving the definition - /// - [DataMember(EmitDefaultValue = false)] - public String Comment - { - get; - set; - } - - /// - /// The description - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The drop location for the definition - /// - [DataMember(EmitDefaultValue = false)] - public String DropLocation - { - get; - set; - } - - /// - /// The job authorization scope for builds which are queued against this definition - /// - [DataMember] - public BuildAuthorizationScope JobAuthorizationScope - { - get; - set; - } - - /// - /// The job execution timeout in minutes for builds which are queued against this definition - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobTimeoutInMinutes - { - get; - set; - } - - /// - /// The job cancel timeout in minutes for builds which are cancelled by user for this definition - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobCancelTimeoutInMinutes - { - get; - set; - } - - /// - /// Indicates whether badges are enabled for this definition - /// - [DataMember(EmitDefaultValue = false)] - public Boolean BadgeEnabled - { - get; - set; - } - - /// - /// The list of steps for this definition. - /// - public List Steps - { - get - { - if (m_steps == null) - { - m_steps = new List(); - } - return m_steps; - } - } - - /// - /// Build options - /// - public List Options - { - get - { - if (m_options == null) - { - m_options = new List(); - } - return m_options; - } - } - - /// - /// The repository - /// - [DataMember(EmitDefaultValue = false)] - public BuildRepository Repository - { - get; - set; - } - - /// - /// Process Parameters - /// - [DataMember(EmitDefaultValue = false)] - public ProcessParameters ProcessParameters - { - get; - set; - } - - /// - /// The triggers - /// - public List Triggers - { - get - { - if (m_triggers == null) - { - m_triggers = new List(); - } - return m_triggers; - } - } - - /// - /// The variables. - /// - public IDictionary Variables - { - get - { - if (m_variables == null) - { - m_variables = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - return m_variables; - } - } - - /// - /// The demands. - /// - public List Demands - { - get - { - if (m_demands == null) - { - m_demands = new List(); - } - return m_demands; - } - } - - /// - /// The retention rules. - /// - public List RetentionRules - { - get - { - if (m_retentionRules == null) - { - m_retentionRules = new List(); - } - return m_retentionRules; - } - } - - /// - /// A collection of properties which may be used to extend the storage fields available - /// for a given definition. - /// - public PropertiesCollection Properties - { - get - { - if (m_properties == null) - { - m_properties = new PropertiesCollection(); - } - return m_properties; - } - internal set - { - m_properties = value; - } - } - - /// - /// A collection of tags associated with the build definition. - /// - public List Tags - { - get - { - if (m_tags == null) - { - m_tags = new List(); - } - return m_tags; - } - } - - /// - /// The latest build for this definition. - /// - public Build LatestBuild - { - get - { - return m_latestBuild; - } - internal set - { - m_latestBuild = value; - } - } - - /// - /// The latest completed build for this definition. - /// - public Build LatestCompletedBuild - { - get - { - return m_latestCompletedBuild; - } - internal set - { - m_latestCompletedBuild = value; - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true); - SerializationHelper.Copy(ref m_serializedSteps, ref m_steps, true); - SerializationHelper.Copy(ref m_serializedTriggers, ref m_triggers, true); - SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true); - SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true); - SerializationHelper.Copy(ref m_serializedRetentionRules, ref m_retentionRules, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_options, ref m_serializedOptions); - SerializationHelper.Copy(ref m_steps, ref m_serializedSteps); - SerializationHelper.Copy(ref m_triggers, ref m_serializedTriggers); - SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase); - SerializationHelper.Copy(ref m_demands, ref m_serializedDemands); - SerializationHelper.Copy(ref m_retentionRules, ref m_serializedRetentionRules); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedSteps = null; - m_serializedOptions = null; - m_serializedTriggers = null; - m_serializedVariables = null; - m_serializedRetentionRules = null; - } - - [DataMember(Name = "Build", EmitDefaultValue = false)] - private List m_serializedSteps; - - [DataMember(Name = "Options", EmitDefaultValue = false)] - private List m_serializedOptions; - - [DataMember(Name = "Triggers", EmitDefaultValue = false)] - private List m_serializedTriggers; - - [DataMember(Name = "Variables", EmitDefaultValue = false)] - private IDictionary m_serializedVariables; - - [DataMember(Name = "Demands", EmitDefaultValue = false)] - private List m_serializedDemands; - - [DataMember(Name = "RetentionRules", EmitDefaultValue = false)] - private List m_serializedRetentionRules; - - [DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Properties")] - private PropertiesCollection m_properties; - - [DataMember(EmitDefaultValue = false, Name = "Tags")] - private List m_tags; - - [DataMember(EmitDefaultValue = false, Name = "LatestBuild")] - private Build m_latestBuild; - - [DataMember(EmitDefaultValue = false, Name = "LatestCompletedBuild")] - private Build m_latestCompletedBuild; - - private List m_demands; - private List m_options; - private List m_triggers; - private List m_retentionRules; - private List m_steps; - private IDictionary m_variables; - } - - internal static class BuildDefinition3_2Extensions - { - public static BuildDefinition ToBuildDefinition( - this BuildDefinition3_2 source) - { - if (source == null) - { - return null; - } - - var result = new BuildDefinition() - { - AuthoredBy = source.AuthoredBy, - BadgeEnabled = source.BadgeEnabled, - BuildNumberFormat = source.BuildNumberFormat, - Comment = source.Comment, - CreatedDate = source.CreatedDate, - DefinitionQuality = source.DefinitionQuality, - Description = source.Description, - DropLocation = source.DropLocation, - Id = source.Id, - JobAuthorizationScope = source.JobAuthorizationScope, - JobCancelTimeoutInMinutes = source.JobCancelTimeoutInMinutes, - JobTimeoutInMinutes = source.JobTimeoutInMinutes, - LatestBuild = source.LatestBuild, - LatestCompletedBuild = source.LatestCompletedBuild, - Name = source.Name, - ParentDefinition = source.ParentDefinition, - Path = source.Path, - ProcessParameters = source.ProcessParameters, - Project = source.Project, - Queue = source.Queue, - QueueStatus = source.QueueStatus, - Repository = source.Repository, - Revision = source.Revision, - Type = source.Type, - Uri = source.Uri, - Url = source.Url - }; - - if (source.Demands.Count > 0) - { - result.Demands.AddRange(source.Demands); - } - - if (source.Metrics.Count > 0) - { - result.Metrics.AddRange(source.Metrics); - } - - if (source.Options.Count > 0) - { - result.Options.AddRange(source.Options); - } - - var process = new DesignerProcess(); - result.Process = process; - - var phase = new Phase(); - process.Phases.Add(phase); - - if (source.Steps.Count > 0) - { - phase.Steps.AddRange(source.Steps); - } - - foreach (var property in source.Properties) - { - result.Properties.Add(property.Key, property.Value); - } - - if (source.RetentionRules.Count > 0) - { - result.RetentionRules.AddRange(source.RetentionRules); - } - - if (source.Tags.Count > 0) - { - result.Tags.AddRange(source.Tags); - } - - if (source.Triggers.Count > 0) - { - result.Triggers.AddRange(source.Triggers); - } - - foreach (var variablePair in source.Variables) - { - result.Variables.Add(variablePair.Key, variablePair.Value); - } - - return result; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionReference3_2.cs b/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionReference3_2.cs deleted file mode 100644 index b000c2297..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionReference3_2.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// For back-compat with extensions that use the old Steps format instead of Process and Phases - /// - [DataContract] - [EditorBrowsable(EditorBrowsableState.Never)] - public class BuildDefinitionReference3_2 : DefinitionReference - { - public BuildDefinitionReference3_2() - { - Type = DefinitionType.Build; - QueueStatus = DefinitionQueueStatus.Enabled; - } - - /// - /// The quality of the definition document (draft, etc.) - /// - [DataMember(EmitDefaultValue = false, Name = "Quality")] - public DefinitionQuality? DefinitionQuality - { - get; - set; - } - - /// - /// The author of the definition. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef AuthoredBy - { - get; - - [EditorBrowsable(EditorBrowsableState.Never)] - set; - } - - /// - /// A reference to the definition that this definition is a draft of, if this is a draft definition. - /// - [DataMember(EmitDefaultValue = false, Name = "draftOf")] - public DefinitionReference ParentDefinition - { - get; - set; - } - - /// - /// The list of drafts associated with this definition, if this is not a draft definition. - /// - [DataMember(EmitDefaultValue = false)] - public List Drafts - { - get - { - return m_drafts ?? (m_drafts = new List()); - } - internal set - { - m_drafts = value; - } - } - - /// - /// The default queue for builds run against this definition. - /// - [DataMember(EmitDefaultValue = false)] - public AgentPoolQueue Queue - { - get; - set; - } - - /// - /// The metrics for this definition. - /// - public List Metrics - { - get - { - return m_metrics ?? (m_metrics = new List()); - } - internal set - { - m_metrics = value; - } - } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links => m_links ?? (m_links = new ReferenceLinks()); - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedMetrics, ref m_metrics, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_metrics, ref m_serializedMetrics); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedMetrics = null; - } - - [DataMember(Name = "Metrics", EmitDefaultValue = false)] - private List m_serializedMetrics; - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - - private List m_metrics; - - private List m_drafts; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionTemplate3_2.cs b/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionTemplate3_2.cs deleted file mode 100644 index 313e38dae..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Deprecated/BuildDefinitionTemplate3_2.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Internals -{ - /// - /// For back-compat with extensions that use the old Steps format instead of Process and Phases - /// - [DataContract] - [EditorBrowsable(EditorBrowsableState.Never)] - public class BuildDefinitionTemplate3_2 - { - - public BuildDefinitionTemplate3_2() - { - Category = "Custom"; - } - - [DataMember(IsRequired = true)] - public String Id - { - get; - set; - } - - [DataMember(IsRequired = true)] - public String Name - { - get; - set; - } - - [DataMember(EmitDefaultValue = true)] - public Boolean CanDelete - { - get; - set; - } - - [DataMember(EmitDefaultValue = true)] - public String Category - { - get; - set; - } - - [DataMember(EmitDefaultValue = true)] - public String DefaultHostedQueue - { - get; - set; - } - - [DataMember(EmitDefaultValue = false)] - public Guid IconTaskId - { - get; - set; - } - - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - [DataMember(EmitDefaultValue = false)] - public BuildDefinition3_2 Template - { - get; - set; - } - - public IDictionary Icons - { - get - { - if (m_icons == null) - { - m_icons = new Dictionary(StringComparer.Ordinal); - } - return m_icons; - } - } - - [DataMember(EmitDefaultValue = false, Name = "Icons")] - private Dictionary m_icons; - } - - internal static class BuildDefinitionTemplate3_2Extensions - { - public static BuildDefinitionTemplate ToBuildDefinitionTemplate( - this BuildDefinitionTemplate3_2 source) - { - if (source == null) - { - return null; - } - - var result = new BuildDefinitionTemplate() - { - CanDelete = source.CanDelete, - Category = source.Category, - DefaultHostedQueue = source.DefaultHostedQueue, - Description = source.Description, - IconTaskId = source.IconTaskId, - Id = source.Id, - Name = source.Name, - Template = source.Template.ToBuildDefinition() - }; - - foreach (var iconPair in source.Icons) - { - result.Icons.Add(iconPair.Key, iconPair.Value); - } - - return result; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcess.cs b/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcess.cs deleted file mode 100644 index 4ca669451..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcess.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a build process supported by the build definition designer. - /// - [DataContract] - public class DesignerProcess : BuildProcess - { - public DesignerProcess() - :this(null) - { - } - - internal DesignerProcess( - ISecuredObject securedObject) - : base(ProcessType.Designer, securedObject) - { - } - - /// - /// The list of phases. - /// - public List Phases - { - get - { - if (m_phases == null) - { - m_phases = new List(); - } - return m_phases; - } - } - - [DataMember(Name = "Phases", EmitDefaultValue = false)] - private List m_phases; - - /// - /// The target for the build process. - /// - [DataMember(EmitDefaultValue = false)] - public DesignerProcessTarget Target { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcessTarget.cs b/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcessTarget.cs deleted file mode 100644 index 293cda6ff..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DesignerProcessTarget.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the target for the build process. - /// - [DataContract] - public class DesignerProcessTarget : BaseSecuredObject - { - public DesignerProcessTarget() - { - } - - public DesignerProcessTarget(ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Agent specification for the build process. - /// - [DataMember(EmitDefaultValue = false)] - public AgentSpecification AgentSpecification { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DockerProcess.cs b/src/Sdk/BuildWebApi/Api/Contracts/DockerProcess.cs deleted file mode 100644 index 7e8febc81..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DockerProcess.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public class DockerProcess : BuildProcess - { - public DockerProcess() - : this(null) - { - } - - internal DockerProcess( - ISecuredObject securedObject) - : base(ProcessType.Docker, securedObject) - { - } - - [DataMember(EmitDefaultValue = false)] - public DockerProcessTarget Target { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/DockerProcessTarget.cs b/src/Sdk/BuildWebApi/Api/Contracts/DockerProcessTarget.cs deleted file mode 100644 index 68ba4985f..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/DockerProcessTarget.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the target for the docker build process. - /// - [DataContract] - public class DockerProcessTarget: DesignerProcessTarget - { - public DockerProcessTarget() - { - } - - public DockerProcessTarget(ISecuredObject securedObject) - : base(securedObject) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Folder.cs b/src/Sdk/BuildWebApi/Api/Contracts/Folder.cs deleted file mode 100644 index a1d330aa4..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Folder.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Core.WebApi; -using GitHub.Services.Common; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a folder that contains build definitions. - /// - [DataContract] - public class Folder : ISecuredObject - { - public Folder() - { - } - - /// - /// The full path. - /// - [DataMember(EmitDefaultValue = false)] - public String Path - { - get; - set; - } - - /// - /// The description. - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The date the folder was created. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime CreatedOn - { - get; - set; - } - - /// - /// The process or person who created the folder. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef CreatedBy - { - get; - set; - } - - /// - /// The date the folder was last changed. - /// - [DataMember(EmitDefaultValue = false)] - public DateTime? LastChangedDate - { - get; - set; - } - - /// - /// The process or person that last changed the folder. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef LastChangedBy - { - get; - set; - } - - /// - /// The project. - /// - [DataMember(EmitDefaultValue = false)] - public TeamProjectReference Project - { - get; - set; - } - - #region ISecuredObject implementation - - // We don't have folder-specific permissions. Folders are secured by the project. - - public Guid NamespaceId - { - get - { - ArgumentUtility.CheckForNull(Project, nameof(Project)); - return ((ISecuredObject)Project).NamespaceId; - } - } - - public Int32 RequiredPermissions - { - get - { - ArgumentUtility.CheckForNull(Project, nameof(Project)); - return ((ISecuredObject)Project).RequiredPermissions; - } - } - - public String GetToken() - { - ArgumentUtility.CheckForNull(Project, nameof(Project)); - return ((ISecuredObject)Project).GetToken(); - } - - #endregion - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Forks.cs b/src/Sdk/BuildWebApi/Api/Contracts/Forks.cs deleted file mode 100644 index 3c420bb6e..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Forks.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the ability to build forks of the selected repository. - /// - [DataContract] - public sealed class Forks : BaseSecuredObject - { - public Forks() - { - } - - internal Forks( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Indicates whether the trigger should queue builds for forks of the selected repository. - /// - [DataMember] - public Boolean Enabled - { - get; - set; - } - - /// - /// Indicates whether a build should use secrets when building forks of the selected repository. - /// - [DataMember] - public Boolean AllowSecrets - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Issue.cs b/src/Sdk/BuildWebApi/Api/Contracts/Issue.cs deleted file mode 100644 index 1e4d5c905..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Issue.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an issue (error, warning) associated with a build. - /// - [DataContract] - public class Issue : BaseSecuredObject - { - public Issue() - { - } - - internal Issue( - ISecuredObject securedObject) - : base(securedObject) - { - } - - private Issue( - Issue issueToBeCloned) - : base(issueToBeCloned) - { - this.Type = issueToBeCloned.Type; - this.Category = issueToBeCloned.Category; - this.Message = issueToBeCloned.Message; - - if (issueToBeCloned.m_data != null) - { - foreach (var item in issueToBeCloned.m_data) - { - this.Data.Add(item); - } - } - } - - /// - /// The type (error, warning) of the issue. - /// - [DataMember(Order = 1)] - public IssueType Type - { - get; - set; - } - - /// - /// The category. - /// - [DataMember(Order = 2)] - public String Category - { - get; - set; - } - - /// - /// A description of the issue. - /// - [DataMember(Order = 3)] - public String Message - { - get; - set; - } - - /// - /// A dictionary containing details about the issue. - /// - public IDictionary Data - { - get - { - if (m_data == null) - { - m_data = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - return m_data; - } - } - - /// - /// Clones this object. - /// - /// - public Issue Clone() - { - return new Issue(this); - } - - [DataMember(Name = "Data", EmitDefaultValue = false, Order = 4)] - private IDictionary m_data; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/JustInTimeProcess.cs b/src/Sdk/BuildWebApi/Api/Contracts/JustInTimeProcess.cs deleted file mode 100644 index 09c9f65a7..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/JustInTimeProcess.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public class JustInTimeProcess : BuildProcess - { - public JustInTimeProcess() - : this(null) - { - } - - internal JustInTimeProcess( - ISecuredObject securedObject) - : base(ProcessType.JustInTime, securedObject) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/MultipleAgentExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/Contracts/MultipleAgentExecutionOptions.cs deleted file mode 100644 index 5c4627142..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/MultipleAgentExecutionOptions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents options for running a phase against multiple agents. - /// - [DataContract] - public class MultipleAgentExecutionOptions : AgentTargetExecutionOptions - { - public MultipleAgentExecutionOptions() - : this(null) - { - } - - internal MultipleAgentExecutionOptions( - ISecuredObject securedObject) - : base(AgentTargetExecutionType.MultipleAgents, securedObject) - { - MaxConcurrency = 1; - } - - /// - /// The maximum number of agents to use simultaneously. - /// - [DataMember(EmitDefaultValue=true)] - [DefaultValue(1)] - public Int32 MaxConcurrency { - get; - set; - } - - /// - /// Indicates whether failure on one agent should prevent the phase from running on other agents. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean ContinueOnError - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Phase.cs b/src/Sdk/BuildWebApi/Api/Contracts/Phase.cs deleted file mode 100644 index 7440edc6c..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Phase.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a phase of a build definition. - /// - [DataContract] - public class Phase : BaseSecuredObject - { - public Phase() - { - } - - internal Phase( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The name of the phase. - /// - [DataMember] - public String Name - { - get; - set; - } - - /// - /// The unique ref name of the phase. - /// - [DataMember] - public String RefName - { - get; - set; - } - - /// - /// The list of steps run by the phase. - /// - public List Steps - { - get - { - if (m_steps == null) - { - m_steps = new List(); - } - - return m_steps; - } - set - { - m_steps = value; - } - } - - /// - /// The list of variables defined on the phase. - /// - public IDictionary Variables - { - get - { - if (m_variables == null) - { - m_variables = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_variables; - } - set - { - m_variables = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - /// - /// The list of dependencies for this phase. - /// - public List Dependencies - { - get - { - if (m_dependencies == null) - { - m_dependencies = new List(); - } - - return m_dependencies; - } - set - { - m_dependencies = value; - } - } - - /// - /// The condition that must be true for this phase to execute. - /// - /// - /// The condition is evaluated after all dependencies are satisfied. - /// - [DataMember(EmitDefaultValue = false, IsRequired = false)] - public String Condition - { - get; - set; - } - - /// - /// The target (agent, server, etc.) for this phase. - /// - [DataMember(EmitDefaultValue = false)] - public PhaseTarget Target - { - get; - set; - } - - /// - /// The job authorization scope for builds queued against this definition. - /// - [DataMember] - public BuildAuthorizationScope JobAuthorizationScope - { - get; - set; - } - - /// - /// The job execution timeout, in minutes, for builds queued against this definition. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobTimeoutInMinutes - { - get; - set; - } - - /// - /// The cancellation timeout, in minutes, for builds queued against this definition. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 JobCancelTimeoutInMinutes - { - get; - set; - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedDependencies, ref m_dependencies, true); - SerializationHelper.Copy(ref m_serializedSteps, ref m_steps, true); - SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_dependencies, ref m_serializedDependencies); - SerializationHelper.Copy(ref m_steps, ref m_serializedSteps); - SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase); - } - - [DataMember(Name = "Dependencies", EmitDefaultValue = false)] - private List m_serializedDependencies; - - [DataMember(Name = "Steps", EmitDefaultValue = false)] - private List m_serializedSteps; - - [DataMember(Name = "Variables", EmitDefaultValue = false)] - private IDictionary m_serializedVariables; - - private List m_dependencies; - private List m_steps; - private IDictionary m_variables; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/PhaseTarget.cs b/src/Sdk/BuildWebApi/Api/Contracts/PhaseTarget.cs deleted file mode 100644 index 4dcd45bb3..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/PhaseTarget.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the target of a phase. - /// - [DataContract] - [KnownType(typeof(AgentPoolQueueTarget))] - [KnownType(typeof(ServerTarget))] - [JsonConverter(typeof(PhaseTargetJsonConverter))] - public abstract class PhaseTarget : BaseSecuredObject - { - protected PhaseTarget() - { - } - - internal protected PhaseTarget( - Int32 type, - ISecuredObject securedObject) - : base(securedObject) - { - this.Type = type; - } - - protected PhaseTarget(Int32 type) - { - this.Type = type; - } - - /// - /// The type of the target. - /// - /// - /// for valid phase target types. - /// - [DataMember] - public Int32 Type { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/PhaseTargetJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/PhaseTargetJsonConverter.cs deleted file mode 100644 index 25e8bd117..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/PhaseTargetJsonConverter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - internal sealed class PhaseTargetJsonConverter : TypePropertyJsonConverter - { - protected override PhaseTarget GetInstance(Type objectType) - { - if (objectType == typeof(AgentPoolQueueTarget)) - { - return new AgentPoolQueueTarget(); - } - else if (objectType == typeof(ServerTarget)) - { - return new ServerTarget(); - } - else - { - return base.GetInstance(objectType); - } - } - - protected override PhaseTarget GetInstance(Int32 targetType) - { - switch (targetType) - { - case PhaseTargetType.Agent: - return new AgentPoolQueueTarget(); - case PhaseTargetType.Server: - return new ServerTarget(); - default: - return null; - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/PropertyValue.cs b/src/Sdk/BuildWebApi/Api/Contracts/PropertyValue.cs deleted file mode 100644 index 060bf3eee..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/PropertyValue.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - // TODO: remove this before dev16 ships. leaving it in for the dev15 cycle to avoid any issues - [Obsolete("This contract is not used by any product code")] - [EditorBrowsable(EditorBrowsableState.Never)] - [DataContract] - public sealed class PropertyValue - { - /// - /// Name in the name value mapping - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String PropertyName { get; set; } - - /// - /// Value in the name value mapping - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Object Value { get; set; } - - /// - /// Guid of identity that changed this property value - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Guid? ChangedBy { get; set; } - - /// - /// The date this property value was changed - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public DateTime? ChangedDate { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/PullRequest.cs b/src/Sdk/BuildWebApi/Api/Contracts/PullRequest.cs deleted file mode 100644 index 8929a7538..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/PullRequest.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a pull request object. These are retrieved from Source Providers. - /// - [DataContract] - public class PullRequest: BaseSecuredObject - { - public PullRequest() - { - this.Links = new ReferenceLinks(); - } - - internal PullRequest( - ISecuredObject securedObject) - : base(securedObject) - { - this.Links = new ReferenceLinks(); - } - - /// - /// The name of the provider this pull request is associated with. - /// - [DataMember] - public String ProviderName { get; set; } - - /// - /// Unique identifier for the pull request - /// - [DataMember(EmitDefaultValue = false)] - public String Id { get; set; } - - /// - /// Title of the pull request. - /// - [DataMember(EmitDefaultValue = false)] - public String Title { get; set; } - - /// - /// Description for the pull request. - /// - [DataMember(EmitDefaultValue = false)] - public String Description { get; set; } - - /// - /// Current state of the pull request, e.g. open, merged, closed, conflicts, etc. - /// - [DataMember(EmitDefaultValue = false)] - public String CurrentState { get; set; } - - /// - /// Author of the pull request. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef Author { get; set; } - - /// - /// Owner of the source repository of this pull request - /// - [DataMember(EmitDefaultValue = false)] - public String SourceRepositoryOwner { get; set; } - - /// - /// Source branch ref of this pull request - /// - [DataMember(EmitDefaultValue = false)] - public String SourceBranchRef { get; set; } - - /// - /// Owner of the target repository of this pull request - /// - [DataMember(EmitDefaultValue = false)] - public String TargetRepositoryOwner { get; set; } - - /// - /// Target branch ref of this pull request - /// - [DataMember(EmitDefaultValue = false)] - public String TargetBranchRef { get; set; } - - /// - /// The links to other objects related to this object. - /// - [DataMember(Name = "_links", EmitDefaultValue = false)] - public ReferenceLinks Links { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/RepositoryWebhook.cs b/src/Sdk/BuildWebApi/Api/Contracts/RepositoryWebhook.cs deleted file mode 100644 index 1dd5be4a4..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/RepositoryWebhook.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a repository's webhook returned from a source provider. - /// - [DataContract] - public class RepositoryWebhook - { - /// - /// The types of triggers the webhook was created for. - /// - public List Types - { - get - { - if (m_types == null) - { - m_types = new List(); - } - - return m_types; - } - set - { - m_types = value; - } - } - - /// - /// The friendly name of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Name { get; set; } - - /// - /// The URL of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Url { get; set; } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedTypes, ref m_types, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_types, ref m_serializedTypes); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedTypes = null; - } - - [DataMember(Name = nameof(Types), EmitDefaultValue = false)] - private List m_serializedTypes; - - private List m_types; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/RequestShallowReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/RequestShallowReference.cs deleted file mode 100644 index c32ea4c39..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/RequestShallowReference.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - // TODO: remove this before dev16 ships. leaving it in for the dev15 cycle to avoid any issues - [Obsolete("This contract is not used by any product code")] - [DataContract] - public class RequestReference - { - /// - /// Id of the resource - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Int32 Id { get; set; } - - /// - /// Full http link to the resource - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Url { get; set; } - - /// - /// Name of the requestor - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public IdentityRef RequestedFor { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/RetentionPolicy.cs b/src/Sdk/BuildWebApi/Api/Contracts/RetentionPolicy.cs deleted file mode 100644 index 58d20bc20..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/RetentionPolicy.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a retention policy for a build definition. - /// - [DataContract] - public class RetentionPolicy : BaseSecuredObject - { - public RetentionPolicy() - : this(null) - { - } - - public RetentionPolicy( - ISecuredObject securedObject) - : base(securedObject) - { - DaysToKeep = 30; // default to 30 days - MinimumToKeep = 1; // default to 1 - DeleteBuildRecord = true; // default to set Deleted bit on build records - DeleteTestResults = false; // For old build definitions, it has to be false. This value in New Definitions will be handled in ts files. - } - - /// - /// The list of branches affected by the retention policy. - /// - public List Branches - { - get - { - if (m_branches == null) - { - m_branches = new List(); - } - - return m_branches; - } - internal set - { - m_branches = value; - } - } - - /// - /// The number of days to keep builds. - /// - [DataMember] - public Int32 DaysToKeep - { - get - { - return m_daysToKeep; - } - - set - { - if (value < 0) - { - m_daysToKeep = 0; - } - else - { - m_daysToKeep = value; - } - } - } - - /// - /// The minimum number of builds to keep. - /// - [DataMember] - public Int32 MinimumToKeep - { - get - { - return m_minimumToKeep; - } - set - { - if (value < 0) - { - m_minimumToKeep = 0; - } - else - { - m_minimumToKeep = value; - } - } - } - - /// - /// Indicates whether the build record itself should be deleted. - /// - [DataMember] - public Boolean DeleteBuildRecord - { - get; - set; - } - - /// - /// The list of artifacts to delete. - /// - public List ArtifactsToDelete - { - get - { - if (m_artifactsToDelete == null) - { - m_artifactsToDelete = new List(); - } - - return m_artifactsToDelete; - } - internal set - { - m_artifactsToDelete = value; - } - } - - // This list contains the types of artifacts to be deleted. - // These are different from ArtifactsToDelete because for certain artifacts giving user a choice for every single artifact can become cumbersome. - // e.g. artifacts in file share - user can choose to delete/keep all the artifacts in file share - /// - /// The list of types of artifacts to delete. - /// - public List ArtifactTypesToDelete - { - get - { - if (m_artifactTypesToDelete == null) - { - m_artifactTypesToDelete = new List(); - } - - return m_artifactTypesToDelete; - } - internal set - { - m_artifactTypesToDelete = value; - } - } - - /// - /// Indicates whether to delete test results associated with the build. - /// - [DataMember] - public Boolean DeleteTestResults - { - get; - set; - } - - [DataMember(Name = "Branches", EmitDefaultValue = false)] - private List m_branches; - - [DataMember(Name = "Artifacts", EmitDefaultValue = false)] - private List m_artifactsToDelete; - - [DataMember(Name = "ArtifactTypesToDelete", EmitDefaultValue = false)] - private List m_artifactTypesToDelete; - - private Int32 m_daysToKeep; - private Int32 m_minimumToKeep; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Schedule.cs b/src/Sdk/BuildWebApi/Api/Contracts/Schedule.cs deleted file mode 100644 index df912f204..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Schedule.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - [EditorBrowsable(EditorBrowsableState.Never)] - [DataContract] - public sealed class Schedule : BaseSecuredObject - { - public Schedule() - { - } - - internal Schedule( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Time zone of the build schedule (String representation of the time zone ID) - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String TimeZoneId { get; set; } - - /// - /// Local timezone hour to start - /// - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public Int32 StartHours { get; set; } - - /// - /// Local timezone minute to start - /// - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public Int32 StartMinutes { get; set; } - - /// - /// Days for a build (flags enum for days of the week) - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public ScheduleDays DaysToBuild { get; set; } - - //TODO: We should be able to remove the ScheduleJobId field in tbl_Definition - /// - /// The Job Id of the Scheduled job that will queue the scheduled build. - /// Since a single trigger can have multiple schedules and we want a single job - /// to process a single schedule (since each schedule has a list of branches - /// to build), the schedule itself needs to define the Job Id. - /// This value will be filled in when a definition is added or updated. The UI - /// does not provide it or use it. - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Guid ScheduleJobId { get; set; } - - /// - /// Branches that the schedule affects - /// - public List BranchFilters - { - get - { - if (m_branchFilters == null) - { - m_branchFilters = new List(); - } - - return m_branchFilters; - } - internal set - { - m_branchFilters = value; - } - } - - /// - /// Flag to determine if this schedule should only build if the associated - /// source has been changed. - /// - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool ScheduleOnlyWithChanges { get; set; } - - [DataMember(Name = "BranchFilters", EmitDefaultValue = false)] - private List m_branchFilters; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/ServerTarget.cs b/src/Sdk/BuildWebApi/Api/Contracts/ServerTarget.cs deleted file mode 100644 index 6b218c828..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/ServerTarget.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a phase target that runs on the server. - /// - [DataContract] - public class ServerTarget : PhaseTarget - { - public ServerTarget() - : base(PhaseTargetType.Server) - { - } - - internal ServerTarget( - ISecuredObject securedObject) - : base(PhaseTargetType.Server, securedObject) - { - } - - /// - /// The execution options. - /// - [DataMember] - public ServerTargetExecutionOptions ExecutionOptions - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptions.cs deleted file mode 100644 index fe26b9628..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptions.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; -using Newtonsoft.Json; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents options for running a phase on the server. - /// - [DataContract] - [KnownType(typeof(VariableMultipliersServerExecutionOptions))] - [JsonConverter(typeof(ServerTargetExecutionOptionsJsonConverter))] - public class ServerTargetExecutionOptions : BaseSecuredObject - { - public ServerTargetExecutionOptions() - : this(ServerTargetExecutionType.Normal) - { - } - - protected ServerTargetExecutionOptions(Int32 type) - : this(type, null) - { - } - - internal ServerTargetExecutionOptions( - ISecuredObject securedObject) - : this(ServerTargetExecutionType.Normal, securedObject) - { - } - - internal ServerTargetExecutionOptions( - Int32 type, - ISecuredObject securedObject) - : base(securedObject) - { - this.Type = type; - } - - /// - /// The type. - /// - /// - /// for supported types. - /// - [DataMember(EmitDefaultValue = true)] - public Int32 Type - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptionsJsonConverter.cs b/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptionsJsonConverter.cs deleted file mode 100644 index 9f2249a15..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/ServerTargetExecutionOptionsJsonConverter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - internal sealed class ServerTargetExecutionOptionsJsonConverter : TypePropertyJsonConverter - { - protected override ServerTargetExecutionOptions GetInstance(Type objectType) - { - if (objectType == typeof(ServerTargetExecutionType)) - { - return new ServerTargetExecutionOptions(); - } - else if (objectType == typeof(VariableMultipliersServerExecutionOptions)) - { - return new VariableMultipliersServerExecutionOptions(); - } - else - { - return base.GetInstance(objectType); - } - } - - protected override ServerTargetExecutionOptions GetInstance(Int32 targetType) - { - switch (targetType) - { - case ServerTargetExecutionType.Normal: - return new ServerTargetExecutionOptions(); - case ServerTargetExecutionType.VariableMultipliers: - return new VariableMultipliersServerExecutionOptions(); - default: - return null; - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/ShallowReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/ShallowReference.cs deleted file mode 100644 index 97e50d89a..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/ShallowReference.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// An abstracted reference to some other resource. This class is used to provide the build - /// data contracts with a uniform way to reference other resources in a way that provides easy - /// traversal through links. - /// - [Obsolete("Use one of the specific References instead.")] - [EditorBrowsable(EditorBrowsableState.Never)] - [DataContract] - public class ShallowReference // TODO: this class is here to maintain binary compat with VS 15 RTW, and should be deleted before dev16 ships - { - /// - /// Id of the resource - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Int32 Id { get; set; } - - /// - /// Name of the linked resource (definition name, controller name, etc.) - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Name { get; set; } - - /// - /// Full http link to the resource - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String Url { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/SourceProviderAttributes.cs b/src/Sdk/BuildWebApi/Api/Contracts/SourceProviderAttributes.cs deleted file mode 100644 index 33c8d20ad..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/SourceProviderAttributes.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public class SourceProviderAttributes - { - /// - /// The name of the source provider. - /// - [DataMember] - public string Name - { - get; - set; - } - - /// - /// The types of triggers supported by this source provider. - /// - [DataMember(EmitDefaultValue = false)] - public IList SupportedTriggers - { - get; - set; - } - - /// - /// The capabilities supported by this source provider. - /// - [DataMember(EmitDefaultValue = false)] - public IDictionary SupportedCapabilities - { - get; - set; - } - - /// - /// The environments where this source provider is available. - /// - [IgnoreDataMember] - public SourceProviderAvailability Availability - { - get; - set; - } - - /// - /// Whether the repository type is external to TFS / VSTS servers - /// - [IgnoreDataMember] - public bool IsExternal - { - get; - set; - } - - #region Server-side convenience properties - [IgnoreDataMember] - public bool SupportsSourceLinks => SupportedCapabilities != null && SupportedCapabilities.TryGetValue(SourceProviderCapabilities.SourceLinks, out bool supported) && supported; - - [IgnoreDataMember] - public bool SupportsYamlDefinition => SupportedCapabilities != null && SupportedCapabilities.TryGetValue(SourceProviderCapabilities.YamlDefinition, out bool supported) && supported; - - [IgnoreDataMember] - public DefinitionTriggerType SupportedTriggerTypes => SupportedTriggers?.Select(t => t.Type).Aggregate(DefinitionTriggerType.None, (x, y) => x | y) ?? DefinitionTriggerType.None; - #endregion - } - - [DataContract] - public class SupportedTrigger - { - /// - /// The type of trigger. - /// - [DataMember] - public DefinitionTriggerType Type { get; set; } - - /// - /// How the trigger is notified of changes. - /// - /// - /// See for supported values. - /// - [DataMember] - public string NotificationType { get; set; } - - /// - /// The default interval to wait between polls (only relevant when is ). - /// - [DataMember] - public int DefaultPollingInterval { get; set; } - - /// - /// The capabilities supported by this trigger. - /// - [DataMember(EmitDefaultValue = false)] - public IDictionary SupportedCapabilities - { - get; - set; - } - } - - [DataContract] - public enum SupportLevel - { - /// - /// The functionality is not supported. - /// - [EnumMember] - Unsupported, - - /// - /// The functionality is supported. - /// - [EnumMember] - Supported, - - /// - /// The functionality is required. - /// - [EnumMember] - Required - } - - [DataContract] - public enum SourceProviderAvailability - { - /// - /// The source provider is available in the hosted environment. - /// - [EnumMember] - Hosted = 1, - - /// - /// The source provider is available in the on-premises environment. - /// - [EnumMember] - OnPremises = 2, - - /// - /// The source provider is available in all environments. - /// - [EnumMember] - All = Hosted | OnPremises - } - - public class SourceProviderCapabilities - { - public const string CreateLabel = "createLabel"; - public const string QueryBranches = "queryBranches"; - public const string QueryFileContents = "queryFileContents"; - public const string QueryPathContents = "queryPathContents"; - public const string QueryPullRequest = "queryPullRequest"; - public const string QueryRelatedWorkItems = "queryRelatedWorkItems"; - public const string QueryRepositories = "queryRepositories"; - public const string QueryTopRepositories = "queryTopRepositories"; - public const string QueryWebhooks = "queryWebhooks"; - public const string SourceLinks = "sourceLinks"; - public const string YamlDefinition = "yamlDefinition"; - } - - public class TriggerCapabilities - { - public const string BranchFilters = "branchFilters"; - public const string PathFilters = "pathFilters"; - public const string BatchChanges = "batchChanges"; - public const string BuildForks = "buildForks"; - public const string Comments = "comments"; - } - - public class TriggerNotificationTypes - { - public const string None = "none"; - public const string Polling = "polling"; - public const string Webhook = "webhook"; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/SourceRelatedWorkItem.cs b/src/Sdk/BuildWebApi/Api/Contracts/SourceRelatedWorkItem.cs deleted file mode 100644 index 0e3c713ff..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/SourceRelatedWorkItem.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a work item related to some source item. - /// These are retrieved from Source Providers. - /// - [DataContract] - public class SourceRelatedWorkItem : BaseSecuredObject - { - public SourceRelatedWorkItem() - { - } - - internal SourceRelatedWorkItem( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The name of the provider the work item is associated with. - /// - [DataMember] - public String ProviderName { get; set; } - - /// - /// Unique identifier for the work item - /// - [DataMember(EmitDefaultValue = false)] - public String Id { get; set; } - - /// - /// Short name for the work item. - /// - [DataMember(EmitDefaultValue = false)] - public String Title { get; set; } - - /// - /// Long description for the work item. - /// - [DataMember(EmitDefaultValue = false)] - public String Description { get; set; } - - /// - /// Type of work item, e.g. Bug, Task, User Story, etc. - /// - [DataMember(EmitDefaultValue = false)] - public String Type { get; set; } - - /// - /// Current state of the work item, e.g. Active, Resolved, Closed, etc. - /// - [DataMember(EmitDefaultValue = false)] - public String CurrentState { get; set; } - - /// - /// Identity ref for the person that the work item is assigned to. - /// - [DataMember(EmitDefaultValue = false)] - public IdentityRef AssignedTo { get; set; } - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/SourceRepository.cs b/src/Sdk/BuildWebApi/Api/Contracts/SourceRepository.cs deleted file mode 100644 index 1e5aca892..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/SourceRepository.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a repository returned from a source provider. - /// - [DataContract] - public class SourceRepository - { - /// - /// The ID of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Id - { - get; - set; - } - - /// - /// The name of the source provider the repository is from. - /// - [DataMember] - public String SourceProviderName - { - get; - set; - } - - /// - /// The friendly name of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The full name of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String FullName - { - get; - set; - } - - /// - /// The URL of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Url - { - get; - set; - } - - /// - /// The name of the default branch. - /// - [DataMember(EmitDefaultValue = false)] - public String DefaultBranch - { - get; - set; - } - - // TODO: Remove the Properties property. It mainly serves as an area to put provider API URLs that are - // passed back to the VSTS API so it does not need to construct provider API URLs. This is risky and we - // should form the URLs ourselves instead of trusting the client. - - /// - /// A dictionary that holds additional information about the repository. - /// - public IDictionary Properties - { - // Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember" - // If it's ever made a "DataMember" please be cautious, we would be leaking secrets - get - { - if (m_properties == null) - { - m_properties = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_properties; - } - internal set - { - m_properties = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedProperties, ref m_properties, StringComparer.OrdinalIgnoreCase, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_properties, ref m_serializedProperties, StringComparer.OrdinalIgnoreCase); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedProperties = null; - } - - [DataMember(Name = "Properties", EmitDefaultValue = false)] - private IDictionary m_serializedProperties; - - // Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember" - // If it's ever made a "DataMember" please be cautious, we would be leaking secrets - private IDictionary m_properties; - } - - /// - /// A set of repositories returned from the source provider. - /// - [DataContract] - public class SourceRepositories - { - /// - /// A list of repositories - /// - [DataMember] - public List Repositories - { - get; - set; - } - - /// - /// A token used to continue this paged request; 'null' if the request is complete - /// - [DataMember] - public String ContinuationToken - { - get; - set; - } - - /// - /// The number of repositories requested for each page - /// - [DataMember] - public Int32 PageLength - { - get; - set; - } - - /// - /// The total number of pages, or '-1' if unknown - /// - [DataMember] - public Int32 TotalPageCount - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/SourceRepositoryItem.cs b/src/Sdk/BuildWebApi/Api/Contracts/SourceRepositoryItem.cs deleted file mode 100644 index 851ac2e39..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/SourceRepositoryItem.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an item in a repository from a source provider. - /// - [DataContract] - public class SourceRepositoryItem - { - /// - /// The type of the item (folder, file, etc). - /// - [DataMember(EmitDefaultValue = false)] - public String Type { get; set; } - - /// - /// Whether the item is able to have sub-items (e.g., is a folder). - /// - [DataMember] - public Boolean IsContainer { get; set; } - - /// - /// The full path of the item, relative to the root of the repository. - /// - [DataMember(EmitDefaultValue = false)] - public String Path { get; set; } - - /// - /// The URL of the item. - /// - [DataMember(EmitDefaultValue = false)] - public Uri Url { get; set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/SvnWorkspace.cs b/src/Sdk/BuildWebApi/Api/Contracts/SvnWorkspace.cs deleted file mode 100644 index 84bae7ec3..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/SvnWorkspace.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a Subversion mapping entry. - /// - [DataContract] - public class SvnMappingDetails - { - /// - /// The server path. - /// - [DataMember(Name = "serverPath")] - public String ServerPath - { - get; - set; - } - - /// - /// The local path. - /// - [DataMember(Name = "localPath")] - public String LocalPath - { - get; - set; - } - - /// - /// The revision. - /// - [DataMember(Name = "revision")] - public String Revision - { - get; - set; - } - - /// - /// The depth. - /// - [DataMember(Name = "depth")] - public Int32 Depth - { - get; - set; - } - - /// - /// Indicates whether to ignore externals. - /// - [DataMember(Name = "ignoreExternals")] - public bool IgnoreExternals - { - get; - set; - } - } - - /// - /// Represents a subversion workspace. - /// - [DataContract] - public class SvnWorkspace - { - /// - /// The list of mappings. - /// - public List Mappings - { - get - { - if (m_Mappings == null) - { - m_Mappings = new List(); - } - return m_Mappings; - } - } - - [DataMember(Name = "mappings")] - private List m_Mappings; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TaskAgentPoolReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/TaskAgentPoolReference.cs deleted file mode 100644 index bc1ce0c4f..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TaskAgentPoolReference.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to an agent pool. - /// - [DataContract] - public class TaskAgentPoolReference : BaseSecuredObject - { - public TaskAgentPoolReference() - { - } - - public TaskAgentPoolReference(Int32 id) - : this(id, null) - { - } - - internal TaskAgentPoolReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - internal TaskAgentPoolReference( - Int32 id, - ISecuredObject securedObject) - : base(securedObject) - { - this.Id = id; - } - - /// - /// The pool ID. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Id - { - get; - set; - } - - /// - /// The pool name. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// A value indicating whether or not this pool is managed by the service. - /// - [DataMember(EmitDefaultValue = false)] - public Boolean IsHosted - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanGroupReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanGroupReference.cs deleted file mode 100644 index 25fa80c29..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanGroupReference.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a plan group. - /// - [DataContract] - public class TaskOrchestrationPlanGroupReference - { - /// - /// The project ID. - /// - [DataMember] - public Guid ProjectId - { - get; set; - } - - /// - /// The name of the plan group. - /// - [DataMember] - public String PlanGroup - { - get; set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanReference.cs deleted file mode 100644 index a8c7e3c19..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TaskOrchestrationPlanReference.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to an orchestration plan. - /// - [DataContract] - public class TaskOrchestrationPlanReference : BaseSecuredObject - { - public TaskOrchestrationPlanReference() - { - OrchestrationType = BuildOrchestrationType.Build; - } - - internal TaskOrchestrationPlanReference( - ISecuredObject securedObject) - : base(securedObject) - { - OrchestrationType = BuildOrchestrationType.Build; - } - - /// - /// The ID of the plan. - /// - [DataMember] - public Guid PlanId - { - get; - set; - } - - /// - /// The type of the plan. - /// - /// - /// for supported types. - /// - [DefaultValue(BuildOrchestrationType.Build)] - [DataMember(EmitDefaultValue = false)] - public Int32? OrchestrationType - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TaskReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/TaskReference.cs deleted file mode 100644 index 3522d34dc..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TaskReference.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a task. - /// - [DataContract] - public class TaskReference : BaseSecuredObject - { - public TaskReference() - { - } - - public TaskReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - protected TaskReference( - TaskReference taskToBeCloned) - : base(taskToBeCloned) - { - this.Id = taskToBeCloned.Id; - this.Name = taskToBeCloned.Name; - this.Version = taskToBeCloned.Version; - } - - /// - /// The ID of the task definition. - /// - [DataMember] - public Guid Id - { - get; - set; - } - - /// - /// The name of the task definition. - /// - [DataMember] - public String Name - { - get; - set; - } - - /// - /// The version of the task definition. - /// - [DataMember] - public String Version - { - get; - set; - } - - /// - /// Clones this object. - /// - /// - public virtual TaskReference Clone() - { - return new TaskReference(this); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/Timeline.cs b/src/Sdk/BuildWebApi/Api/Contracts/Timeline.cs deleted file mode 100644 index 7cb78b098..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/Timeline.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents the timeline of a build. - /// - [DataContract] - public sealed class Timeline : TimelineReference - { - internal Timeline() - { - } - - internal Timeline( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The process or person that last changed the timeline. - /// - [DataMember] - public Guid LastChangedBy - { - get; - internal set; - } - - /// - /// The time the timeline was last changed. - /// - [DataMember] - public DateTime LastChangedOn - { - get; - internal set; - } - - /// - /// The list of records in this timeline. - /// - public List Records - { - get - { - if (m_records == null) - { - m_records = new List(); - } - return m_records; - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - if (m_serializedRecords != null && m_serializedRecords.Count > 0) - { - m_records = new List(m_serializedRecords); - m_serializedRecords = null; - } - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - if (m_records != null && m_records.Count > 0) - { - m_serializedRecords = new List(m_records); - } - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedRecords = null; - } - - private List m_records; - - [DataMember(Name = "Records", EmitDefaultValue = false)] - private List m_serializedRecords; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TimelineAttempt.cs b/src/Sdk/BuildWebApi/Api/Contracts/TimelineAttempt.cs deleted file mode 100644 index b0131f77b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TimelineAttempt.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public sealed class TimelineAttempt : BaseSecuredObject - { - public TimelineAttempt() - { - } - - internal TimelineAttempt( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// Gets or sets the attempt of the record. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Attempt - { - get; - set; - } - - /// - /// Gets or sets the timeline identifier which owns the record representing this attempt. - /// - [DataMember(EmitDefaultValue = false)] - public Guid TimelineId - { - get; - set; - } - - /// - /// Gets or sets the record identifier located within the specified timeline. - /// - [DataMember(EmitDefaultValue = false)] - public Guid RecordId - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TimelineRecord.cs b/src/Sdk/BuildWebApi/Api/Contracts/TimelineRecord.cs deleted file mode 100644 index 8a2205d99..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TimelineRecord.cs +++ /dev/null @@ -1,309 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents an entry in a build's timeline. - /// - [DataContract] - public sealed class TimelineRecord : BaseSecuredObject - { - public TimelineRecord() - { - } - - internal TimelineRecord( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the record. - /// - [DataMember] - public Guid Id - { - get; - set; - } - - /// - /// The ID of the record's parent. - /// - [DataMember] - public Guid? ParentId - { - get; - set; - } - - /// - /// The type of the record. - /// - [DataMember(Name = "Type")] - public String RecordType - { - get; - set; - } - - /// - /// The name. - /// - [DataMember] - public String Name - { - get; - set; - } - - /// - /// The start time. - /// - [DataMember] - public DateTime? StartTime - { - get; - set; - } - - /// - /// The finish time. - /// - [DataMember] - public DateTime? FinishTime - { - get; - set; - } - - /// - /// A string that indicates the current operation. - /// - [DataMember] - public String CurrentOperation - { - get; - set; - } - - /// - /// The current completion percentage. - /// - [DataMember] - public Int32? PercentComplete - { - get; - set; - } - - /// - /// The state of the record. - /// - [DataMember] - public TimelineRecordState? State - { - get; - set; - } - - /// - /// The result. - /// - [DataMember] - public TaskResult? Result - { - get; - set; - } - - /// - /// The result code. - /// - [DataMember] - public String ResultCode - { - get; - set; - } - - /// - /// The change ID. - /// - /// - /// This is a monotonically-increasing number used to ensure consistency in the UI. - /// - [DataMember] - public Int32 ChangeId - { - get; - set; - } - - /// - /// The time the record was last modified. - /// - [DataMember] - public DateTime LastModified - { - get; - set; - } - - /// - /// The name of the agent running the operation. - /// - [DataMember] - public String WorkerName - { - get; - set; - } - - /// - /// An ordinal value relative to other records. - /// - [DataMember(EmitDefaultValue = false)] - public Int32? Order - { - get; - set; - } - - /// - /// A reference to a sub-timeline. - /// - [DataMember] - public TimelineReference Details - { - get; - set; - } - - /// - /// The number of errors produced by this operation. - /// - [DataMember] - public Int32? ErrorCount - { - get; - set; - } - - /// - /// The number of warnings produced by this operation. - /// - [DataMember] - public Int32? WarningCount - { - get; - set; - } - - /// - /// The list of issues produced by this operation. - /// - public List Issues - { - get - { - if (m_issues == null) - { - m_issues = new List(); - } - return m_issues; - } - } - - /// - /// The REST URL of the timeline record. - /// - [DataMember] - public Uri Url - { - get; - set; - } - - /// - /// A reference to the log produced by this operation. - /// - [DataMember] - public BuildLogReference Log - { - get; - set; - } - - /// - /// A reference to the task represented by this timeline record. - /// - [DataMember] - public TaskReference Task - { - get; - set; - } - - /// - /// Attempt number of record. - /// - [DataMember] - public Int32 Attempt - { - get; - set; - } - - /// - /// String identifier that is consistent across attempts. - /// - [DataMember] - public String Identifier - { - get; - set; - } - - public IList PreviousAttempts - { - get - { - if (m_previousAttempts == null) - { - m_previousAttempts = new List(); - } - return m_previousAttempts; - } - } - - - /// - /// The links to other objects related to this object. - /// - public ReferenceLinks Links - { - get - { - if (m_links == null) - { - m_links = new ReferenceLinks(); - } - return m_links; - } - } - - [DataMember(Name = "_links", EmitDefaultValue = false)] - private ReferenceLinks m_links; - - [DataMember(Name = "Issues", EmitDefaultValue = false, Order = 60)] - private List m_issues; - - [DataMember(Name = "PreviousAttempts", EmitDefaultValue = false)] - private List m_previousAttempts; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/TimelineReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/TimelineReference.cs deleted file mode 100644 index 2ba50efd9..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/TimelineReference.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a timeline. - /// - [DataContract] - public class TimelineReference : BaseSecuredObject - { - internal TimelineReference() - { - } - - internal TimelineReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the timeline. - /// - [DataMember(Order = 1)] - public Guid Id - { - get; - internal set; - } - - /// - /// The change ID. - /// - /// - /// This is a monotonically-increasing number used to ensure consistency in the UI. - /// - [DataMember(Order = 2)] - public Int32 ChangeId - { - get; - internal set; - } - - /// - /// The REST URL of the timeline. - /// - [DataMember(Order = 3)] - public String Url - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/VariableGroup.cs b/src/Sdk/BuildWebApi/Api/Contracts/VariableGroup.cs deleted file mode 100644 index 0e463e40e..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/VariableGroup.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a variable group. - /// - [DataContract] - public class VariableGroup : VariableGroupReference - { - public VariableGroup() - : this(null) - { - } - - internal VariableGroup( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The type of the variable group. - /// - [DataMember(EmitDefaultValue = false)] - public String Type - { - get; - set; - } - - /// - /// The name of the variable group. - /// - [DataMember(EmitDefaultValue = false)] - public String Name - { - get; - set; - } - - /// - /// The description. - /// - [DataMember(EmitDefaultValue = false)] - public String Description - { - get; - set; - } - - /// - /// The variables in this group. - /// - public IDictionary Variables - { - get - { - if (m_variables == null) - { - m_variables = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - return m_variables; - } - internal set - { - m_variables = new Dictionary(value, StringComparer.OrdinalIgnoreCase); - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase); - } - - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - m_serializedVariables = null; - } - - [DataMember(Name = "Variables", EmitDefaultValue = false)] - private IDictionary m_serializedVariables; - - private IDictionary m_variables; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/VariableGroupReference.cs b/src/Sdk/BuildWebApi/Api/Contracts/VariableGroupReference.cs deleted file mode 100644 index b6f3f8f1d..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/VariableGroupReference.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a reference to a variable group. - /// - [DataContract] - public class VariableGroupReference : BaseSecuredObject - { - public VariableGroupReference() - : this(null) - { - } - - internal VariableGroupReference( - ISecuredObject securedObject) - : base(securedObject) - { - } - - /// - /// The ID of the variable group. - /// - [DataMember(EmitDefaultValue = false)] - public Int32 Id - { - get; - set; - } - - /// - /// The Name of the variable group. - /// - [DataMember(EmitDefaultValue = false)] - public String Alias - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersAgentExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersAgentExecutionOptions.cs deleted file mode 100644 index d325d3db8..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersAgentExecutionOptions.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents options for running a phase based on values specified by a list of variables. - /// - [DataContract] - public class VariableMultipliersAgentExecutionOptions : AgentTargetExecutionOptions, IVariableMultiplierExecutionOptions - { - public VariableMultipliersAgentExecutionOptions() - : base(AgentTargetExecutionType.VariableMultipliers) - { - } - - internal VariableMultipliersAgentExecutionOptions( - ISecuredObject securedObject) - : base(AgentTargetExecutionType.VariableMultipliers, securedObject) - { - MaxConcurrency = 1; - ContinueOnError = false; - } - - /// - /// The maximum number of agents to use in parallel. - /// - [DataMember(EmitDefaultValue=true)] - [DefaultValue(1)] - public Int32 MaxConcurrency { - get; - set; - } - - /// - /// Indicates whether failure on one agent should prevent the phase from running on other agents. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean ContinueOnError - { - get; - set; - } - - /// - /// The list of variables used to determine the matrix of phases to run. - /// - public List Multipliers - { - get - { - if (m_multipliers == null) - { - m_multipliers = new List(); - } - return m_multipliers; - } - set - { - m_multipliers = value; - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedMultipliers, ref m_multipliers, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_multipliers, ref m_serializedMultipliers); - } - - [DataMember(Name = "Multipliers", EmitDefaultValue = false)] - private List m_serializedMultipliers; - - private List m_multipliers; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersServerExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersServerExecutionOptions.cs deleted file mode 100644 index 505c570e6..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/VariableMultipliersServerExecutionOptions.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents options for running a phase based on values specified by a list of variables. - /// - [DataContract] - public class VariableMultipliersServerExecutionOptions : ServerTargetExecutionOptions, IVariableMultiplierExecutionOptions - { - public VariableMultipliersServerExecutionOptions() - : this(null) - { - } - - internal VariableMultipliersServerExecutionOptions( - ISecuredObject securedObject) - : base(ServerTargetExecutionType.VariableMultipliers, securedObject) - { - MaxConcurrency = 1; - ContinueOnError = false; - } - - /// - /// The maximum number of server jobs to run in parallel. - /// - [DataMember(EmitDefaultValue = true)] - [DefaultValue(1)] - public Int32 MaxConcurrency { - get; - set; - } - - /// - /// Indicates whether failure of one job should prevent the phase from running in other jobs. - /// - [DataMember(EmitDefaultValue = true)] - public Boolean ContinueOnError - { - get; - set; - } - - /// - /// The list of variables used to determine the matrix of phases to run. - /// - public List Multipliers - { - get - { - if (m_multipliers == null) - { - m_multipliers = new List(); - } - return m_multipliers; - } - set - { - m_multipliers = new List(value); - } - } - - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - SerializationHelper.Copy(ref m_serializedMultipliers, ref m_multipliers, true); - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - SerializationHelper.Copy(ref m_multipliers, ref m_serializedMultipliers); - } - - [DataMember(Name = "Multipliers", EmitDefaultValue = false)] - private List m_serializedMultipliers; - - private List m_multipliers; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/WorkspaceTemplate.cs b/src/Sdk/BuildWebApi/Api/Contracts/WorkspaceTemplate.cs deleted file mode 100644 index 06831b63b..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/WorkspaceTemplate.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - [EditorBrowsable(EditorBrowsableState.Never)] - [DataContract] - public sealed class WorkspaceTemplate - { - /// - /// Uri of the associated definition - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String DefinitionUri - { - get; - set; - } - - /// - /// List of workspace mappings - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public List Mappings - { - get; - set; - } - - /// - /// The last time this template was modified - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public DateTime LastModifiedDate - { - get; - set; - } - - /// - /// The identity that last modified this template - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String LastModifiedBy - { - get; - set; - } - - /// - /// Id of the workspace for this template - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - internal Int32 WorkspaceId - { - get; - set; - } - - } - - /// - /// Mapping for a workspace - /// - [EditorBrowsable(EditorBrowsableState.Never)] - [DataContract] - public sealed class WorkspaceMapping - { - /// - /// Server location of the definition - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String ServerItem - { - get; - set; - } - - /// - /// local location of the definition - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public String LocalItem - { - get; - set; - } - - /// - /// type of workspace mapping - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public WorkspaceMappingType MappingType - { - get; - set; - } - - /// - /// Depth of this mapping - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - public Int32 Depth - { - get; - set; - } - - /// - /// Uri of the associated definition - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - internal String DefinitionUri - { - get; - set; - } - - /// - /// Id of the workspace - /// - [DataMember(IsRequired = false, EmitDefaultValue = false)] - internal Int32 WorkspaceId - { - get; - set; - } - - public override String ToString() - { - return String.Format(System.Globalization.CultureInfo.InvariantCulture, - "[WorkspaceMapping ServerItem={0} LocalItem={1} MappingType={2} Depth={3}]", - ServerItem, - LocalItem, - MappingType, - Depth); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Contracts/YamlProcess.cs b/src/Sdk/BuildWebApi/Api/Contracts/YamlProcess.cs deleted file mode 100644 index f10ae8e03..000000000 --- a/src/Sdk/BuildWebApi/Api/Contracts/YamlProcess.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi -{ - /// - /// Represents a YAML process. - /// - [DataContract] - public class YamlProcess : BuildProcess - { - public YamlProcess() - : this(null) - { - } - - internal YamlProcess( - ISecuredObject securedObject) - : base(ProcessType.Yaml, securedObject) - { - } - - /// - /// The resources used by the build definition. - /// - [DataMember(EmitDefaultValue = false)] - public BuildProcessResources Resources - { - get; - set; - } - - /// - /// The list of errors encountered when reading the YAML definition. - /// - public IList Errors - { - get - { - if (m_errors == null) - { - m_errors = new List(); - } - return m_errors; - } - set - { - m_errors = new List(value); - } - } - - /// - /// The YAML filename. - /// - [DataMember] - public String YamlFilename - { - get; - set; - } - - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - if (m_errors?.Count == 0) - { - m_errors = null; - } - } - - [DataMember(Name = "Errors", EmitDefaultValue = false)] - private List m_errors; - } -} diff --git a/src/Sdk/BuildWebApi/Api/DefinitionMetrics.cs b/src/Sdk/BuildWebApi/Api/DefinitionMetrics.cs deleted file mode 100644 index 49b5ce45d..000000000 --- a/src/Sdk/BuildWebApi/Api/DefinitionMetrics.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class DefinitionMetrics - { - // historic metrics - public const String SuccessfulBuilds = "SuccessfulBuilds"; - public const String FailedBuilds = "FailedBuilds"; - public const String PartiallySuccessfulBuilds = "PartiallySuccessfulBuilds"; - public const String CanceledBuilds = "CanceledBuilds"; - public const String TotalBuilds = "TotalBuilds"; - - // current metrics - scopeddate null - public const String CurrentBuildsInQueue = "CurrentBuildsInQueue"; - public const String CurrentBuildsInProgress = "CurrentBuildsInProgress"; - } - - [Obsolete("Use DefinitionMetrics instead.")] - public static class WellKnownDefinitionMetrics - { - // historic metrics - public const String SuccessfulBuilds = DefinitionMetrics.SuccessfulBuilds; - public const String FailedBuilds = DefinitionMetrics.FailedBuilds; - public const String PartiallySuccessfulBuilds = DefinitionMetrics.PartiallySuccessfulBuilds; - public const String CanceledBuilds = DefinitionMetrics.CanceledBuilds; - public const String TotalBuilds = DefinitionMetrics.TotalBuilds; - - // current metrics - scopeddate null - public const String CurrentBuildsInQueue = DefinitionMetrics.CurrentBuildsInQueue; - public const String CurrentBuildsInProgress = DefinitionMetrics.CurrentBuildsInProgress; - } -} diff --git a/src/Sdk/BuildWebApi/Api/DefinitionReferenceJsonConverter.cs b/src/Sdk/BuildWebApi/Api/DefinitionReferenceJsonConverter.cs deleted file mode 100644 index 9f0caa2a7..000000000 --- a/src/Sdk/BuildWebApi/Api/DefinitionReferenceJsonConverter.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Reflection; -using GitHub.Build.WebApi.Internals; -using GitHub.Services.WebApi; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; - -namespace GitHub.Build.WebApi -{ - internal sealed class DefinitionReferenceJsonConverter : VssSecureJsonConverter - { - public override Boolean CanConvert(Type objectType) - { - return typeof(DefinitionReference).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - public override Boolean CanWrite - { - get - { - return false; - } - } - - public override Object ReadJson( - JsonReader reader, - Type objectType, - Object existingValue, - JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - Object newValue = null; - - if (objectType == typeof(BuildDefinition)) - { - newValue = new BuildDefinition(); - } - else if (objectType == typeof(BuildDefinition3_2)) - { - newValue = new BuildDefinition3_2(); - } - else if (objectType == typeof(BuildDefinitionReference)) - { - newValue = new BuildDefinitionReference(); - } - - JObject value = JObject.Load(reader); - - if (newValue == null) - { - var contract = serializer.ContractResolver.ResolveContract(objectType) as JsonObjectContract; - if (contract == null) - { - return existingValue; - } - - JsonProperty property = contract.Properties.GetClosestMatchProperty("Type"); - if (property == null) - { - return existingValue; - } - - JToken definitionTypeValue; - DefinitionType definitionType = DefinitionType.Build; - if (value.TryGetValue(property.PropertyName, out definitionTypeValue)) - { - if (definitionTypeValue.Type == JTokenType.Integer) - { - definitionType = (DefinitionType)(Int32)definitionTypeValue; - } - else if (definitionTypeValue.Type != JTokenType.String || - !Enum.TryParse((String)definitionTypeValue, true, out definitionType)) - { - definitionType = DefinitionType.Build; - } - } - - switch (definitionType) - { - case DefinitionType.Build: - default: // this is build2, after all - newValue = new BuildDefinition(); - break; - } - } - - if (value != null) - { - using (JsonReader objectReader = value.CreateReader()) - { - serializer.Populate(objectReader, newValue); - } - } - - return newValue; - } - - public override void WriteJson( - JsonWriter writer, - Object value, - JsonSerializer serializer) - { - // The virtual method returns false for CanWrite so this should never be invoked - throw new NotSupportedException(); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/EndpointData.cs b/src/Sdk/BuildWebApi/Api/EndpointData.cs deleted file mode 100644 index 691af7001..000000000 --- a/src/Sdk/BuildWebApi/Api/EndpointData.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - public static class EndpointData - { - public const string AcceptUntrustedCertificates = "acceptUntrustedCerts"; - public const string CheckoutNestedSubmodules = "checkoutNestedSubmodules"; - public const string CheckoutSubmodules = "checkoutSubmodules"; - public const string Clean = "clean"; - public const string CleanOptions = "cleanOptions"; - public const string DefaultBranch = "defaultBranch"; - public const string FetchDepth = "fetchDepth"; - public const string GitLfsSupport = "gitLfsSupport"; - public const string JenkinsAcceptUntrustedCertificates = "acceptUntrustedCerts"; - public const string OnPremTfsGit = "onpremtfsgit"; - public const string Password = "password"; - public const string RepositoryId = "repositoryId"; - public const string RootFolder = "rootFolder"; - public const string SkipSyncSource = "skipSyncSource"; - public const string SvnAcceptUntrustedCertificates = "acceptUntrustedCerts"; - public const string SvnRealmName = "realmName"; - public const string SvnWorkspaceMapping = "svnWorkspaceMapping"; - public const string TfvcWorkspaceMapping = "tfvcWorkspaceMapping"; - public const string Username = "username"; - } - - [Obsolete("Use EndpointData instead.")] - public static class WellKnownEndpointData - { - public const string CheckoutNestedSubmodules = EndpointData.CheckoutNestedSubmodules; - public const string CheckoutSubmodules = EndpointData.CheckoutSubmodules; - public const string Clean = EndpointData.Clean; - public const string CleanOptions = EndpointData.CleanOptions; - public const string DefaultBranch = EndpointData.DefaultBranch; - public const string FetchDepth = EndpointData.FetchDepth; - public const string GitLfsSupport = EndpointData.GitLfsSupport; - public const string JenkinsAcceptUntrustedCertificates = EndpointData.JenkinsAcceptUntrustedCertificates; - public const string OnPremTfsGit = EndpointData.OnPremTfsGit; - public const string Password = EndpointData.Password; - public const string RepositoryId = EndpointData.RepositoryId; - public const string RootFolder = EndpointData.RootFolder; - public const string SkipSyncSource = EndpointData.SkipSyncSource; - public const string SvnAcceptUntrustedCertificates = EndpointData.SvnAcceptUntrustedCertificates; - public const string SvnRealmName = EndpointData.SvnRealmName; - public const string SvnWorkspaceMapping = EndpointData.SvnWorkspaceMapping; - public const string TfvcWorkspaceMapping = EndpointData.TfvcWorkspaceMapping; - public const string Username = EndpointData.Username; - public const string AcceptUntrustedCertificates = EndpointData.AcceptUntrustedCertificates; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Enumerations.cs b/src/Sdk/BuildWebApi/Api/Enumerations.cs deleted file mode 100644 index 0e835dc69..000000000 --- a/src/Sdk/BuildWebApi/Api/Enumerations.cs +++ /dev/null @@ -1,855 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public enum AgentStatus - { - /// - /// Indicates that the build agent cannot be contacted. - /// - [EnumMember] - Unavailable = 0, - - /// - /// Indicates that the build agent is currently available. - /// - [EnumMember] - Available = 1, - - /// - /// Indicates that the build agent has taken itself offline. - /// - [EnumMember] - Offline = 2, - } - - [DataContract] - public enum AuditAction - { - [EnumMember] - Add = 1, - [EnumMember] - Update = 2, - [EnumMember] - Delete = 3 - } - - /// - /// Represents the desired scope of authorization for a build. - /// - [DataContract] - public enum BuildAuthorizationScope - { - /// - /// The identity used should have build service account permissions scoped to the project collection. This is - /// useful when resources for a single build are spread across multiple projects. - /// - [EnumMember] - ProjectCollection = 1, - - /// - /// The identity used should have build service account permissions scoped to the project in which the build - /// definition resides. This is useful for isolation of build jobs to a particular team project to avoid any - /// unintentional escalation of privilege attacks during a build. - /// - [EnumMember] - Project = 2, - } - - [DataContract] - public enum BuildOptionInputType - { - [EnumMember] - String, - [EnumMember] - Boolean, - [EnumMember] - StringList, - [EnumMember] - Radio, - [EnumMember] - PickList, - [EnumMember] - MultiLine, - [EnumMember] - BranchFilter - } - - [DataContract] - public enum BuildPhaseStatus - { - /// - /// The state is not known. - /// - [EnumMember] - Unknown = 0, - - /// - /// The build phase completed unsuccessfully. - /// - [EnumMember] - Failed = 1, - - /// - /// The build phase completed successfully. - /// - [EnumMember] - Succeeded = 2, - } - - /// - /// Specifies the desired ordering of builds. - /// - [DataContract] - public enum BuildQueryOrder - { - /// - /// Order by finish time ascending. - /// - [EnumMember] - FinishTimeAscending = 2, - - /// - /// Order by finish time descending. - /// - [EnumMember] - FinishTimeDescending = 3, - - /// - /// Order by queue time descending. - /// - [EnumMember] - QueueTimeDescending = 4, - - /// - /// Order by queue time ascending. - /// - [EnumMember] - QueueTimeAscending = 5, - - /// - /// Order by start time descending. - /// - [EnumMember] - StartTimeDescending = 6, - - /// - /// Order by start time ascending. - /// - [EnumMember] - StartTimeAscending = 7 - } - - /// - /// Specifies the desired ordering of definitions. - /// - [DataContract] - public enum DefinitionQueryOrder - { - /// - /// No order - /// - [EnumMember] - None = 0, - - /// - /// Order by created on/last modified time ascending. - /// - [EnumMember] - LastModifiedAscending = 1, - - /// - /// Order by created on/last modified time descending. - /// - [EnumMember] - LastModifiedDescending = 2, - - /// - /// Order by definition name ascending. - /// - [EnumMember] - DefinitionNameAscending = 3, - - /// - /// Order by definition name descending. - /// - [EnumMember] - DefinitionNameDescending = 4 - } - - /// - /// Specifies the desired ordering of folders. - /// - [DataContract] - public enum FolderQueryOrder - { - /// - /// No order - /// - [EnumMember] - None = 0, - - /// - /// Order by folder name and path ascending. - /// - [EnumMember] - FolderAscending = 1, - - /// - /// Order by folder name and path descending. - /// - [EnumMember] - FolderDescending = 2 - } - - [DataContract] - public enum BuildReason - { - /// - /// No reason. This value should not be used. - /// - [EnumMember] - None = 0, - - /// - /// The build was started manually. - /// - [EnumMember] - Manual = 1, - - /// - /// The build was started for the trigger TriggerType.ContinuousIntegration. - /// - [EnumMember] - IndividualCI = 2, - - /// - /// The build was started for the trigger TriggerType.BatchedContinuousIntegration. - /// - [EnumMember] - BatchedCI = 4, - - /// - /// The build was started for the trigger TriggerType.Schedule. - /// - [EnumMember] - Schedule = 8, - - /// - /// The build was started for the trigger TriggerType.ScheduleForced. - /// - [EnumMember] - ScheduleForced = 16, - - /// - /// The build was created by a user. - /// - [EnumMember] - UserCreated = 32, - - /// - /// The build was started manually for private validation. - /// - [EnumMember] - ValidateShelveset = 64, - - /// - /// The build was started for the trigger ContinuousIntegrationType.Gated. - /// - [EnumMember] - CheckInShelveset = 128, - - /// - /// The build was started by a pull request. - /// Added in resource version 3. - /// - [EnumMember] - PullRequest = 256, - - /// - /// The build was started when another build completed. - /// - [EnumMember] - BuildCompletion = 512, - - /// - /// The build was triggered for retention policy purposes. - /// - [EnumMember] - Triggered = Manual | IndividualCI | BatchedCI | Schedule | UserCreated | CheckInShelveset | PullRequest | BuildCompletion, - - /// - /// All reasons. - /// - [EnumMember] - All = Manual | IndividualCI | BatchedCI | Schedule | UserCreated | ValidateShelveset | CheckInShelveset | PullRequest | BuildCompletion, - } - - /// - /// This is not a Flags enum because we don't want to set multiple statuses on a build. - /// However, when adding values, please stick to powers of 2 as if it were a Flags enum - /// This will ensure that things that key off multiple result types (like labelling sources) continue to work - /// - [DataContract] - public enum BuildResult - { - /// - /// No result - /// - [EnumMember] - None = 0, - - /// - /// The build completed successfully. - /// - [EnumMember] - Succeeded = 2, - - /// - /// The build completed compilation successfully but had other errors. - /// - [EnumMember] - PartiallySucceeded = 4, - - /// - /// The build completed unsuccessfully. - /// - [EnumMember] - Failed = 8, - - /// - /// The build was canceled before starting. - /// - [EnumMember] - Canceled = 32 - } - - [DataContract] - public enum BuildStatus - { - /// - /// No status. - /// - [EnumMember] - None = 0, - - /// - /// The build is currently in progress. - /// - [EnumMember] - InProgress = 1, - - /// - /// The build has completed. - /// - [EnumMember] - Completed = 2, - - /// - /// The build is cancelling - /// - [EnumMember] - Cancelling = 4, - - /// - /// The build is inactive in the queue. - /// - [EnumMember] - Postponed = 8, - - /// - /// The build has not yet started. - /// - [EnumMember] - NotStarted = 32, - - /// - /// All status. - /// - [EnumMember] - All = 47, - } - - [DataContract] - public enum ControllerStatus - { - /// - /// Indicates that the build controller cannot be contacted. - /// - [EnumMember] - Unavailable = 0, - - /// - /// Indicates that the build controller is currently available. - /// - [EnumMember] - Available = 1, - - /// - /// Indicates that the build controller has taken itself offline. - /// - [EnumMember] - Offline = 2, - } - - [DataContract] - public enum DefinitionType - { - [EnumMember] - Xaml = 1, - [EnumMember] - Build = 2 - - } - - [DataContract] - public enum DefinitionQuality - { - [EnumMember] - Definition = 1, - [EnumMember] - Draft = 2 - } - - [DataContract] - public enum GetOption - { - /// - /// Use the latest changeset at the time the build is queued. - /// - [EnumMember] - LatestOnQueue = 0, - - /// - /// Use the latest changeset at the time the build is started. - /// - [EnumMember] - LatestOnBuild = 1, - - /// - /// A user-specified version has been supplied. - /// - [EnumMember] - Custom = 2, - } - - [DataContract] - public enum IssueType - { - [EnumMember] - Error = 1, - - [EnumMember] - Warning = 2 - } - - [DataContract] - public enum QueryDeletedOption - { - /// - /// Include only non-deleted builds. - /// - [EnumMember] - ExcludeDeleted = 0, - - /// - /// Include deleted and non-deleted builds. - /// - [EnumMember] - IncludeDeleted = 1, - - /// - /// Include only deleted builds. - /// - [EnumMember] - OnlyDeleted = 2 - } - - [DataContract] - public enum QueuePriority - { - /// - /// Low priority. - /// - [EnumMember] - Low = 5, - - /// - /// Below normal priority. - /// - [EnumMember] - BelowNormal = 4, - - /// - /// Normal priority. - /// - [EnumMember] - Normal = 3, - - /// - /// Above normal priority. - /// - [EnumMember] - AboveNormal = 2, - - /// - /// High priority. - /// - [EnumMember] - High = 1, - } - - [DataContract] - [Flags] - public enum QueueOptions - { - /// - /// No queue options - /// - [EnumMember] - None = 0, - - /// - /// Create a plan Id for the build, do not run it - /// - [EnumMember] - DoNotRun = 1 - } - - [DataContract] - public enum RepositoryCleanOptions - { - /// - /// Run git clean -fdx && git reset --hard or Tf /scorch on $(build.sourcesDirectory) - /// - [EnumMember] - Source, - - /// - /// Run git clean -fdx && git reset --hard or Tf /scorch on $(build.sourcesDirectory), also re-create $(build.binariesDirectory) - /// - [EnumMember] - SourceAndOutputDir, - - /// - /// Re-create $(build.sourcesDirectory) - /// - [EnumMember] - SourceDir, - - /// - /// Re-create $(agnet.buildDirectory) which contains $(build.sourcesDirectory), $(build.binariesDirectory) and any folders that left from previous build. - /// - [EnumMember] - AllBuildDir, - } - - [DataContract] - public enum ResultSet - { - /// - /// Include all repositories - /// - [EnumMember] - All = 0, - - /// - /// Include most relevant repositories for user - /// - [EnumMember] - Top = 1, - } - - [DataContract] - public enum ServiceHostStatus - { - /// - /// The service host is currently connected and accepting commands. - /// - [EnumMember] - Online = 1, - - /// - /// The service host is currently disconnected and not accepting commands. - /// - [EnumMember] - Offline = 2, - } - - [DataContract] - public enum TaskResult - { - [EnumMember] - Succeeded = 0, - - [EnumMember] - SucceededWithIssues = 1, - - [EnumMember] - Failed = 2, - - [EnumMember] - Canceled = 3, - - [EnumMember] - Skipped = 4, - - [EnumMember] - Abandoned = 5, - } - - [DataContract] - public enum TimelineRecordState - { - [EnumMember] - Pending, - - [EnumMember] - InProgress, - - [EnumMember] - Completed, - } - - [DataContract] - public enum DefinitionTriggerType - { - /// - /// Manual builds only. - /// - [EnumMember] - None = 1, - - /// - /// A build should be started for each changeset. - /// - [EnumMember] - ContinuousIntegration = 2, - - /// - /// A build should be started for multiple changesets at a time at a specified interval. - /// - [EnumMember] - BatchedContinuousIntegration = 4, - - /// - /// A build should be started on a specified schedule whether or not changesets exist. - /// - [EnumMember] - Schedule = 8, - - /// - /// A validation build should be started for each check-in. - /// - [EnumMember] - GatedCheckIn = 16, - - /// - /// A validation build should be started for each batch of check-ins. - /// - [EnumMember] - BatchedGatedCheckIn = 32, - - /// - /// A build should be triggered when a GitHub pull request is created or updated. - /// Added in resource version 3 - /// - [EnumMember] - PullRequest = 64, - - /// - /// A build should be triggered when another build completes. - /// - [EnumMember] - BuildCompletion = 128, - - /// - /// All types. - /// - [EnumMember] - All = None | ContinuousIntegration | BatchedContinuousIntegration | Schedule | GatedCheckIn | BatchedGatedCheckIn | PullRequest | BuildCompletion, - } - - [DataContract] - public enum DefinitionQueueStatus - { - /// - /// When enabled the definition queue allows builds to be queued by users, - /// the system will queue scheduled, gated and continuous integration builds, - /// and the queued builds will be started by the system. - /// - [EnumMember] - Enabled, - - /// - /// When paused the definition queue allows builds to be queued by users - /// and the system will queue scheduled, gated and continuous integration builds. - /// Builds in the queue will not be started by the system. - /// - [EnumMember] - Paused, - - /// - /// When disabled the definition queue will not allow builds to be queued by users - /// and the system will not queue scheduled, gated or continuous integration builds. - /// Builds already in the queue will not be started by the system. - /// - [EnumMember] - Disabled - } - - [DataContract] - public enum DeleteOptions - { - /// - /// No data should be deleted. This value should not be used. - /// - [EnumMember] - None = 0, - - /// - /// The drop location should be deleted. - /// - [EnumMember] - DropLocation = 1, - - /// - /// The test results should be deleted. - /// - [EnumMember] - TestResults = 2, - - /// - /// The version control label should be deleted. - /// - [EnumMember] - Label = 4, - - /// - /// The build should be deleted. - /// - [EnumMember] - Details = 8, - - /// - /// Published symbols should be deleted. - /// - [EnumMember] - Symbols = 16, - - /// - /// All data should be deleted. - /// - [EnumMember] - All = 31, - } - - [DataContract] - public enum ScheduleDays - { - /// - /// Do not run. - /// - [EnumMember] - None = 0, - - /// - /// Run on Monday. - /// - [EnumMember] - Monday = 1, - - /// - /// Run on Tuesday. - /// - [EnumMember] - Tuesday = 2, - - /// - /// Run on Wednesday. - /// - [EnumMember] - Wednesday = 4, - - /// - /// Run on Thursday. - /// - [EnumMember] - Thursday = 8, - - /// - /// Run on Friday. - /// - [EnumMember] - Friday = 16, - - /// - /// Run on Saturday. - /// - [EnumMember] - Saturday = 32, - - /// - /// Run on Sunday. - /// - [EnumMember] - Sunday = 64, - - /// - /// Run on all days of the week. - /// - [EnumMember] - All = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday, - } - - [DataContract] - public enum WorkspaceMappingType - { - /// - /// The path is mapped in the workspace. - /// - [EnumMember] - Map = 0, - - /// - /// The path is cloaked in the workspace. - /// - [EnumMember] - Cloak = 1, - } - - [DataContract] - public enum ProcessTemplateType - { - /// - /// Indicates a custom template. - /// - [EnumMember] - Custom = 0, - - /// - /// Indicates a default template. - /// - [EnumMember] - Default = 1, - - /// - /// Indicates an upgrade template. - /// - [EnumMember] - Upgrade = 2, - } - - [DataContract] - public enum ValidationResult - { - [EnumMember] - OK, - [EnumMember] - Warning, - [EnumMember] - Error - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildArtifactAddedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildArtifactAddedEvent.cs deleted file mode 100644 index a1392decd..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildArtifactAddedEvent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [Obsolete("Use BuildEvent instead.")] - public class BuildArtifactAddedEvent : BuildUpdatedEvent - { - public BuildArtifactAddedEvent( - Build build, - BuildArtifact artifact) - : base(build) - { - this.Artifact = artifact; - } - - [DataMember(IsRequired = true)] - public BuildArtifact Artifact - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildChangesCalculatedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildChangesCalculatedEvent.cs deleted file mode 100644 index bddcda88f..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildChangesCalculatedEvent.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [Obsolete("Use BuildEvent instead.")] - public class BuildChangesCalculatedEvent : BuildUpdatedEvent - { - public BuildChangesCalculatedEvent( - Build build, - List changes) - : base(build) - { - this.Changes = changes; - } - - [DataMember(IsRequired = true)] - public List Changes - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangedEvent.cs deleted file mode 100644 index fe750169d..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangedEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [Obsolete("No longer used")] - public class BuildDefinitionChangedEvent - { - public BuildDefinitionChangedEvent() - { - } - - public BuildDefinitionChangedEvent(AuditAction changeType, BuildDefinition definition) - { - Definition = definition; - ChangeType = changeType; - } - - [DataMember] - public BuildDefinition Definition - { - get; - set; - } - - [DataMember] - public AuditAction ChangeType - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangingEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangingEvent.cs deleted file mode 100644 index 961b6406b..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildDefinitionChangingEvent.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [Obsolete("No longer used")] - public class BuildDefinitionChangingEvent - { - public BuildDefinitionChangingEvent() - { - } - - public BuildDefinitionChangingEvent(AuditAction changeType, BuildDefinition originalDefinition, BuildDefinition newDefinition) - { - OriginalDefinition = originalDefinition; - NewDefinition = newDefinition; - ChangeType = changeType; - } - - [DataMember] - public BuildDefinition OriginalDefinition - { - get; - set; - } - - [DataMember] - public BuildDefinition NewDefinition - { - get; - set; - } - - [DataMember] - public AuditAction ChangeType - { - get; - set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildDeletedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildDeletedEvent.cs deleted file mode 100644 index 1ac20968b..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildDeletedEvent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public class BuildDeletedEvent : RealtimeBuildEvent - { - public BuildDeletedEvent(Build deletedBuild) - : base(deletedBuild.Id) - { - this.Build = deletedBuild; - } - - [DataMember(IsRequired = true)] - public Build Build - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildDestroyedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildDestroyedEvent.cs deleted file mode 100644 index c124dd7a1..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildDestroyedEvent.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [Obsolete("No longer used.")] - [DataContract] - public class BuildDestroyedEvent : RealtimeBuildEvent - { - public BuildDestroyedEvent(Build destroyedBuild) - : base(destroyedBuild.Id) - { - this.Build = destroyedBuild; - } - - [DataMember(IsRequired = true)] - public Build Build - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildEvent.cs deleted file mode 100644 index 717209f47..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildEvent.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [DataContract] - public sealed class BuildEvent - { - public BuildEvent( - String identifier) - : this(identifier, (String)null) - { - } - - public BuildEvent( - String identifier, - String data) - : this(identifier, new[] { data }) - { - Identifier = identifier; - if (data != null) - { - Data.Add(data); - } - } - - public BuildEvent( - String identifier, - IList data) - { - Identifier = identifier; - if (data != null && data.Count > 0) - { - Data.AddRange(data); - } - } - - [DataMember] - public String Identifier - { - get; - private set; - } - - public IList Data - { - get - { - if (m_data == null) - { - m_data = new List(); - } - return m_data; - } - } - - [DataMember(Name = "Data", EmitDefaultValue = false)] - private List m_data; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildEvents.cs b/src/Sdk/BuildWebApi/Api/Events/BuildEvents.cs deleted file mode 100644 index da7845836..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class BuildEvents - { - public const String ArtifactAdded = "artifactAdded"; - public const String BuildUpdated = "buildUpdated"; - public const String ChangesCalculated = "changesCalculated"; - public const String ConsoleLinesReceived = "consoleLinesReceived"; - public const String StagesUpdated = "stagesUpdated"; - public const String TagsAdded = "tagsAdded"; - public const String TimelineRecordsUpdated = "timelineRecordsUpdated"; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildPollingSummaryEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildPollingSummaryEvent.cs deleted file mode 100644 index be9ddd1b5..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildPollingSummaryEvent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - [Obsolete("No longer used")] - public class BuildPollingSummaryEvent - { - public BuildPollingSummaryEvent(Dictionary ciData) - { - m_ciData = ciData; - } - - public Dictionary CIData - { - get { return m_ciData; } - } - - private Dictionary m_ciData; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildQueuedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildQueuedEvent.cs deleted file mode 100644 index 4f474f679..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildQueuedEvent.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - public class BuildQueuedEvent : BuildUpdatedEvent - { - public BuildQueuedEvent(Build build) - : base(build) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildStartedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildStartedEvent.cs deleted file mode 100644 index b97c810a7..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildStartedEvent.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [Obsolete("No longer used.")] - public class BuildStartedEvent : BuildUpdatedEvent - { - public BuildStartedEvent(Build build) - : base(build) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildTagsAddedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildTagsAddedEvent.cs deleted file mode 100644 index c3613d0ba..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildTagsAddedEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - public class BuildTagsAddedEvent : BuildUpdatedEvent - { - public BuildTagsAddedEvent(Build build, List allTags, List newTags) - : base(build) - { - this.AllTags = allTags; - this.NewTags = newTags; - } - - [DataMember(IsRequired = true)] - public List AllTags - { - get; - private set; - } - - [DataMember(IsRequired = true)] - public List NewTags - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildUpdatedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildUpdatedEvent.cs deleted file mode 100644 index 1cae031b6..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildUpdatedEvent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public class BuildUpdatedEvent : RealtimeBuildEvent - { - public BuildUpdatedEvent(Build build) - : base(build.Id) - { - this.Build = build; - } - - [DataMember(IsRequired = true)] - public Build Build - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/BuildsDeletedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/BuildsDeletedEvent.cs deleted file mode 100644 index f4958f1d5..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/BuildsDeletedEvent.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - public class BuildsDeletedEvent : BuildsDeletedEvent1 - { - } - - // trying this out to avoid future compat issues. - // the idea is to keep this around when we create BuildsDeletedEvent2, and make BuildsDeletedEvent inherit from BuildsDeletedEvent2 instead of BuildsDeletedEvent1 - // then, when we publish to service bus, we can send BuildsDeletedEvent1 explicitly along with BuildsDeletedEvent - [DataContract] - [ServiceEventObject] - [EditorBrowsable(EditorBrowsableState.Never)] - public class BuildsDeletedEvent1 - { - /// - /// The ID of the project. - /// - [DataMember] - public Guid ProjectId - { - get; - set; - } - - /// - /// The ID of the definition. - /// - [DataMember] - public Int32 DefinitionId - { - get; - set; - } - - /// - /// The IDs of the builds that were deleted. - /// - public List BuildIds - { - get - { - if (m_buildIds == null) - { - m_buildIds = new List(); - } - - return m_buildIds; - } - } - - [DataMember(Name = "BuildIds")] - private List m_buildIds; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/ConsoleLogEvent.cs b/src/Sdk/BuildWebApi/Api/Events/ConsoleLogEvent.cs deleted file mode 100644 index 8201e6936..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/ConsoleLogEvent.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public sealed class ConsoleLogEvent : RealtimeBuildEvent - { - public ConsoleLogEvent( - Int32 buildId, - Guid timelineId, - Guid jobTimelineRecordId, - IEnumerable lines) - : this(buildId, timelineId, jobTimelineRecordId, Guid.Empty, lines) - { - } - - public ConsoleLogEvent( - Int32 buildId, - Guid timelineId, - Guid jobTimelineRecordId, - Guid stepTimelineRecordId, - IEnumerable lines) - : base(buildId) - { - this.TimelineId = timelineId; - this.TimelineRecordId = jobTimelineRecordId; - this.StepRecordId = stepTimelineRecordId; - m_lines = new List(lines); - } - - [DataMember(IsRequired = true)] - public Guid TimelineId - { - get; - private set; - } - - [DataMember(IsRequired = true)] - public Guid TimelineRecordId - { - get; - private set; - } - - [DataMember(IsRequired = false)] - public Guid StepRecordId - { - get; - private set; - } - - public List Lines - { - get - { - if (m_lines == null) - { - m_lines = new List(); - } - return m_lines; - } - } - - [DataMember(Name = "Lines")] - private List m_lines; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/RealTimeBuildEvent.cs b/src/Sdk/BuildWebApi/Api/Events/RealTimeBuildEvent.cs deleted file mode 100644 index 357ca3092..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/RealTimeBuildEvent.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public abstract class RealtimeBuildEvent - { - protected RealtimeBuildEvent(Int32 buildId) - { - this.BuildId = buildId; - } - - [DataMember(IsRequired = true)] - public Int32 BuildId - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/SyncBuildCompletedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/SyncBuildCompletedEvent.cs deleted file mode 100644 index 63483bf06..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/SyncBuildCompletedEvent.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("No longer used.")] - public class SyncBuildCompletedEvent : BuildUpdatedEvent - { - internal SyncBuildCompletedEvent(Build build) - : base(build) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/SyncBuildStartedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/SyncBuildStartedEvent.cs deleted file mode 100644 index a5629dc0d..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/SyncBuildStartedEvent.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.Serialization; -using GitHub.Services.WebApi; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - [ServiceEventObject] - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("No longer used.")] - public class SyncBuildStartedEvent : BuildUpdatedEvent - { - internal SyncBuildStartedEvent(Build build) - : base(build) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/TaskOrchestrationPlanGroupsStartedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/TaskOrchestrationPlanGroupsStartedEvent.cs deleted file mode 100644 index 7fd4b6d6c..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/TaskOrchestrationPlanGroupsStartedEvent.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public class TaskOrchestrationPlanGroupsStartedEvent - { - public TaskOrchestrationPlanGroupsStartedEvent(IList planGroups) - { - this.PlanGroups = planGroups; - } - - [DataMember(IsRequired = true)] - public IList PlanGroups { get; private set; } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Events/TimelineRecordsUpdatedEvent.cs b/src/Sdk/BuildWebApi/Api/Events/TimelineRecordsUpdatedEvent.cs deleted file mode 100644 index 605a3cab5..000000000 --- a/src/Sdk/BuildWebApi/Api/Events/TimelineRecordsUpdatedEvent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace GitHub.Build.WebApi.Events -{ - [DataContract] - public class TimelineRecordsUpdatedEvent : RealtimeBuildEvent - { - public TimelineRecordsUpdatedEvent( - Int32 buildId, - IEnumerable records) - : base(buildId) - { - this.TimelineRecords = records; - } - - [DataMember(IsRequired = true)] - public IEnumerable TimelineRecords - { - get; - private set; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Exceptions.cs b/src/Sdk/BuildWebApi/Api/Exceptions.cs deleted file mode 100644 index 2aab92154..000000000 --- a/src/Sdk/BuildWebApi/Api/Exceptions.cs +++ /dev/null @@ -1,1632 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [Serializable] - [ExceptionMapping("0.0", "3.0", "AccessDeniedException", "GitHub.Build.WebApi.AccessDeniedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class AccessDeniedException : VssServiceException - { - public AccessDeniedException(String message) - : base(message) - { - } - public AccessDeniedException(String message, Exception ex) - : base(message, ex) - { - } - - protected AccessDeniedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildException", "GitHub.Build.WebApi.BuildException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildException : VssServiceException - { - public BuildException(String message) - : base(message) - { - } - - public BuildException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "AgentsNotFoundException", "GitHub.Build.WebApi.AgentsNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class AgentsNotFoundException : BuildException - { - public AgentsNotFoundException(String message) - : base(message) - { - } - - public AgentsNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected AgentsNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ArtifactExistsException", "GitHub.Build.WebApi.ArtifactExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ArtifactExistsException : BuildException - { - public ArtifactExistsException(String message) - : base(message) - { - } - - public ArtifactExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected ArtifactExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ArtifactNotFoundException", "GitHub.Build.WebApi.ArtifactNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ArtifactNotFoundException : BuildException - { - public ArtifactNotFoundException(String message) - : base(message) - { - } - - public ArtifactNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected ArtifactNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ArtifactTypeNotSupportedException", "GitHub.Build.WebApi.ArtifactTypeNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ArtifactTypeNotSupportedException : BuildException - { - public ArtifactTypeNotSupportedException(String message) - : base(message) - { - } - - public ArtifactTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected ArtifactTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BranchNotFoundException", "GitHub.Build.WebApi.BranchNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BranchNotFoundException : BuildException - { - public BranchNotFoundException(String message) - : base(message) - { - } - - public BranchNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected BranchNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildControllerNotFoundException", "GitHub.Build.WebApi.BuildControllerNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildControllerNotFoundException : BuildException - { - public BuildControllerNotFoundException(String message) - : base(message) - { - } - - public BuildControllerNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildControllerNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class BuildEventNotFoundException : BuildException - { - public BuildEventNotFoundException(String message) - : base(message) - { - } - - public BuildEventNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildEventNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class BuildEventPermissionException : BuildException - { - public BuildEventPermissionException(String message) - : base(message) - { - } - - public BuildEventPermissionException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildEventPermissionException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildExistsException", "GitHub.Build.WebApi.BuildExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildExistsException : BuildException - { - public BuildExistsException(String message) - : base(message) - { - } - - public BuildExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildLogNotFoundException", "GitHub.Build.WebApi.BuildLogNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildLogNotFoundException : BuildException - { - public BuildLogNotFoundException(String message) - : base(message) - { - } - - public BuildLogNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildLogNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildNotFoundException", "GitHub.Build.WebApi.BuildNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildNotFoundException : BuildException - { - public BuildNotFoundException(String message) - : base(message) - { - } - - public BuildNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildNumberFormatException", "GitHub.Build.WebApi.BuildNumberFormatException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildNumberFormatException : BuildException - { - public BuildNumberFormatException(String message) - : base(message) - { - } - - public BuildNumberFormatException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildNumberFormatException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildOptionNotSupportedException", "GitHub.Build.WebApi.BuildOptionNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildOptionNotSupportedException : BuildException - { - public BuildOptionNotSupportedException(String message) - : base(message) - { - } - - public BuildOptionNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildOptionNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildRepositoryTypeNotSupportedException", "GitHub.Build.WebApi.BuildRepositoryTypeNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildRepositoryTypeNotSupportedException : BuildException - { - public BuildRepositoryTypeNotSupportedException(String message) - : base(message) - { - } - - public BuildRepositoryTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildRepositoryTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildRequestValidationFailedException", "GitHub.Build.WebApi.BuildRequestValidationFailedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildRequestValidationFailedException : BuildException - { - public BuildRequestValidationFailedException(String message) - : base(message) - { - } - - public BuildRequestValidationFailedException(String message, Exception ex) - : base(message, ex) - { - } - - public BuildRequestValidationFailedException(String message, List validationResults) - : base(message) - { - ValidationResults.AddRange(validationResults); - } - - protected BuildRequestValidationFailedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - m_validationResults = (List)info.GetValue("ValidationResults", typeof(List)); - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("ValidationResults", ValidationResults); - } - - [DataMember(Name = "ValidationResults", EmitDefaultValue = false)] - public List ValidationResults - { - get - { - if (m_validationResults == null) - { - m_validationResults = new List(); - } - return m_validationResults; - } - private set - { - m_validationResults = value; - } - } - - private List m_validationResults; - } - - [Serializable] - [ExceptionMapping("0.0", "4.1", "BuildRequestValidationFailedException", "GitHub.Build.WebApi.BuildRequestValidationFailedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildRequestValidationWarningException : BuildException - { - public BuildRequestValidationWarningException(String message) - : base(message) - { - } - - public BuildRequestValidationWarningException(String message, Exception ex) - : base(message, ex) - { - } - - public BuildRequestValidationWarningException(String message, List validationResults) - : base(message) - { - ValidationResults.AddRange(validationResults); - } - - protected BuildRequestValidationWarningException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - m_validationResults = (List)info.GetValue("ValidationResults", typeof(List)); - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("ValidationResults", ValidationResults); - } - - [DataMember(Name = "ValidationResults", EmitDefaultValue = false)] - public List ValidationResults - { - get - { - if (m_validationResults == null) - { - m_validationResults = new List(); - } - return m_validationResults; - } - private set - { - m_validationResults = value; - } - } - - private List m_validationResults; - } - - [Serializable] - public class BuildEventStatusInvalidChangeException : BuildException - { - public BuildEventStatusInvalidChangeException(String message) - : base(message) - { - } - - public BuildEventStatusInvalidChangeException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildEventStatusInvalidChangeException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "BuildStatusInvalidChangeException", "GitHub.Build.WebApi.BuildStatusInvalidChangeException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class BuildStatusInvalidChangeException : BuildException - { - public BuildStatusInvalidChangeException(String message) - : base(message) - { - } - - public BuildStatusInvalidChangeException(String message, Exception ex) - : base(message, ex) - { - } - - protected BuildStatusInvalidChangeException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "CannotDeleteRetainedBuildException", "GitHub.Build.WebApi.CannotDeleteRetainedBuildException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class CannotDeleteRetainedBuildException : BuildException - { - public CannotDeleteRetainedBuildException(String message) - : base(message) - { - } - - public CannotDeleteRetainedBuildException(String message, IReadOnlyList buildIds) - : base(message) - { - RetainedBuildIds = buildIds; - } - - public CannotDeleteRetainedBuildException(String message, Exception ex) - : base(message, ex) - { - } - - protected CannotDeleteRetainedBuildException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - - [DataMember(EmitDefaultValue = false)] - public IReadOnlyList RetainedBuildIds { get; } - } - - [Serializable] - public class CouldNotRetrieveSourceVersionDisplayUrlException : BuildException - { - public CouldNotRetrieveSourceVersionDisplayUrlException(String message) - : base(message) - { - } - - public CouldNotRetrieveSourceVersionDisplayUrlException(String message, Exception ex) - : base(message, ex) - { - } - - protected CouldNotRetrieveSourceVersionDisplayUrlException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionDisabledException", "GitHub.Build.WebApi.DefinitionDisabledException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionDisabledException : BuildException - { - public DefinitionDisabledException(String message) - : base(message) - { - } - - public DefinitionDisabledException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionDisabledException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionExistsException", "GitHub.Build.WebApi.DefinitionExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionExistsException : BuildException - { - public DefinitionExistsException(String message) - : base(message) - { - } - - public DefinitionExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class FolderExistsException : BuildException - { - public FolderExistsException(String message) - : base(message) - { - } - - public FolderExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected FolderExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class FolderNotFoundException : BuildException - { - public FolderNotFoundException(String message) - : base(message) - { - } - - public FolderNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected FolderNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionNotFoundException", "GitHub.Build.WebApi.DefinitionNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionNotFoundException : BuildException - { - public DefinitionNotFoundException(String message) - : base(message) - { - } - - public DefinitionNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionNotMatchedException", "GitHub.Build.WebApi.DefinitionNotMatchedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionNotMatchedException : BuildException - { - public DefinitionNotMatchedException(String message) - : base(message) - { - } - - public DefinitionNotMatchedException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionNotMatchedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionTemplateExistsException", "GitHub.Build.WebApi.DefinitionTemplateExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionTemplateExistsException : BuildException - { - public DefinitionTemplateExistsException(String message) - : base(message) - { - } - - public DefinitionTemplateExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionTemplateExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionTemplateNotFoundException", "GitHub.Build.WebApi.DefinitionTemplateNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionTemplateNotFoundException : BuildException - { - public DefinitionTemplateNotFoundException(String message) - : base(message) - { - } - - public DefinitionTemplateNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionTemplateNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionTypeNotSupportedException", "GitHub.Build.WebApi.DefinitionTypeNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionTypeNotSupportedException : BuildException - { - public DefinitionTypeNotSupportedException(String message) - : base(message) - { - } - - public DefinitionTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DuplicateBuildSpecException", "GitHub.Build.WebApi.DuplicateBuildSpecException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DuplicateBuildSpecException : BuildException - { - public DuplicateBuildSpecException(String message) - : base(message) - { - } - - public DuplicateBuildSpecException(String message, Exception ex) - : base(message, ex) - { - } - - protected DuplicateBuildSpecException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class EndpointAccessDeniedException : BuildException - { - public EndpointAccessDeniedException(String message) - : base(message) - { - } - - public EndpointAccessDeniedException(String message, Exception ex) - : base(message, ex) - { - } - - protected EndpointAccessDeniedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class ExternalSourceProviderException : BuildException - { - public ExternalSourceProviderException(String message) - : base(message) - { - } - - public ExternalSourceProviderException(String message, Exception ex) - : base(message, ex) - { - } - - protected ExternalSourceProviderException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class SecureFileAccessDeniedException : BuildException - { - public SecureFileAccessDeniedException(String message) - : base(message) - { - } - - public SecureFileAccessDeniedException(String message, Exception ex) - : base(message, ex) - { - } - - protected SecureFileAccessDeniedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidArtifactDataException", "GitHub.Build.WebApi.InvalidArtifactDataException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidArtifactDataException : BuildException - { - public InvalidArtifactDataException(String message) - : base(message) - { - } - - public InvalidArtifactDataException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidArtifactDataException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidBuildException", "GitHub.Build.WebApi.InvalidBuildException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidBuildException : BuildException - { - public InvalidBuildException(String message) - : base(message) - { - } - - public InvalidBuildException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidBuildException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidBuildQueryException", "GitHub.Build.WebApi.InvalidBuildQueryException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidBuildQueryException : BuildException - { - public InvalidBuildQueryException(String message) - : base(message) - { - } - - public InvalidBuildQueryException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidBuildQueryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidContinuationTokenException : BuildException - { - public InvalidContinuationTokenException(String message) - : base(message) - { - } - - public InvalidContinuationTokenException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidContinuationTokenException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidDefinitionException : BuildException - { - public InvalidDefinitionException(String message) - : base(message) - { - } - - public InvalidDefinitionException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidDefinitionException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class CannotDeleteDefinitionWithRetainedBuildsException : BuildException - { - public CannotDeleteDefinitionWithRetainedBuildsException(String message) - : base(message) - { - } - - public CannotDeleteDefinitionWithRetainedBuildsException(String message, Exception ex) - : base(message, ex) - { - } - - protected CannotDeleteDefinitionWithRetainedBuildsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class CannotRestoreDeletedDraftWithoutRestoringParentException : BuildException - { - public CannotRestoreDeletedDraftWithoutRestoringParentException(String message) - : base(message) - { - } - - public CannotRestoreDeletedDraftWithoutRestoringParentException(String message, Exception ex) - : base(message, ex) - { - } - - protected CannotRestoreDeletedDraftWithoutRestoringParentException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidFolderException : BuildException - { - public InvalidFolderException(String message) - : base(message) - { - } - - public InvalidFolderException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidFolderException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidDefinitionQueryException", "GitHub.Build.WebApi.InvalidDefinitionQueryException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidDefinitionQueryException : BuildException - { - public InvalidDefinitionQueryException(String message) - : base(message) - { - } - - public InvalidDefinitionQueryException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidDefinitionQueryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidFolderQueryException : BuildException - { - public InvalidFolderQueryException(String message) - : base(message) - { - } - - public InvalidFolderQueryException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidFolderQueryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidEndpointUrlException : BuildException - { - public InvalidEndpointUrlException(String message) - : base(message) - { - } - - public InvalidEndpointUrlException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidEndpointUrlException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidLogLocationException", "GitHub.Build.WebApi.InvalidLogLocationException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidLogLocationException : BuildException - { - public InvalidLogLocationException(String message) - : base(message) - { - } - - public InvalidLogLocationException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidLogLocationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidProjectException", "GitHub.Build.WebApi.InvalidProjectException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidProjectException : BuildException - { - public InvalidProjectException(String message) - : base(message) - { - } - - public InvalidProjectException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidProjectException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidSourceLabelFormatException", "GitHub.Build.WebApi.InvalidSourceLabelFormatException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidSourceLabelFormatException : BuildException - { - public InvalidSourceLabelFormatException(String message) - : base(message) - { - } - - public InvalidSourceLabelFormatException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidSourceLabelFormatException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidTemplateException ", "GitHub.Build.WebApi.InvalidTemplateException , GitHub.Build.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public sealed class InvalidTemplateException : BuildException - { - public InvalidTemplateException(String message) - : base(message) - { - } - - public InvalidTemplateException(String message, Exception innerException) - : base(message, innerException) - { - } - - private InvalidTemplateException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "MetaTaskDefinitionMissingException", "GitHub.Build.WebApi.MetaTaskDefinitionMissingException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class MetaTaskDefinitionMissingException : BuildException - { - public MetaTaskDefinitionMissingException(String message) - : base(message) - { - } - - public MetaTaskDefinitionMissingException(String message, Exception ex) - : base(message, ex) - { - } - - protected MetaTaskDefinitionMissingException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class MissingEndpointInformationException : BuildException - { - public MissingEndpointInformationException(String message) - : base(message) - { - } - - public MissingEndpointInformationException(String message, Exception ex) - : base(message, ex) - { - } - - protected MissingEndpointInformationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class MissingRepositoryException : BuildException - { - public MissingRepositoryException(String message) - : base(message) - { - } - - public MissingRepositoryException(String message, Exception ex) - : base(message, ex) - { - } - protected MissingRepositoryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class MissingTasksForDefinition : BuildException - { - public MissingTasksForDefinition(String message) - : base(message) - { - } - - public MissingTasksForDefinition(String message, Exception ex) - : base(message, ex) - { - } - protected MissingTasksForDefinition(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "NotSupportedOnXamlBuildException", "GitHub.Build.WebApi.NotSupportedOnXamlBuildException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class NotSupportedOnXamlBuildException : BuildException - { - public NotSupportedOnXamlBuildException(String message) - : base(message) - { - } - - public NotSupportedOnXamlBuildException(String message, Exception ex) - : base(message, ex) - { - } - - protected NotSupportedOnXamlBuildException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class OrchestrationTypeNotSupportedException : BuildException - { - public OrchestrationTypeNotSupportedException(String message) - : base(message) - { - } - - public OrchestrationTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - protected OrchestrationTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ProcessTemplateDeletedException", "GitHub.Build.WebApi.ProcessTemplateDeletedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ProcessTemplateDeletedException : BuildException - { - public ProcessTemplateDeletedException(String message) - : base(message) - { - } - - public ProcessTemplateDeletedException(String message, Exception ex) - : base(message, ex) - { - } - - protected ProcessTemplateDeletedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ProcessTemplateNotFoundException", "GitHub.Build.WebApi.ProcessTemplateNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ProcessTemplateNotFoundException : BuildException - { - public ProcessTemplateNotFoundException(String message) - : base(message) - { - } - - public ProcessTemplateNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected ProcessTemplateNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ProjectConflictException", "GitHub.Build.WebApi.ProjectConflictException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ProjectConflictException : BuildException - { - public ProjectConflictException(String message) - : base(message) - { - } - - public ProjectConflictException(String message, Exception ex) - : base(message, ex) - { - } - - protected ProjectConflictException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "QueueExistsException", "GitHub.Build.WebApi.QueueExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class QueueExistsException : BuildException - { - public QueueExistsException(String message) - : base(message) - { - } - - public QueueExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected QueueExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "QueueNotFoundException", "GitHub.Build.WebApi.QueueNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class QueueNotFoundException : BuildException - { - public QueueNotFoundException(String message) - : base(message) - { - } - - public QueueNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected QueueNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "RecreatingSubscriptionFailedException", "GitHub.Build.WebApi.RecreatingSubscriptionFailedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class RecreatingSubscriptionFailedException : BuildException - { - public RecreatingSubscriptionFailedException(String message) - : base(message) - { - } - - public RecreatingSubscriptionFailedException(String message, Exception ex) - : base(message, ex) - { - } - - protected RecreatingSubscriptionFailedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ReportFormatTypeNotSupportedException", "GitHub.Build.WebApi.ReportFormatTypeNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ReportFormatTypeNotSupportedException : BuildException - { - public ReportFormatTypeNotSupportedException(String message) - : base(message) - { - } - - public ReportFormatTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected ReportFormatTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "ReportStreamNotSupportedException", "GitHub.Build.WebApi.ReportStreamNotSupportedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class ReportStreamNotSupportedException : BuildException - { - public ReportStreamNotSupportedException(String message) - : base(message) - { - } - - public ReportStreamNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected ReportStreamNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "RepositoryInformationInvalidException", "GitHub.Build.WebApi.RepositoryInformationInvalidException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class RepositoryInformationInvalidException : BuildException - { - public RepositoryInformationInvalidException(String message) - : base(message) - { - } - - public RepositoryInformationInvalidException(String message, Exception ex) - : base(message, ex) - { - } - - protected RepositoryInformationInvalidException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class RequestContentException : BuildException - { - public RequestContentException(String message) - : base(message) - { - } - - public RequestContentException(String message, Exception ex) - : base(message, ex) - { - } - - protected RequestContentException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "RouteIdConflictException", "GitHub.Build.WebApi.RouteIdConflictException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class RouteIdConflictException : BuildException - { - public RouteIdConflictException(String message) - : base(message) - { - } - - public RouteIdConflictException(String message, Exception ex) - : base(message, ex) - { - } - - protected RouteIdConflictException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "TimelineNotFoundException", "GitHub.Build.WebApi.TimelineNotFoundException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class TimelineNotFoundException : BuildException - { - public TimelineNotFoundException(String message) - : base(message) - { - } - - public TimelineNotFoundException(String message, Exception ex) - : base(message, ex) - { - } - - protected TimelineNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "VariableNameIsReservedException", "GitHub.Build.WebApi.VariableNameIsReservedException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class VariableNameIsReservedException : BuildException - { - public VariableNameIsReservedException(String message) - : base(message) - { - } - - public VariableNameIsReservedException(String message, Exception ex) - : base(message, ex) - { - } - - protected VariableNameIsReservedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class VariableGroupsAccessDeniedException : BuildException - { - public VariableGroupsAccessDeniedException(String message) - : base(message) - { - } - - public VariableGroupsAccessDeniedException(String message, Exception ex) - : base(message, ex) - { - } - - protected VariableGroupsAccessDeniedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class MetricAggregationTypeNotSupportedException : BuildException - { - public MetricAggregationTypeNotSupportedException(String message) - : base(message) - { - } - - public MetricAggregationTypeNotSupportedException(String message, Exception ex) - : base(message, ex) - { - } - - protected MetricAggregationTypeNotSupportedException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "DefinitionTriggerAlreadyExistsException", "GitHub.Build.WebApi.DefinitionTriggerAlreadyExistsException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class DefinitionTriggerAlreadyExistsException : BuildException - { - public DefinitionTriggerAlreadyExistsException(String message) - : base(message) - { - } - - public DefinitionTriggerAlreadyExistsException(String message, Exception ex) - : base(message, ex) - { - } - - protected DefinitionTriggerAlreadyExistsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "InvalidDefinitionInTriggerSourceException", "GitHub.Build.WebApi.InvalidDefinitionInTriggerSourceException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class InvalidDefinitionInTriggerSourceException : BuildException - { - public InvalidDefinitionInTriggerSourceException(String message) - : base(message) - { - } - - public InvalidDefinitionInTriggerSourceException(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidDefinitionInTriggerSourceException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "CycleDetectedInProvidedBuildCompletionTriggersException", "GitHub.Build.WebApi.CycleDetectedInProvidedBuildCompletionTriggersException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class CycleDetectedInProvidedBuildCompletionTriggersException : BuildException - { - public CycleDetectedInProvidedBuildCompletionTriggersException(String message) - : base(message) - { - } - - public CycleDetectedInProvidedBuildCompletionTriggersException(String message, Exception ex) - : base(message, ex) - { - } - - protected CycleDetectedInProvidedBuildCompletionTriggersException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - - [Serializable] - [ExceptionMapping("0.0", "3.0", "UnsupportedBuildCompletionTriggerChainException", "GitHub.Build.WebApi.UnsupportedBuildCompletionTriggerChainException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class UnsupportedBuildCompletionTriggerChainException : BuildException - { - public UnsupportedBuildCompletionTriggerChainException(String message) - : base(message) - { - } - - public UnsupportedBuildCompletionTriggerChainException(String message, Exception ex) - : base(message, ex) - { - } - - protected UnsupportedBuildCompletionTriggerChainException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - [ExceptionMapping("0.0", "3.0", "CannotUpdateTriggeredByBuildException", "GitHub.Build.WebApi.CannotUpdateTriggeredByBuildException, GitHub.Build2.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] - public class CannotUpdateTriggeredByBuildException : BuildException - { - public CannotUpdateTriggeredByBuildException(String message) - : base(message) - { - } - - public CannotUpdateTriggeredByBuildException(String message, Exception ex) - : base(message, ex) - { - } - - protected CannotUpdateTriggeredByBuildException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class InvalidGitVersionSpec : BuildException - { - public InvalidGitVersionSpec(String message) - : base(message) - { - } - - public InvalidGitVersionSpec(String message, Exception ex) - : base(message, ex) - { - } - - protected InvalidGitVersionSpec(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class AmbiguousDefinitionNameException : BuildException - { - public AmbiguousDefinitionNameException(String message) - : base(message) - { - } - - public AmbiguousDefinitionNameException(String message, Exception ex) - : base(message, ex) - { - } - - public AmbiguousDefinitionNameException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } - - [Serializable] - public class DataProviderException : BuildException - { - public DataProviderException(String message) - : base(message) - { - } - - public DataProviderException(String message, Exception ex) - : base(message, ex) - { - } - - protected DataProviderException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Generated/BuildHttpClientBase.cs b/src/Sdk/BuildWebApi/Api/Generated/BuildHttpClientBase.cs index 8b6de9580..6c48b5617 100644 --- a/src/Sdk/BuildWebApi/Api/Generated/BuildHttpClientBase.cs +++ b/src/Sdk/BuildWebApi/Api/Generated/BuildHttpClientBase.cs @@ -2,37 +2,20 @@ * --------------------------------------------------------- * Copyright(C) Microsoft Corporation. All rights reserved. * --------------------------------------------------------- - * - * --------------------------------------------------------- - * Generated file, DO NOT EDIT - * --------------------------------------------------------- - * - * See following wiki page for instructions on how to regenerate: - * https://aka.ms/azure-devops-client-generation - * - * Configuration file: - * tfs\client\build2\api\clientgeneratorconfigs\genclient.json */ using System; using System.Collections.Generic; -using System.Collections.Specialized; -using System.Globalization; -using System.IO; -using System.IO.Compression; -using System.Linq; using System.Net.Http; -using System.Net.Http.Formatting; using System.Threading; using System.Threading.Tasks; using GitHub.Services.Common; using GitHub.Services.WebApi; -using GitHub.Services.WebApi.Patch.Json; namespace GitHub.Build.WebApi { [ResourceArea(BuildResourceIds.AreaId)] - public abstract class BuildHttpClientBase : BuildHttpClientCompatBase + public abstract class BuildHttpClientBase : VssHttpClientBase { public BuildHttpClientBase(Uri baseUrl, VssCredentials credentials) : base(baseUrl, credentials) @@ -59,36 +42,6 @@ namespace GitHub.Build.WebApi { } - /// - /// [Preview API] Associates an artifact with a build. - /// - /// The artifact. - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task CreateArtifactAsync( - BuildArtifact artifact, - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent(artifact, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - /// /// [Preview API] Associates an artifact with a build. /// @@ -119,38 +72,6 @@ namespace GitHub.Build.WebApi content: content); } - /// - /// [Preview API] Gets a specific artifact for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The name of the artifact. - /// - /// The cancellation token to cancel operation. - public virtual Task GetArtifactAsync( - string project, - int buildId, - string artifactName, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - queryParams.Add("artifactName", artifactName); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - /// /// [Preview API] Gets a specific artifact for a build. /// @@ -182,5563 +103,5 @@ namespace GitHub.Build.WebApi userState: userState, cancellationToken: cancellationToken); } - - /// - /// [Preview API] Gets a specific artifact for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The name of the artifact. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetArtifactContentZipAsync( - string project, - int buildId, - string artifactName, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - queryParams.Add("artifactName", artifactName); - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.5"), - queryParameters: queryParams, - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets a specific artifact for a build. - /// - /// Project ID - /// The ID of the build. - /// The name of the artifact. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetArtifactContentZipAsync( - Guid project, - int buildId, - string artifactName, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - queryParams.Add("artifactName", artifactName); - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.5"), - queryParameters: queryParams, - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets all artifacts for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetArtifactsAsync( - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all artifacts for a build. - /// - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetArtifactsAsync( - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a file from the build. - /// - /// Project ID or project name - /// The ID of the build. - /// The name of the artifact. - /// The primary key for the file. - /// The name that the file will be set to. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetFileAsync( - string project, - int buildId, - string artifactName, - string fileId, - string fileName, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - queryParams.Add("artifactName", artifactName); - queryParams.Add("fileId", fileId); - queryParams.Add("fileName", fileName); - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.5"), - queryParameters: queryParams, - mediaType: "application/octet-stream", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets a file from the build. - /// - /// Project ID - /// The ID of the build. - /// The name of the artifact. - /// The primary key for the file. - /// The name that the file will be set to. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetFileAsync( - Guid project, - int buildId, - string artifactName, - string fileId, - string fileName, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - queryParams.Add("artifactName", artifactName); - queryParams.Add("fileId", fileId); - queryParams.Add("fileName", fileName); - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.5"), - queryParameters: queryParams, - mediaType: "application/octet-stream", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets the list of attachments of a specific type that are associated with a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The type of attachment. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetAttachmentsAsync( - string project, - int buildId, - string type, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("f2192269-89fa-4f94-baf6-8fb128c55159"); - object routeValues = new { project = project, buildId = buildId, type = type }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the list of attachments of a specific type that are associated with a build. - /// - /// Project ID - /// The ID of the build. - /// The type of attachment. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetAttachmentsAsync( - Guid project, - int buildId, - string type, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("f2192269-89fa-4f94-baf6-8fb128c55159"); - object routeValues = new { project = project, buildId = buildId, type = type }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a specific attachment. - /// - /// Project ID or project name - /// The ID of the build. - /// The ID of the timeline. - /// The ID of the timeline record. - /// The type of the attachment. - /// The name of the attachment. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetAttachmentAsync( - string project, - int buildId, - Guid timelineId, - Guid recordId, - string type, - string name, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("af5122d3-3438-485e-a25a-2dbbfde84ee6"); - object routeValues = new { project = project, buildId = buildId, timelineId = timelineId, recordId = recordId, type = type, name = name }; - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - mediaType: "application/octet-stream", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets a specific attachment. - /// - /// Project ID - /// The ID of the build. - /// The ID of the timeline. - /// The ID of the timeline record. - /// The type of the attachment. - /// The name of the attachment. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetAttachmentAsync( - Guid project, - int buildId, - Guid timelineId, - Guid recordId, - string type, - string name, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("af5122d3-3438-485e-a25a-2dbbfde84ee6"); - object routeValues = new { project = project, buildId = buildId, timelineId = timelineId, recordId = recordId, type = type, name = name }; - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - mediaType: "application/octet-stream", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] - /// - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> AuthorizeProjectResourcesAsync( - IEnumerable resources, - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent>(resources, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] - /// - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> AuthorizeProjectResourcesAsync( - IEnumerable resources, - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent>(resources, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] - /// - /// Project ID or project name - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetProjectResourcesAsync( - string project, - string type = null, - string id = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - if (id != null) - { - queryParams.Add("id", id); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] - /// - /// Project ID - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetProjectResourcesAsync( - Guid project, - string type = null, - string id = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - if (id != null) - { - queryParams.Add("id", id); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a badge that indicates the status of the most recent build for a definition. Note that this API is deprecated. Prefer StatusBadgeController.GetStatusBadge. - /// - /// The project ID or name. - /// The ID of the definition. - /// The name of the branch. - /// - /// The cancellation token to cancel operation. - [Obsolete("This endpoint is deprecated. Please see the Build Status REST endpoint.")] - public virtual Task GetBadgeAsync( - Guid project, - int definitionId, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("de6a4df8-22cd-44ee-af2d-39f6aa7a4261"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of branches for the given source code repository. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// If supplied, the name of the branch to check for specifically. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListBranchesAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e05d4403-9b81-4244-8763-20fde28d1976"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of branches for the given source code repository. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// If supplied, the name of the branch to check for specifically. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListBranchesAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e05d4403-9b81-4244-8763-20fde28d1976"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. - /// - /// Project ID or project name - /// The repository type. - /// The repository ID. - /// The branch name. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildBadgeAsync( - string project, - string repoType, - string repoId = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003"); - object routeValues = new { project = project, repoType = repoType }; - - List> queryParams = new List>(); - if (repoId != null) - { - queryParams.Add("repoId", repoId); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. - /// - /// Project ID - /// The repository type. - /// The repository ID. - /// The branch name. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildBadgeAsync( - Guid project, - string repoType, - string repoId = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003"); - object routeValues = new { project = project, repoType = repoType }; - - List> queryParams = new List>(); - if (repoId != null) - { - queryParams.Add("repoId", repoId); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. - /// - /// Project ID or project name - /// The repository type. - /// The repository ID. - /// The branch name. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildBadgeDataAsync( - string project, - string repoType, - string repoId = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003"); - object routeValues = new { project = project, repoType = repoType }; - - List> queryParams = new List>(); - if (repoId != null) - { - queryParams.Add("repoId", repoId); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. - /// - /// Project ID - /// The repository type. - /// The repository ID. - /// The branch name. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildBadgeDataAsync( - Guid project, - string repoType, - string repoId = null, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003"); - object routeValues = new { project = project, repoType = repoType }; - - List> queryParams = new List>(); - if (repoId != null) - { - queryParams.Add("repoId", repoId); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Deletes a build. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteBuildAsync( - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Deletes a build. - /// - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteBuildAsync( - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Gets a build - /// - /// Project ID or project name - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildAsync( - string project, - int buildId, - string propertyFilters = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (propertyFilters != null) - { - queryParams.Add("propertyFilters", propertyFilters); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a build - /// - /// Project ID - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildAsync( - Guid project, - int buildId, - string propertyFilters = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (propertyFilters != null) - { - queryParams.Add("propertyFilters", propertyFilters); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of builds. - /// - /// Project ID or project name - /// A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. - /// A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. - /// If specified, filters to builds that match this build number. Append * to do a prefix search. - /// If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. - /// If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. - /// If specified, filters to builds requested for the specified user. - /// If specified, filters to builds that match this reason. - /// If specified, filters to builds that match this status. - /// If specified, filters to builds that match this result. - /// A comma-delimited list of tags. If specified, filters to builds that have the specified tags. - /// A comma-delimited list of properties to retrieve. - /// The maximum number of builds to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. - /// The maximum number of builds to return per definition. - /// Indicates whether to exclude, include, or only return deleted builds. - /// The order in which builds should be returned. - /// If specified, filters to builds that built branches that built this branch. - /// A comma-delimited list that specifies the IDs of builds to retrieve. - /// If specified, filters to builds that built from this repository. - /// If specified, filters to builds that built from repositories of this type. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync( - string project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minTime = null, - DateTime? maxTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - string repositoryId = null, - string repositoryType = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (buildNumber != null) - { - queryParams.Add("buildNumber", buildNumber); - } - if (minTime != null) - { - AddDateTimeToQueryParams(queryParams, "minTime", minTime.Value); - } - if (maxTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxTime", maxTime.Value); - } - if (requestedFor != null) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (repositoryType != null) - { - queryParams.Add("repositoryType", repositoryType); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of builds. - /// - /// Project ID - /// A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. - /// A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. - /// If specified, filters to builds that match this build number. Append * to do a prefix search. - /// If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. - /// If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. - /// If specified, filters to builds requested for the specified user. - /// If specified, filters to builds that match this reason. - /// If specified, filters to builds that match this status. - /// If specified, filters to builds that match this result. - /// A comma-delimited list of tags. If specified, filters to builds that have the specified tags. - /// A comma-delimited list of properties to retrieve. - /// The maximum number of builds to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. - /// The maximum number of builds to return per definition. - /// Indicates whether to exclude, include, or only return deleted builds. - /// The order in which builds should be returned. - /// If specified, filters to builds that built branches that built this branch. - /// A comma-delimited list that specifies the IDs of builds to retrieve. - /// If specified, filters to builds that built from this repository. - /// If specified, filters to builds that built from repositories of this type. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildsAsync( - Guid project, - IEnumerable definitions = null, - IEnumerable queues = null, - string buildNumber = null, - DateTime? minTime = null, - DateTime? maxTime = null, - string requestedFor = null, - BuildReason? reasonFilter = null, - BuildStatus? statusFilter = null, - BuildResult? resultFilter = null, - IEnumerable tagFilters = null, - IEnumerable properties = null, - int? top = null, - string continuationToken = null, - int? maxBuildsPerDefinition = null, - QueryDeletedOption? deletedFilter = null, - BuildQueryOrder? queryOrder = null, - string branchName = null, - IEnumerable buildIds = null, - string repositoryId = null, - string repositoryType = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (definitions != null && definitions.Any()) - { - queryParams.Add("definitions", string.Join(",", definitions)); - } - if (queues != null && queues.Any()) - { - queryParams.Add("queues", string.Join(",", queues)); - } - if (buildNumber != null) - { - queryParams.Add("buildNumber", buildNumber); - } - if (minTime != null) - { - AddDateTimeToQueryParams(queryParams, "minTime", minTime.Value); - } - if (maxTime != null) - { - AddDateTimeToQueryParams(queryParams, "maxTime", maxTime.Value); - } - if (requestedFor != null) - { - queryParams.Add("requestedFor", requestedFor); - } - if (reasonFilter != null) - { - queryParams.Add("reasonFilter", reasonFilter.Value.ToString()); - } - if (statusFilter != null) - { - queryParams.Add("statusFilter", statusFilter.Value.ToString()); - } - if (resultFilter != null) - { - queryParams.Add("resultFilter", resultFilter.Value.ToString()); - } - if (tagFilters != null && tagFilters.Any()) - { - queryParams.Add("tagFilters", string.Join(",", tagFilters)); - } - if (properties != null && properties.Any()) - { - queryParams.Add("properties", string.Join(",", properties)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (maxBuildsPerDefinition != null) - { - queryParams.Add("maxBuildsPerDefinition", maxBuildsPerDefinition.Value.ToString(CultureInfo.InvariantCulture)); - } - if (deletedFilter != null) - { - queryParams.Add("deletedFilter", deletedFilter.Value.ToString()); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - if (buildIds != null && buildIds.Any()) - { - queryParams.Add("buildIds", string.Join(",", buildIds)); - } - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (repositoryType != null) - { - queryParams.Add("repositoryType", repositoryType); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// Project ID or project name - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task QueueBuildAsync( - Build build, - string project, - bool? ignoreWarnings = null, - string checkInTicket = null, - int? sourceBuildId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (ignoreWarnings != null) - { - queryParams.Add("ignoreWarnings", ignoreWarnings.Value.ToString()); - } - if (checkInTicket != null) - { - queryParams.Add("checkInTicket", checkInTicket); - } - if (sourceBuildId != null) - { - queryParams.Add("sourceBuildId", sourceBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Queues a build - /// - /// - /// Project ID - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task QueueBuildAsync( - Build build, - Guid project, - bool? ignoreWarnings = null, - string checkInTicket = null, - int? sourceBuildId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (ignoreWarnings != null) - { - queryParams.Add("ignoreWarnings", ignoreWarnings.Value.ToString()); - } - if (checkInTicket != null) - { - queryParams.Add("checkInTicket", checkInTicket); - } - if (sourceBuildId != null) - { - queryParams.Add("sourceBuildId", sourceBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// Project ID or project name - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - private protected virtual Task UpdateBuildAsync( - Build build, - string project, - int buildId, - bool? retry = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (retry != null) - { - queryParams.Add("retry", retry.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates a build. - /// - /// The build. - /// Project ID - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - private protected virtual Task UpdateBuildAsync( - Build build, - Guid project, - int buildId, - bool? retry = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent(build, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (retry != null) - { - queryParams.Add("retry", retry.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates multiple builds. - /// - /// The builds to update. - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> UpdateBuildsAsync( - IEnumerable builds, - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent>(builds, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates multiple builds. - /// - /// The builds to update. - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> UpdateBuildsAsync( - IEnumerable builds, - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("0cd358e1-9217-4d94-8269-1c1ee6f93dcf"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent>(builds, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 5), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets the changes associated with a build - /// - /// Project ID or project name - /// - /// - /// The maximum number of changes to return - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildChangesAsync( - string project, - int buildId, - string continuationToken = null, - int? top = null, - bool? includeSourceChange = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54572c7b-bbd3-45d4-80dc-28be08941620"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (includeSourceChange != null) - { - queryParams.Add("includeSourceChange", includeSourceChange.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the changes associated with a build - /// - /// Project ID - /// - /// - /// The maximum number of changes to return - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildChangesAsync( - Guid project, - int buildId, - string continuationToken = null, - int? top = null, - bool? includeSourceChange = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54572c7b-bbd3-45d4-80dc-28be08941620"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (includeSourceChange != null) - { - queryParams.Add("includeSourceChange", includeSourceChange.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the changes made to the repository between two given builds. - /// - /// Project ID or project name - /// The ID of the first build. - /// The ID of the last build. - /// The maximum number of changes to return. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetChangesBetweenBuildsAsync( - string project, - int? fromBuildId = null, - int? toBuildId = null, - int? top = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("f10f0ea5-18a1-43ec-a8fb-2042c7be9b43"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (fromBuildId != null) - { - queryParams.Add("fromBuildId", fromBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (toBuildId != null) - { - queryParams.Add("toBuildId", toBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the changes made to the repository between two given builds. - /// - /// Project ID - /// The ID of the first build. - /// The ID of the last build. - /// The maximum number of changes to return. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetChangesBetweenBuildsAsync( - Guid project, - int? fromBuildId = null, - int? toBuildId = null, - int? top = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("f10f0ea5-18a1-43ec-a8fb-2042c7be9b43"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (fromBuildId != null) - { - queryParams.Add("fromBuildId", fromBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (toBuildId != null) - { - queryParams.Add("toBuildId", toBuildId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Creates a new definition. - /// - /// The definition. - /// Project ID or project name - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task CreateDefinitionAsync( - BuildDefinition definition, - string project, - int? definitionToCloneId = null, - int? definitionToCloneRevision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(definition, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (definitionToCloneId != null) - { - queryParams.Add("definitionToCloneId", definitionToCloneId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (definitionToCloneRevision != null) - { - queryParams.Add("definitionToCloneRevision", definitionToCloneRevision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Creates a new definition. - /// - /// The definition. - /// Project ID - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task CreateDefinitionAsync( - BuildDefinition definition, - Guid project, - int? definitionToCloneId = null, - int? definitionToCloneRevision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(definition, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (definitionToCloneId != null) - { - queryParams.Add("definitionToCloneId", definitionToCloneId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (definitionToCloneRevision != null) - { - queryParams.Add("definitionToCloneRevision", definitionToCloneRevision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Deletes a definition and all associated builds. - /// - /// Project ID or project name - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteDefinitionAsync( - string project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Deletes a definition and all associated builds. - /// - /// Project ID - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteDefinitionAsync( - Guid project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Gets a definition, optionally at a specific revision. - /// - /// Project ID or project name - /// The ID of the definition. - /// The revision number to retrieve. If this is not specified, the latest version will be returned. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list of properties to include in the results. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionAsync( - string project, - int definitionId, - int? revision = null, - DateTime? minMetricsTime = null, - IEnumerable propertyFilters = null, - bool? includeLatestBuilds = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (propertyFilters != null && propertyFilters.Any()) - { - queryParams.Add("propertyFilters", string.Join(",", propertyFilters)); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a definition, optionally at a specific revision. - /// - /// Project ID - /// The ID of the definition. - /// The revision number to retrieve. If this is not specified, the latest version will be returned. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list of properties to include in the results. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionAsync( - Guid project, - int definitionId, - int? revision = null, - DateTime? minMetricsTime = null, - IEnumerable propertyFilters = null, - bool? includeLatestBuilds = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (propertyFilters != null && propertyFilters.Any()) - { - queryParams.Add("propertyFilters", string.Join(",", propertyFilters)); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of definitions. - /// - /// Project ID or project name - /// If specified, filters to definitions whose names match this pattern. - /// A repository ID. If specified, filters to definitions that use this repository. - /// If specified, filters to definitions that have a repository of this type. - /// Indicates the order in which definitions should be returned. - /// The maximum number of definitions to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list that specifies the IDs of definitions to retrieve. - /// If specified, filters to definitions under this folder. - /// If specified, filters to definitions that have builds after this date. - /// If specified, filters to definitions that do not have builds after this date. - /// Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. - /// Indicates whether to return the latest and latest completed builds for this definition. - /// If specified, filters to definitions that use the specified task. - /// If specified, filters to definitions with the given process type. - /// If specified, filters to YAML definitions that match the given filename. - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - string project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (name != null) - { - queryParams.Add("name", name); - } - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (repositoryType != null) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (path != null) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter != null) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - if (processType != null) - { - queryParams.Add("processType", processType.Value.ToString(CultureInfo.InvariantCulture)); - } - if (yamlFilename != null) - { - queryParams.Add("yamlFilename", yamlFilename); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of definitions. - /// - /// Project ID - /// If specified, filters to definitions whose names match this pattern. - /// A repository ID. If specified, filters to definitions that use this repository. - /// If specified, filters to definitions that have a repository of this type. - /// Indicates the order in which definitions should be returned. - /// The maximum number of definitions to return. - /// A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. - /// If specified, indicates the date from which metrics should be included. - /// A comma-delimited list that specifies the IDs of definitions to retrieve. - /// If specified, filters to definitions under this folder. - /// If specified, filters to definitions that have builds after this date. - /// If specified, filters to definitions that do not have builds after this date. - /// Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. - /// Indicates whether to return the latest and latest completed builds for this definition. - /// If specified, filters to definitions that use the specified task. - /// If specified, filters to definitions with the given process type. - /// If specified, filters to YAML definitions that match the given filename. - /// - /// The cancellation token to cancel operation. - protected virtual Task> GetDefinitionsAsync( - Guid project, - string name = null, - string repositoryId = null, - string repositoryType = null, - DefinitionQueryOrder? queryOrder = null, - int? top = null, - string continuationToken = null, - DateTime? minMetricsTime = null, - IEnumerable definitionIds = null, - string path = null, - DateTime? builtAfter = null, - DateTime? notBuiltAfter = null, - bool? includeAllProperties = null, - bool? includeLatestBuilds = null, - Guid? taskIdFilter = null, - int? processType = null, - string yamlFilename = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - if (name != null) - { - queryParams.Add("name", name); - } - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (repositoryType != null) - { - queryParams.Add("repositoryType", repositoryType); - } - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - if (top != null) - { - queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture)); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - if (definitionIds != null && definitionIds.Any()) - { - queryParams.Add("definitionIds", string.Join(",", definitionIds)); - } - if (path != null) - { - queryParams.Add("path", path); - } - if (builtAfter != null) - { - AddDateTimeToQueryParams(queryParams, "builtAfter", builtAfter.Value); - } - if (notBuiltAfter != null) - { - AddDateTimeToQueryParams(queryParams, "notBuiltAfter", notBuiltAfter.Value); - } - if (includeAllProperties != null) - { - queryParams.Add("includeAllProperties", includeAllProperties.Value.ToString()); - } - if (includeLatestBuilds != null) - { - queryParams.Add("includeLatestBuilds", includeLatestBuilds.Value.ToString()); - } - if (taskIdFilter != null) - { - queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString()); - } - if (processType != null) - { - queryParams.Add("processType", processType.Value.ToString(CultureInfo.InvariantCulture)); - } - if (yamlFilename != null) - { - queryParams.Add("yamlFilename", yamlFilename); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Restores a deleted definition - /// - /// Project ID or project name - /// The identifier of the definition to restore. - /// When false, restores a deleted definition. - /// - /// The cancellation token to cancel operation. - public virtual Task RestoreDefinitionAsync( - string project, - int definitionId, - bool deleted, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - queryParams.Add("deleted", deleted.ToString()); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Restores a deleted definition - /// - /// Project ID - /// The identifier of the definition to restore. - /// When false, restores a deleted definition. - /// - /// The cancellation token to cancel operation. - public virtual Task RestoreDefinitionAsync( - Guid project, - int definitionId, - bool deleted, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - queryParams.Add("deleted", deleted.ToString()); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Updates an existing definition. - /// - /// The new version of the defintion. - /// Project ID or project name - /// The ID of the definition. - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateDefinitionAsync( - BuildDefinition definition, - string project, - int definitionId, - int? secretsSourceDefinitionId = null, - int? secretsSourceDefinitionRevision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent(definition, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (secretsSourceDefinitionId != null) - { - queryParams.Add("secretsSourceDefinitionId", secretsSourceDefinitionId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (secretsSourceDefinitionRevision != null) - { - queryParams.Add("secretsSourceDefinitionRevision", secretsSourceDefinitionRevision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates an existing definition. - /// - /// The new version of the defintion. - /// Project ID - /// The ID of the definition. - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateDefinitionAsync( - BuildDefinition definition, - Guid project, - int definitionId, - int? secretsSourceDefinitionId = null, - int? secretsSourceDefinitionRevision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("dbeaf647-6167-421a-bda9-c9327b25e2e6"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent(definition, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (secretsSourceDefinitionId != null) - { - queryParams.Add("secretsSourceDefinitionId", secretsSourceDefinitionId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (secretsSourceDefinitionRevision != null) - { - queryParams.Add("secretsSourceDefinitionRevision", secretsSourceDefinitionRevision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 7), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets the contents of a file in the given source code repository. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// The identifier of the commit or branch from which a file's contents are retrieved. - /// The path to the file to retrieve, relative to the root of the repository. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetFileContentsAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string commitOrBranch = null, - string path = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("29d12225-b1d9-425f-b668-6c594a981313"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (commitOrBranch != null) - { - queryParams.Add("commitOrBranch", commitOrBranch); - } - if (path != null) - { - queryParams.Add("path", path); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.1"), - queryParameters: queryParams, - mediaType: "text/plain", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets the contents of a file in the given source code repository. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// The identifier of the commit or branch from which a file's contents are retrieved. - /// The path to the file to retrieve, relative to the root of the repository. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetFileContentsAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string commitOrBranch = null, - string path = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("29d12225-b1d9-425f-b668-6c594a981313"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (commitOrBranch != null) - { - queryParams.Add("commitOrBranch", commitOrBranch); - } - if (path != null) - { - queryParams.Add("path", path); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.1"), - queryParameters: queryParams, - mediaType: "text/plain", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Creates a new folder. - /// - /// The folder. - /// Project ID or project name - /// The full path of the folder. - /// - /// The cancellation token to cancel operation. - public virtual Task CreateFolderAsync( - Folder folder, - string project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(folder, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - queryParams.Add("path", path); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Creates a new folder. - /// - /// The folder. - /// Project ID - /// The full path of the folder. - /// - /// The cancellation token to cancel operation. - public virtual Task CreateFolderAsync( - Folder folder, - Guid project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(folder, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - queryParams.Add("path", path); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Deletes a definition folder. Definitions and their corresponding builds will also be deleted. - /// - /// Project ID or project name - /// The full path to the folder. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteFolderAsync( - string project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - queryParams.Add("path", path); - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Deletes a definition folder. Definitions and their corresponding builds will also be deleted. - /// - /// Project ID - /// The full path to the folder. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteFolderAsync( - Guid project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - - List> queryParams = new List>(); - queryParams.Add("path", path); - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Gets a list of build definition folders. - /// - /// Project ID or project name - /// The path to start with. - /// The order in which folders should be returned. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFoldersAsync( - string project, - string path = null, - FolderQueryOrder? queryOrder = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project, path = path }; - - List> queryParams = new List>(); - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of build definition folders. - /// - /// Project ID - /// The path to start with. - /// The order in which folders should be returned. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetFoldersAsync( - Guid project, - string path = null, - FolderQueryOrder? queryOrder = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project, path = path }; - - List> queryParams = new List>(); - if (queryOrder != null) - { - queryParams.Add("queryOrder", queryOrder.Value.ToString()); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Updates an existing folder at given existing path - /// - /// The new version of the folder. - /// Project ID or project name - /// The full path to the folder. - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateFolderAsync( - Folder folder, - string project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(folder, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - queryParams.Add("path", path); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates an existing folder at given existing path - /// - /// The new version of the folder. - /// Project ID - /// The full path to the folder. - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateFolderAsync( - Folder folder, - Guid project, - string path, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("a906531b-d2da-4f55-bda7-f3e676cc50d9"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(folder, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - queryParams.Add("path", path); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets the latest build for a definition, optionally scoped to a specific branch. - /// - /// Project ID or project name - /// definition name with optional leading folder path, or the definition id - /// optional parameter that indicates the specific branch to use - /// - /// The cancellation token to cancel operation. - public virtual Task GetLatestBuildAsync( - string project, - string definition, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54481611-01f4-47f3-998f-160da0f0c229"); - object routeValues = new { project = project, definition = definition }; - - List> queryParams = new List>(); - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the latest build for a definition, optionally scoped to a specific branch. - /// - /// Project ID - /// definition name with optional leading folder path, or the definition id - /// optional parameter that indicates the specific branch to use - /// - /// The cancellation token to cancel operation. - public virtual Task GetLatestBuildAsync( - Guid project, - string definition, - string branchName = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("54481611-01f4-47f3-998f-160da0f0c229"); - object routeValues = new { project = project, definition = definition }; - - List> queryParams = new List>(); - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogAsync( - string project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "text/plain", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogAsync( - Guid project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "text/plain", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildLogLinesAsync( - string project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildLogLinesAsync( - Guid project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the logs for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildLogsAsync( - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the logs for a build. - /// - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildLogsAsync( - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the logs for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogsZipAsync( - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId }; - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets the logs for a build. - /// - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogsZipAsync( - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId }; - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogZipAsync( - string project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets an individual log file for a build. - /// - /// Project ID - /// The ID of the build. - /// The ID of the log file. - /// The start line. - /// The end line. - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildLogZipAsync( - Guid project, - int buildId, - int logId, - long? startLine = null, - long? endLine = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("35a80daf-7f30-45fc-86e8-6b813d9c90df"); - object routeValues = new { project = project, buildId = buildId, logId = logId }; - - List> queryParams = new List>(); - if (startLine != null) - { - queryParams.Add("startLine", startLine.Value.ToString(CultureInfo.InvariantCulture)); - } - if (endLine != null) - { - queryParams.Add("endLine", endLine.Value.ToString(CultureInfo.InvariantCulture)); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "application/zip", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets build metrics for a project. - /// - /// Project ID or project name - /// The aggregation type to use (hourly, daily). - /// The date from which to calculate metrics. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetProjectMetricsAsync( - string project, - string metricAggregationType = null, - DateTime? minMetricsTime = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7433fae7-a6bc-41dc-a6e2-eef9005ce41a"); - object routeValues = new { project = project, metricAggregationType = metricAggregationType }; - - List> queryParams = new List>(); - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets build metrics for a project. - /// - /// Project ID - /// The aggregation type to use (hourly, daily). - /// The date from which to calculate metrics. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetProjectMetricsAsync( - Guid project, - string metricAggregationType = null, - DateTime? minMetricsTime = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7433fae7-a6bc-41dc-a6e2-eef9005ce41a"); - object routeValues = new { project = project, metricAggregationType = metricAggregationType }; - - List> queryParams = new List>(); - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets build metrics for a definition. - /// - /// Project ID or project name - /// The ID of the definition. - /// The date from which to calculate metrics. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionMetricsAsync( - string project, - int definitionId, - DateTime? minMetricsTime = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d973b939-0ce0-4fec-91d8-da3940fa1827"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets build metrics for a definition. - /// - /// Project ID - /// The ID of the definition. - /// The date from which to calculate metrics. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionMetricsAsync( - Guid project, - int definitionId, - DateTime? minMetricsTime = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d973b939-0ce0-4fec-91d8-da3940fa1827"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (minMetricsTime != null) - { - AddDateTimeToQueryParams(queryParams, "minMetricsTime", minMetricsTime.Value); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all build definition options supported by the system. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildOptionDefinitionsAsync( - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("591cb5a4-2d46-4f3a-a697-5cd42b6bd332"); - - return SendAsync>( - httpMethod, - locationId, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all build definition options supported by the system. - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildOptionDefinitionsAsync( - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("591cb5a4-2d46-4f3a-a697-5cd42b6bd332"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all build definition options supported by the system. - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildOptionDefinitionsAsync( - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("591cb5a4-2d46-4f3a-a697-5cd42b6bd332"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the contents of a directory in the given source code repository. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// The identifier of the commit or branch from which a file's contents are retrieved. - /// The path contents to list, relative to the root of the repository. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetPathContentsAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string commitOrBranch = null, - string path = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7944d6fb-df01-4709-920a-7a189aa34037"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (commitOrBranch != null) - { - queryParams.Add("commitOrBranch", commitOrBranch); - } - if (path != null) - { - queryParams.Add("path", path); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the contents of a directory in the given source code repository. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. - /// The identifier of the commit or branch from which a file's contents are retrieved. - /// The path contents to list, relative to the root of the repository. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetPathContentsAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - string commitOrBranch = null, - string path = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7944d6fb-df01-4709-920a-7a189aa34037"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (commitOrBranch != null) - { - queryParams.Add("commitOrBranch", commitOrBranch); - } - if (path != null) - { - queryParams.Add("path", path); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets properties for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// A comma-delimited list of properties. If specified, filters to these specific properties. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildPropertiesAsync( - string project, - int buildId, - IEnumerable filter = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0a6312e9-0627-49b7-8083-7d74a64849c9"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (filter != null && filter.Any()) - { - queryParams.Add("filter", string.Join(",", filter)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets properties for a build. - /// - /// Project ID - /// The ID of the build. - /// A comma-delimited list of properties. If specified, filters to these specific properties. - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildPropertiesAsync( - Guid project, - int buildId, - IEnumerable filter = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("0a6312e9-0627-49b7-8083-7d74a64849c9"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (filter != null && filter.Any()) - { - queryParams.Add("filter", string.Join(",", filter)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets properties for a definition. - /// - /// Project ID or project name - /// The ID of the definition. - /// A comma-delimited list of properties. If specified, filters to these specific properties. - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionPropertiesAsync( - string project, - int definitionId, - IEnumerable filter = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d9826ad7-2a68-46a9-a6e9-677698777895"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (filter != null && filter.Any()) - { - queryParams.Add("filter", string.Join(",", filter)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets properties for a definition. - /// - /// Project ID - /// The ID of the definition. - /// A comma-delimited list of properties. If specified, filters to these specific properties. - /// - /// The cancellation token to cancel operation. - public virtual Task GetDefinitionPropertiesAsync( - Guid project, - int definitionId, - IEnumerable filter = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d9826ad7-2a68-46a9-a6e9-677698777895"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (filter != null && filter.Any()) - { - queryParams.Add("filter", string.Join(",", filter)); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a pull request object from source provider. - /// - /// Project ID or project name - /// The name of the source provider. - /// Vendor-specific id of the pull request. - /// Vendor-specific identifier or the name of the repository that contains the pull request. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// - /// The cancellation token to cancel operation. - public virtual Task GetPullRequestAsync( - string project, - string providerName, - string pullRequestId, - string repositoryId = null, - Guid? serviceEndpointId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d8763ec7-9ff0-4fb4-b2b2-9d757906ff14"); - object routeValues = new { project = project, providerName = providerName, pullRequestId = pullRequestId }; - - List> queryParams = new List>(); - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a pull request object from source provider. - /// - /// Project ID - /// The name of the source provider. - /// Vendor-specific id of the pull request. - /// Vendor-specific identifier or the name of the repository that contains the pull request. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// - /// The cancellation token to cancel operation. - public virtual Task GetPullRequestAsync( - Guid project, - string providerName, - string pullRequestId, - string repositoryId = null, - Guid? serviceEndpointId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d8763ec7-9ff0-4fb4-b2b2-9d757906ff14"); - object routeValues = new { project = project, providerName = providerName, pullRequestId = pullRequestId }; - - List> queryParams = new List>(); - if (repositoryId != null) - { - queryParams.Add("repositoryId", repositoryId); - } - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a build report. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildReportAsync( - string project, - int buildId, - string type = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("45bcaa88-67e1-4042-a035-56d3b4a7d44c"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a build report. - /// - /// Project ID - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildReportAsync( - Guid project, - int buildId, - string type = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("45bcaa88-67e1-4042-a035-56d3b4a7d44c"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a build report. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildReportHtmlContentAsync( - string project, - int buildId, - string type = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("45bcaa88-67e1-4042-a035-56d3b4a7d44c"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "text/html", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets a build report. - /// - /// Project ID - /// The ID of the build. - /// - /// - /// The cancellation token to cancel operation. - public virtual async Task GetBuildReportHtmlContentAsync( - Guid project, - int buildId, - string type = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("45bcaa88-67e1-4042-a035-56d3b4a7d44c"); - object routeValues = new { project = project, buildId = buildId }; - - List> queryParams = new List>(); - if (type != null) - { - queryParams.Add("type", type); - } - HttpResponseMessage response; - using (HttpRequestMessage requestMessage = await CreateRequestMessageAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion("5.2-preview.2"), - queryParameters: queryParams, - mediaType: "text/html", - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false); - } - response.EnsureSuccessStatusCode(); - - if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase)) - { - Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return new GZipStream(responseStream, CompressionMode.Decompress); - } - else - { - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } - } - - /// - /// [Preview API] Gets a list of source code repositories. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of a single repository to get. - /// 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set. - /// If set to true, this will limit the set of results and will return a continuation token to continue the query. - /// When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task ListRepositoriesAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - ResultSet? resultSet = null, - bool? pageResults = null, - string continuationToken = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d44d1680-f978-4834-9b93-8c6e132329c9"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (resultSet != null) - { - queryParams.Add("resultSet", resultSet.Value.ToString()); - } - if (pageResults != null) - { - queryParams.Add("pageResults", pageResults.Value.ToString()); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of source code repositories. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of a single repository to get. - /// 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set. - /// If set to true, this will limit the set of results and will return a continuation token to continue the query. - /// When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task ListRepositoriesAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - ResultSet? resultSet = null, - bool? pageResults = null, - string continuationToken = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d44d1680-f978-4834-9b93-8c6e132329c9"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - if (resultSet != null) - { - queryParams.Add("resultSet", resultSet.Value.ToString()); - } - if (pageResults != null) - { - queryParams.Add("pageResults", pageResults.Value.ToString()); - } - if (continuationToken != null) - { - queryParams.Add("continuationToken", continuationToken); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] - /// - /// - /// Project ID or project name - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> AuthorizeDefinitionResourcesAsync( - IEnumerable resources, - string project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent>(resources, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] - /// - /// - /// Project ID - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> AuthorizeDefinitionResourcesAsync( - IEnumerable resources, - Guid project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent>(resources, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] - /// - /// Project ID or project name - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionResourcesAsync( - string project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6"); - object routeValues = new { project = project, definitionId = definitionId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] - /// - /// Project ID - /// - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionResourcesAsync( - Guid project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6"); - object routeValues = new { project = project, definitionId = definitionId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets information about build resources in the system. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetResourceUsageAsync( - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("3813d06c-9e36-4ea1-aac3-61a485d60e3d"); - - return SendAsync( - httpMethod, - locationId, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all revisions of a definition. - /// - /// Project ID or project name - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionRevisionsAsync( - string project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7c116775-52e5-453e-8c5d-914d9762d8c4"); - object routeValues = new { project = project, definitionId = definitionId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all revisions of a definition. - /// - /// Project ID - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionRevisionsAsync( - Guid project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("7c116775-52e5-453e-8c5d-914d9762d8c4"); - object routeValues = new { project = project, definitionId = definitionId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the build settings. - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildSettingsAsync( - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - - return SendAsync( - httpMethod, - locationId, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the build settings. - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildSettingsAsync( - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - object routeValues = new { project = project }; - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the build settings. - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildSettingsAsync( - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - object routeValues = new { project = project }; - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Updates the build settings. - /// - /// The new settings. - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateBuildSettingsAsync( - BuildSettings settings, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - HttpContent content = new ObjectContent(settings, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates the build settings. - /// - /// The new settings. - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateBuildSettingsAsync( - BuildSettings settings, - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(settings, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates the build settings. - /// - /// The new settings. - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task UpdateBuildSettingsAsync( - BuildSettings settings, - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PATCH"); - Guid locationId = new Guid("aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d"); - object routeValues = new { project = project }; - HttpContent content = new ObjectContent(settings, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Get a list of source providers and their capabilities. - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> ListSourceProvidersAsync( - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("3ce81729-954f-423d-a581-9fea01d25186"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Get a list of source providers and their capabilities. - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> ListSourceProvidersAsync( - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("3ce81729-954f-423d-a581-9fea01d25186"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API]

Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.

If there are more than one, then it is required to pass in a value when specifying a , and the same rule then applies for both if passing a parameter.

- ///
- /// Project ID or project name - /// Either the definition name with optional leading folder path, or the definition id. - /// Only consider the most recent build for this branch. - /// Use this stage within the pipeline to render the status. - /// Use this job within a stage of the pipeline to render the status. - /// Use this job configuration to render the status - /// Replaces the default text on the left side of the badge. - /// - /// The cancellation token to cancel operation. - public virtual Task GetStatusBadgeAsync( - string project, - string definition, - string branchName = null, - string stageName = null, - string jobName = null, - string configuration = null, - string label = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("07acfdce-4757-4439-b422-ddd13a2fcc10"); - object routeValues = new { project = project, definition = definition }; - - List> queryParams = new List>(); - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - if (stageName != null) - { - queryParams.Add("stageName", stageName); - } - if (jobName != null) - { - queryParams.Add("jobName", jobName); - } - if (configuration != null) - { - queryParams.Add("configuration", configuration); - } - if (label != null) - { - queryParams.Add("label", label); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API]

Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.

If there are more than one, then it is required to pass in a value when specifying a , and the same rule then applies for both if passing a parameter.

- ///
- /// Project ID - /// Either the definition name with optional leading folder path, or the definition id. - /// Only consider the most recent build for this branch. - /// Use this stage within the pipeline to render the status. - /// Use this job within a stage of the pipeline to render the status. - /// Use this job configuration to render the status - /// Replaces the default text on the left side of the badge. - /// - /// The cancellation token to cancel operation. - public virtual Task GetStatusBadgeAsync( - Guid project, - string definition, - string branchName = null, - string stageName = null, - string jobName = null, - string configuration = null, - string label = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("07acfdce-4757-4439-b422-ddd13a2fcc10"); - object routeValues = new { project = project, definition = definition }; - - List> queryParams = new List>(); - if (branchName != null) - { - queryParams.Add("branchName", branchName); - } - if (stageName != null) - { - queryParams.Add("stageName", stageName); - } - if (jobName != null) - { - queryParams.Add("jobName", jobName); - } - if (configuration != null) - { - queryParams.Add("configuration", configuration); - } - if (label != null) - { - queryParams.Add("label", label); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds a tag to a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The tag to add. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddBuildTagAsync( - string project, - int buildId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds a tag to a build. - /// - /// Project ID - /// The ID of the build. - /// The tag to add. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddBuildTagAsync( - Guid project, - int buildId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds tags to a build. - /// - /// The tags to add. - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddBuildTagsAsync( - IEnumerable tags, - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent>(tags, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Adds tags to a build. - /// - /// The tags to add. - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddBuildTagsAsync( - IEnumerable tags, - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId }; - HttpContent content = new ObjectContent>(tags, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Removes a tag from a build. - /// - /// Project ID or project name - /// The ID of the build. - /// The tag to remove. - /// - /// The cancellation token to cancel operation. - public virtual Task> DeleteBuildTagAsync( - string project, - int buildId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Removes a tag from a build. - /// - /// Project ID - /// The ID of the build. - /// The tag to remove. - /// - /// The cancellation token to cancel operation. - public virtual Task> DeleteBuildTagAsync( - Guid project, - int buildId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the tags for a build. - /// - /// Project ID or project name - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildTagsAsync( - string project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the tags for a build. - /// - /// Project ID - /// The ID of the build. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetBuildTagsAsync( - Guid project, - int buildId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("6e6114b2-8161-44c8-8f6c-c5505782427f"); - object routeValues = new { project = project, buildId = buildId }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds a tag to a definition - /// - /// Project ID or project name - /// The ID of the definition. - /// The tag to add. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddDefinitionTagAsync( - string project, - int definitionId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds a tag to a definition - /// - /// Project ID - /// The ID of the definition. - /// The tag to add. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddDefinitionTagAsync( - Guid project, - int definitionId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Adds multiple tags to a definition. - /// - /// The tags to add. - /// Project ID or project name - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddDefinitionTagsAsync( - IEnumerable tags, - string project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent>(tags, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Adds multiple tags to a definition. - /// - /// The tags to add. - /// Project ID - /// The ID of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> AddDefinitionTagsAsync( - IEnumerable tags, - Guid project, - int definitionId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId }; - HttpContent content = new ObjectContent>(tags, new VssJsonMediaTypeFormatter(true)); - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Removes a tag from a definition. - /// - /// Project ID or project name - /// The ID of the definition. - /// The tag to remove. - /// - /// The cancellation token to cancel operation. - public virtual Task> DeleteDefinitionTagAsync( - string project, - int definitionId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Removes a tag from a definition. - /// - /// Project ID - /// The ID of the definition. - /// The tag to remove. - /// - /// The cancellation token to cancel operation. - public virtual Task> DeleteDefinitionTagAsync( - Guid project, - int definitionId, - string tag, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId, tag = tag }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the tags for a definition. - /// - /// Project ID or project name - /// The ID of the definition. - /// The definition revision number. If not specified, uses the latest revision of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionTagsAsync( - string project, - int definitionId, - int? revision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets the tags for a definition. - /// - /// Project ID - /// The ID of the definition. - /// The definition revision number. If not specified, uses the latest revision of the definition. - /// - /// The cancellation token to cancel operation. - public virtual Task> GetDefinitionTagsAsync( - Guid project, - int definitionId, - int? revision = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("cb894432-134a-4d31-a839-83beceaace4b"); - object routeValues = new { project = project, definitionId = definitionId }; - - List> queryParams = new List>(); - if (revision != null) - { - queryParams.Add("revision", revision.Value.ToString(CultureInfo.InvariantCulture)); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of all build and definition tags in the project. - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> GetTagsAsync( - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d84ac5c6-edc7-43d5-adc9-1b34be5dea09"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of all build and definition tags in the project. - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> GetTagsAsync( - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("d84ac5c6-edc7-43d5-adc9-1b34be5dea09"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Deletes a build definition template. - /// - /// Project ID or project name - /// The ID of the template. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteTemplateAsync( - string project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Deletes a build definition template. - /// - /// Project ID - /// The ID of the template. - /// - /// The cancellation token to cancel operation. - public virtual async Task DeleteTemplateAsync( - Guid project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("DELETE"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Gets a specific build definition template. - /// - /// Project ID or project name - /// The ID of the requested template. - /// - /// The cancellation token to cancel operation. - public virtual Task GetTemplateAsync( - string project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a specific build definition template. - /// - /// Project ID - /// The ID of the requested template. - /// - /// The cancellation token to cancel operation. - public virtual Task GetTemplateAsync( - Guid project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all definition templates. - /// - /// Project ID or project name - /// - /// The cancellation token to cancel operation. - public virtual Task> GetTemplatesAsync( - string project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets all definition templates. - /// - /// Project ID - /// - /// The cancellation token to cancel operation. - public virtual Task> GetTemplatesAsync( - Guid project, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project }; - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Updates an existing build definition template. - /// - /// The new version of the template. - /// Project ID or project name - /// The ID of the template. - /// - /// The cancellation token to cancel operation. - public virtual Task SaveTemplateAsync( - BuildDefinitionTemplate template, - string project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - HttpContent content = new ObjectContent(template, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Updates an existing build definition template. - /// - /// The new version of the template. - /// Project ID - /// The ID of the template. - /// - /// The cancellation token to cancel operation. - public virtual Task SaveTemplateAsync( - BuildDefinitionTemplate template, - Guid project, - string templateId, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("PUT"); - Guid locationId = new Guid("e884571e-7f92-4d6a-9274-3f5649900835"); - object routeValues = new { project = project, templateId = templateId }; - HttpContent content = new ObjectContent(template, new VssJsonMediaTypeFormatter(true)); - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 3), - userState: userState, - cancellationToken: cancellationToken, - content: content); - } - - /// - /// [Preview API] Gets details for a build - /// - /// Project ID or project name - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildTimelineAsync( - string project, - int buildId, - Guid? timelineId = null, - int? changeId = null, - Guid? planId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("8baac422-4c6e-4de5-8532-db96d92acffa"); - object routeValues = new { project = project, buildId = buildId, timelineId = timelineId }; - - List> queryParams = new List>(); - if (changeId != null) - { - queryParams.Add("changeId", changeId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (planId != null) - { - queryParams.Add("planId", planId.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets details for a build - /// - /// Project ID - /// - /// - /// - /// - /// - /// The cancellation token to cancel operation. - public virtual Task GetBuildTimelineAsync( - Guid project, - int buildId, - Guid? timelineId = null, - int? changeId = null, - Guid? planId = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("8baac422-4c6e-4de5-8532-db96d92acffa"); - object routeValues = new { project = project, buildId = buildId, timelineId = timelineId }; - - List> queryParams = new List>(); - if (changeId != null) - { - queryParams.Add("changeId", changeId.Value.ToString(CultureInfo.InvariantCulture)); - } - if (planId != null) - { - queryParams.Add("planId", planId.Value.ToString()); - } - - return SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 2), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Recreates the webhooks for the specified triggers in the given source code repository. - /// - /// The types of triggers to restore webhooks for. - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual async Task RestoreWebhooksAsync( - List triggerTypes, - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("793bceb8-9736-4030-bd2f-fb3ce6d6b478"); - object routeValues = new { project = project, providerName = providerName }; - HttpContent content = new ObjectContent>(triggerTypes, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Recreates the webhooks for the specified triggers in the given source code repository. - /// - /// The types of triggers to restore webhooks for. - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual async Task RestoreWebhooksAsync( - List triggerTypes, - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("POST"); - Guid locationId = new Guid("793bceb8-9736-4030-bd2f-fb3ce6d6b478"); - object routeValues = new { project = project, providerName = providerName }; - HttpContent content = new ObjectContent>(triggerTypes, new VssJsonMediaTypeFormatter(true)); - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - using (HttpResponseMessage response = await SendAsync( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken, - content: content).ConfigureAwait(false)) - { - return; - } - } - - /// - /// [Preview API] Gets a list of webhooks installed in the given source code repository. - /// - /// Project ID or project name - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListWebhooksAsync( - string project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("8f20ff82-9498-4812-9f6e-9c01bdc50e99"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } - - /// - /// [Preview API] Gets a list of webhooks installed in the given source code repository. - /// - /// Project ID - /// The name of the source provider. - /// If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. - /// If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. - /// - /// The cancellation token to cancel operation. - public virtual Task> ListWebhooksAsync( - Guid project, - string providerName, - Guid? serviceEndpointId = null, - string repository = null, - object userState = null, - CancellationToken cancellationToken = default) - { - HttpMethod httpMethod = new HttpMethod("GET"); - Guid locationId = new Guid("8f20ff82-9498-4812-9f6e-9c01bdc50e99"); - object routeValues = new { project = project, providerName = providerName }; - - List> queryParams = new List>(); - if (serviceEndpointId != null) - { - queryParams.Add("serviceEndpointId", serviceEndpointId.Value.ToString()); - } - if (repository != null) - { - queryParams.Add("repository", repository); - } - - return SendAsync>( - httpMethod, - locationId, - routeValues: routeValues, - version: new ApiResourceVersion(5.2, 1), - queryParameters: queryParams, - userState: userState, - cancellationToken: cancellationToken); - } } } diff --git a/src/Sdk/BuildWebApi/Api/IVariableMultiplierExecutionOptions.cs b/src/Sdk/BuildWebApi/Api/IVariableMultiplierExecutionOptions.cs deleted file mode 100644 index 4aa4e41f6..000000000 --- a/src/Sdk/BuildWebApi/Api/IVariableMultiplierExecutionOptions.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace GitHub.Build.WebApi -{ - public interface IVariableMultiplierExecutionOptions - { - Int32 MaxConcurrency - { - get; - } - - Boolean ContinueOnError - { - get; - } - - List Multipliers - { - get; - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/Links.cs b/src/Sdk/BuildWebApi/Api/Links.cs deleted file mode 100644 index 428ca0019..000000000 --- a/src/Sdk/BuildWebApi/Api/Links.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class Links - { - public const string Avatar = "avatar"; - public const String Self = "self"; - public const String Web = "web"; - public const String Editor = "editor"; - public const String Badge = "badge"; - public const String Timeline = "timeline"; - public const String Details = "details"; - public const String SourceVersionDisplayUri = "sourceVersionDisplayUri"; - } -} diff --git a/src/Sdk/BuildWebApi/Api/MetricAggregationTypes.cs b/src/Sdk/BuildWebApi/Api/MetricAggregationTypes.cs deleted file mode 100644 index 8269b10a8..000000000 --- a/src/Sdk/BuildWebApi/Api/MetricAggregationTypes.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class MetricAggregationTypes - { - public const String Hourly = "Hourly"; - public const String Daily = "Daily"; - } - - [Obsolete("Use MetricAggregationTypes instead.")] - public static class WellKnownMetricAggregationTypes - { - public const String Hourly = MetricAggregationTypes.Hourly; - public const String Daily = MetricAggregationTypes.Daily; - } -} diff --git a/src/Sdk/BuildWebApi/Api/PhaseTargetType.cs b/src/Sdk/BuildWebApi/Api/PhaseTargetType.cs deleted file mode 100644 index 126026ece..000000000 --- a/src/Sdk/BuildWebApi/Api/PhaseTargetType.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class PhaseTargetType - { - public const Int32 Agent = 1; - public const Int32 Server = 2; - } -} diff --git a/src/Sdk/BuildWebApi/Api/ProcessType.cs b/src/Sdk/BuildWebApi/Api/ProcessType.cs deleted file mode 100644 index 3b91987c6..000000000 --- a/src/Sdk/BuildWebApi/Api/ProcessType.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class ProcessType - { - public const Int32 Designer = 1; - public const Int32 Yaml = 2; - public const Int32 Docker = 3; - public const Int32 JustInTime = 4; - - public static String GetName(Int32 type) - { - switch (type) - { - case ProcessType.Docker: - return nameof(Docker); - case ProcessType.JustInTime: - return nameof(JustInTime); - case ProcessType.Yaml: - return nameof(Yaml); - default: - return nameof(Designer); - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/ReportTypes.cs b/src/Sdk/BuildWebApi/Api/ReportTypes.cs deleted file mode 100644 index 983cf2565..000000000 --- a/src/Sdk/BuildWebApi/Api/ReportTypes.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - public static class ReportTypes - { - public const String Html = "Html"; - } - - [Obsolete("Use ReportTypes instead.")] - public static class WellKnownReportTypes - { - public const String Html = ReportTypes.Html; - } -} diff --git a/src/Sdk/BuildWebApi/Api/RepositoryProperties.cs b/src/Sdk/BuildWebApi/Api/RepositoryProperties.cs deleted file mode 100644 index ef82fe4c1..000000000 --- a/src/Sdk/BuildWebApi/Api/RepositoryProperties.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [Obsolete("Use RepositoryProperties instead.")] - public static class WellKnownRepositoryProperties - { - public const String ApiUrl = RepositoryProperties.ApiUrl; - public const String BranchesUrl = RepositoryProperties.BranchesUrl; - public const String CheckoutNestedSubmodules = RepositoryProperties.CheckoutNestedSubmodules; - public const String CleanOptions = RepositoryProperties.CleanOptions; - public const String CloneUrl = RepositoryProperties.CloneUrl; - public const String ConnectedServiceId = RepositoryProperties.ConnectedServiceId; - public const String FetchDepth = RepositoryProperties.FetchDepth; - public const String Fullname = RepositoryProperties.Fullname; - public const String GitLfsSupport = RepositoryProperties.GitLfsSupport; - public const String LabelSources = RepositoryProperties.LabelSources; - public const String LabelSourcesFormat = RepositoryProperties.LabelSourcesFormat; - public const String Password = RepositoryProperties.Password; - public const String SkipSyncSource = RepositoryProperties.SkipSyncSource; - public const String SvnMapping = RepositoryProperties.SvnMapping; - public const String TfvcMapping = RepositoryProperties.TfvcMapping; - public const String TokenType = RepositoryProperties.TokenType; - public const String Username = RepositoryProperties.Username; - public const String ReportBuildStatus = RepositoryProperties.ReportBuildStatus; - public const String AcceptUntrustedCertificates = RepositoryProperties.AcceptUntrustedCertificates; - } - - [GenerateAllConstants] - public static class RepositoryProperties - { - public const String AcceptUntrustedCertificates = "acceptUntrustedCerts"; - public const String ApiUrl = "apiUrl"; - public const String Archived = "archived"; - public const String BranchesUrl = "branchesUrl"; - public const String CheckoutNestedSubmodules = "checkoutNestedSubmodules"; - public const String CleanOptions = "cleanOptions"; - public const String CloneUrl = "cloneUrl"; - public const String ConnectedServiceId = "connectedServiceId"; - public const String DefaultBranch = "defaultBranch"; - public const String ExternalId = "externalId"; - public const String FetchDepth = "fetchDepth"; - public const String Fullname = "fullName"; - public const String GitLfsSupport = "gitLfsSupport"; - public const String HasAdminPermissions = "hasAdminPermissions"; - public const String IsFork = "isFork"; - public const String IsPrivate = "isPrivate"; - public const String LabelSources = "labelSources"; - public const String LabelSourcesFormat = "labelSourcesFormat"; - public const String Languages = "languages"; - public const String LastUpdated = "lastUpdated"; - public const String ManageUrl = "manageUrl"; - public const String NodeId = "nodeId"; - public const String OwnerAvatarUrl = "ownerAvatarUrl"; - public const String OwnerId = "ownerId"; - public const String OwnerIsAUser = "ownerIsAUser"; - public const String OrgName = "orgName"; - public const String Password = "password"; - public const String PrimaryLanguage = "primaryLanguage"; - public const String RefsUrl = "refsUrl"; - public const String ReportBuildStatus = "reportBuildStatus"; - public const String SafeId = "safeId"; // Used in telemetry, so sensitive information removed (may be a url w/ password) - public const String SafeRepository = "safeRepository"; // Used in telemetry, so sensitive information removed - public const String ShortName = "shortName"; - public const String SkipSyncSource = "skipSyncSource"; - public const String SvnMapping = "svnMapping"; - public const String TfvcMapping = "tfvcMapping"; - public const String TokenType = "tokenType"; - public const String Username = "username"; - } -} diff --git a/src/Sdk/BuildWebApi/Api/RepositoryTypes.cs b/src/Sdk/BuildWebApi/Api/RepositoryTypes.cs deleted file mode 100644 index df1c868ef..000000000 --- a/src/Sdk/BuildWebApi/Api/RepositoryTypes.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - public static class RepositoryTypes - { - public const String TfsVersionControl = "TfsVersionControl"; - public const String TfsGit = "TfsGit"; - public const String Git = "Git"; - public const String GitHub = "GitHub"; - public const String GitHubEnterprise = "GitHubEnterprise"; - public const String Bitbucket = "Bitbucket"; - public const String Svn = "Svn"; - } - - [Obsolete("Use RepositoryTypes instead.")] - public static class WellKnownRepositoryTypes - { - public const String TfsVersionControl = RepositoryTypes.TfsVersionControl; - public const String TfsGit = RepositoryTypes.TfsGit; - public const String Git = RepositoryTypes.Git; - public const String GitHub = RepositoryTypes.GitHub; - public const String GitHubEnterprise = RepositoryTypes.GitHubEnterprise; - public const String Bitbucket = RepositoryTypes.Bitbucket; - public const String Svn = RepositoryTypes.Svn; - } -} diff --git a/src/Sdk/BuildWebApi/Api/Security.cs b/src/Sdk/BuildWebApi/Api/Security.cs deleted file mode 100644 index 4f1d3c651..000000000 --- a/src/Sdk/BuildWebApi/Api/Security.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.ComponentModel; -using System.Text; - -namespace GitHub.Build.WebApi -{ - [EditorBrowsable(EditorBrowsableState.Never)] - public static class Security - { - /// - /// Gets tokenized path from the given path to fit in to build hierarchical security - /// - /// - /// - public static String GetSecurityTokenPath(String path) - { - if (String.IsNullOrEmpty(path)) - { - // return root path by default - return NamespaceSeparator.ToString(); - } - - String[] components = path.Split(new char[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries); - if (components.Length == 0) - { - // for root path - return NamespaceSeparator.ToString(); - } - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < components.Length; i++) - { -#if !NETSTANDARD - // FileSpec isn't available in NetStandard - String error; - if (!FileSpec.IsLegalNtfsName(components[i], MaxPathNameLength, true, out error)) - { - throw new InvalidPathException(error); - } -#endif - - sb.AppendFormat("{0}{1}", NamespaceSeparator, components[i]); - } - - sb.Append(NamespaceSeparator); - return sb.ToString(); - } - - public static readonly Char NamespaceSeparator = '/'; - public static readonly Int32 MaxPathNameLength = 248; - - public const String BuildNamespaceIdString = "33344D9C-FC72-4d6f-ABA5-FA317101A7E9"; - public static readonly Guid BuildNamespaceId = new Guid(BuildNamespaceIdString); - } -} diff --git a/src/Sdk/BuildWebApi/Api/SerializationHelper.cs b/src/Sdk/BuildWebApi/Api/SerializationHelper.cs deleted file mode 100644 index 5185bd76c..000000000 --- a/src/Sdk/BuildWebApi/Api/SerializationHelper.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace GitHub.Build.WebApi -{ - internal static class SerializationHelper - { - public static void Copy( - ref List source, - ref List target, - Boolean clearSource = false) - { - if (source != null && source.Count > 0) - { - target = new List(source); - if (clearSource) - { - source = null; - } - } - } - - public static void Copy( - ref IDictionary source, - ref IDictionary target, - IEqualityComparer comparer, - Boolean clearSource = false) - { - if (source != null && source.Count > 0) - { - target = new Dictionary(source, comparer); - if (clearSource) - { - source = null; - } - } - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/ServerTargetExecutionType.cs b/src/Sdk/BuildWebApi/Api/ServerTargetExecutionType.cs deleted file mode 100644 index d23250466..000000000 --- a/src/Sdk/BuildWebApi/Api/ServerTargetExecutionType.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi { - - [GenerateAllConstants] - public static class ServerTargetExecutionType { - public const Int32 Normal = 0; - public const Int32 VariableMultipliers = 1; - } -} diff --git a/src/Sdk/BuildWebApi/Api/SettingsSourceType.cs b/src/Sdk/BuildWebApi/Api/SettingsSourceType.cs deleted file mode 100644 index 6d70c0b1c..000000000 --- a/src/Sdk/BuildWebApi/Api/SettingsSourceType.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.ComponentModel; -using GitHub.Services.Common; - -namespace GitHub.Build.WebApi -{ - [GenerateAllConstants] - [EditorBrowsable(EditorBrowsableState.Never)] - public static class SettingsSourceType - { - public const Int32 Definition = 1; - public const Int32 Process = 2; - } -} diff --git a/src/Sdk/BuildWebApi/Api/TypePropertyJsonConverter.cs b/src/Sdk/BuildWebApi/Api/TypePropertyJsonConverter.cs deleted file mode 100644 index 8a10d1172..000000000 --- a/src/Sdk/BuildWebApi/Api/TypePropertyJsonConverter.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Reflection; -using GitHub.Services.WebApi; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; - -namespace GitHub.Build.WebApi -{ - internal abstract class TypePropertyJsonConverter : VssSecureJsonConverter where TInstance : class - { - public override Object ReadJson( - JsonReader reader, - Type objectType, - Object existingValue, - JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - var contract = serializer.ContractResolver.ResolveContract(objectType) as JsonObjectContract; - if (contract == null) - { - return existingValue; - } - - var property = contract.Properties.GetClosestMatchProperty("Type"); - if (property == null) - { - return existingValue; - } - - Int32 targetType; - JToken targetTypeValue; - var value = JObject.Load(reader); - - TInstance newValue = GetInstance(objectType); - if (newValue == null) - { - if (!value.TryGetValue(property.PropertyName, StringComparison.OrdinalIgnoreCase, out targetTypeValue)) - { - if (!TryInferType(value, out targetType)) - { - return existingValue; - } - } - else - { - if (targetTypeValue.Type != JTokenType.Integer) - { - return existingValue; - } - else - { - targetType = (Int32)targetTypeValue; - } - } - - newValue = GetInstance(targetType); - } - - if (value != null) - { - using (JsonReader objectReader = value.CreateReader()) - { - serializer.Populate(objectReader, newValue); - } - } - - return newValue; - } - - protected abstract TInstance GetInstance(Int32 targetType); - - protected virtual TInstance GetInstance( - Type objectType) - { - return null; - } - - protected virtual Boolean TryInferType( - JObject value, - out Int32 type) - { - type = 0; - return false; - } - - public override Boolean CanConvert( - Type objectType) - { - return typeof(TInstance).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); - } - - public override Boolean CanWrite - { - get - { - return false; - } - } - - public override void WriteJson( - JsonWriter writer, - Object value, - JsonSerializer serializer) - { - // The virtual method returns false for CanWrite so this should never be invoked - throw new NotSupportedException(); - } - } -} diff --git a/src/Sdk/BuildWebApi/Api/WellKnownBuildOptions.cs b/src/Sdk/BuildWebApi/Api/WellKnownBuildOptions.cs deleted file mode 100644 index 039eeb0e3..000000000 --- a/src/Sdk/BuildWebApi/Api/WellKnownBuildOptions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace GitHub.Build.WebApi -{ - [Obsolete("No longer used.")] - public static class WellKnownBuildOptions - { - public static readonly Guid CreateDrop = Guid.Parse("{E8B30F6F-039D-4D34-969C-449BBE9C3B9E}"); - public static readonly Guid CopyToStagingFolder = Guid.Parse("{82F9A3E8-3930-482E-AC62-AE3276F284D5}"); - } -} diff --git a/src/Sdk/BuildWebApi/Api/WellKnownDataProviderKeys.cs b/src/Sdk/BuildWebApi/Api/WellKnownDataProviderKeys.cs deleted file mode 100644 index bdd412b51..000000000 --- a/src/Sdk/BuildWebApi/Api/WellKnownDataProviderKeys.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.ComponentModel; - -namespace GitHub.Build.WebApi -{ - // moved to WebAccess/Build.Plugins - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public static class WellKnownDataProviderKeys - { - // Extensions - public const String MyDefinitions = "TFS.Build.MyDefinitions"; - public const String AllDefinitions = "TFS.Build.AllDefinitions"; - public const String QueuedDefinitions = "TFS.Build.QueuedDefinitions"; - public const String AllBuilds = "TFS.Build.AllBuilds"; - public const String DefinitionSummary = "TFS.Build.DefinitionSummary"; - public const String DefinitionHistory = "TFS.Build.DefinitionHistory"; - public const String DefinitionDeletedHistory = "TFS.Build.DefinitionDeletedHistory"; - - // Resources - public const String Builds = "TFS.Build.Builds"; - public const String Changes = "TFS.Build.Changes"; - public const String Definitions = "TFS.Build.Definitions"; - public const String Folders = "TFS.Build.Folders"; - public const String Queues = "TFS.Build.Queues"; - - // Resources grouped together - public const String BuildHistory = "TFS.Build.BuildHistory"; - - // Settings - public const String NewCIWorkflowOptInState = "TFS.Build.NewCIWorkflowOptInState"; - public const String NewCIWorkflowPreviewFeatureState = "TFS.Build.NewCIWorkflowPreviewFeatureState"; - - // Others - public const String AllDefinitionIds = "TFS.Build.AllDefinitions.DefinitionIds"; - public const String BuildIds = "TFS.Build.Mine.BuildIds"; - public const String HasMyBuilds = "TFS.Build.Mine.HasMyBuilds"; - public const String MyFavoriteDefinitionIds = "TFS.Build.MyFavoriteDefinitionIds"; - public const String TeamFavoriteDefinitionIds = "TFS.Build.TeamFavoriteDefinitionIds"; - - public const String BuildsContinuationToken = "TFS.Build.Builds.ContinuationToken"; - public const String DefinitionsContinuationToken = "TFS.Build.Definitions.ContinuationToken"; - } -}