From cc40bc100788d4834b3ef2d9241aaaf5d716f31f Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:06:41 +0000 Subject: [PATCH 01/13] chaore: add azure devops workitemtracking v7 Add generated Azure DevOps Work Item Tracking v7 client and models under vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking --- .../azuredevops/v7/workitemtracking/client.go | 3740 +++++++++++++++++ .../azuredevops/v7/workitemtracking/models.go | 1731 ++++++++ vendor/modules.txt | 1 + 3 files changed, 5472 insertions(+) create mode 100644 vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/client.go create mode 100644 vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/models.go diff --git a/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/client.go b/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/client.go new file mode 100644 index 00000000..6bfd17d1 --- /dev/null +++ b/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/client.go @@ -0,0 +1,3740 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package workitemtracking + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/webapi" + "io" + "net/http" + "net/url" + "strconv" + "strings" +) + +var ResourceAreaId, _ = uuid.Parse("5264459e-e5e0-4bd8-b118-0985e68a4ec5") + +type Client interface { + // [Preview API] Add a comment on a work item. + AddComment(context.Context, AddCommentArgs) (*Comment, error) + // [Preview API] Add a comment on a work item. + AddWorkItemComment(context.Context, AddWorkItemCommentArgs) (*Comment, error) + // [Preview API] Uploads an attachment. + CreateAttachment(context.Context, CreateAttachmentArgs) (*AttachmentReference, error) + // [Preview API] Adds a new reaction to a comment. + CreateCommentReaction(context.Context, CreateCommentReactionArgs) (*CommentReaction, error) + // [Preview API] Create new or update an existing classification node. + CreateOrUpdateClassificationNode(context.Context, CreateOrUpdateClassificationNodeArgs) (*WorkItemClassificationNode, error) + // [Preview API] Creates a query, or moves a query. + CreateQuery(context.Context, CreateQueryArgs) (*QueryHierarchyItem, error) + // [Preview API] Creates a template + CreateTemplate(context.Context, CreateTemplateArgs) (*WorkItemTemplate, error) + // [Preview API] Creates a temporary query + CreateTempQuery(context.Context, CreateTempQueryArgs) (*TemporaryQueryResponseModel, error) + // [Preview API] Creates a single work item. + CreateWorkItem(context.Context, CreateWorkItemArgs) (*WorkItem, error) + // [Preview API] Create a new field. + CreateWorkItemField(context.Context, CreateWorkItemFieldArgs) (*WorkItemField2, error) + // [Preview API] Delete an existing classification node. + DeleteClassificationNode(context.Context, DeleteClassificationNodeArgs) error + // [Preview API] Delete a comment on a work item. + DeleteComment(context.Context, DeleteCommentArgs) error + // [Preview API] Deletes an existing reaction on a comment. + DeleteCommentReaction(context.Context, DeleteCommentReactionArgs) (*CommentReaction, error) + // [Preview API] Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder. + DeleteQuery(context.Context, DeleteQueryArgs) error + // [Preview API] + DeleteTag(context.Context, DeleteTagArgs) error + // [Preview API] Deletes the template with given id + DeleteTemplate(context.Context, DeleteTemplateArgs) error + // [Preview API] Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution. + DeleteWorkItem(context.Context, DeleteWorkItemArgs) (*WorkItemDelete, error) + // [Preview API] Deletes the field. To undelete a filed, see "Update Field" API. + DeleteWorkItemField(context.Context, DeleteWorkItemFieldArgs) error + // [Preview API] Deletes specified work items and sends them to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. + DeleteWorkItems(context.Context, DeleteWorkItemsArgs) (*WorkItemDeleteBatch, error) + // [Preview API] Destroys the specified work item permanently from the Recycle Bin. This action can not be undone. + DestroyWorkItem(context.Context, DestroyWorkItemArgs) error + // [Preview API] Downloads an attachment. + GetAttachmentContent(context.Context, GetAttachmentContentArgs) (io.ReadCloser, error) + // [Preview API] Downloads an attachment. + GetAttachmentZip(context.Context, GetAttachmentZipArgs) (io.ReadCloser, error) + // [Preview API] Gets the classification node for a given node path. + GetClassificationNode(context.Context, GetClassificationNodeArgs) (*WorkItemClassificationNode, error) + // [Preview API] Gets root classification nodes or list of classification nodes for a given list of nodes ids, for a given project. In case ids parameter is supplied you will get list of classification nodes for those ids. Otherwise you will get root classification nodes for this project. + GetClassificationNodes(context.Context, GetClassificationNodesArgs) (*[]WorkItemClassificationNode, error) + // [Preview API] Returns a work item comment. + GetComment(context.Context, GetCommentArgs) (*Comment, error) + // [Preview API] Gets reactions of a comment. + GetCommentReactions(context.Context, GetCommentReactionsArgs) (*[]CommentReaction, error) + // [Preview API] Returns a list of work item comments, pageable. + GetComments(context.Context, GetCommentsArgs) (*CommentList, error) + // [Preview API] Returns a list of work item comments by ids. + GetCommentsBatch(context.Context, GetCommentsBatchArgs) (*CommentList, error) + // [Preview API] + GetCommentVersion(context.Context, GetCommentVersionArgs) (*CommentVersion, error) + // [Preview API] + GetCommentVersions(context.Context, GetCommentVersionsArgs) (*[]CommentVersion, error) + // [Preview API] Gets a deleted work item from Recycle Bin. + GetDeletedWorkItem(context.Context, GetDeletedWorkItemArgs) (*WorkItemDelete, error) + // [Preview API] Gets the work items from the recycle bin, whose IDs have been specified in the parameters + GetDeletedWorkItems(context.Context, GetDeletedWorkItemsArgs) (*[]WorkItemDeleteReference, error) + // [Preview API] Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin. + GetDeletedWorkItemShallowReferences(context.Context, GetDeletedWorkItemShallowReferencesArgs) (*[]WorkItemDeleteShallowReference, error) + // [Preview API] Get users who reacted on the comment. + GetEngagedUsers(context.Context, GetEngagedUsersArgs) (*[]webapi.IdentityRef, error) + // [Preview API] Gets a list of repos within specified github connection. + GetGithubConnectionRepositories(context.Context, GetGithubConnectionRepositoriesArgs) (*[]GitHubConnectionRepoModel, error) + // [Preview API] Gets a list of github connections + GetGithubConnections(context.Context, GetGithubConnectionsArgs) (*[]GitHubConnectionModel, error) + // [Preview API] Gets the root queries and their children + GetQueries(context.Context, GetQueriesArgs) (*[]QueryHierarchyItem, error) + // [Preview API] Gets a list of queries by ids (Maximum 1000) + GetQueriesBatch(context.Context, GetQueriesBatchArgs) (*[]QueryHierarchyItem, error) + // [Preview API] Retrieves an individual query and its children + GetQuery(context.Context, GetQueryArgs) (*QueryHierarchyItem, error) + // [Preview API] Gets the results of the query given the query ID. + GetQueryResultCount(context.Context, GetQueryResultCountArgs) (*int, error) + // [Preview API] Gets recent work item activities + GetRecentActivityData(context.Context, GetRecentActivityDataArgs) (*[]AccountRecentActivityWorkItemModel2, error) + // [Preview API] Gets the work item relation type definition. + GetRelationType(context.Context, GetRelationTypeArgs) (*WorkItemRelationType, error) + // [Preview API] Gets the work item relation types. + GetRelationTypes(context.Context, GetRelationTypesArgs) (*[]WorkItemRelationType, error) + // [Preview API] Get a batch of work item links + GetReportingLinksByLinkType(context.Context, GetReportingLinksByLinkTypeArgs) (*ReportingWorkItemLinksBatch, error) + // [Preview API] Returns a fully hydrated work item for the requested revision + GetRevision(context.Context, GetRevisionArgs) (*WorkItem, error) + // [Preview API] Returns the list of fully hydrated work item revisions, paged. + GetRevisions(context.Context, GetRevisionsArgs) (*[]WorkItem, error) + // [Preview API] Gets root classification nodes under the project. + GetRootNodes(context.Context, GetRootNodesArgs) (*[]WorkItemClassificationNode, error) + // [Preview API] + GetTag(context.Context, GetTagArgs) (*WorkItemTagDefinition, error) + // [Preview API] + GetTags(context.Context, GetTagsArgs) (*[]WorkItemTagDefinition, error) + // [Preview API] Gets the template with specified id + GetTemplate(context.Context, GetTemplateArgs) (*WorkItemTemplate, error) + // [Preview API] Gets template + GetTemplates(context.Context, GetTemplatesArgs) (*[]WorkItemTemplateReference, error) + // [Preview API] Returns a single update for a work item + GetUpdate(context.Context, GetUpdateArgs) (*WorkItemUpdate, error) + // [Preview API] Returns a the deltas between work item revisions + GetUpdates(context.Context, GetUpdatesArgs) (*[]WorkItemUpdate, error) + // [Preview API] Get the list of work item tracking outbound artifact link types. + GetWorkArtifactLinkTypes(context.Context, GetWorkArtifactLinkTypesArgs) (*[]WorkArtifactLink, error) + // [Preview API] Returns a single work item. + GetWorkItem(context.Context, GetWorkItemArgs) (*WorkItem, error) + // [Preview API] Gets information on a specific field. + GetWorkItemField(context.Context, GetWorkItemFieldArgs) (*WorkItemField2, error) + // [Preview API] Returns information for all fields. The project ID/name parameter is optional. + GetWorkItemFields(context.Context, GetWorkItemFieldsArgs) (*[]WorkItemField2, error) + // [Preview API] Get a work item icon given the friendly name and icon color. + GetWorkItemIconJson(context.Context, GetWorkItemIconJsonArgs) (*WorkItemIcon, error) + // [Preview API] Get a list of all work item icons. + GetWorkItemIcons(context.Context, GetWorkItemIconsArgs) (*[]WorkItemIcon, error) + // [Preview API] Get a work item icon given the friendly name and icon color. + GetWorkItemIconSvg(context.Context, GetWorkItemIconSvgArgs) (io.ReadCloser, error) + // [Preview API] Get a work item icon given the friendly name and icon color. + GetWorkItemIconXaml(context.Context, GetWorkItemIconXamlArgs) (io.ReadCloser, error) + // [Preview API] Returns the next state on the given work item IDs. + GetWorkItemNextStatesOnCheckinAction(context.Context, GetWorkItemNextStatesOnCheckinActionArgs) (*[]WorkItemNextStateOnTransition, error) + // [Preview API] Returns a list of work items (Maximum 200) + GetWorkItems(context.Context, GetWorkItemsArgs) (*[]WorkItem, error) + // [Preview API] Gets work items for a list of work item ids (Maximum 200) + GetWorkItemsBatch(context.Context, GetWorkItemsBatchArgs) (*[]WorkItem, error) + // [Preview API] Returns a single work item from a template. + GetWorkItemTemplate(context.Context, GetWorkItemTemplateArgs) (*WorkItem, error) + // [Preview API] Returns a work item type definition. + GetWorkItemType(context.Context, GetWorkItemTypeArgs) (*WorkItemType, error) + // [Preview API] Get all work item type categories. + GetWorkItemTypeCategories(context.Context, GetWorkItemTypeCategoriesArgs) (*[]WorkItemTypeCategory, error) + // [Preview API] Get specific work item type category by name. + GetWorkItemTypeCategory(context.Context, GetWorkItemTypeCategoryArgs) (*WorkItemTypeCategory, error) + // [Preview API] Get a list of fields for a work item type with detailed references. + GetWorkItemTypeFieldsWithReferences(context.Context, GetWorkItemTypeFieldsWithReferencesArgs) (*[]WorkItemTypeFieldWithReferences, error) + // [Preview API] Get a field for a work item type with detailed references. + GetWorkItemTypeFieldWithReferences(context.Context, GetWorkItemTypeFieldWithReferencesArgs) (*WorkItemTypeFieldWithReferences, error) + // [Preview API] Returns the list of work item types + GetWorkItemTypes(context.Context, GetWorkItemTypesArgs) (*[]WorkItemType, error) + // [Preview API] Returns the state names and colors for a work item type. + GetWorkItemTypeStates(context.Context, GetWorkItemTypeStatesArgs) (*[]WorkItemStateColor, error) + // [Preview API] Migrates a project to a different process within the same OOB type. For example, you can only migrate a project from agile/custom-agile to agile/custom-agile. + MigrateProjectsProcess(context.Context, MigrateProjectsProcessArgs) (*ProcessMigrationResultModel, error) + // [Preview API] Gets the results of the query given the query ID. + QueryById(context.Context, QueryByIdArgs) (*WorkItemQueryResult, error) + // [Preview API] Gets the results of the query given its WIQL. + QueryByWiql(context.Context, QueryByWiqlArgs) (*WorkItemQueryResult, error) + // [Preview API] Queries work items linked to a given list of artifact URI. + QueryWorkItemsForArtifactUris(context.Context, QueryWorkItemsForArtifactUrisArgs) (*ArtifactUriQueryResult, error) + // [Preview API] + ReadReportingDiscussions(context.Context, ReadReportingDiscussionsArgs) (*ReportingWorkItemRevisionsBatch, error) + // [Preview API] Get a batch of work item revisions with the option of including deleted items + ReadReportingRevisionsGet(context.Context, ReadReportingRevisionsGetArgs) (*ReportingWorkItemRevisionsBatch, error) + // [Preview API] Get a batch of work item revisions. This request may be used if your list of fields is large enough that it may run the URL over the length limit. + ReadReportingRevisionsPost(context.Context, ReadReportingRevisionsPostArgs) (*ReportingWorkItemRevisionsBatch, error) + // [Preview API] Replace template contents + ReplaceTemplate(context.Context, ReplaceTemplateArgs) (*WorkItemTemplate, error) + // [Preview API] Restores the deleted work item from Recycle Bin. + RestoreWorkItem(context.Context, RestoreWorkItemArgs) (*WorkItemDelete, error) + // [Preview API] Searches all queries the user has access to in the current project + SearchQueries(context.Context, SearchQueriesArgs) (*QueryHierarchyItemsResult, error) + // [Preview API] RESTful method to send mail for selected/queried work items. + SendMail(context.Context, SendMailArgs) error + // [Preview API] Update an existing classification node. + UpdateClassificationNode(context.Context, UpdateClassificationNodeArgs) (*WorkItemClassificationNode, error) + // [Preview API] Update a comment on a work item. + UpdateComment(context.Context, UpdateCommentArgs) (*Comment, error) + // [Preview API] Add/remove list of repos within specified github connection. + UpdateGithubConnectionRepos(context.Context, UpdateGithubConnectionReposArgs) (*[]GitHubConnectionRepoModel, error) + // [Preview API] Update a query or a folder. This allows you to update, rename and move queries and folders. + UpdateQuery(context.Context, UpdateQueryArgs) (*QueryHierarchyItem, error) + // [Preview API] + UpdateTag(context.Context, UpdateTagArgs) (*WorkItemTagDefinition, error) + // [Preview API] Updates a single work item. + UpdateWorkItem(context.Context, UpdateWorkItemArgs) (*WorkItem, error) + // [Preview API] Update a comment on a work item. + UpdateWorkItemComment(context.Context, UpdateWorkItemCommentArgs) (*Comment, error) + // [Preview API] Update a field. + UpdateWorkItemField(context.Context, UpdateWorkItemFieldArgs) (*WorkItemField2, error) +} + +type ClientImpl struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &ClientImpl{ + Client: *client, + }, nil +} + +// [Preview API] Add a comment on a work item. +func (client *ClientImpl) AddComment(ctx context.Context, args AddCommentArgs) (*Comment, error) { + if args.Request == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Request"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + + body, marshalErr := json.Marshal(*args.Request) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.4", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddComment function +type AddCommentArgs struct { + // (required) Comment create request. + Request *CommentCreate + // (required) Project ID or project name + Project *string + // (required) Id of a work item. + WorkItemId *int +} + +// [Preview API] Add a comment on a work item. +func (client *ClientImpl) AddWorkItemComment(ctx context.Context, args AddWorkItemCommentArgs) (*Comment, error) { + if args.Request == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Request"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + + queryParams := url.Values{} + if args.Format == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "format"} + } + queryParams.Add("format", string(*args.Format)) + body, marshalErr := json.Marshal(*args.Request) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.4", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddWorkItemComment function +type AddWorkItemCommentArgs struct { + // (required) Comment create request. + Request *CommentCreate + // (required) Project ID or project name + Project *string + // (required) Id of a work item. + WorkItemId *int + // (required) Format of a work item comment (Markdown or Html). + Format *CommentFormat +} + +// [Preview API] Uploads an attachment. +func (client *ClientImpl) CreateAttachment(ctx context.Context, args CreateAttachmentArgs) (*AttachmentReference, error) { + if args.UploadStream == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UploadStream"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.UploadType != nil { + queryParams.Add("uploadType", *args.UploadType) + } + if args.AreaPath != nil { + queryParams.Add("areaPath", *args.AreaPath) + } + locationId, _ := uuid.Parse("e07b5fa4-1499-494d-a496-64b860fd64ff") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.3", routeValues, queryParams, args.UploadStream, "application/octet-stream", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue AttachmentReference + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateAttachment function +type CreateAttachmentArgs struct { + // (required) Stream to upload + UploadStream io.Reader + // (optional) Project ID or project name + Project *string + // (optional) The name of the file + FileName *string + // (optional) Attachment upload type: Simple or Chunked + UploadType *string + // (optional) Target project Area Path + AreaPath *string +} + +// [Preview API] Adds a new reaction to a comment. +func (client *ClientImpl) CreateCommentReaction(ctx context.Context, args CreateCommentReactionArgs) (*CommentReaction, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + if args.ReactionType == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ReactionType"} + } + routeValues["reactionType"] = string(*args.ReactionType) + + locationId, _ := uuid.Parse("f6cb3f27-1028-4851-af96-887e570dc21f") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CommentReaction + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateCommentReaction function +type CreateCommentReactionArgs struct { + // (required) Project ID or project name + Project *string + // (required) WorkItem ID + WorkItemId *int + // (required) Comment ID + CommentId *int + // (required) Type of the reaction + ReactionType *CommentReactionType +} + +// [Preview API] Create new or update an existing classification node. +func (client *ClientImpl) CreateOrUpdateClassificationNode(ctx context.Context, args CreateOrUpdateClassificationNodeArgs) (*WorkItemClassificationNode, error) { + if args.PostedNode == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PostedNode"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.StructureGroup == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.StructureGroup"} + } + routeValues["structureGroup"] = string(*args.StructureGroup) + if args.Path != nil && *args.Path != "" { + routeValues["path"] = *args.Path + } + + body, marshalErr := json.Marshal(*args.PostedNode) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("5a172953-1b41-49d3-840a-33f79c3ce89f") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemClassificationNode + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateOrUpdateClassificationNode function +type CreateOrUpdateClassificationNodeArgs struct { + // (required) Node to create or update. + PostedNode *WorkItemClassificationNode + // (required) Project ID or project name + Project *string + // (required) Structure group of the classification node, area or iteration. + StructureGroup *TreeStructureGroup + // (optional) Path of the classification node. + Path *string +} + +// [Preview API] Creates a query, or moves a query. +func (client *ClientImpl) CreateQuery(ctx context.Context, args CreateQueryArgs) (*QueryHierarchyItem, error) { + if args.PostedQuery == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PostedQuery"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Query == nil || *args.Query == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Query"} + } + routeValues["query"] = *args.Query + + queryParams := url.Values{} + if args.ValidateWiqlOnly != nil { + queryParams.Add("validateWiqlOnly", strconv.FormatBool(*args.ValidateWiqlOnly)) + } + body, marshalErr := json.Marshal(*args.PostedQuery) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue QueryHierarchyItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateQuery function +type CreateQueryArgs struct { + // (required) The query to create. + PostedQuery *QueryHierarchyItem + // (required) Project ID or project name + Project *string + // (required) The parent id or path under which the query is to be created. + Query *string + // (optional) If you only want to validate your WIQL query without actually creating one, set it to true. Default is false. + ValidateWiqlOnly *bool +} + +// [Preview API] Creates a template +func (client *ClientImpl) CreateTemplate(ctx context.Context, args CreateTemplateArgs) (*WorkItemTemplate, error) { + if args.Template == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Template"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team == nil || *args.Team == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Team"} + } + routeValues["team"] = *args.Team + + body, marshalErr := json.Marshal(*args.Template) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("6a90345f-a676-4969-afce-8e163e1d5642") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTemplate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTemplate function +type CreateTemplateArgs struct { + // (required) Template contents + Template *WorkItemTemplate + // (required) Project ID or project name + Project *string + // (required) Team ID or team name + Team *string +} + +// [Preview API] Creates a temporary query +func (client *ClientImpl) CreateTempQuery(ctx context.Context, args CreateTempQueryArgs) (*TemporaryQueryResponseModel, error) { + if args.PostedQuery == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PostedQuery"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.PostedQuery) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("9f614388-a9f0-4952-ad6c-89756bd8e388") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue TemporaryQueryResponseModel + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateTempQuery function +type CreateTempQueryArgs struct { + // (required) The temporary query to create + PostedQuery *TemporaryQueryRequestModel + // (required) Project ID or project name + Project *string +} + +// [Preview API] Creates a single work item. +func (client *ClientImpl) CreateWorkItem(ctx context.Context, args CreateWorkItemArgs) (*WorkItem, error) { + if args.Document == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Document"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + queryParams := url.Values{} + if args.ValidateOnly != nil { + queryParams.Add("validateOnly", strconv.FormatBool(*args.ValidateOnly)) + } + if args.BypassRules != nil { + queryParams.Add("bypassRules", strconv.FormatBool(*args.BypassRules)) + } + if args.SuppressNotifications != nil { + queryParams.Add("suppressNotifications", strconv.FormatBool(*args.SuppressNotifications)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + body, marshalErr := json.Marshal(*args.Document) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("62d3d110-0047-428c-ad3c-4fe872c91c74") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.3", routeValues, queryParams, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateWorkItem function +type CreateWorkItemArgs struct { + // (required) The JSON Patch document representing the work item + Document *[]webapi.JsonPatchOperation + // (required) Project ID or project name + Project *string + // (required) The work item type of the work item to create + Type *string + // (optional) Indicate if you only want to validate the changes without saving the work item + ValidateOnly *bool + // (optional) Do not enforce the work item type rules on this update + BypassRules *bool + // (optional) Do not fire any notifications for this change + SuppressNotifications *bool + // (optional) The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + Expand *WorkItemExpand +} + +// [Preview API] Create a new field. +func (client *ClientImpl) CreateWorkItemField(ctx context.Context, args CreateWorkItemFieldArgs) (*WorkItemField2, error) { + if args.WorkItemField == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemField"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.WorkItemField) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.3", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemField2 + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the CreateWorkItemField function +type CreateWorkItemFieldArgs struct { + // (required) New field definition + WorkItemField *WorkItemField2 + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Delete an existing classification node. +func (client *ClientImpl) DeleteClassificationNode(ctx context.Context, args DeleteClassificationNodeArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.StructureGroup == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.StructureGroup"} + } + routeValues["structureGroup"] = string(*args.StructureGroup) + if args.Path != nil && *args.Path != "" { + routeValues["path"] = *args.Path + } + + queryParams := url.Values{} + if args.ReclassifyId != nil { + queryParams.Add("$reclassifyId", strconv.Itoa(*args.ReclassifyId)) + } + locationId, _ := uuid.Parse("5a172953-1b41-49d3-840a-33f79c3ce89f") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteClassificationNode function +type DeleteClassificationNodeArgs struct { + // (required) Project ID or project name + Project *string + // (required) Structure group of the classification node, area or iteration. + StructureGroup *TreeStructureGroup + // (optional) Path of the classification node. + Path *string + // (optional) Id of the target classification node for reclassification. + ReclassifyId *int +} + +// [Preview API] Delete a comment on a work item. +func (client *ClientImpl) DeleteComment(ctx context.Context, args DeleteCommentArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.4", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteComment function +type DeleteCommentArgs struct { + // (required) Project ID or project name + Project *string + // (required) Id of a work item. + WorkItemId *int + // (required) + CommentId *int +} + +// [Preview API] Deletes an existing reaction on a comment. +func (client *ClientImpl) DeleteCommentReaction(ctx context.Context, args DeleteCommentReactionArgs) (*CommentReaction, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + if args.ReactionType == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ReactionType"} + } + routeValues["reactionType"] = string(*args.ReactionType) + + locationId, _ := uuid.Parse("f6cb3f27-1028-4851-af96-887e570dc21f") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CommentReaction + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the DeleteCommentReaction function +type DeleteCommentReactionArgs struct { + // (required) Project ID or project name + Project *string + // (required) WorkItem ID + WorkItemId *int + // (required) Comment ID + CommentId *int + // (required) Type of the reaction + ReactionType *CommentReactionType +} + +// [Preview API] Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder. +func (client *ClientImpl) DeleteQuery(ctx context.Context, args DeleteQueryArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Query == nil || *args.Query == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Query"} + } + routeValues["query"] = *args.Query + + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteQuery function +type DeleteQueryArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID or path of the query or folder to delete. + Query *string +} + +// [Preview API] +func (client *ClientImpl) DeleteTag(ctx context.Context, args DeleteTagArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TagIdOrName == nil || *args.TagIdOrName == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TagIdOrName"} + } + routeValues["tagIdOrName"] = *args.TagIdOrName + + locationId, _ := uuid.Parse("bc15bc60-e7a8-43cb-ab01-2106be3983a1") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTag function +type DeleteTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) + TagIdOrName *string +} + +// [Preview API] Deletes the template with given id +func (client *ClientImpl) DeleteTemplate(ctx context.Context, args DeleteTemplateArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team == nil || *args.Team == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Team"} + } + routeValues["team"] = *args.Team + if args.TemplateId == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = (*args.TemplateId).String() + + locationId, _ := uuid.Parse("fb10264a-8836-48a0-8033-1b0ccd2748d5") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteTemplate function +type DeleteTemplateArgs struct { + // (required) Project ID or project name + Project *string + // (required) Team ID or team name + Team *string + // (required) Template id + TemplateId *uuid.UUID +} + +// [Preview API] Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution. +func (client *ClientImpl) DeleteWorkItem(ctx context.Context, args DeleteWorkItemArgs) (*WorkItemDelete, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + queryParams := url.Values{} + if args.Destroy != nil { + queryParams.Add("destroy", strconv.FormatBool(*args.Destroy)) + } + locationId, _ := uuid.Parse("72c7ddf8-2cdc-4f60-90cd-ab71c14a399b") + resp, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemDelete + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the DeleteWorkItem function +type DeleteWorkItemArgs struct { + // (required) ID of the work item to be deleted + Id *int + // (optional) Project ID or project name + Project *string + // (optional) Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone. + Destroy *bool +} + +// [Preview API] Deletes the field. To undelete a filed, see "Update Field" API. +func (client *ClientImpl) DeleteWorkItemField(ctx context.Context, args DeleteWorkItemFieldArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FieldNameOrRefName == nil || *args.FieldNameOrRefName == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FieldNameOrRefName"} + } + routeValues["fieldNameOrRefName"] = *args.FieldNameOrRefName + + locationId, _ := uuid.Parse("b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.3", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteWorkItemField function +type DeleteWorkItemFieldArgs struct { + // (required) Field simple name or reference name + FieldNameOrRefName *string + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Deletes specified work items and sends them to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. +func (client *ClientImpl) DeleteWorkItems(ctx context.Context, args DeleteWorkItemsArgs) (*WorkItemDeleteBatch, error) { + if args.DeleteRequest == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.DeleteRequest"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.DeleteRequest) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("8bc57545-27e5-420d-b709-f6e3ebcc1fc1") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemDeleteBatch + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the DeleteWorkItems function +type DeleteWorkItemsArgs struct { + // (required) + DeleteRequest *WorkItemDeleteBatchRequest + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Destroys the specified work item permanently from the Recycle Bin. This action can not be undone. +func (client *ClientImpl) DestroyWorkItem(ctx context.Context, args DestroyWorkItemArgs) error { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + locationId, _ := uuid.Parse("b70d8d39-926c-465e-b927-b1bf0e5ca0e0") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DestroyWorkItem function +type DestroyWorkItemArgs struct { + // (required) ID of the work item to be destroyed permanently + Id *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Downloads an attachment. +func (client *ClientImpl) GetAttachmentContent(ctx context.Context, args GetAttachmentContentArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = (*args.Id).String() + + queryParams := url.Values{} + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + locationId, _ := uuid.Parse("e07b5fa4-1499-494d-a496-64b860fd64ff") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/octet-stream", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetAttachmentContent function +type GetAttachmentContentArgs struct { + // (required) Attachment ID + Id *uuid.UUID + // (optional) Project ID or project name + Project *string + // (optional) Name of the file + FileName *string + // (optional) If set to true always download attachment + Download *bool +} + +// [Preview API] Downloads an attachment. +func (client *ClientImpl) GetAttachmentZip(ctx context.Context, args GetAttachmentZipArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = (*args.Id).String() + + queryParams := url.Values{} + if args.FileName != nil { + queryParams.Add("fileName", *args.FileName) + } + if args.Download != nil { + queryParams.Add("download", strconv.FormatBool(*args.Download)) + } + locationId, _ := uuid.Parse("e07b5fa4-1499-494d-a496-64b860fd64ff") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/zip", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetAttachmentZip function +type GetAttachmentZipArgs struct { + // (required) Attachment ID + Id *uuid.UUID + // (optional) Project ID or project name + Project *string + // (optional) Name of the file + FileName *string + // (optional) If set to true always download attachment + Download *bool +} + +// [Preview API] Gets the classification node for a given node path. +func (client *ClientImpl) GetClassificationNode(ctx context.Context, args GetClassificationNodeArgs) (*WorkItemClassificationNode, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.StructureGroup == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.StructureGroup"} + } + routeValues["structureGroup"] = string(*args.StructureGroup) + if args.Path != nil && *args.Path != "" { + routeValues["path"] = *args.Path + } + + queryParams := url.Values{} + if args.Depth != nil { + queryParams.Add("$depth", strconv.Itoa(*args.Depth)) + } + locationId, _ := uuid.Parse("5a172953-1b41-49d3-840a-33f79c3ce89f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemClassificationNode + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetClassificationNode function +type GetClassificationNodeArgs struct { + // (required) Project ID or project name + Project *string + // (required) Structure group of the classification node, area or iteration. + StructureGroup *TreeStructureGroup + // (optional) Path of the classification node. + Path *string + // (optional) Depth of children to fetch. + Depth *int +} + +// [Preview API] Gets root classification nodes or list of classification nodes for a given list of nodes ids, for a given project. In case ids parameter is supplied you will get list of classification nodes for those ids. Otherwise you will get root classification nodes for this project. +func (client *ClientImpl) GetClassificationNodes(ctx context.Context, args GetClassificationNodesArgs) (*[]WorkItemClassificationNode, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Ids == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "ids"} + } + var stringList []string + for _, item := range *args.Ids { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("ids", listAsString) + if args.Depth != nil { + queryParams.Add("$depth", strconv.Itoa(*args.Depth)) + } + if args.ErrorPolicy != nil { + queryParams.Add("errorPolicy", string(*args.ErrorPolicy)) + } + locationId, _ := uuid.Parse("a70579d1-f53a-48ee-a5be-7be8659023b9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemClassificationNode + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetClassificationNodes function +type GetClassificationNodesArgs struct { + // (required) Project ID or project name + Project *string + // (required) Comma separated integer classification nodes ids. It's not required, if you want root nodes. + Ids *[]int + // (optional) Depth of children to fetch. + Depth *int + // (optional) Flag to handle errors in getting some nodes. Possible options are Fail and Omit. + ErrorPolicy *ClassificationNodesErrorPolicy +} + +// [Preview API] Returns a work item comment. +func (client *ClientImpl) GetComment(ctx context.Context, args GetCommentArgs) (*Comment, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + queryParams := url.Values{} + if args.IncludeDeleted != nil { + queryParams.Add("includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.4", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetComment function +type GetCommentArgs struct { + // (required) Project ID or project name + Project *string + // (required) Id of a work item to get the comment. + WorkItemId *int + // (required) Id of the comment to return. + CommentId *int + // (optional) Specify if the deleted comment should be retrieved. + IncludeDeleted *bool + // (optional) Specifies the additional data retrieval options for work item comments. + Expand *CommentExpandOptions +} + +// [Preview API] Gets reactions of a comment. +func (client *ClientImpl) GetCommentReactions(ctx context.Context, args GetCommentReactionsArgs) (*[]CommentReaction, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("f6cb3f27-1028-4851-af96-887e570dc21f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []CommentReaction + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommentReactions function +type GetCommentReactionsArgs struct { + // (required) Project ID or project name + Project *string + // (required) WorkItem ID + WorkItemId *int + // (required) Comment ID + CommentId *int +} + +// [Preview API] Returns a list of work item comments, pageable. +func (client *ClientImpl) GetComments(ctx context.Context, args GetCommentsArgs) (*CommentList, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.IncludeDeleted != nil { + queryParams.Add("includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.Order != nil { + queryParams.Add("order", string(*args.Order)) + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.4", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CommentList + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetComments function +type GetCommentsArgs struct { + // (required) Project ID or project name + Project *string + // (required) Id of a work item to get comments for. + WorkItemId *int + // (optional) Max number of comments to return. + Top *int + // (optional) Used to query for the next page of comments. + ContinuationToken *string + // (optional) Specify if the deleted comments should be retrieved. + IncludeDeleted *bool + // (optional) Specifies the additional data retrieval options for work item comments. + Expand *CommentExpandOptions + // (optional) Order in which the comments should be returned. + Order *CommentSortOrder +} + +// [Preview API] Returns a list of work item comments by ids. +func (client *ClientImpl) GetCommentsBatch(ctx context.Context, args GetCommentsBatchArgs) (*CommentList, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + + queryParams := url.Values{} + if args.Ids == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "ids"} + } + var stringList []string + for _, item := range *args.Ids { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("ids", listAsString) + if args.IncludeDeleted != nil { + queryParams.Add("includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.4", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CommentList + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommentsBatch function +type GetCommentsBatchArgs struct { + // (required) Project ID or project name + Project *string + // (required) Id of a work item to get comments for. + WorkItemId *int + // (required) Comma-separated list of comment ids to return. + Ids *[]int + // (optional) Specify if the deleted comments should be retrieved. + IncludeDeleted *bool + // (optional) Specifies the additional data retrieval options for work item comments. + Expand *CommentExpandOptions +} + +// [Preview API] +func (client *ClientImpl) GetCommentVersion(ctx context.Context, args GetCommentVersionArgs) (*CommentVersion, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + if args.Version == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Version"} + } + routeValues["version"] = strconv.Itoa(*args.Version) + + locationId, _ := uuid.Parse("49e03b34-3be0-42e3-8a5d-e8dfb88ac954") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CommentVersion + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommentVersion function +type GetCommentVersionArgs struct { + // (required) Project ID or project name + Project *string + // (required) + WorkItemId *int + // (required) + CommentId *int + // (required) + Version *int +} + +// [Preview API] +func (client *ClientImpl) GetCommentVersions(ctx context.Context, args GetCommentVersionsArgs) (*[]CommentVersion, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + locationId, _ := uuid.Parse("49e03b34-3be0-42e3-8a5d-e8dfb88ac954") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []CommentVersion + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCommentVersions function +type GetCommentVersionsArgs struct { + // (required) Project ID or project name + Project *string + // (required) + WorkItemId *int + // (required) + CommentId *int +} + +// [Preview API] Gets a deleted work item from Recycle Bin. +func (client *ClientImpl) GetDeletedWorkItem(ctx context.Context, args GetDeletedWorkItemArgs) (*WorkItemDelete, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + locationId, _ := uuid.Parse("b70d8d39-926c-465e-b927-b1bf0e5ca0e0") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemDelete + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDeletedWorkItem function +type GetDeletedWorkItemArgs struct { + // (required) ID of the work item to be returned + Id *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Gets the work items from the recycle bin, whose IDs have been specified in the parameters +func (client *ClientImpl) GetDeletedWorkItems(ctx context.Context, args GetDeletedWorkItemsArgs) (*[]WorkItemDeleteReference, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.Ids == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "ids"} + } + var stringList []string + for _, item := range *args.Ids { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("ids", listAsString) + locationId, _ := uuid.Parse("b70d8d39-926c-465e-b927-b1bf0e5ca0e0") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemDeleteReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDeletedWorkItems function +type GetDeletedWorkItemsArgs struct { + // (required) Comma separated list of IDs of the deleted work items to be returned + Ids *[]int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin. +func (client *ClientImpl) GetDeletedWorkItemShallowReferences(ctx context.Context, args GetDeletedWorkItemShallowReferencesArgs) (*[]WorkItemDeleteShallowReference, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + locationId, _ := uuid.Parse("b70d8d39-926c-465e-b927-b1bf0e5ca0e0") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemDeleteShallowReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetDeletedWorkItemShallowReferences function +type GetDeletedWorkItemShallowReferencesArgs struct { + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Get users who reacted on the comment. +func (client *ClientImpl) GetEngagedUsers(ctx context.Context, args GetEngagedUsersArgs) (*[]webapi.IdentityRef, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + if args.ReactionType == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ReactionType"} + } + routeValues["reactionType"] = string(*args.ReactionType) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("e33ca5e0-2349-4285-af3d-d72d86781c35") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []webapi.IdentityRef + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetEngagedUsers function +type GetEngagedUsersArgs struct { + // (required) Project ID or project name + Project *string + // (required) WorkItem ID. + WorkItemId *int + // (required) Comment ID. + CommentId *int + // (required) Type of the reaction. + ReactionType *CommentReactionType + // (optional) + Top *int + // (optional) + Skip *int +} + +// [Preview API] Gets a list of repos within specified github connection. +func (client *ClientImpl) GetGithubConnectionRepositories(ctx context.Context, args GetGithubConnectionRepositoriesArgs) (*[]GitHubConnectionRepoModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConnectionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConnectionId"} + } + routeValues["connectionId"] = (*args.ConnectionId).String() + + locationId, _ := uuid.Parse("0b3a5212-f65b-2102-0d80-1dd77ce4c700") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitHubConnectionRepoModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetGithubConnectionRepositories function +type GetGithubConnectionRepositoriesArgs struct { + // (required) Project ID or project name + Project *string + // (required) + ConnectionId *uuid.UUID +} + +// [Preview API] Gets a list of github connections +func (client *ClientImpl) GetGithubConnections(ctx context.Context, args GetGithubConnectionsArgs) (*[]GitHubConnectionModel, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("0cf95f86-6ce1-f410-ccf6-3d8c92b3a1ef") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitHubConnectionModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetGithubConnections function +type GetGithubConnectionsArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Gets the root queries and their children +func (client *ClientImpl) GetQueries(ctx context.Context, args GetQueriesArgs) (*[]QueryHierarchyItem, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.Depth != nil { + queryParams.Add("$depth", strconv.Itoa(*args.Depth)) + } + if args.IncludeDeleted != nil { + queryParams.Add("$includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []QueryHierarchyItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetQueries function +type GetQueriesArgs struct { + // (required) Project ID or project name + Project *string + // (optional) Include the query string (wiql), clauses, query result columns, and sort options in the results. + Expand *QueryExpand + // (optional) In the folder of queries, return child queries and folders to this depth. + Depth *int + // (optional) Include deleted queries and folders + IncludeDeleted *bool +} + +// [Preview API] Gets a list of queries by ids (Maximum 1000) +func (client *ClientImpl) GetQueriesBatch(ctx context.Context, args GetQueriesBatchArgs) (*[]QueryHierarchyItem, error) { + if args.QueryGetRequest == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.QueryGetRequest"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.QueryGetRequest) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("549816f9-09b0-4e75-9e81-01fbfcd07426") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []QueryHierarchyItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetQueriesBatch function +type GetQueriesBatchArgs struct { + // (required) + QueryGetRequest *QueryBatchGetRequest + // (required) Project ID or project name + Project *string +} + +// [Preview API] Retrieves an individual query and its children +func (client *ClientImpl) GetQuery(ctx context.Context, args GetQueryArgs) (*QueryHierarchyItem, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Query == nil || *args.Query == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Query"} + } + routeValues["query"] = *args.Query + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.Depth != nil { + queryParams.Add("$depth", strconv.Itoa(*args.Depth)) + } + if args.IncludeDeleted != nil { + queryParams.Add("$includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + if args.UseIsoDateFormat != nil { + queryParams.Add("$useIsoDateFormat", strconv.FormatBool(*args.UseIsoDateFormat)) + } + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue QueryHierarchyItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetQuery function +type GetQueryArgs struct { + // (required) Project ID or project name + Project *string + // (required) ID or path of the query. + Query *string + // (optional) Include the query string (wiql), clauses, query result columns, and sort options in the results. + Expand *QueryExpand + // (optional) In the folder of queries, return child queries and folders to this depth. + Depth *int + // (optional) Include deleted queries and folders + IncludeDeleted *bool + // (optional) DateTime query clauses will be formatted using a ISO 8601 compliant format + UseIsoDateFormat *bool +} + +// [Preview API] Gets the results of the query given the query ID. +func (client *ClientImpl) GetQueryResultCount(ctx context.Context, args GetQueryResultCountArgs) (*int, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = (*args.Id).String() + + queryParams := url.Values{} + if args.TimePrecision != nil { + queryParams.Add("timePrecision", strconv.FormatBool(*args.TimePrecision)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("a02355f5-5f8a-4671-8e32-369d23aac83d") + resp, err := client.Client.Send(ctx, http.MethodHead, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue int + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetQueryResultCount function +type GetQueryResultCountArgs struct { + // (required) The query ID. + Id *uuid.UUID + // (optional) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string + // (optional) Whether or not to use time precision. + TimePrecision *bool + // (optional) The max number of results to return. + Top *int +} + +// [Preview API] Gets recent work item activities +func (client *ClientImpl) GetRecentActivityData(ctx context.Context, args GetRecentActivityDataArgs) (*[]AccountRecentActivityWorkItemModel2, error) { + locationId, _ := uuid.Parse("1bc988f4-c15f-4072-ad35-497c87e3a909") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []AccountRecentActivityWorkItemModel2 + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRecentActivityData function +type GetRecentActivityDataArgs struct { +} + +// [Preview API] Gets the work item relation type definition. +func (client *ClientImpl) GetRelationType(ctx context.Context, args GetRelationTypeArgs) (*WorkItemRelationType, error) { + routeValues := make(map[string]string) + if args.Relation == nil || *args.Relation == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Relation"} + } + routeValues["relation"] = *args.Relation + + locationId, _ := uuid.Parse("f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemRelationType + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRelationType function +type GetRelationTypeArgs struct { + // (required) The relation name + Relation *string +} + +// [Preview API] Gets the work item relation types. +func (client *ClientImpl) GetRelationTypes(ctx context.Context, args GetRelationTypesArgs) (*[]WorkItemRelationType, error) { + locationId, _ := uuid.Parse("f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemRelationType + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRelationTypes function +type GetRelationTypesArgs struct { +} + +// [Preview API] Get a batch of work item links +func (client *ClientImpl) GetReportingLinksByLinkType(ctx context.Context, args GetReportingLinksByLinkTypeArgs) (*ReportingWorkItemLinksBatch, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.LinkTypes != nil { + listAsString := strings.Join((*args.LinkTypes)[:], ",") + queryParams.Add("linkTypes", listAsString) + } + if args.Types != nil { + listAsString := strings.Join((*args.Types)[:], ",") + queryParams.Add("types", listAsString) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.StartDateTime != nil { + queryParams.Add("startDateTime", (*args.StartDateTime).AsQueryParameter()) + } + locationId, _ := uuid.Parse("b5b5b6d0-0308-40a1-b3f4-b9bb3c66878f") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ReportingWorkItemLinksBatch + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetReportingLinksByLinkType function +type GetReportingLinksByLinkTypeArgs struct { + // (optional) Project ID or project name + Project *string + // (optional) A list of types to filter the results to specific link types. Omit this parameter to get work item links of all link types. + LinkTypes *[]string + // (optional) A list of types to filter the results to specific work item types. Omit this parameter to get work item links of all work item types. + Types *[]string + // (optional) Specifies the continuationToken to start the batch from. Omit this parameter to get the first batch of links. + ContinuationToken *string + // (optional) Date/time to use as a starting point for link changes. Only link changes that occurred after that date/time will be returned. Cannot be used in conjunction with 'watermark' parameter. + StartDateTime *azuredevops.Time +} + +// [Preview API] Returns a fully hydrated work item for the requested revision +func (client *ClientImpl) GetRevision(ctx context.Context, args GetRevisionArgs) (*WorkItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + if args.RevisionNumber == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevisionNumber"} + } + routeValues["revisionNumber"] = strconv.Itoa(*args.RevisionNumber) + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("a00c85a5-80fa-4565-99c3-bcd2181434bb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRevision function +type GetRevisionArgs struct { + // (required) + Id *int + // (required) + RevisionNumber *int + // (optional) Project ID or project name + Project *string + // (optional) + Expand *WorkItemExpand +} + +// [Preview API] Returns the list of fully hydrated work item revisions, paged. +func (client *ClientImpl) GetRevisions(ctx context.Context, args GetRevisionsArgs) (*[]WorkItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("a00c85a5-80fa-4565-99c3-bcd2181434bb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRevisions function +type GetRevisionsArgs struct { + // (required) + Id *int + // (optional) Project ID or project name + Project *string + // (optional) + Top *int + // (optional) + Skip *int + // (optional) + Expand *WorkItemExpand +} + +// [Preview API] Gets root classification nodes under the project. +func (client *ClientImpl) GetRootNodes(ctx context.Context, args GetRootNodesArgs) (*[]WorkItemClassificationNode, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Depth != nil { + queryParams.Add("$depth", strconv.Itoa(*args.Depth)) + } + locationId, _ := uuid.Parse("a70579d1-f53a-48ee-a5be-7be8659023b9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemClassificationNode + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetRootNodes function +type GetRootNodesArgs struct { + // (required) Project ID or project name + Project *string + // (optional) Depth of children to fetch. + Depth *int +} + +// [Preview API] +func (client *ClientImpl) GetTag(ctx context.Context, args GetTagArgs) (*WorkItemTagDefinition, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TagIdOrName == nil || *args.TagIdOrName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TagIdOrName"} + } + routeValues["tagIdOrName"] = *args.TagIdOrName + + locationId, _ := uuid.Parse("bc15bc60-e7a8-43cb-ab01-2106be3983a1") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTagDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTag function +type GetTagArgs struct { + // (required) Project ID or project name + Project *string + // (required) + TagIdOrName *string +} + +// [Preview API] +func (client *ClientImpl) GetTags(ctx context.Context, args GetTagsArgs) (*[]WorkItemTagDefinition, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("bc15bc60-e7a8-43cb-ab01-2106be3983a1") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemTagDefinition + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTags function +type GetTagsArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Gets the template with specified id +func (client *ClientImpl) GetTemplate(ctx context.Context, args GetTemplateArgs) (*WorkItemTemplate, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team == nil || *args.Team == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Team"} + } + routeValues["team"] = *args.Team + if args.TemplateId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = (*args.TemplateId).String() + + locationId, _ := uuid.Parse("fb10264a-8836-48a0-8033-1b0ccd2748d5") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTemplate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTemplate function +type GetTemplateArgs struct { + // (required) Project ID or project name + Project *string + // (required) Team ID or team name + Team *string + // (required) Template Id + TemplateId *uuid.UUID +} + +// [Preview API] Gets template +func (client *ClientImpl) GetTemplates(ctx context.Context, args GetTemplatesArgs) (*[]WorkItemTemplateReference, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team == nil || *args.Team == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Team"} + } + routeValues["team"] = *args.Team + + queryParams := url.Values{} + if args.Workitemtypename != nil { + queryParams.Add("workitemtypename", *args.Workitemtypename) + } + locationId, _ := uuid.Parse("6a90345f-a676-4969-afce-8e163e1d5642") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemTemplateReference + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetTemplates function +type GetTemplatesArgs struct { + // (required) Project ID or project name + Project *string + // (required) Team ID or team name + Team *string + // (optional) Optional, When specified returns templates for given Work item type. + Workitemtypename *string +} + +// [Preview API] Returns a single update for a work item +func (client *ClientImpl) GetUpdate(ctx context.Context, args GetUpdateArgs) (*WorkItemUpdate, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + if args.UpdateNumber == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.UpdateNumber"} + } + routeValues["updateNumber"] = strconv.Itoa(*args.UpdateNumber) + + locationId, _ := uuid.Parse("6570bf97-d02c-4a91-8d93-3abe9895b1a9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemUpdate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetUpdate function +type GetUpdateArgs struct { + // (required) + Id *int + // (required) + UpdateNumber *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Returns a the deltas between work item revisions +func (client *ClientImpl) GetUpdates(ctx context.Context, args GetUpdatesArgs) (*[]WorkItemUpdate, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + queryParams := url.Values{} + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Skip != nil { + queryParams.Add("$skip", strconv.Itoa(*args.Skip)) + } + locationId, _ := uuid.Parse("6570bf97-d02c-4a91-8d93-3abe9895b1a9") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemUpdate + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetUpdates function +type GetUpdatesArgs struct { + // (required) + Id *int + // (optional) Project ID or project name + Project *string + // (optional) + Top *int + // (optional) + Skip *int +} + +// [Preview API] Get the list of work item tracking outbound artifact link types. +func (client *ClientImpl) GetWorkArtifactLinkTypes(ctx context.Context, args GetWorkArtifactLinkTypesArgs) (*[]WorkArtifactLink, error) { + locationId, _ := uuid.Parse("1a31de40-e318-41cd-a6c6-881077df52e3") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkArtifactLink + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkArtifactLinkTypes function +type GetWorkArtifactLinkTypesArgs struct { +} + +// [Preview API] Returns a single work item. +func (client *ClientImpl) GetWorkItem(ctx context.Context, args GetWorkItemArgs) (*WorkItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + queryParams := url.Values{} + if args.Fields != nil { + listAsString := strings.Join((*args.Fields)[:], ",") + queryParams.Add("fields", listAsString) + } + if args.AsOf != nil { + queryParams.Add("asOf", (*args.AsOf).AsQueryParameter()) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("72c7ddf8-2cdc-4f60-90cd-ab71c14a399b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItem function +type GetWorkItemArgs struct { + // (required) The work item id + Id *int + // (optional) Project ID or project name + Project *string + // (optional) Comma-separated list of requested fields + Fields *[]string + // (optional) AsOf UTC date time string + AsOf *azuredevops.Time + // (optional) The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + Expand *WorkItemExpand +} + +// [Preview API] Gets information on a specific field. +func (client *ClientImpl) GetWorkItemField(ctx context.Context, args GetWorkItemFieldArgs) (*WorkItemField2, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FieldNameOrRefName == nil || *args.FieldNameOrRefName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FieldNameOrRefName"} + } + routeValues["fieldNameOrRefName"] = *args.FieldNameOrRefName + + locationId, _ := uuid.Parse("b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemField2 + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemField function +type GetWorkItemFieldArgs struct { + // (required) Field simple name or reference name + FieldNameOrRefName *string + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Returns information for all fields. The project ID/name parameter is optional. +func (client *ClientImpl) GetWorkItemFields(ctx context.Context, args GetWorkItemFieldsArgs) (*[]WorkItemField2, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemField2 + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemFields function +type GetWorkItemFieldsArgs struct { + // (optional) Project ID or project name + Project *string + // (optional) Use ExtensionFields to include extension fields, otherwise exclude them. Unless the feature flag for this parameter is enabled, extension fields are always included. + Expand *GetFieldsExpand +} + +// [Preview API] Get a work item icon given the friendly name and icon color. +func (client *ClientImpl) GetWorkItemIconJson(ctx context.Context, args GetWorkItemIconJsonArgs) (*WorkItemIcon, error) { + routeValues := make(map[string]string) + if args.Icon == nil || *args.Icon == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Icon"} + } + routeValues["icon"] = *args.Icon + + queryParams := url.Values{} + if args.Color != nil { + queryParams.Add("color", *args.Color) + } + if args.V != nil { + queryParams.Add("v", strconv.Itoa(*args.V)) + } + locationId, _ := uuid.Parse("4e1eb4a5-1970-4228-a682-ec48eb2dca30") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemIcon + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemIconJson function +type GetWorkItemIconJsonArgs struct { + // (required) The name of the icon + Icon *string + // (optional) The 6-digit hex color for the icon + Color *string + // (optional) The version of the icon (used only for cache invalidation) + V *int +} + +// [Preview API] Get a list of all work item icons. +func (client *ClientImpl) GetWorkItemIcons(ctx context.Context, args GetWorkItemIconsArgs) (*[]WorkItemIcon, error) { + locationId, _ := uuid.Parse("4e1eb4a5-1970-4228-a682-ec48eb2dca30") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", nil, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemIcon + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemIcons function +type GetWorkItemIconsArgs struct { +} + +// [Preview API] Get a work item icon given the friendly name and icon color. +func (client *ClientImpl) GetWorkItemIconSvg(ctx context.Context, args GetWorkItemIconSvgArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Icon == nil || *args.Icon == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Icon"} + } + routeValues["icon"] = *args.Icon + + queryParams := url.Values{} + if args.Color != nil { + queryParams.Add("color", *args.Color) + } + if args.V != nil { + queryParams.Add("v", strconv.Itoa(*args.V)) + } + locationId, _ := uuid.Parse("4e1eb4a5-1970-4228-a682-ec48eb2dca30") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "image/svg+xml", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetWorkItemIconSvg function +type GetWorkItemIconSvgArgs struct { + // (required) The name of the icon + Icon *string + // (optional) The 6-digit hex color for the icon + Color *string + // (optional) The version of the icon (used only for cache invalidation) + V *int +} + +// [Preview API] Get a work item icon given the friendly name and icon color. +func (client *ClientImpl) GetWorkItemIconXaml(ctx context.Context, args GetWorkItemIconXamlArgs) (io.ReadCloser, error) { + routeValues := make(map[string]string) + if args.Icon == nil || *args.Icon == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Icon"} + } + routeValues["icon"] = *args.Icon + + queryParams := url.Values{} + if args.Color != nil { + queryParams.Add("color", *args.Color) + } + if args.V != nil { + queryParams.Add("v", strconv.Itoa(*args.V)) + } + locationId, _ := uuid.Parse("4e1eb4a5-1970-4228-a682-ec48eb2dca30") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "image/xaml+xml", nil) + if err != nil { + return nil, err + } + + return resp.Body, err +} + +// Arguments for the GetWorkItemIconXaml function +type GetWorkItemIconXamlArgs struct { + // (required) The name of the icon + Icon *string + // (optional) The 6-digit hex color for the icon + Color *string + // (optional) The version of the icon (used only for cache invalidation) + V *int +} + +// [Preview API] Returns the next state on the given work item IDs. +func (client *ClientImpl) GetWorkItemNextStatesOnCheckinAction(ctx context.Context, args GetWorkItemNextStatesOnCheckinActionArgs) (*[]WorkItemNextStateOnTransition, error) { + queryParams := url.Values{} + if args.Ids == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "ids"} + } + var stringList []string + for _, item := range *args.Ids { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("ids", listAsString) + if args.Action != nil { + queryParams.Add("action", *args.Action) + } + locationId, _ := uuid.Parse("afae844b-e2f6-44c2-8053-17b3bb936a40") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", nil, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemNextStateOnTransition + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemNextStatesOnCheckinAction function +type GetWorkItemNextStatesOnCheckinActionArgs struct { + // (required) list of work item ids + Ids *[]int + // (optional) possible actions. Currently only supports checkin + Action *string +} + +// [Preview API] Returns a list of work items (Maximum 200) +func (client *ClientImpl) GetWorkItems(ctx context.Context, args GetWorkItemsArgs) (*[]WorkItem, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.Ids == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "ids"} + } + var stringList []string + for _, item := range *args.Ids { + stringList = append(stringList, strconv.Itoa(item)) + } + listAsString := strings.Join((stringList)[:], ",") + queryParams.Add("ids", listAsString) + if args.Fields != nil { + listAsString := strings.Join((*args.Fields)[:], ",") + queryParams.Add("fields", listAsString) + } + if args.AsOf != nil { + queryParams.Add("asOf", (*args.AsOf).AsQueryParameter()) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.ErrorPolicy != nil { + queryParams.Add("errorPolicy", string(*args.ErrorPolicy)) + } + locationId, _ := uuid.Parse("72c7ddf8-2cdc-4f60-90cd-ab71c14a399b") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItems function +type GetWorkItemsArgs struct { + // (required) The comma-separated list of requested work item ids. (Maximum 200 ids allowed). + Ids *[]int + // (optional) Project ID or project name + Project *string + // (optional) Comma-separated list of requested fields + Fields *[]string + // (optional) AsOf UTC date time string + AsOf *azuredevops.Time + // (optional) The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + Expand *WorkItemExpand + // (optional) The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}. + ErrorPolicy *WorkItemErrorPolicy +} + +// [Preview API] Gets work items for a list of work item ids (Maximum 200) +func (client *ClientImpl) GetWorkItemsBatch(ctx context.Context, args GetWorkItemsBatchArgs) (*[]WorkItem, error) { + if args.WorkItemGetRequest == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemGetRequest"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.WorkItemGetRequest) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("908509b6-4248-4475-a1cd-829139ba419f") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItem + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemsBatch function +type GetWorkItemsBatchArgs struct { + // (required) + WorkItemGetRequest *WorkItemBatchGetRequest + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Returns a single work item from a template. +func (client *ClientImpl) GetWorkItemTemplate(ctx context.Context, args GetWorkItemTemplateArgs) (*WorkItem, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + queryParams := url.Values{} + if args.Fields != nil { + queryParams.Add("fields", *args.Fields) + } + if args.AsOf != nil { + queryParams.Add("asOf", (*args.AsOf).AsQueryParameter()) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("62d3d110-0047-428c-ad3c-4fe872c91c74") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTemplate function +type GetWorkItemTemplateArgs struct { + // (required) Project ID or project name + Project *string + // (required) The work item type name + Type *string + // (optional) Comma-separated list of requested fields + Fields *string + // (optional) AsOf UTC date time string + AsOf *azuredevops.Time + // (optional) The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + Expand *WorkItemExpand +} + +// [Preview API] Returns a work item type definition. +func (client *ClientImpl) GetWorkItemType(ctx context.Context, args GetWorkItemTypeArgs) (*WorkItemType, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + locationId, _ := uuid.Parse("7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemType + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemType function +type GetWorkItemTypeArgs struct { + // (required) Project ID or project name + Project *string + // (required) Work item type name + Type *string +} + +// [Preview API] Get all work item type categories. +func (client *ClientImpl) GetWorkItemTypeCategories(ctx context.Context, args GetWorkItemTypeCategoriesArgs) (*[]WorkItemTypeCategory, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("9b9f5734-36c8-415e-ba67-f83b45c31408") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemTypeCategory + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypeCategories function +type GetWorkItemTypeCategoriesArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Get specific work item type category by name. +func (client *ClientImpl) GetWorkItemTypeCategory(ctx context.Context, args GetWorkItemTypeCategoryArgs) (*WorkItemTypeCategory, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Category == nil || *args.Category == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Category"} + } + routeValues["category"] = *args.Category + + locationId, _ := uuid.Parse("9b9f5734-36c8-415e-ba67-f83b45c31408") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTypeCategory + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypeCategory function +type GetWorkItemTypeCategoryArgs struct { + // (required) Project ID or project name + Project *string + // (required) The category name + Category *string +} + +// [Preview API] Get a list of fields for a work item type with detailed references. +func (client *ClientImpl) GetWorkItemTypeFieldsWithReferences(ctx context.Context, args GetWorkItemTypeFieldsWithReferencesArgs) (*[]WorkItemTypeFieldWithReferences, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("bd293ce5-3d25-4192-8e67-e8092e879efb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemTypeFieldWithReferences + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypeFieldsWithReferences function +type GetWorkItemTypeFieldsWithReferencesArgs struct { + // (required) Project ID or project name + Project *string + // (required) Work item type. + Type *string + // (optional) Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + Expand *WorkItemTypeFieldsExpandLevel +} + +// [Preview API] Get a field for a work item type with detailed references. +func (client *ClientImpl) GetWorkItemTypeFieldWithReferences(ctx context.Context, args GetWorkItemTypeFieldWithReferencesArgs) (*WorkItemTypeFieldWithReferences, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + if args.Field == nil || *args.Field == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Field"} + } + routeValues["field"] = *args.Field + + queryParams := url.Values{} + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + locationId, _ := uuid.Parse("bd293ce5-3d25-4192-8e67-e8092e879efb") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.3", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTypeFieldWithReferences + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypeFieldWithReferences function +type GetWorkItemTypeFieldWithReferencesArgs struct { + // (required) Project ID or project name + Project *string + // (required) Work item type. + Type *string + // (required) + Field *string + // (optional) Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + Expand *WorkItemTypeFieldsExpandLevel +} + +// [Preview API] Returns the list of work item types +func (client *ClientImpl) GetWorkItemTypes(ctx context.Context, args GetWorkItemTypesArgs) (*[]WorkItemType, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + locationId, _ := uuid.Parse("7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemType + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypes function +type GetWorkItemTypesArgs struct { + // (required) Project ID or project name + Project *string +} + +// [Preview API] Returns the state names and colors for a work item type. +func (client *ClientImpl) GetWorkItemTypeStates(ctx context.Context, args GetWorkItemTypeStatesArgs) (*[]WorkItemStateColor, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Type == nil || *args.Type == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Type"} + } + routeValues["type"] = *args.Type + + locationId, _ := uuid.Parse("7c9d7a76-4a09-43e8-b5df-bd792f4ac6aa") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []WorkItemStateColor + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetWorkItemTypeStates function +type GetWorkItemTypeStatesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The state name + Type *string +} + +// [Preview API] Migrates a project to a different process within the same OOB type. For example, you can only migrate a project from agile/custom-agile to agile/custom-agile. +func (client *ClientImpl) MigrateProjectsProcess(ctx context.Context, args MigrateProjectsProcessArgs) (*ProcessMigrationResultModel, error) { + if args.NewProcess == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.NewProcess"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.NewProcess) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("19801631-d4e5-47e9-8166-0330de0ff1e6") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ProcessMigrationResultModel + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the MigrateProjectsProcess function +type MigrateProjectsProcessArgs struct { + // (required) + NewProcess *ProcessIdModel + // (required) Project ID or project name + Project *string +} + +// [Preview API] Gets the results of the query given the query ID. +func (client *ClientImpl) QueryById(ctx context.Context, args QueryByIdArgs) (*WorkItemQueryResult, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = (*args.Id).String() + + queryParams := url.Values{} + if args.TimePrecision != nil { + queryParams.Add("timePrecision", strconv.FormatBool(*args.TimePrecision)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + locationId, _ := uuid.Parse("a02355f5-5f8a-4671-8e32-369d23aac83d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemQueryResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueryById function +type QueryByIdArgs struct { + // (required) The query ID. + Id *uuid.UUID + // (optional) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string + // (optional) Whether or not to use time precision. + TimePrecision *bool + // (optional) The max number of results to return. + Top *int +} + +// [Preview API] Gets the results of the query given its WIQL. +func (client *ClientImpl) QueryByWiql(ctx context.Context, args QueryByWiqlArgs) (*WorkItemQueryResult, error) { + if args.Wiql == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Wiql"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Team != nil && *args.Team != "" { + routeValues["team"] = *args.Team + } + + queryParams := url.Values{} + if args.TimePrecision != nil { + queryParams.Add("timePrecision", strconv.FormatBool(*args.TimePrecision)) + } + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + body, marshalErr := json.Marshal(*args.Wiql) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("1a9c53f7-f243-4447-b110-35ef023636e4") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemQueryResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueryByWiql function +type QueryByWiqlArgs struct { + // (required) The query containing the WIQL. + Wiql *Wiql + // (optional) Project ID or project name + Project *string + // (optional) Team ID or team name + Team *string + // (optional) Whether or not to use time precision. + TimePrecision *bool + // (optional) The max number of results to return. + Top *int +} + +// [Preview API] Queries work items linked to a given list of artifact URI. +func (client *ClientImpl) QueryWorkItemsForArtifactUris(ctx context.Context, args QueryWorkItemsForArtifactUrisArgs) (*ArtifactUriQueryResult, error) { + if args.ArtifactUriQuery == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ArtifactUriQuery"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.ArtifactUriQuery) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a9a9aa7a-8c09-44d3-ad1b-46e855c1e3d3") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ArtifactUriQueryResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the QueryWorkItemsForArtifactUris function +type QueryWorkItemsForArtifactUrisArgs struct { + // (required) Defines a list of artifact URI for querying work items. + ArtifactUriQuery *ArtifactUriQuery + // (optional) Project ID or project name + Project *string +} + +// [Preview API] +func (client *ClientImpl) ReadReportingDiscussions(ctx context.Context, args ReadReportingDiscussionsArgs) (*ReportingWorkItemRevisionsBatch, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.MaxPageSize != nil { + queryParams.Add("$maxPageSize", strconv.Itoa(*args.MaxPageSize)) + } + locationId, _ := uuid.Parse("4a644469-90c5-4fcc-9a9f-be0827d369ec") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ReportingWorkItemRevisionsBatch + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadReportingDiscussions function +type ReadReportingDiscussionsArgs struct { + // (optional) Project ID or project name + Project *string + // (optional) + ContinuationToken *string + // (optional) + MaxPageSize *int +} + +// [Preview API] Get a batch of work item revisions with the option of including deleted items +func (client *ClientImpl) ReadReportingRevisionsGet(ctx context.Context, args ReadReportingRevisionsGetArgs) (*ReportingWorkItemRevisionsBatch, error) { + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.Fields != nil { + listAsString := strings.Join((*args.Fields)[:], ",") + queryParams.Add("fields", listAsString) + } + if args.Types != nil { + listAsString := strings.Join((*args.Types)[:], ",") + queryParams.Add("types", listAsString) + } + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.StartDateTime != nil { + queryParams.Add("startDateTime", (*args.StartDateTime).AsQueryParameter()) + } + if args.IncludeIdentityRef != nil { + queryParams.Add("includeIdentityRef", strconv.FormatBool(*args.IncludeIdentityRef)) + } + if args.IncludeDeleted != nil { + queryParams.Add("includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + if args.IncludeTagRef != nil { + queryParams.Add("includeTagRef", strconv.FormatBool(*args.IncludeTagRef)) + } + if args.IncludeLatestOnly != nil { + queryParams.Add("includeLatestOnly", strconv.FormatBool(*args.IncludeLatestOnly)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.IncludeDiscussionChangesOnly != nil { + queryParams.Add("includeDiscussionChangesOnly", strconv.FormatBool(*args.IncludeDiscussionChangesOnly)) + } + if args.MaxPageSize != nil { + queryParams.Add("$maxPageSize", strconv.Itoa(*args.MaxPageSize)) + } + locationId, _ := uuid.Parse("f828fe59-dd87-495d-a17c-7a8d6211ca6c") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ReportingWorkItemRevisionsBatch + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadReportingRevisionsGet function +type ReadReportingRevisionsGetArgs struct { + // (optional) Project ID or project name + Project *string + // (optional) A list of fields to return in work item revisions. Omit this parameter to get all reportable fields. + Fields *[]string + // (optional) A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types. + Types *[]string + // (optional) Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + ContinuationToken *string + // (optional) Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + StartDateTime *azuredevops.Time + // (optional) Return an identity reference instead of a string value for identity fields. + IncludeIdentityRef *bool + // (optional) Specify if the deleted item should be returned. + IncludeDeleted *bool + // (optional) Specify if the tag objects should be returned for System.Tags field. + IncludeTagRef *bool + // (optional) Return only the latest revisions of work items, skipping all historical revisions + IncludeLatestOnly *bool + // (optional) Return all the fields in work item revisions, including long text fields which are not returned by default + Expand *ReportingRevisionsExpand + // (optional) Return only the those revisions of work items, where only history field was changed + IncludeDiscussionChangesOnly *bool + // (optional) The maximum number of results to return in this batch + MaxPageSize *int +} + +// [Preview API] Get a batch of work item revisions. This request may be used if your list of fields is large enough that it may run the URL over the length limit. +func (client *ClientImpl) ReadReportingRevisionsPost(ctx context.Context, args ReadReportingRevisionsPostArgs) (*ReportingWorkItemRevisionsBatch, error) { + if args.Filter == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Filter"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + queryParams := url.Values{} + if args.ContinuationToken != nil { + queryParams.Add("continuationToken", *args.ContinuationToken) + } + if args.StartDateTime != nil { + queryParams.Add("startDateTime", (*args.StartDateTime).AsQueryParameter()) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + body, marshalErr := json.Marshal(*args.Filter) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("f828fe59-dd87-495d-a17c-7a8d6211ca6c") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ReportingWorkItemRevisionsBatch + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReadReportingRevisionsPost function +type ReadReportingRevisionsPostArgs struct { + // (required) An object that contains request settings: field filter, type filter, identity format + Filter *ReportingWorkItemRevisionsFilter + // (optional) Project ID or project name + Project *string + // (optional) Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + ContinuationToken *string + // (optional) Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + StartDateTime *azuredevops.Time + // (optional) + Expand *ReportingRevisionsExpand +} + +// [Preview API] Replace template contents +func (client *ClientImpl) ReplaceTemplate(ctx context.Context, args ReplaceTemplateArgs) (*WorkItemTemplate, error) { + if args.TemplateContent == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TemplateContent"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Team == nil || *args.Team == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Team"} + } + routeValues["team"] = *args.Team + if args.TemplateId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TemplateId"} + } + routeValues["templateId"] = (*args.TemplateId).String() + + body, marshalErr := json.Marshal(*args.TemplateContent) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("fb10264a-8836-48a0-8033-1b0ccd2748d5") + resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTemplate + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the ReplaceTemplate function +type ReplaceTemplateArgs struct { + // (required) Template contents to replace with + TemplateContent *WorkItemTemplate + // (required) Project ID or project name + Project *string + // (required) Team ID or team name + Team *string + // (required) Template id + TemplateId *uuid.UUID +} + +// [Preview API] Restores the deleted work item from Recycle Bin. +func (client *ClientImpl) RestoreWorkItem(ctx context.Context, args RestoreWorkItemArgs) (*WorkItemDelete, error) { + if args.Payload == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Payload"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + body, marshalErr := json.Marshal(*args.Payload) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b70d8d39-926c-465e-b927-b1bf0e5ca0e0") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemDelete + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the RestoreWorkItem function +type RestoreWorkItemArgs struct { + // (required) Paylod with instructions to update the IsDeleted flag to false + Payload *WorkItemDeleteUpdate + // (required) ID of the work item to be restored + Id *int + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Searches all queries the user has access to in the current project +func (client *ClientImpl) SearchQueries(ctx context.Context, args SearchQueriesArgs) (*QueryHierarchyItemsResult, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.Filter == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "filter"} + } + queryParams.Add("$filter", *args.Filter) + if args.Top != nil { + queryParams.Add("$top", strconv.Itoa(*args.Top)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + if args.IncludeDeleted != nil { + queryParams.Add("$includeDeleted", strconv.FormatBool(*args.IncludeDeleted)) + } + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.2", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue QueryHierarchyItemsResult + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the SearchQueries function +type SearchQueriesArgs struct { + // (required) Project ID or project name + Project *string + // (required) The text to filter the queries with. + Filter *string + // (optional) The number of queries to return (Default is 50 and maximum is 200). + Top *int + // (optional) + Expand *QueryExpand + // (optional) Include deleted queries and folders + IncludeDeleted *bool +} + +// [Preview API] RESTful method to send mail for selected/queried work items. +func (client *ClientImpl) SendMail(ctx context.Context, args SendMailArgs) error { + if args.Body == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.Body"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + + body, marshalErr := json.Marshal(*args.Body) + if marshalErr != nil { + return marshalErr + } + locationId, _ := uuid.Parse("12438500-2f84-4fa7-9f1a-c31871b4959d") + _, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the SendMail function +type SendMailArgs struct { + // (required) + Body *SendMailBody + // (optional) Project ID or project name + Project *string +} + +// [Preview API] Update an existing classification node. +func (client *ClientImpl) UpdateClassificationNode(ctx context.Context, args UpdateClassificationNodeArgs) (*WorkItemClassificationNode, error) { + if args.PostedNode == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.PostedNode"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.StructureGroup == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.StructureGroup"} + } + routeValues["structureGroup"] = string(*args.StructureGroup) + if args.Path != nil && *args.Path != "" { + routeValues["path"] = *args.Path + } + + body, marshalErr := json.Marshal(*args.PostedNode) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("5a172953-1b41-49d3-840a-33f79c3ce89f") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.2", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemClassificationNode + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateClassificationNode function +type UpdateClassificationNodeArgs struct { + // (required) Node to create or update. + PostedNode *WorkItemClassificationNode + // (required) Project ID or project name + Project *string + // (required) Structure group of the classification node, area or iteration. + StructureGroup *TreeStructureGroup + // (optional) Path of the classification node. + Path *string +} + +// [Preview API] Update a comment on a work item. +func (client *ClientImpl) UpdateComment(ctx context.Context, args UpdateCommentArgs) (*Comment, error) { + if args.Request == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Request"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + body, marshalErr := json.Marshal(*args.Request) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.4", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateComment function +type UpdateCommentArgs struct { + // (required) Comment update request. + Request *CommentUpdate + // (required) Project ID or project name + Project *string + // (required) Id of a work item. + WorkItemId *int + // (required) + CommentId *int +} + +// [Preview API] Add/remove list of repos within specified github connection. +func (client *ClientImpl) UpdateGithubConnectionRepos(ctx context.Context, args UpdateGithubConnectionReposArgs) (*[]GitHubConnectionRepoModel, error) { + if args.ReposOperationData == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ReposOperationData"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ConnectionId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConnectionId"} + } + routeValues["connectionId"] = (*args.ConnectionId).String() + + body, marshalErr := json.Marshal(*args.ReposOperationData) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("15b19676-8d9e-e224-d795-ca4d1a18024d") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []GitHubConnectionRepoModel + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateGithubConnectionRepos function +type UpdateGithubConnectionReposArgs struct { + // (required) + ReposOperationData *GitHubConnectionReposBatchRequest + // (required) Project ID or project name + Project *string + // (required) + ConnectionId *uuid.UUID +} + +// [Preview API] Update a query or a folder. This allows you to update, rename and move queries and folders. +func (client *ClientImpl) UpdateQuery(ctx context.Context, args UpdateQueryArgs) (*QueryHierarchyItem, error) { + if args.QueryUpdate == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.QueryUpdate"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Query == nil || *args.Query == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Query"} + } + routeValues["query"] = *args.Query + + queryParams := url.Values{} + if args.UndeleteDescendants != nil { + queryParams.Add("$undeleteDescendants", strconv.FormatBool(*args.UndeleteDescendants)) + } + body, marshalErr := json.Marshal(*args.QueryUpdate) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("a67d190c-c41f-424b-814d-0e906f659301") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.2", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue QueryHierarchyItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateQuery function +type UpdateQueryArgs struct { + // (required) The query to update. + QueryUpdate *QueryHierarchyItem + // (required) Project ID or project name + Project *string + // (required) The ID or path for the query to update. + Query *string + // (optional) Undelete the children of this folder. It is important to note that this will not bring back the permission changes that were previously applied to the descendants. + UndeleteDescendants *bool +} + +// [Preview API] +func (client *ClientImpl) UpdateTag(ctx context.Context, args UpdateTagArgs) (*WorkItemTagDefinition, error) { + if args.TagData == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.TagData"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.TagIdOrName == nil || *args.TagIdOrName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.TagIdOrName"} + } + routeValues["tagIdOrName"] = *args.TagIdOrName + + body, marshalErr := json.Marshal(*args.TagData) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("bc15bc60-e7a8-43cb-ab01-2106be3983a1") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemTagDefinition + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateTag function +type UpdateTagArgs struct { + // (required) + TagData *WorkItemTagDefinition + // (required) Project ID or project name + Project *string + // (required) + TagIdOrName *string +} + +// [Preview API] Updates a single work item. +func (client *ClientImpl) UpdateWorkItem(ctx context.Context, args UpdateWorkItemArgs) (*WorkItem, error) { + if args.Document == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Document"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + queryParams := url.Values{} + if args.ValidateOnly != nil { + queryParams.Add("validateOnly", strconv.FormatBool(*args.ValidateOnly)) + } + if args.BypassRules != nil { + queryParams.Add("bypassRules", strconv.FormatBool(*args.BypassRules)) + } + if args.SuppressNotifications != nil { + queryParams.Add("suppressNotifications", strconv.FormatBool(*args.SuppressNotifications)) + } + if args.Expand != nil { + queryParams.Add("$expand", string(*args.Expand)) + } + body, marshalErr := json.Marshal(*args.Document) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("72c7ddf8-2cdc-4f60-90cd-ab71c14a399b") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.3", routeValues, queryParams, bytes.NewReader(body), "application/json-patch+json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItem + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateWorkItem function +type UpdateWorkItemArgs struct { + // (required) The JSON Patch document representing the update + Document *[]webapi.JsonPatchOperation + // (required) The id of the work item to update + Id *int + // (optional) Project ID or project name + Project *string + // (optional) Indicate if you only want to validate the changes without saving the work item + ValidateOnly *bool + // (optional) Do not enforce the work item type rules on this update + BypassRules *bool + // (optional) Do not fire any notifications for this change + SuppressNotifications *bool + // (optional) The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + Expand *WorkItemExpand +} + +// [Preview API] Update a comment on a work item. +func (client *ClientImpl) UpdateWorkItemComment(ctx context.Context, args UpdateWorkItemCommentArgs) (*Comment, error) { + if args.Request == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Request"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.WorkItemId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.WorkItemId"} + } + routeValues["workItemId"] = strconv.Itoa(*args.WorkItemId) + if args.CommentId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CommentId"} + } + routeValues["commentId"] = strconv.Itoa(*args.CommentId) + + queryParams := url.Values{} + if args.Format == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "format"} + } + queryParams.Add("format", string(*args.Format)) + body, marshalErr := json.Marshal(*args.Request) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("608aac0a-32e1-4493-a863-b9cf4566d257") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.4", routeValues, queryParams, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue Comment + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateWorkItemComment function +type UpdateWorkItemCommentArgs struct { + // (required) Comment update request. + Request *CommentUpdate + // (required) Project ID or project name + Project *string + // (required) Id of a work item. + WorkItemId *int + // (required) + CommentId *int + // (required) Format of a work item comment (Markdown or Html). + Format *CommentFormat +} + +// [Preview API] Update a field. +func (client *ClientImpl) UpdateWorkItemField(ctx context.Context, args UpdateWorkItemFieldArgs) (*WorkItemField2, error) { + if args.Payload == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Payload"} + } + routeValues := make(map[string]string) + if args.Project != nil && *args.Project != "" { + routeValues["project"] = *args.Project + } + if args.FieldNameOrRefName == nil || *args.FieldNameOrRefName == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.FieldNameOrRefName"} + } + routeValues["fieldNameOrRefName"] = *args.FieldNameOrRefName + + body, marshalErr := json.Marshal(*args.Payload) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "7.1-preview.3", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue WorkItemField2 + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateWorkItemField function +type UpdateWorkItemFieldArgs struct { + // (required) Payload contains desired value of the field's properties + Payload *FieldUpdate + // (required) Name/reference name of the field to be updated + FieldNameOrRefName *string + // (optional) Project ID or project name + Project *string +} diff --git a/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/models.go b/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/models.go new file mode 100644 index 00000000..5b377943 --- /dev/null +++ b/vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking/models.go @@ -0,0 +1,1731 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package workitemtracking + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/webapi" +) + +type AccountMyWorkResult struct { + // True, when length of WorkItemDetails is same as the limit + QuerySizeLimitExceeded *bool `json:"querySizeLimitExceeded,omitempty"` + // WorkItem Details + WorkItemDetails *[]AccountWorkWorkItemModel `json:"workItemDetails,omitempty"` +} + +// Represents Work Item Recent Activity +type AccountRecentActivityWorkItemModel struct { + // Date of the last Activity by the user + ActivityDate *azuredevops.Time `json:"activityDate,omitempty"` + // Type of the activity + ActivityType *WorkItemRecentActivityType `json:"activityType,omitempty"` + // Last changed date of the work item + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + // Work Item Id + Id *int `json:"id,omitempty"` + // TeamFoundationId of the user this activity belongs to + IdentityId *uuid.UUID `json:"identityId,omitempty"` + // State of the work item + State *string `json:"state,omitempty"` + // Team project the work item belongs to + TeamProject *string `json:"teamProject,omitempty"` + // Title of the work item + Title *string `json:"title,omitempty"` + // Type of Work Item + WorkItemType *string `json:"workItemType,omitempty"` + // Assigned To + AssignedTo *string `json:"assignedTo,omitempty"` +} + +// Represents Work Item Recent Activity +type AccountRecentActivityWorkItemModel2 struct { + // Date of the last Activity by the user + ActivityDate *azuredevops.Time `json:"activityDate,omitempty"` + // Type of the activity + ActivityType *WorkItemRecentActivityType `json:"activityType,omitempty"` + // Last changed date of the work item + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + // Work Item Id + Id *int `json:"id,omitempty"` + // TeamFoundationId of the user this activity belongs to + IdentityId *uuid.UUID `json:"identityId,omitempty"` + // State of the work item + State *string `json:"state,omitempty"` + // Team project the work item belongs to + TeamProject *string `json:"teamProject,omitempty"` + // Title of the work item + Title *string `json:"title,omitempty"` + // Type of Work Item + WorkItemType *string `json:"workItemType,omitempty"` + // Assigned To + AssignedTo *webapi.IdentityRef `json:"assignedTo,omitempty"` +} + +// Represents Work Item Recent Activity +type AccountRecentActivityWorkItemModelBase struct { + // Date of the last Activity by the user + ActivityDate *azuredevops.Time `json:"activityDate,omitempty"` + // Type of the activity + ActivityType *WorkItemRecentActivityType `json:"activityType,omitempty"` + // Last changed date of the work item + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + // Work Item Id + Id *int `json:"id,omitempty"` + // TeamFoundationId of the user this activity belongs to + IdentityId *uuid.UUID `json:"identityId,omitempty"` + // State of the work item + State *string `json:"state,omitempty"` + // Team project the work item belongs to + TeamProject *string `json:"teamProject,omitempty"` + // Title of the work item + Title *string `json:"title,omitempty"` + // Type of Work Item + WorkItemType *string `json:"workItemType,omitempty"` +} + +// Represents Recent Mention Work Item +type AccountRecentMentionWorkItemModel struct { + // Assigned To + AssignedTo *string `json:"assignedTo,omitempty"` + // Work Item Id + Id *int `json:"id,omitempty"` + // Latest date that the user were mentioned + MentionedDateField *azuredevops.Time `json:"mentionedDateField,omitempty"` + // State of the work item + State *string `json:"state,omitempty"` + // Team project the work item belongs to + TeamProject *string `json:"teamProject,omitempty"` + // Title of the work item + Title *string `json:"title,omitempty"` + // Type of Work Item + WorkItemType *string `json:"workItemType,omitempty"` +} + +type AccountWorkWorkItemModel struct { + AssignedTo *string `json:"assignedTo,omitempty"` + ChangedDate *azuredevops.Time `json:"changedDate,omitempty"` + Id *int `json:"id,omitempty"` + State *string `json:"state,omitempty"` + TeamProject *string `json:"teamProject,omitempty"` + Title *string `json:"title,omitempty"` + WorkItemType *string `json:"workItemType,omitempty"` +} + +// Contains criteria for querying work items based on artifact URI. +type ArtifactUriQuery struct { + // List of artifact URIs to use for querying work items. + ArtifactUris *[]string `json:"artifactUris,omitempty"` +} + +// Defines result of artifact URI query on work items. Contains mapping of work item IDs to artifact URI. +type ArtifactUriQueryResult struct { + // A Dictionary that maps a list of work item references to the given list of artifact URI. + ArtifactUrisQueryResult *map[string][]WorkItemReference `json:"artifactUrisQueryResult,omitempty"` +} + +type AttachmentReference struct { + Id *uuid.UUID `json:"id,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Flag to control error policy in a batch classification nodes get request. +type ClassificationNodesErrorPolicy string + +type classificationNodesErrorPolicyValuesType struct { + Fail ClassificationNodesErrorPolicy + Omit ClassificationNodesErrorPolicy +} + +var ClassificationNodesErrorPolicyValues = classificationNodesErrorPolicyValuesType{ + Fail: "fail", + Omit: "omit", +} + +// Comment on a Work Item. +type Comment struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // IdentityRef of the creator of the comment. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // The creation date of the comment. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Effective Date/time value for adding the comment. Can be optionally different from CreatedDate. + CreatedOnBehalfDate *azuredevops.Time `json:"createdOnBehalfDate,omitempty"` + // Identity on whose behalf this comment has been added. Can be optionally different from CreatedBy. + CreatedOnBehalfOf *webapi.IdentityRef `json:"createdOnBehalfOf,omitempty"` + // Represents the possible types for the comment format. + Format *CommentFormat `json:"format,omitempty"` + // The id assigned to the comment. + Id *int `json:"id,omitempty"` + // Indicates if the comment has been deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // The mentions of the comment. + Mentions *[]CommentMention `json:"mentions,omitempty"` + // IdentityRef of the user who last modified the comment. + ModifiedBy *webapi.IdentityRef `json:"modifiedBy,omitempty"` + // The last modification date of the comment. + ModifiedDate *azuredevops.Time `json:"modifiedDate,omitempty"` + // The reactions of the comment. + Reactions *[]CommentReaction `json:"reactions,omitempty"` + // The text of the comment in HTML format. + RenderedText *string `json:"renderedText,omitempty"` + // The text of the comment. + Text *string `json:"text,omitempty"` + // The current version of the comment. + Version *int `json:"version,omitempty"` + // The id of the work item this comment belongs to. + WorkItemId *int `json:"workItemId,omitempty"` +} + +// Represents a request to create a work item comment. +type CommentCreate struct { + // The text of the comment. + Text *string `json:"text,omitempty"` +} + +// [Flags] Specifies the additional data retrieval options for work item comments. +type CommentExpandOptions string + +type commentExpandOptionsValuesType struct { + None CommentExpandOptions + Reactions CommentExpandOptions + RenderedText CommentExpandOptions + RenderedTextOnly CommentExpandOptions + All CommentExpandOptions +} + +var CommentExpandOptionsValues = commentExpandOptionsValuesType{ + None: "none", + // Include comment reactions. + Reactions: "reactions", + // Include the rendered text (html) in addition to MD text. + RenderedText: "renderedText", + // If specified, then ONLY rendered text (html) will be returned, w/o markdown. Supposed to be used internally from data provides for optimization purposes. + RenderedTextOnly: "renderedTextOnly", + All: "all", +} + +// Represents the possible types for the comment format. Should be in sync with WorkItemCommentFormat.cs +type CommentFormat string + +type commentFormatValuesType struct { + Markdown CommentFormat + Html CommentFormat +} + +var CommentFormatValues = commentFormatValuesType{ + Markdown: "markdown", + Html: "html", +} + +// Represents a list of work item comments. +type CommentList struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // List of comments in the current batch. + Comments *[]Comment `json:"comments,omitempty"` + // A string token that can be used to retrieving next page of comments if available. Otherwise null. + ContinuationToken *string `json:"continuationToken,omitempty"` + // The count of comments in the current batch. + Count *int `json:"count,omitempty"` + // Uri to the next page of comments if it is available. Otherwise null. + NextPage *string `json:"nextPage,omitempty"` + // Total count of comments on a work item. + TotalCount *int `json:"totalCount,omitempty"` +} + +type CommentMention struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The artifact portion of the parsed text. (i.e. the work item's id) + ArtifactId *string `json:"artifactId,omitempty"` + // The type the parser assigned to the mention. (i.e. person, work item, etc) + ArtifactType *string `json:"artifactType,omitempty"` + // The comment id of the mention. + CommentId *int `json:"commentId,omitempty"` + // The resolved target of the mention. An example of this could be a user's tfid + TargetId *string `json:"targetId,omitempty"` +} + +// Contains information about work item comment reaction for a particular reaction type. +type CommentReaction struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The id of the comment this reaction belongs to. + CommentId *int `json:"commentId,omitempty"` + // Total number of reactions for the CommentReactionType. + Count *int `json:"count,omitempty"` + // Flag to indicate if the current user has engaged on this particular EngagementType (e.g. if they liked the associated comment). + IsCurrentUserEngaged *bool `json:"isCurrentUserEngaged,omitempty"` + // Type of the reaction. + Type *CommentReactionType `json:"type,omitempty"` +} + +// Represents different reaction types for a work item comment. +type CommentReactionType string + +type commentReactionTypeValuesType struct { + Like CommentReactionType + Dislike CommentReactionType + Heart CommentReactionType + Hooray CommentReactionType + Smile CommentReactionType + Confused CommentReactionType +} + +var CommentReactionTypeValues = commentReactionTypeValuesType{ + Like: "like", + Dislike: "dislike", + Heart: "heart", + Hooray: "hooray", + Smile: "smile", + Confused: "confused", +} + +type CommentSortOrder string + +type commentSortOrderValuesType struct { + Asc CommentSortOrder + Desc CommentSortOrder +} + +var CommentSortOrderValues = commentSortOrderValuesType{ + // The results will be sorted in Ascending order. + Asc: "asc", + // The results will be sorted in Descending order. + Desc: "desc", +} + +// Represents a request to update a work item comment. +type CommentUpdate struct { + // The updated text of the comment. + Text *string `json:"text,omitempty"` +} + +// Represents a specific version of a comment on a work item. +type CommentVersion struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // IdentityRef of the creator of the comment. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // The creation date of the comment. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // Effective Date/time value for adding the comment. Can be optionally different from CreatedDate. + CreatedOnBehalfDate *azuredevops.Time `json:"createdOnBehalfDate,omitempty"` + // Identity on whose behalf this comment has been added. Can be optionally different from CreatedBy. + CreatedOnBehalfOf *webapi.IdentityRef `json:"createdOnBehalfOf,omitempty"` + // The id assigned to the comment. + Id *int `json:"id,omitempty"` + // Indicates if the comment has been deleted at this version. + IsDeleted *bool `json:"isDeleted,omitempty"` + // IdentityRef of the user who modified the comment at this version. + ModifiedBy *webapi.IdentityRef `json:"modifiedBy,omitempty"` + // The modification date of the comment for this version. + ModifiedDate *azuredevops.Time `json:"modifiedDate,omitempty"` + // The rendered content of the comment at this version. + RenderedText *string `json:"renderedText,omitempty"` + // The text of the comment at this version. + Text *string `json:"text,omitempty"` + // The version number. + Version *int `json:"version,omitempty"` +} + +type EmailRecipients struct { + // Plaintext email addresses. + EmailAddresses *[]string `json:"emailAddresses,omitempty"` + // TfIds + TfIds *[]uuid.UUID `json:"tfIds,omitempty"` + // Unresolved entity ids + UnresolvedEntityIds *[]uuid.UUID `json:"unresolvedEntityIds,omitempty"` +} + +type ExternalDeployment struct { + ArtifactId *uuid.UUID `json:"artifactId,omitempty"` + CreatedBy *uuid.UUID `json:"createdBy,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Environment *ExternalEnvironment `json:"environment,omitempty"` + Group *string `json:"group,omitempty"` + Pipeline *ExternalPipeline `json:"pipeline,omitempty"` + RelatedWorkItemIds *[]int `json:"relatedWorkItemIds,omitempty"` + RunId *int `json:"runId,omitempty"` + SequenceNumber *int `json:"sequenceNumber,omitempty"` + Status *string `json:"status,omitempty"` + StatusDate *azuredevops.Time `json:"statusDate,omitempty"` + Url *string `json:"url,omitempty"` +} + +type ExternalEnvironment struct { + DisplayName *string `json:"displayName,omitempty"` + Id *int `json:"id,omitempty"` + Type *string `json:"type,omitempty"` +} + +type ExternalPipeline struct { + DisplayName *string `json:"displayName,omitempty"` + Id *int `json:"id,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Describes a list of dependent fields for a rule. +type FieldDependentRule struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The dependent fields. + DependentFields *[]WorkItemFieldReference `json:"dependentFields,omitempty"` +} + +// Enum for field types. +type FieldType string + +type fieldTypeValuesType struct { + String FieldType + Integer FieldType + DateTime FieldType + PlainText FieldType + Html FieldType + TreePath FieldType + History FieldType + Double FieldType + Guid FieldType + Boolean FieldType + Identity FieldType + PicklistString FieldType + PicklistInteger FieldType + PicklistDouble FieldType +} + +var FieldTypeValues = fieldTypeValuesType{ + // String field type. + String: "string", + // Integer field type. + Integer: "integer", + // Datetime field type. + DateTime: "dateTime", + // Plain text field type. + PlainText: "plainText", + // HTML (Multiline) field type. + Html: "html", + // Treepath field type. + TreePath: "treePath", + // History field type. + History: "history", + // Double field type. + Double: "double", + // Guid field type. + Guid: "guid", + // Boolean field type. + Boolean: "boolean", + // Identity field type. + Identity: "identity", + // String picklist field type. When creating a string picklist field from REST API, use "String" FieldType. + PicklistString: "picklistString", + // Integer picklist field type. When creating a integer picklist field from REST API, use "Integer" FieldType. + PicklistInteger: "picklistInteger", + // Double picklist field type. When creating a double picklist field from REST API, use "Double" FieldType. + PicklistDouble: "picklistDouble", +} + +// Describes an update request for a work item field. +type FieldUpdate struct { + // Indicates whether the user wants to restore the field. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Indicates whether the user wants to lock the field. + IsLocked *bool `json:"isLocked,omitempty"` +} + +// Enum for field usages. +type FieldUsage string + +type fieldUsageValuesType struct { + None FieldUsage + WorkItem FieldUsage + WorkItemLink FieldUsage + Tree FieldUsage + WorkItemTypeExtension FieldUsage +} + +var FieldUsageValues = fieldUsageValuesType{ + // Empty usage. + None: "none", + // Work item field usage. + WorkItem: "workItem", + // Work item link field usage. + WorkItemLink: "workItemLink", + // Treenode field usage. + Tree: "tree", + // Work Item Type Extension usage. + WorkItemTypeExtension: "workItemTypeExtension", +} + +// Flag to expand types of fields. +type GetFieldsExpand string + +type getFieldsExpandValuesType struct { + None GetFieldsExpand + ExtensionFields GetFieldsExpand + IncludeDeleted GetFieldsExpand +} + +var GetFieldsExpandValues = getFieldsExpandValuesType{ + // Default behavior. + None: "none", + // Adds extension fields to the response. + ExtensionFields: "extensionFields", + // Includes fields that have been deleted. + IncludeDeleted: "includeDeleted", +} + +// Describes Github connection. +type GitHubConnectionModel struct { + // Github connection authorization type (f. e. PAT, OAuth) + AuthorizationType *string `json:"authorizationType,omitempty"` + // Github connection created by + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // Github connection id + Id *uuid.UUID `json:"id,omitempty"` + // Whether current Github connection is valid or not + IsConnectionValid *bool `json:"isConnectionValid,omitempty"` + // Github connection name (should contain organization/user name) + Name *string `json:"name,omitempty"` +} + +// Describes Github connection's repo. +type GitHubConnectionRepoModel struct { + // Error message + ErrorMessage *string `json:"errorMessage,omitempty"` + // Repository web url + GitHubRepositoryUrl *string `json:"gitHubRepositoryUrl,omitempty"` +} + +// Describes Github connection's repo bulk request +type GitHubConnectionReposBatchRequest struct { + // Requested repos urls + GitHubRepositoryUrls *[]GitHubConnectionRepoModel `json:"gitHubRepositoryUrls,omitempty"` + // Operation type (f. e. add, remove) + OperationType *string `json:"operationType,omitempty"` +} + +// Describes a reference to an identity. +type IdentityReference struct { + // This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. + Links interface{} `json:"_links,omitempty"` + // The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. + Descriptor *string `json:"descriptor,omitempty"` + // This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider. + DisplayName *string `json:"displayName,omitempty"` + // This url is the full route to the source resource of this graph subject. + Url *string `json:"url,omitempty"` + // Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary + DirectoryAlias *string `json:"directoryAlias,omitempty"` + // Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary + ImageUrl *string `json:"imageUrl,omitempty"` + // Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary + Inactive *bool `json:"inactive,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) + IsAadIdentity *bool `json:"isAadIdentity,omitempty"` + // Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType) + IsContainer *bool `json:"isContainer,omitempty"` + IsDeletedInOrigin *bool `json:"isDeletedInOrigin,omitempty"` + // Deprecated - not in use in most preexisting implementations of ToIdentityRef + ProfileUrl *string `json:"profileUrl,omitempty"` + // Deprecated - use Domain+PrincipalName instead + UniqueName *string `json:"uniqueName,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + // Legacy back-compat property. This has been the WIT specific value from Constants. Will be hidden (but exists) on the client unless they are targeting the newest version + Name *string `json:"name,omitempty"` +} + +// Link description. +type Link struct { + // Collection of link attributes. + Attributes *map[string]interface{} `json:"attributes,omitempty"` + // Relation type. + Rel *string `json:"rel,omitempty"` + // Link url. + Url *string `json:"url,omitempty"` +} + +// The link query mode which determines the behavior of the query. +type LinkQueryMode string + +type linkQueryModeValuesType struct { + WorkItems LinkQueryMode + LinksOneHopMustContain LinkQueryMode + LinksOneHopMayContain LinkQueryMode + LinksOneHopDoesNotContain LinkQueryMode + LinksRecursiveMustContain LinkQueryMode + LinksRecursiveMayContain LinkQueryMode + LinksRecursiveDoesNotContain LinkQueryMode +} + +var LinkQueryModeValues = linkQueryModeValuesType{ + // Returns flat list of work items. + WorkItems: "workItems", + // Returns work items where the source, target, and link criteria are all satisfied. + LinksOneHopMustContain: "linksOneHopMustContain", + // Returns work items that satisfy the source and link criteria, even if no linked work item satisfies the target criteria. + LinksOneHopMayContain: "linksOneHopMayContain", + // Returns work items that satisfy the source, only if no linked work item satisfies the link and target criteria. + LinksOneHopDoesNotContain: "linksOneHopDoesNotContain", + LinksRecursiveMustContain: "linksRecursiveMustContain", + // Returns work items a hierarchy of work items that by default satisfy the source + LinksRecursiveMayContain: "linksRecursiveMayContain", + LinksRecursiveDoesNotContain: "linksRecursiveDoesNotContain", +} + +type LogicalOperation string + +type logicalOperationValuesType struct { + None LogicalOperation + And LogicalOperation + Or LogicalOperation +} + +var LogicalOperationValues = logicalOperationValuesType{ + None: "none", + And: "and", + Or: "or", +} + +type MailMessage struct { + // The mail body in HTML format. + Body *string `json:"body,omitempty"` + // CC recipients. + Cc *EmailRecipients `json:"cc,omitempty"` + // The in-reply-to header value + InReplyTo *string `json:"inReplyTo,omitempty"` + // The Message Id value + MessageId *string `json:"messageId,omitempty"` + // Reply To recipients. + ReplyTo *EmailRecipients `json:"replyTo,omitempty"` + // The mail subject. + Subject *string `json:"subject,omitempty"` + // To recipients + To *EmailRecipients `json:"to,omitempty"` +} + +// Stores process ID. +type ProcessIdModel struct { + // The ID of the process. + TypeId *uuid.UUID `json:"typeId,omitempty"` +} + +// Stores project ID and its process ID. +type ProcessMigrationResultModel struct { + // The ID of the process. + ProcessId *uuid.UUID `json:"processId,omitempty"` + // The ID of the project. + ProjectId *uuid.UUID `json:"projectId,omitempty"` +} + +// Project work item type state colors +type ProjectWorkItemStateColors struct { + // Project name + ProjectName *string `json:"projectName,omitempty"` + // State colors for all work item type in a project + WorkItemTypeStateColors *[]WorkItemTypeStateColors `json:"workItemTypeStateColors,omitempty"` +} + +// Enumerates the possible provisioning actions that can be triggered on process template update. +type ProvisioningActionType string + +type provisioningActionTypeValuesType struct { + Import ProvisioningActionType + Validate ProvisioningActionType +} + +var ProvisioningActionTypeValues = provisioningActionTypeValuesType{ + Import: "import", + Validate: "validate", +} + +// Result of an update work item type XML update operation. +type ProvisioningResult struct { + // Details about of the provisioning import events. + ProvisioningImportEvents *[]string `json:"provisioningImportEvents,omitempty"` +} + +// Describes a request to get a list of queries +type QueryBatchGetRequest struct { + // The expand parameters for queries. Possible options are { None, Wiql, Clauses, All, Minimal } + Expand *QueryExpand `json:"$expand,omitempty"` + // The flag to control error policy in a query batch request. Possible options are { Fail, Omit }. + ErrorPolicy *QueryErrorPolicy `json:"errorPolicy,omitempty"` + // The requested query ids + Ids *[]uuid.UUID `json:"ids,omitempty"` +} + +// Enum to control error policy in a query batch request. +type QueryErrorPolicy string + +type queryErrorPolicyValuesType struct { + Fail QueryErrorPolicy + Omit QueryErrorPolicy +} + +var QueryErrorPolicyValues = queryErrorPolicyValuesType{ + Fail: "fail", + Omit: "omit", +} + +// Determines which set of additional query properties to display +type QueryExpand string + +type queryExpandValuesType struct { + None QueryExpand + Wiql QueryExpand + Clauses QueryExpand + All QueryExpand + Minimal QueryExpand +} + +var QueryExpandValues = queryExpandValuesType{ + // Expands Columns, Links and ChangeInfo + None: "none", + // Expands Columns, Links, ChangeInfo and WIQL text + Wiql: "wiql", + // Expands Columns, Links, ChangeInfo, WIQL text and clauses + Clauses: "clauses", + // Expands all properties + All: "all", + // Displays minimal properties and the WIQL text + Minimal: "minimal", +} + +// Represents an item in the work item query hierarchy. This can be either a query or a folder. +type QueryHierarchyItem struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The clauses for a flat query. + Clauses *WorkItemQueryClause `json:"clauses,omitempty"` + // The columns of the query. + Columns *[]WorkItemFieldReference `json:"columns,omitempty"` + // The identity who created the query item. + CreatedBy *IdentityReference `json:"createdBy,omitempty"` + // When the query item was created. + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + // The link query mode. + FilterOptions *LinkQueryMode `json:"filterOptions,omitempty"` + // If this is a query folder, indicates if it contains any children. + HasChildren *bool `json:"hasChildren,omitempty"` + // The child query items inside a query folder. + Children *[]QueryHierarchyItem `json:"children,omitempty"` + // The id of the query item. + Id *uuid.UUID `json:"id,omitempty"` + // Indicates if this query item is deleted. Setting this to false on a deleted query item will undelete it. Undeleting a query or folder will not bring back the permission changes that were previously applied to it. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Indicates if this is a query folder or a query. + IsFolder *bool `json:"isFolder,omitempty"` + // Indicates if the WIQL of this query is invalid. This could be due to invalid syntax or a no longer valid area/iteration path. + IsInvalidSyntax *bool `json:"isInvalidSyntax,omitempty"` + // Indicates if this query item is public or private. + IsPublic *bool `json:"isPublic,omitempty"` + // The identity who last ran the query. + LastExecutedBy *IdentityReference `json:"lastExecutedBy,omitempty"` + // When the query was last run. + LastExecutedDate *azuredevops.Time `json:"lastExecutedDate,omitempty"` + // The identity who last modified the query item. + LastModifiedBy *IdentityReference `json:"lastModifiedBy,omitempty"` + // When the query item was last modified. + LastModifiedDate *azuredevops.Time `json:"lastModifiedDate,omitempty"` + // The link query clause. + LinkClauses *WorkItemQueryClause `json:"linkClauses,omitempty"` + // The name of the query item. + Name *string `json:"name,omitempty"` + // The path of the query item. + Path *string `json:"path,omitempty"` + // The recursion option for use in a tree query. + QueryRecursionOption *QueryRecursionOption `json:"queryRecursionOption,omitempty"` + // The type of query. + QueryType *QueryType `json:"queryType,omitempty"` + // The sort columns of the query. + SortColumns *[]WorkItemQuerySortColumn `json:"sortColumns,omitempty"` + // The source clauses in a tree or one-hop link query. + SourceClauses *WorkItemQueryClause `json:"sourceClauses,omitempty"` + // The target clauses in a tree or one-hop link query. + TargetClauses *WorkItemQueryClause `json:"targetClauses,omitempty"` + // The WIQL text of the query + Wiql *string `json:"wiql,omitempty"` +} + +type QueryHierarchyItemsResult struct { + // The count of items. + Count *int `json:"count,omitempty"` + // Indicates if the max return limit was hit but there are still more items + HasMore *bool `json:"hasMore,omitempty"` + // The list of items + Value *[]QueryHierarchyItem `json:"value,omitempty"` +} + +type QueryOption string + +type queryOptionValuesType struct { + Doing QueryOption + Done QueryOption + Followed QueryOption +} + +var QueryOptionValues = queryOptionValuesType{ + Doing: "doing", + Done: "done", + Followed: "followed", +} + +// Determines whether a tree query matches parents or children first. +type QueryRecursionOption string + +type queryRecursionOptionValuesType struct { + ParentFirst QueryRecursionOption + ChildFirst QueryRecursionOption +} + +var QueryRecursionOptionValues = queryRecursionOptionValuesType{ + // Returns work items that satisfy the source, even if no linked work item satisfies the target and link criteria. + ParentFirst: "parentFirst", + // Returns work items that satisfy the target criteria, even if no work item satisfies the source and link criteria. + ChildFirst: "childFirst", +} + +// The query result type +type QueryResultType string + +type queryResultTypeValuesType struct { + WorkItem QueryResultType + WorkItemLink QueryResultType +} + +var QueryResultTypeValues = queryResultTypeValuesType{ + // A list of work items (for flat queries). + WorkItem: "workItem", + // A list of work item links (for OneHop and Tree queries). + WorkItemLink: "workItemLink", +} + +// The type of query. +type QueryType string + +type queryTypeValuesType struct { + Flat QueryType + Tree QueryType + OneHop QueryType +} + +var QueryTypeValues = queryTypeValuesType{ + // Gets a flat list of work items. + Flat: "flat", + // Gets a tree of work items showing their link hierarchy. + Tree: "tree", + // Gets a list of work items and their direct links. + OneHop: "oneHop", +} + +// The reporting revision expand level. +type ReportingRevisionsExpand string + +type reportingRevisionsExpandValuesType struct { + None ReportingRevisionsExpand + Fields ReportingRevisionsExpand +} + +var ReportingRevisionsExpandValues = reportingRevisionsExpandValuesType{ + // Default behavior. + None: "none", + // Add fields to the response. + Fields: "fields", +} + +type ReportingWorkItemLinksBatch struct { + // ContinuationToken acts as a waterMark. Used while querying large results. + ContinuationToken *string `json:"continuationToken,omitempty"` + // Returns 'true' if it's last batch, 'false' otherwise. + IsLastBatch *bool `json:"isLastBatch,omitempty"` + // The next link for the work item. + NextLink *string `json:"nextLink,omitempty"` + // Values such as rel, sourceId, TargetId, ChangedDate, isActive. + Values *[]interface{} `json:"values,omitempty"` +} + +type ReportingWorkItemRevisionsBatch struct { + // ContinuationToken acts as a waterMark. Used while querying large results. + ContinuationToken *string `json:"continuationToken,omitempty"` + // Returns 'true' if it's last batch, 'false' otherwise. + IsLastBatch *bool `json:"isLastBatch,omitempty"` + // The next link for the work item. + NextLink *string `json:"nextLink,omitempty"` + // Values such as rel, sourceId, TargetId, ChangedDate, isActive. + Values *[]interface{} `json:"values,omitempty"` +} + +// The class represents the reporting work item revision filer. +type ReportingWorkItemRevisionsFilter struct { + // A list of fields to return in work item revisions. Omit this parameter to get all reportable fields. + Fields *[]string `json:"fields,omitempty"` + // Include deleted work item in the result. + IncludeDeleted *bool `json:"includeDeleted,omitempty"` + // Return an identity reference instead of a string value for identity fields. + IncludeIdentityRef *bool `json:"includeIdentityRef,omitempty"` + // Include only the latest version of a work item, skipping over all previous revisions of the work item. + IncludeLatestOnly *bool `json:"includeLatestOnly,omitempty"` + // Include tag reference instead of string value for System.Tags field + IncludeTagRef *bool `json:"includeTagRef,omitempty"` + // A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types. + Types *[]string `json:"types,omitempty"` +} + +type SendMailBody struct { + Fields *[]string `json:"fields,omitempty"` + Ids *[]int `json:"ids,omitempty"` + Message *MailMessage `json:"message,omitempty"` + PersistenceId *uuid.UUID `json:"persistenceId,omitempty"` + ProjectId *string `json:"projectId,omitempty"` + SortFields *[]string `json:"sortFields,omitempty"` + TempQueryId *string `json:"tempQueryId,omitempty"` + Wiql *string `json:"wiql,omitempty"` +} + +// The class describes reporting work item revision batch. +type StreamedBatch struct { + // ContinuationToken acts as a waterMark. Used while querying large results. + ContinuationToken *string `json:"continuationToken,omitempty"` + // Returns 'true' if it's last batch, 'false' otherwise. + IsLastBatch *bool `json:"isLastBatch,omitempty"` + // The next link for the work item. + NextLink *string `json:"nextLink,omitempty"` + // Values such as rel, sourceId, TargetId, ChangedDate, isActive. + Values *[]interface{} `json:"values,omitempty"` +} + +// Enumerates types of supported xml templates used for customization. +type TemplateType string + +type templateTypeValuesType struct { + WorkItemType TemplateType + GlobalWorkflow TemplateType +} + +var TemplateTypeValues = templateTypeValuesType{ + WorkItemType: "workItemType", + GlobalWorkflow: "globalWorkflow", +} + +// Describes a request to create a temporary query +type TemporaryQueryRequestModel struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The WIQL text of the temporary query + Wiql *string `json:"wiql,omitempty"` +} + +// The result of a temporary query creation. +type TemporaryQueryResponseModel struct { + // The id of the temporary query item. + Id *uuid.UUID `json:"id,omitempty"` +} + +// Types of tree node structures. +type TreeNodeStructureType string + +type treeNodeStructureTypeValuesType struct { + Area TreeNodeStructureType + Iteration TreeNodeStructureType +} + +var TreeNodeStructureTypeValues = treeNodeStructureTypeValuesType{ + // Area type. + Area: "area", + // Iteration type. + Iteration: "iteration", +} + +// Types of tree structures groups. +type TreeStructureGroup string + +type treeStructureGroupValuesType struct { + Areas TreeStructureGroup + Iterations TreeStructureGroup +} + +var TreeStructureGroupValues = treeStructureGroupValuesType{ + Areas: "areas", + Iterations: "iterations", +} + +// Describes an update request for a work item field. +type UpdateWorkItemField struct { + // Indicates whether the user wants to restore the field. + IsDeleted *bool `json:"isDeleted,omitempty"` +} + +// A WIQL query +type Wiql struct { + // The text of the WIQL query + Query *string `json:"query,omitempty"` +} + +// A work artifact link describes an outbound artifact link type. +type WorkArtifactLink struct { + // Target artifact type. + ArtifactType *string `json:"artifactType,omitempty"` + // Outbound link type. + LinkType *string `json:"linkType,omitempty"` + // Target tool type. + ToolType *string `json:"toolType,omitempty"` +} + +// Describes a work item. +type WorkItem struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Reference to a specific version of the comment added/edited/deleted in this revision. + CommentVersionRef *WorkItemCommentVersionRef `json:"commentVersionRef,omitempty"` + // Map of field and values for the work item. + Fields *map[string]interface{} `json:"fields,omitempty"` + // The work item ID. + Id *int `json:"id,omitempty"` + // Relations of the work item. + Relations *[]WorkItemRelation `json:"relations,omitempty"` + // Revision number of the work item. + Rev *int `json:"rev,omitempty"` +} + +// Describes a request to get a set of work items +type WorkItemBatchGetRequest struct { + // The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All } + Expand *WorkItemExpand `json:"$expand,omitempty"` + // AsOf UTC date time string + AsOf *azuredevops.Time `json:"asOf,omitempty"` + // The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}. + ErrorPolicy *WorkItemErrorPolicy `json:"errorPolicy,omitempty"` + // The requested fields + Fields *[]string `json:"fields,omitempty"` + // The requested work item ids + Ids *[]int `json:"ids,omitempty"` +} + +// Defines a classification node for work item tracking. +type WorkItemClassificationNode struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Dictionary that has node attributes like start/finish date for iteration nodes. + Attributes *map[string]interface{} `json:"attributes,omitempty"` + // Flag that indicates if the classification node has any child nodes. + HasChildren *bool `json:"hasChildren,omitempty"` + // List of child nodes fetched. + Children *[]WorkItemClassificationNode `json:"children,omitempty"` + // Integer ID of the classification node. + Id *int `json:"id,omitempty"` + // GUID ID of the classification node. + Identifier *uuid.UUID `json:"identifier,omitempty"` + // Name of the classification node. + Name *string `json:"name,omitempty"` + // Path of the classification node. + Path *string `json:"path,omitempty"` + // Node structure type. + StructureType *TreeNodeStructureType `json:"structureType,omitempty"` +} + +// Comment on Work Item +type WorkItemComment struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Represents the possible types for the comment format. + Format *CommentFormat `json:"format,omitempty"` + // The text of the comment in HTML format. + RenderedText *string `json:"renderedText,omitempty"` + // Identity of user who added the comment. + RevisedBy *IdentityReference `json:"revisedBy,omitempty"` + // The date of comment. + RevisedDate *azuredevops.Time `json:"revisedDate,omitempty"` + // The work item revision number. + Revision *int `json:"revision,omitempty"` + // The text of the comment. + Text *string `json:"text,omitempty"` +} + +// Collection of comments. +type WorkItemComments struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Comments collection. + Comments *[]WorkItemComment `json:"comments,omitempty"` + // The count of comments. + Count *int `json:"count,omitempty"` + // Count of comments from the revision. + FromRevisionCount *int `json:"fromRevisionCount,omitempty"` + // Total count of comments. + TotalCount *int `json:"totalCount,omitempty"` +} + +// Represents the reference to a specific version of a comment on a Work Item. +type WorkItemCommentVersionRef struct { + Url *string `json:"url,omitempty"` + // The id assigned to the comment. + CommentId *int `json:"commentId,omitempty"` + // [Internal] The work item revision where this comment was originally added. + CreatedInRevision *int `json:"createdInRevision,omitempty"` + // [Internal] Specifies whether comment was deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // [Internal] The text of the comment. + Text *string `json:"text,omitempty"` + // The version number. + Version *int `json:"version,omitempty"` +} + +// Full deleted work item object. Includes the work item itself. +type WorkItemDelete struct { + // The HTTP status code for work item operation in a batch request. + Code *int `json:"code,omitempty"` + // The user who deleted the work item type. + DeletedBy *string `json:"deletedBy,omitempty"` + // The work item deletion date. + DeletedDate *string `json:"deletedDate,omitempty"` + // Work item ID. + Id *int `json:"id,omitempty"` + // The exception message for work item operation in a batch request. + Message *string `json:"message,omitempty"` + // Name or title of the work item. + Name *string `json:"name,omitempty"` + // Parent project of the deleted work item. + Project *string `json:"project,omitempty"` + // Type of work item. + Type *string `json:"type,omitempty"` + // REST API URL of the resource + Url *string `json:"url,omitempty"` + // The work item object that was deleted. + Resource *WorkItem `json:"resource,omitempty"` +} + +// Describes response to delete a set of work items. +type WorkItemDeleteBatch struct { + // List of results for each work item + Results *[]WorkItemDelete `json:"results,omitempty"` +} + +// Describes a request to delete a set of work items +type WorkItemDeleteBatchRequest struct { + // Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone. + Destroy *bool `json:"destroy,omitempty"` + // The requested work item ids + Ids *[]int `json:"ids,omitempty"` + // Optional parameter, if set to true, notifications will be disabled. + SkipNotifications *bool `json:"skipNotifications,omitempty"` +} + +// Reference to a deleted work item. +type WorkItemDeleteReference struct { + // The HTTP status code for work item operation in a batch request. + Code *int `json:"code,omitempty"` + // The user who deleted the work item type. + DeletedBy *string `json:"deletedBy,omitempty"` + // The work item deletion date. + DeletedDate *string `json:"deletedDate,omitempty"` + // Work item ID. + Id *int `json:"id,omitempty"` + // The exception message for work item operation in a batch request. + Message *string `json:"message,omitempty"` + // Name or title of the work item. + Name *string `json:"name,omitempty"` + // Parent project of the deleted work item. + Project *string `json:"project,omitempty"` + // Type of work item. + Type *string `json:"type,omitempty"` + // REST API URL of the resource + Url *string `json:"url,omitempty"` +} + +// Shallow Reference to a deleted work item. +type WorkItemDeleteShallowReference struct { + // Work item ID. + Id *int `json:"id,omitempty"` + // REST API URL of the resource + Url *string `json:"url,omitempty"` +} + +// Describes an update request for a deleted work item. +type WorkItemDeleteUpdate struct { + // Sets a value indicating whether this work item is deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` +} + +// Enum to control error policy in a bulk get work items request. +type WorkItemErrorPolicy string + +type workItemErrorPolicyValuesType struct { + Fail WorkItemErrorPolicy + Omit WorkItemErrorPolicy +} + +var WorkItemErrorPolicyValues = workItemErrorPolicyValuesType{ + // Fail work error policy. + Fail: "fail", + // Omit work error policy. + Omit: "omit", +} + +// Flag to control payload properties from get work item command. +type WorkItemExpand string + +type workItemExpandValuesType struct { + None WorkItemExpand + Relations WorkItemExpand + Fields WorkItemExpand + Links WorkItemExpand + All WorkItemExpand +} + +var WorkItemExpandValues = workItemExpandValuesType{ + // Default behavior. + None: "none", + // Relations work item expand. + Relations: "relations", + // Fields work item expand. + Fields: "fields", + // Links work item expand. + Links: "links", + // Expands all. + All: "all", +} + +// Describes a field on a work item and it's properties specific to that work item type. +type WorkItemField struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Indicates whether the field is sortable in server queries. + CanSortBy *bool `json:"canSortBy,omitempty"` + // The description of the field. + Description *string `json:"description,omitempty"` + // Indicates whether this field is deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Indicates whether this field is an identity field. + IsIdentity *bool `json:"isIdentity,omitempty"` + // Indicates whether this instance is picklist. + IsPicklist *bool `json:"isPicklist,omitempty"` + // Indicates whether this instance is a suggested picklist . + IsPicklistSuggested *bool `json:"isPicklistSuggested,omitempty"` + // Indicates whether the field can be queried in the server. + IsQueryable *bool `json:"isQueryable,omitempty"` + // The name of the field. + Name *string `json:"name,omitempty"` + // If this field is picklist, the identifier of the picklist associated, otherwise null + PicklistId *uuid.UUID `json:"picklistId,omitempty"` + // Indicates whether the field is [read only]. + ReadOnly *bool `json:"readOnly,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The supported operations on this field. + SupportedOperations *[]WorkItemFieldOperation `json:"supportedOperations,omitempty"` + // The type of the field. + Type *FieldType `json:"type,omitempty"` + // The usage of the field. + Usage *FieldUsage `json:"usage,omitempty"` +} + +// Describes a field on a work item and it's properties specific to that work item type. +type WorkItemField2 struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Indicates whether the field is sortable in server queries. + CanSortBy *bool `json:"canSortBy,omitempty"` + // The description of the field. + Description *string `json:"description,omitempty"` + // Indicates whether this field is deleted. + IsDeleted *bool `json:"isDeleted,omitempty"` + // Indicates whether this field is an identity field. + IsIdentity *bool `json:"isIdentity,omitempty"` + // Indicates whether this instance is picklist. + IsPicklist *bool `json:"isPicklist,omitempty"` + // Indicates whether this instance is a suggested picklist . + IsPicklistSuggested *bool `json:"isPicklistSuggested,omitempty"` + // Indicates whether the field can be queried in the server. + IsQueryable *bool `json:"isQueryable,omitempty"` + // The name of the field. + Name *string `json:"name,omitempty"` + // If this field is picklist, the identifier of the picklist associated, otherwise null + PicklistId *uuid.UUID `json:"picklistId,omitempty"` + // Indicates whether the field is [read only]. + ReadOnly *bool `json:"readOnly,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The supported operations on this field. + SupportedOperations *[]WorkItemFieldOperation `json:"supportedOperations,omitempty"` + // The type of the field. + Type *FieldType `json:"type,omitempty"` + // The usage of the field. + Usage *FieldUsage `json:"usage,omitempty"` + // Indicates whether this field is marked as locked for editing. + IsLocked *bool `json:"isLocked,omitempty"` +} + +// Describes the list of allowed values of the field. +type WorkItemFieldAllowedValues struct { + // The list of field allowed values. + AllowedValues *[]string `json:"allowedValues,omitempty"` + // Name of the field. + FieldName *string `json:"fieldName,omitempty"` +} + +// Describes a work item field operation. +type WorkItemFieldOperation struct { + // Friendly name of the operation. + Name *string `json:"name,omitempty"` + // Reference name of the operation. + ReferenceName *string `json:"referenceName,omitempty"` +} + +// Reference to a field in a work item +type WorkItemFieldReference struct { + // The friendly name of the field. + Name *string `json:"name,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The REST URL of the resource. + Url *string `json:"url,omitempty"` +} + +// Describes an update to a work item field. +type WorkItemFieldUpdate struct { + // The new value of the field. + NewValue interface{} `json:"newValue,omitempty"` + // The old value of the field. + OldValue interface{} `json:"oldValue,omitempty"` +} + +type WorkItemHistory struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + Rev *int `json:"rev,omitempty"` + RevisedBy *IdentityReference `json:"revisedBy,omitempty"` + RevisedDate *azuredevops.Time `json:"revisedDate,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Reference to a work item icon. +type WorkItemIcon struct { + // The identifier of the icon. + Id *string `json:"id,omitempty"` + // The REST URL of the resource. + Url *string `json:"url,omitempty"` +} + +// A link between two work items. +type WorkItemLink struct { + // The type of link. + Rel *string `json:"rel,omitempty"` + // The source work item. + Source *WorkItemReference `json:"source,omitempty"` + // The target work item. + Target *WorkItemReference `json:"target,omitempty"` +} + +// Describes the next state for a work item. +type WorkItemNextStateOnTransition struct { + // Error code if there is no next state transition possible. + ErrorCode *string `json:"errorCode,omitempty"` + // Work item ID. + Id *int `json:"id,omitempty"` + // Error message if there is no next state transition possible. + Message *string `json:"message,omitempty"` + // Name of the next state on transition. + StateOnTransition *string `json:"stateOnTransition,omitempty"` +} + +// Represents a clause in a work item query. This shows the structure of a work item query. +type WorkItemQueryClause struct { + // Child clauses if the current clause is a logical operator + Clauses *[]WorkItemQueryClause `json:"clauses,omitempty"` + // Field associated with condition + Field *WorkItemFieldReference `json:"field,omitempty"` + // Right side of the condition when a field to field comparison + FieldValue *WorkItemFieldReference `json:"fieldValue,omitempty"` + // Determines if this is a field to field comparison + IsFieldValue *bool `json:"isFieldValue,omitempty"` + // Logical operator separating the condition clause + LogicalOperator *LogicalOperation `json:"logicalOperator,omitempty"` + // The field operator + Operator *WorkItemFieldOperation `json:"operator,omitempty"` + // Right side of the condition when a field to value comparison + Value *string `json:"value,omitempty"` +} + +// The result of a work item query. +type WorkItemQueryResult struct { + // The date the query was run in the context of. + AsOf *azuredevops.Time `json:"asOf,omitempty"` + // The columns of the query. + Columns *[]WorkItemFieldReference `json:"columns,omitempty"` + // The result type + QueryResultType *QueryResultType `json:"queryResultType,omitempty"` + // The type of the query + QueryType *QueryType `json:"queryType,omitempty"` + // The sort columns of the query. + SortColumns *[]WorkItemQuerySortColumn `json:"sortColumns,omitempty"` + // The work item links returned by the query. + WorkItemRelations *[]WorkItemLink `json:"workItemRelations,omitempty"` + // The work items returned by the query. + WorkItems *[]WorkItemReference `json:"workItems,omitempty"` +} + +// A sort column. +type WorkItemQuerySortColumn struct { + // The direction to sort by. + Descending *bool `json:"descending,omitempty"` + // A work item field. + Field *WorkItemFieldReference `json:"field,omitempty"` +} + +// Type of the activity +type WorkItemRecentActivityType string + +type workItemRecentActivityTypeValuesType struct { + Visited WorkItemRecentActivityType + Edited WorkItemRecentActivityType + Deleted WorkItemRecentActivityType + Restored WorkItemRecentActivityType +} + +var WorkItemRecentActivityTypeValues = workItemRecentActivityTypeValuesType{ + Visited: "visited", + Edited: "edited", + Deleted: "deleted", + Restored: "restored", +} + +// Contains reference to a work item. +type WorkItemReference struct { + // Work item ID. + Id *int `json:"id,omitempty"` + // REST API URL of the resource + Url *string `json:"url,omitempty"` +} + +type WorkItemRelation struct { + // Collection of link attributes. + Attributes *map[string]interface{} `json:"attributes,omitempty"` + // Relation type. + Rel *string `json:"rel,omitempty"` + // Link url. + Url *string `json:"url,omitempty"` +} + +// Represents the work item type relation type. +type WorkItemRelationType struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The name. + Name *string `json:"name,omitempty"` + // The reference name. + ReferenceName *string `json:"referenceName,omitempty"` + // The collection of relation type attributes. + Attributes *map[string]interface{} `json:"attributes,omitempty"` +} + +// Describes updates to a work item's relations. +type WorkItemRelationUpdates struct { + // List of newly added relations. + Added *[]WorkItemRelation `json:"added,omitempty"` + // List of removed relations. + Removed *[]WorkItemRelation `json:"removed,omitempty"` + // List of updated relations. + Updated *[]WorkItemRelation `json:"updated,omitempty"` +} + +// Work item type state name, color and state category +type WorkItemStateColor struct { + // Category of state + Category *string `json:"category,omitempty"` + // Color value + Color *string `json:"color,omitempty"` + // Work item type state name + Name *string `json:"name,omitempty"` +} + +// Describes a state transition in a work item. +type WorkItemStateTransition struct { + // Gets a list of actions needed to transition to that state. + Actions *[]string `json:"actions,omitempty"` + // Name of the next state. + To *string `json:"to,omitempty"` +} + +type WorkItemTagDefinition struct { + Id *uuid.UUID `json:"id,omitempty"` + LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` +} + +// Describes a work item template. +type WorkItemTemplate struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The description of the work item template. + Description *string `json:"description,omitempty"` + // The identifier of the work item template. + Id *uuid.UUID `json:"id,omitempty"` + // The name of the work item template. + Name *string `json:"name,omitempty"` + // The name of the work item type. + WorkItemTypeName *string `json:"workItemTypeName,omitempty"` + // Mapping of field and its templated value. + Fields *map[string]string `json:"fields,omitempty"` +} + +// Describes a shallow reference to a work item template. +type WorkItemTemplateReference struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The description of the work item template. + Description *string `json:"description,omitempty"` + // The identifier of the work item template. + Id *uuid.UUID `json:"id,omitempty"` + // The name of the work item template. + Name *string `json:"name,omitempty"` + // The name of the work item type. + WorkItemTypeName *string `json:"workItemTypeName,omitempty"` +} + +type WorkItemTrackingReference struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The name. + Name *string `json:"name,omitempty"` + // The reference name. + ReferenceName *string `json:"referenceName,omitempty"` +} + +// Base class for WIT REST resources. +type WorkItemTrackingResource struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` +} + +// Base class for work item tracking resource references. +type WorkItemTrackingResourceReference struct { + Url *string `json:"url,omitempty"` +} + +// Describes a work item type. +type WorkItemType struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // The color. + Color *string `json:"color,omitempty"` + // The description of the work item type. + Description *string `json:"description,omitempty"` + // The fields that exist on the work item type. + FieldInstances *[]WorkItemTypeFieldInstance `json:"fieldInstances,omitempty"` + // The fields that exist on the work item type. + Fields *[]WorkItemTypeFieldInstance `json:"fields,omitempty"` + // The icon of the work item type. + Icon *WorkItemIcon `json:"icon,omitempty"` + // True if work item type is disabled + IsDisabled *bool `json:"isDisabled,omitempty"` + // Gets the name of the work item type. + Name *string `json:"name,omitempty"` + // The reference name of the work item type. + ReferenceName *string `json:"referenceName,omitempty"` + // Gets state information for the work item type. + States *[]WorkItemStateColor `json:"states,omitempty"` + // Gets the various state transition mappings in the work item type. + Transitions *map[string][]WorkItemStateTransition `json:"transitions,omitempty"` + // The XML form. + XmlForm *string `json:"xmlForm,omitempty"` +} + +// Describes a work item type category. +type WorkItemTypeCategory struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // Gets or sets the default type of the work item. + DefaultWorkItemType *WorkItemTypeReference `json:"defaultWorkItemType,omitempty"` + // The name of the category. + Name *string `json:"name,omitempty"` + // The reference name of the category. + ReferenceName *string `json:"referenceName,omitempty"` + // The work item types that belong to the category. + WorkItemTypes *[]WorkItemTypeReference `json:"workItemTypes,omitempty"` +} + +// Describes a work item type's colors. +type WorkItemTypeColor struct { + // Gets or sets the color of the primary. + PrimaryColor *string `json:"primaryColor,omitempty"` + // Gets or sets the color of the secondary. + SecondaryColor *string `json:"secondaryColor,omitempty"` + // The name of the work item type. + WorkItemTypeName *string `json:"workItemTypeName,omitempty"` +} + +// Describes work item type name, its icon and color. +type WorkItemTypeColorAndIcon struct { + // The color of the work item type in hex format. + Color *string `json:"color,omitempty"` + // The work item type icon. + Icon *string `json:"icon,omitempty"` + // Indicates if the work item is disabled in the process. + IsDisabled *bool `json:"isDisabled,omitempty"` + // The name of the work item type. + WorkItemTypeName *string `json:"workItemTypeName,omitempty"` +} + +// Field instance of a work item type. +type WorkItemTypeFieldInstance struct { + // The friendly name of the field. + Name *string `json:"name,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The REST URL of the resource. + Url *string `json:"url,omitempty"` + // Indicates whether field value is always required. + AlwaysRequired *bool `json:"alwaysRequired,omitempty"` + // The list of dependent fields. + DependentFields *[]WorkItemFieldReference `json:"dependentFields,omitempty"` + // Gets the help text for the field. + HelpText *string `json:"helpText,omitempty"` + // The list of field allowed values. + AllowedValues *[]string `json:"allowedValues,omitempty"` + // Represents the default value of the field. + DefaultValue *string `json:"defaultValue,omitempty"` +} + +// Base field instance for workItemType fields. +type WorkItemTypeFieldInstanceBase struct { + // The friendly name of the field. + Name *string `json:"name,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The REST URL of the resource. + Url *string `json:"url,omitempty"` + // Indicates whether field value is always required. + AlwaysRequired *bool `json:"alwaysRequired,omitempty"` + // The list of dependent fields. + DependentFields *[]WorkItemFieldReference `json:"dependentFields,omitempty"` + // Gets the help text for the field. + HelpText *string `json:"helpText,omitempty"` +} + +// Expand options for the work item field(s) request. +type WorkItemTypeFieldsExpandLevel string + +type workItemTypeFieldsExpandLevelValuesType struct { + None WorkItemTypeFieldsExpandLevel + AllowedValues WorkItemTypeFieldsExpandLevel + DependentFields WorkItemTypeFieldsExpandLevel + All WorkItemTypeFieldsExpandLevel +} + +var WorkItemTypeFieldsExpandLevelValues = workItemTypeFieldsExpandLevelValuesType{ + // Includes only basic properties of the field. + None: "none", + // Includes allowed values for the field. + AllowedValues: "allowedValues", + // Includes dependent fields of the field. + DependentFields: "dependentFields", + // Includes allowed values and dependent fields of the field. + All: "all", +} + +// Field Instance of a workItemype with detailed references. +type WorkItemTypeFieldWithReferences struct { + // The friendly name of the field. + Name *string `json:"name,omitempty"` + // The reference name of the field. + ReferenceName *string `json:"referenceName,omitempty"` + // The REST URL of the resource. + Url *string `json:"url,omitempty"` + // Indicates whether field value is always required. + AlwaysRequired *bool `json:"alwaysRequired,omitempty"` + // The list of dependent fields. + DependentFields *[]WorkItemFieldReference `json:"dependentFields,omitempty"` + // Gets the help text for the field. + HelpText *string `json:"helpText,omitempty"` + // The list of field allowed values. + AllowedValues *[]interface{} `json:"allowedValues,omitempty"` + // Represents the default value of the field. + DefaultValue interface{} `json:"defaultValue,omitempty"` +} + +// Reference to a work item type. +type WorkItemTypeReference struct { + Url *string `json:"url,omitempty"` + // Name of the work item type. + Name *string `json:"name,omitempty"` +} + +// State colors for a work item type +type WorkItemTypeStateColors struct { + // Work item type state colors + StateColors *[]WorkItemStateColor `json:"stateColors,omitempty"` + // Work item type name + WorkItemTypeName *string `json:"workItemTypeName,omitempty"` +} + +// Describes a work item type template. +type WorkItemTypeTemplate struct { + // XML template in string format. + Template *string `json:"template,omitempty"` +} + +// Describes a update work item type template request body. +type WorkItemTypeTemplateUpdateModel struct { + // Describes the type of the action for the update request. + ActionType *ProvisioningActionType `json:"actionType,omitempty"` + // Methodology to which the template belongs, eg. Agile, Scrum, CMMI. + Methodology *string `json:"methodology,omitempty"` + // String representation of the work item type template. + Template *string `json:"template,omitempty"` + // The type of the template described in the request body. + TemplateType *TemplateType `json:"templateType,omitempty"` +} + +// Describes an update to a work item. +type WorkItemUpdate struct { + Url *string `json:"url,omitempty"` + // Link references to related REST resources. + Links interface{} `json:"_links,omitempty"` + // List of updates to fields. + Fields *map[string]WorkItemFieldUpdate `json:"fields,omitempty"` + // ID of update. + Id *int `json:"id,omitempty"` + // List of updates to relations. + Relations *WorkItemRelationUpdates `json:"relations,omitempty"` + // The revision number of work item update. + Rev *int `json:"rev,omitempty"` + // Identity for the work item update. + RevisedBy *IdentityReference `json:"revisedBy,omitempty"` + // The work item updates revision date. + RevisedDate *azuredevops.Time `json:"revisedDate,omitempty"` + // The work item ID. + WorkItemId *int `json:"workItemId,omitempty"` +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 52e8d9a0..b626e329 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -150,6 +150,7 @@ github.com/microsoft/azure-devops-go-api/azuredevops/v7/security github.com/microsoft/azure-devops-go-api/azuredevops/v7/serviceendpoint github.com/microsoft/azure-devops-go-api/azuredevops/v7/system github.com/microsoft/azure-devops-go-api/azuredevops/v7/webapi +github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking # github.com/muesli/reflow v0.3.0 ## explicit; go 1.13 github.com/muesli/reflow/ansi From 7943f5ac05982872609ac73992763561d437ea40 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:07:00 +0000 Subject: [PATCH 02/13] chore: update go.sum --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index a15d79d1..012707ee 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From ae18f5c4defdd156837a23b815af62bd2186e7cd Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:07:22 +0000 Subject: [PATCH 03/13] chore: add workitemtracking client mock generation Add a mockgen invocation to generate a MockWorkItemTrackingClient for the Azure DevOps workitemtracking v7 package. --- scripts/generate_mocks.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/generate_mocks.sh b/scripts/generate_mocks.sh index 0e2207c2..7210745a 100644 --- a/scripts/generate_mocks.sh +++ b/scripts/generate_mocks.sh @@ -53,6 +53,12 @@ mockgen \ -mock_names Client=MockSecurityClient \ github.com/microsoft/azure-devops-go-api/azuredevops/v7/security Client +echo "Generating Azure DevOps WorkItemTracking client mock..." +mockgen \ + -package=mocks -destination internal/mocks/workitemtracking_client_mock.go \ + -mock_names Client=MockWorkItemTrackingClient \ + github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking Client + echo "Generating Repository mock..." mockgen -source internal/azdo/repo.go \ -package=mocks -destination internal/mocks/repository_mock.go From e1cacfbdb664624d5a559b9d8e37320d4cf759ec Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:17:30 +0000 Subject: [PATCH 04/13] =?UTF-8?q?chore:=20=F0=9F=92=85=F0=9F=8F=BC=20fixed?= =?UTF-8?q?=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmd/security/permission/reset/reset.go | 12 ++-- internal/test/poll_test.go | 58 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/internal/cmd/security/permission/reset/reset.go b/internal/cmd/security/permission/reset/reset.go index a82b792e..0056a33f 100644 --- a/internal/cmd/security/permission/reset/reset.go +++ b/internal/cmd/security/permission/reset/reset.go @@ -16,12 +16,12 @@ import ( ) type opts struct { - rawTarget string - namespaceID string - token string - permission []string - yes bool - exporter util.Exporter + rawTarget string + namespaceID string + token string + permission []string + yes bool + exporter util.Exporter } type permissionResult struct { diff --git a/internal/test/poll_test.go b/internal/test/poll_test.go index 16db92de..ebebd6d7 100644 --- a/internal/test/poll_test.go +++ b/internal/test/poll_test.go @@ -77,33 +77,33 @@ func TestPollTimeout(t *testing.T) { } func TestPollBinaryExponentialBackoff(t *testing.T) { - // Expected waits: 2s, 4s, 8s (formula: 2^i * 2s) - expectedDurations := []time.Duration{2 * time.Second, 4 * time.Second, 8 * time.Second} - var lastCall time.Time - var callIndex int - - err := Poll(func() error { - now := time.Now() - if callIndex > 0 { - elapsed := now.Sub(lastCall) - expected := expectedDurations[callIndex-1] - - // Allow ±10% margin for scheduler jitter - min := expected - expected/10 - max := expected + expected/10 - if elapsed < min || elapsed > max { - t.Fatalf("Call %d: expected ~%v wait, got %v", callIndex, expected, elapsed) - } - } - if callIndex >= len(expectedDurations) { - return nil // succeed after verifying waits - } - lastCall = now - callIndex++ - return errors.New("simulated failure") - }, PollOptions{ - Tries: len(expectedDurations) + 1, // enough tries to verify all intervals - }) // Delay left at zero - - require.NoError(t, err) + // Expected waits: 2s, 4s, 8s (formula: 2^i * 2s) + expectedDurations := []time.Duration{2 * time.Second, 4 * time.Second, 8 * time.Second} + var lastCall time.Time + var callIndex int + + err := Poll(func() error { + now := time.Now() + if callIndex > 0 { + elapsed := now.Sub(lastCall) + expected := expectedDurations[callIndex-1] + + // Allow ±10% margin for scheduler jitter + min := expected - expected/10 + max := expected + expected/10 + if elapsed < min || elapsed > max { + t.Fatalf("Call %d: expected ~%v wait, got %v", callIndex, expected, elapsed) + } + } + if callIndex >= len(expectedDurations) { + return nil // succeed after verifying waits + } + lastCall = now + callIndex++ + return errors.New("simulated failure") + }, PollOptions{ + Tries: len(expectedDurations) + 1, // enough tries to verify all intervals + }) // Delay left at zero + + require.NoError(t, err) } From e29e2df30629054aa9e33588f06108907d9e32ac Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:18:10 +0000 Subject: [PATCH 05/13] feat: add workitemtracking client Add Azure DevOps workitemtracking client support to the azdo client factory and interface. This adds the workitemtracking import, a new WorkItemTracking method to the ClientFactory interface, and the WorkItemTracking implementation in the clientFactory to create a workitemtracking client from a connection. --- internal/azdo/connection.go | 2 ++ internal/azdo/factory.go | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/internal/azdo/connection.go b/internal/azdo/connection.go index 7c251641..a0f11b34 100644 --- a/internal/azdo/connection.go +++ b/internal/azdo/connection.go @@ -15,6 +15,7 @@ import ( "github.com/microsoft/azure-devops-go-api/azuredevops/v7/operations" "github.com/microsoft/azure-devops-go-api/azuredevops/v7/security" "github.com/microsoft/azure-devops-go-api/azuredevops/v7/serviceendpoint" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" "github.com/tmeckel/azdo-cli/internal/azdo/extensions" ) @@ -52,4 +53,5 @@ type ClientFactory interface { ServiceEndpoint(ctx context.Context, organization string) (serviceendpoint.Client, error) Security(ctx context.Context, organization string) (security.Client, error) Extensions(ctx context.Context, organization string) (extensions.Client, error) + WorkItemTracking(ctx context.Context, organization string) (workitemtracking.Client, error) } diff --git a/internal/azdo/factory.go b/internal/azdo/factory.go index 922a93da..07e748d2 100644 --- a/internal/azdo/factory.go +++ b/internal/azdo/factory.go @@ -11,6 +11,7 @@ import ( "github.com/microsoft/azure-devops-go-api/azuredevops/v7/operations" "github.com/microsoft/azure-devops-go-api/azuredevops/v7/security" "github.com/microsoft/azure-devops-go-api/azuredevops/v7/serviceendpoint" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" "github.com/tmeckel/azdo-cli/internal/azdo/extensions" "github.com/tmeckel/azdo-cli/internal/config" ) @@ -115,3 +116,11 @@ func (c *clientFactory) Extensions(ctx context.Context, org string) (extensions. } return extensions.NewClient(ctx, conn.(*connectionAdapter).conn), nil } + +func (c *clientFactory) WorkItemTracking(ctx context.Context, org string) (workitemtracking.Client, error) { + conn, err := c.factory.Connection(org) + if err != nil { + return nil, err + } + return workitemtracking.NewClient(ctx, conn.(*connectionAdapter).conn) +} From 7248746c020f70e8fa405acb81b9b8415b1c782e Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:22:33 +0000 Subject: [PATCH 06/13] feat: add workitemtracking client mock Add generated GoMock for the workitemtracking Client and update the connection factory mock to expose WorkItemTracking. --- internal/mocks/connection_factory_mock.go | 16 + .../mocks/workitemtracking_client_mock.go | 1401 +++++++++++++++++ 2 files changed, 1417 insertions(+) create mode 100644 internal/mocks/workitemtracking_client_mock.go diff --git a/internal/mocks/connection_factory_mock.go b/internal/mocks/connection_factory_mock.go index 78ea7f8e..4501f5d4 100644 --- a/internal/mocks/connection_factory_mock.go +++ b/internal/mocks/connection_factory_mock.go @@ -25,6 +25,7 @@ import ( operations "github.com/microsoft/azure-devops-go-api/azuredevops/v7/operations" security "github.com/microsoft/azure-devops-go-api/azuredevops/v7/security" serviceendpoint "github.com/microsoft/azure-devops-go-api/azuredevops/v7/serviceendpoint" + workitemtracking "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" azdo "github.com/tmeckel/azdo-cli/internal/azdo" extensions "github.com/tmeckel/azdo-cli/internal/azdo/extensions" gomock "go.uber.org/mock/gomock" @@ -433,3 +434,18 @@ func (mr *MockClientFactoryMockRecorder) ServiceEndpoint(ctx, organization any) mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceEndpoint", reflect.TypeOf((*MockClientFactory)(nil).ServiceEndpoint), ctx, organization) } + +// WorkItemTracking mocks base method. +func (m *MockClientFactory) WorkItemTracking(ctx context.Context, organization string) (workitemtracking.Client, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WorkItemTracking", ctx, organization) + ret0, _ := ret[0].(workitemtracking.Client) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WorkItemTracking indicates an expected call of WorkItemTracking. +func (mr *MockClientFactoryMockRecorder) WorkItemTracking(ctx, organization any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkItemTracking", reflect.TypeOf((*MockClientFactory)(nil).WorkItemTracking), ctx, organization) +} diff --git a/internal/mocks/workitemtracking_client_mock.go b/internal/mocks/workitemtracking_client_mock.go new file mode 100644 index 00000000..ffeadd71 --- /dev/null +++ b/internal/mocks/workitemtracking_client_mock.go @@ -0,0 +1,1401 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking (interfaces: Client) +// +// Generated by this command: +// +// mockgen -package=mocks -destination internal/mocks/workitemtracking_client_mock.go -mock_names Client=MockWorkItemTrackingClient github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking Client +// + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + io "io" + reflect "reflect" + + webapi "github.com/microsoft/azure-devops-go-api/azuredevops/v7/webapi" + workitemtracking "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" + gomock "go.uber.org/mock/gomock" +) + +// MockWorkItemTrackingClient is a mock of Client interface. +type MockWorkItemTrackingClient struct { + ctrl *gomock.Controller + recorder *MockWorkItemTrackingClientMockRecorder + isgomock struct{} +} + +// MockWorkItemTrackingClientMockRecorder is the mock recorder for MockWorkItemTrackingClient. +type MockWorkItemTrackingClientMockRecorder struct { + mock *MockWorkItemTrackingClient +} + +// NewMockWorkItemTrackingClient creates a new mock instance. +func NewMockWorkItemTrackingClient(ctrl *gomock.Controller) *MockWorkItemTrackingClient { + mock := &MockWorkItemTrackingClient{ctrl: ctrl} + mock.recorder = &MockWorkItemTrackingClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockWorkItemTrackingClient) EXPECT() *MockWorkItemTrackingClientMockRecorder { + return m.recorder +} + +// AddComment mocks base method. +func (m *MockWorkItemTrackingClient) AddComment(arg0 context.Context, arg1 workitemtracking.AddCommentArgs) (*workitemtracking.Comment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddComment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.Comment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddComment indicates an expected call of AddComment. +func (mr *MockWorkItemTrackingClientMockRecorder) AddComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).AddComment), arg0, arg1) +} + +// AddWorkItemComment mocks base method. +func (m *MockWorkItemTrackingClient) AddWorkItemComment(arg0 context.Context, arg1 workitemtracking.AddWorkItemCommentArgs) (*workitemtracking.Comment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddWorkItemComment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.Comment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddWorkItemComment indicates an expected call of AddWorkItemComment. +func (mr *MockWorkItemTrackingClientMockRecorder) AddWorkItemComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddWorkItemComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).AddWorkItemComment), arg0, arg1) +} + +// CreateAttachment mocks base method. +func (m *MockWorkItemTrackingClient) CreateAttachment(arg0 context.Context, arg1 workitemtracking.CreateAttachmentArgs) (*workitemtracking.AttachmentReference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAttachment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.AttachmentReference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAttachment indicates an expected call of CreateAttachment. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateAttachment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAttachment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateAttachment), arg0, arg1) +} + +// CreateCommentReaction mocks base method. +func (m *MockWorkItemTrackingClient) CreateCommentReaction(arg0 context.Context, arg1 workitemtracking.CreateCommentReactionArgs) (*workitemtracking.CommentReaction, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateCommentReaction", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.CommentReaction) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateCommentReaction indicates an expected call of CreateCommentReaction. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateCommentReaction(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCommentReaction", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateCommentReaction), arg0, arg1) +} + +// CreateOrUpdateClassificationNode mocks base method. +func (m *MockWorkItemTrackingClient) CreateOrUpdateClassificationNode(arg0 context.Context, arg1 workitemtracking.CreateOrUpdateClassificationNodeArgs) (*workitemtracking.WorkItemClassificationNode, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdateClassificationNode", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemClassificationNode) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdateClassificationNode indicates an expected call of CreateOrUpdateClassificationNode. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateOrUpdateClassificationNode(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateClassificationNode", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateOrUpdateClassificationNode), arg0, arg1) +} + +// CreateQuery mocks base method. +func (m *MockWorkItemTrackingClient) CreateQuery(arg0 context.Context, arg1 workitemtracking.CreateQueryArgs) (*workitemtracking.QueryHierarchyItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateQuery", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.QueryHierarchyItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateQuery indicates an expected call of CreateQuery. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateQuery(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateQuery", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateQuery), arg0, arg1) +} + +// CreateTempQuery mocks base method. +func (m *MockWorkItemTrackingClient) CreateTempQuery(arg0 context.Context, arg1 workitemtracking.CreateTempQueryArgs) (*workitemtracking.TemporaryQueryResponseModel, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTempQuery", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.TemporaryQueryResponseModel) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateTempQuery indicates an expected call of CreateTempQuery. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateTempQuery(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTempQuery", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateTempQuery), arg0, arg1) +} + +// CreateTemplate mocks base method. +func (m *MockWorkItemTrackingClient) CreateTemplate(arg0 context.Context, arg1 workitemtracking.CreateTemplateArgs) (*workitemtracking.WorkItemTemplate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateTemplate", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTemplate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateTemplate indicates an expected call of CreateTemplate. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateTemplate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTemplate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateTemplate), arg0, arg1) +} + +// CreateWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) CreateWorkItem(arg0 context.Context, arg1 workitemtracking.CreateWorkItemArgs) (*workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateWorkItem indicates an expected call of CreateWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateWorkItem), arg0, arg1) +} + +// CreateWorkItemField mocks base method. +func (m *MockWorkItemTrackingClient) CreateWorkItemField(arg0 context.Context, arg1 workitemtracking.CreateWorkItemFieldArgs) (*workitemtracking.WorkItemField2, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateWorkItemField", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemField2) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateWorkItemField indicates an expected call of CreateWorkItemField. +func (mr *MockWorkItemTrackingClientMockRecorder) CreateWorkItemField(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateWorkItemField", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).CreateWorkItemField), arg0, arg1) +} + +// DeleteClassificationNode mocks base method. +func (m *MockWorkItemTrackingClient) DeleteClassificationNode(arg0 context.Context, arg1 workitemtracking.DeleteClassificationNodeArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteClassificationNode", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteClassificationNode indicates an expected call of DeleteClassificationNode. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteClassificationNode(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteClassificationNode", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteClassificationNode), arg0, arg1) +} + +// DeleteComment mocks base method. +func (m *MockWorkItemTrackingClient) DeleteComment(arg0 context.Context, arg1 workitemtracking.DeleteCommentArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteComment", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteComment indicates an expected call of DeleteComment. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteComment), arg0, arg1) +} + +// DeleteCommentReaction mocks base method. +func (m *MockWorkItemTrackingClient) DeleteCommentReaction(arg0 context.Context, arg1 workitemtracking.DeleteCommentReactionArgs) (*workitemtracking.CommentReaction, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteCommentReaction", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.CommentReaction) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteCommentReaction indicates an expected call of DeleteCommentReaction. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteCommentReaction(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCommentReaction", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteCommentReaction), arg0, arg1) +} + +// DeleteQuery mocks base method. +func (m *MockWorkItemTrackingClient) DeleteQuery(arg0 context.Context, arg1 workitemtracking.DeleteQueryArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteQuery", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteQuery indicates an expected call of DeleteQuery. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteQuery(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteQuery", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteQuery), arg0, arg1) +} + +// DeleteTag mocks base method. +func (m *MockWorkItemTrackingClient) DeleteTag(arg0 context.Context, arg1 workitemtracking.DeleteTagArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTag", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteTag indicates an expected call of DeleteTag. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteTag(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTag", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteTag), arg0, arg1) +} + +// DeleteTemplate mocks base method. +func (m *MockWorkItemTrackingClient) DeleteTemplate(arg0 context.Context, arg1 workitemtracking.DeleteTemplateArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTemplate", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteTemplate indicates an expected call of DeleteTemplate. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteTemplate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTemplate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteTemplate), arg0, arg1) +} + +// DeleteWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) DeleteWorkItem(arg0 context.Context, arg1 workitemtracking.DeleteWorkItemArgs) (*workitemtracking.WorkItemDelete, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemDelete) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteWorkItem indicates an expected call of DeleteWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteWorkItem), arg0, arg1) +} + +// DeleteWorkItemField mocks base method. +func (m *MockWorkItemTrackingClient) DeleteWorkItemField(arg0 context.Context, arg1 workitemtracking.DeleteWorkItemFieldArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteWorkItemField", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteWorkItemField indicates an expected call of DeleteWorkItemField. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteWorkItemField(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWorkItemField", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteWorkItemField), arg0, arg1) +} + +// DeleteWorkItems mocks base method. +func (m *MockWorkItemTrackingClient) DeleteWorkItems(arg0 context.Context, arg1 workitemtracking.DeleteWorkItemsArgs) (*workitemtracking.WorkItemDeleteBatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteWorkItems", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemDeleteBatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteWorkItems indicates an expected call of DeleteWorkItems. +func (mr *MockWorkItemTrackingClientMockRecorder) DeleteWorkItems(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWorkItems", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DeleteWorkItems), arg0, arg1) +} + +// DestroyWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) DestroyWorkItem(arg0 context.Context, arg1 workitemtracking.DestroyWorkItemArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DestroyWorkItem", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DestroyWorkItem indicates an expected call of DestroyWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) DestroyWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DestroyWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).DestroyWorkItem), arg0, arg1) +} + +// GetAttachmentContent mocks base method. +func (m *MockWorkItemTrackingClient) GetAttachmentContent(arg0 context.Context, arg1 workitemtracking.GetAttachmentContentArgs) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAttachmentContent", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAttachmentContent indicates an expected call of GetAttachmentContent. +func (mr *MockWorkItemTrackingClientMockRecorder) GetAttachmentContent(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttachmentContent", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetAttachmentContent), arg0, arg1) +} + +// GetAttachmentZip mocks base method. +func (m *MockWorkItemTrackingClient) GetAttachmentZip(arg0 context.Context, arg1 workitemtracking.GetAttachmentZipArgs) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAttachmentZip", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAttachmentZip indicates an expected call of GetAttachmentZip. +func (mr *MockWorkItemTrackingClientMockRecorder) GetAttachmentZip(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttachmentZip", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetAttachmentZip), arg0, arg1) +} + +// GetClassificationNode mocks base method. +func (m *MockWorkItemTrackingClient) GetClassificationNode(arg0 context.Context, arg1 workitemtracking.GetClassificationNodeArgs) (*workitemtracking.WorkItemClassificationNode, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClassificationNode", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemClassificationNode) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetClassificationNode indicates an expected call of GetClassificationNode. +func (mr *MockWorkItemTrackingClientMockRecorder) GetClassificationNode(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClassificationNode", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetClassificationNode), arg0, arg1) +} + +// GetClassificationNodes mocks base method. +func (m *MockWorkItemTrackingClient) GetClassificationNodes(arg0 context.Context, arg1 workitemtracking.GetClassificationNodesArgs) (*[]workitemtracking.WorkItemClassificationNode, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClassificationNodes", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemClassificationNode) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetClassificationNodes indicates an expected call of GetClassificationNodes. +func (mr *MockWorkItemTrackingClientMockRecorder) GetClassificationNodes(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClassificationNodes", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetClassificationNodes), arg0, arg1) +} + +// GetComment mocks base method. +func (m *MockWorkItemTrackingClient) GetComment(arg0 context.Context, arg1 workitemtracking.GetCommentArgs) (*workitemtracking.Comment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.Comment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetComment indicates an expected call of GetComment. +func (mr *MockWorkItemTrackingClientMockRecorder) GetComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetComment), arg0, arg1) +} + +// GetCommentReactions mocks base method. +func (m *MockWorkItemTrackingClient) GetCommentReactions(arg0 context.Context, arg1 workitemtracking.GetCommentReactionsArgs) (*[]workitemtracking.CommentReaction, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommentReactions", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.CommentReaction) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCommentReactions indicates an expected call of GetCommentReactions. +func (mr *MockWorkItemTrackingClientMockRecorder) GetCommentReactions(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommentReactions", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetCommentReactions), arg0, arg1) +} + +// GetCommentVersion mocks base method. +func (m *MockWorkItemTrackingClient) GetCommentVersion(arg0 context.Context, arg1 workitemtracking.GetCommentVersionArgs) (*workitemtracking.CommentVersion, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommentVersion", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.CommentVersion) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCommentVersion indicates an expected call of GetCommentVersion. +func (mr *MockWorkItemTrackingClientMockRecorder) GetCommentVersion(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommentVersion", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetCommentVersion), arg0, arg1) +} + +// GetCommentVersions mocks base method. +func (m *MockWorkItemTrackingClient) GetCommentVersions(arg0 context.Context, arg1 workitemtracking.GetCommentVersionsArgs) (*[]workitemtracking.CommentVersion, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommentVersions", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.CommentVersion) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCommentVersions indicates an expected call of GetCommentVersions. +func (mr *MockWorkItemTrackingClientMockRecorder) GetCommentVersions(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommentVersions", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetCommentVersions), arg0, arg1) +} + +// GetComments mocks base method. +func (m *MockWorkItemTrackingClient) GetComments(arg0 context.Context, arg1 workitemtracking.GetCommentsArgs) (*workitemtracking.CommentList, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComments", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.CommentList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetComments indicates an expected call of GetComments. +func (mr *MockWorkItemTrackingClientMockRecorder) GetComments(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComments", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetComments), arg0, arg1) +} + +// GetCommentsBatch mocks base method. +func (m *MockWorkItemTrackingClient) GetCommentsBatch(arg0 context.Context, arg1 workitemtracking.GetCommentsBatchArgs) (*workitemtracking.CommentList, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommentsBatch", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.CommentList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCommentsBatch indicates an expected call of GetCommentsBatch. +func (mr *MockWorkItemTrackingClientMockRecorder) GetCommentsBatch(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommentsBatch", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetCommentsBatch), arg0, arg1) +} + +// GetDeletedWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) GetDeletedWorkItem(arg0 context.Context, arg1 workitemtracking.GetDeletedWorkItemArgs) (*workitemtracking.WorkItemDelete, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDeletedWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemDelete) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDeletedWorkItem indicates an expected call of GetDeletedWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) GetDeletedWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeletedWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetDeletedWorkItem), arg0, arg1) +} + +// GetDeletedWorkItemShallowReferences mocks base method. +func (m *MockWorkItemTrackingClient) GetDeletedWorkItemShallowReferences(arg0 context.Context, arg1 workitemtracking.GetDeletedWorkItemShallowReferencesArgs) (*[]workitemtracking.WorkItemDeleteShallowReference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDeletedWorkItemShallowReferences", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemDeleteShallowReference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDeletedWorkItemShallowReferences indicates an expected call of GetDeletedWorkItemShallowReferences. +func (mr *MockWorkItemTrackingClientMockRecorder) GetDeletedWorkItemShallowReferences(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeletedWorkItemShallowReferences", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetDeletedWorkItemShallowReferences), arg0, arg1) +} + +// GetDeletedWorkItems mocks base method. +func (m *MockWorkItemTrackingClient) GetDeletedWorkItems(arg0 context.Context, arg1 workitemtracking.GetDeletedWorkItemsArgs) (*[]workitemtracking.WorkItemDeleteReference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDeletedWorkItems", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemDeleteReference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetDeletedWorkItems indicates an expected call of GetDeletedWorkItems. +func (mr *MockWorkItemTrackingClientMockRecorder) GetDeletedWorkItems(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeletedWorkItems", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetDeletedWorkItems), arg0, arg1) +} + +// GetEngagedUsers mocks base method. +func (m *MockWorkItemTrackingClient) GetEngagedUsers(arg0 context.Context, arg1 workitemtracking.GetEngagedUsersArgs) (*[]webapi.IdentityRef, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetEngagedUsers", arg0, arg1) + ret0, _ := ret[0].(*[]webapi.IdentityRef) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetEngagedUsers indicates an expected call of GetEngagedUsers. +func (mr *MockWorkItemTrackingClientMockRecorder) GetEngagedUsers(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEngagedUsers", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetEngagedUsers), arg0, arg1) +} + +// GetGithubConnectionRepositories mocks base method. +func (m *MockWorkItemTrackingClient) GetGithubConnectionRepositories(arg0 context.Context, arg1 workitemtracking.GetGithubConnectionRepositoriesArgs) (*[]workitemtracking.GitHubConnectionRepoModel, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGithubConnectionRepositories", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.GitHubConnectionRepoModel) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGithubConnectionRepositories indicates an expected call of GetGithubConnectionRepositories. +func (mr *MockWorkItemTrackingClientMockRecorder) GetGithubConnectionRepositories(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGithubConnectionRepositories", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetGithubConnectionRepositories), arg0, arg1) +} + +// GetGithubConnections mocks base method. +func (m *MockWorkItemTrackingClient) GetGithubConnections(arg0 context.Context, arg1 workitemtracking.GetGithubConnectionsArgs) (*[]workitemtracking.GitHubConnectionModel, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGithubConnections", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.GitHubConnectionModel) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGithubConnections indicates an expected call of GetGithubConnections. +func (mr *MockWorkItemTrackingClientMockRecorder) GetGithubConnections(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGithubConnections", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetGithubConnections), arg0, arg1) +} + +// GetQueries mocks base method. +func (m *MockWorkItemTrackingClient) GetQueries(arg0 context.Context, arg1 workitemtracking.GetQueriesArgs) (*[]workitemtracking.QueryHierarchyItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetQueries", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.QueryHierarchyItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetQueries indicates an expected call of GetQueries. +func (mr *MockWorkItemTrackingClientMockRecorder) GetQueries(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueries", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetQueries), arg0, arg1) +} + +// GetQueriesBatch mocks base method. +func (m *MockWorkItemTrackingClient) GetQueriesBatch(arg0 context.Context, arg1 workitemtracking.GetQueriesBatchArgs) (*[]workitemtracking.QueryHierarchyItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetQueriesBatch", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.QueryHierarchyItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetQueriesBatch indicates an expected call of GetQueriesBatch. +func (mr *MockWorkItemTrackingClientMockRecorder) GetQueriesBatch(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueriesBatch", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetQueriesBatch), arg0, arg1) +} + +// GetQuery mocks base method. +func (m *MockWorkItemTrackingClient) GetQuery(arg0 context.Context, arg1 workitemtracking.GetQueryArgs) (*workitemtracking.QueryHierarchyItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetQuery", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.QueryHierarchyItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetQuery indicates an expected call of GetQuery. +func (mr *MockWorkItemTrackingClientMockRecorder) GetQuery(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuery", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetQuery), arg0, arg1) +} + +// GetQueryResultCount mocks base method. +func (m *MockWorkItemTrackingClient) GetQueryResultCount(arg0 context.Context, arg1 workitemtracking.GetQueryResultCountArgs) (*int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetQueryResultCount", arg0, arg1) + ret0, _ := ret[0].(*int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetQueryResultCount indicates an expected call of GetQueryResultCount. +func (mr *MockWorkItemTrackingClientMockRecorder) GetQueryResultCount(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryResultCount", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetQueryResultCount), arg0, arg1) +} + +// GetRecentActivityData mocks base method. +func (m *MockWorkItemTrackingClient) GetRecentActivityData(arg0 context.Context, arg1 workitemtracking.GetRecentActivityDataArgs) (*[]workitemtracking.AccountRecentActivityWorkItemModel2, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRecentActivityData", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.AccountRecentActivityWorkItemModel2) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRecentActivityData indicates an expected call of GetRecentActivityData. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRecentActivityData(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRecentActivityData", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRecentActivityData), arg0, arg1) +} + +// GetRelationType mocks base method. +func (m *MockWorkItemTrackingClient) GetRelationType(arg0 context.Context, arg1 workitemtracking.GetRelationTypeArgs) (*workitemtracking.WorkItemRelationType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRelationType", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemRelationType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRelationType indicates an expected call of GetRelationType. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRelationType(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRelationType", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRelationType), arg0, arg1) +} + +// GetRelationTypes mocks base method. +func (m *MockWorkItemTrackingClient) GetRelationTypes(arg0 context.Context, arg1 workitemtracking.GetRelationTypesArgs) (*[]workitemtracking.WorkItemRelationType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRelationTypes", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemRelationType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRelationTypes indicates an expected call of GetRelationTypes. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRelationTypes(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRelationTypes", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRelationTypes), arg0, arg1) +} + +// GetReportingLinksByLinkType mocks base method. +func (m *MockWorkItemTrackingClient) GetReportingLinksByLinkType(arg0 context.Context, arg1 workitemtracking.GetReportingLinksByLinkTypeArgs) (*workitemtracking.ReportingWorkItemLinksBatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReportingLinksByLinkType", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ReportingWorkItemLinksBatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReportingLinksByLinkType indicates an expected call of GetReportingLinksByLinkType. +func (mr *MockWorkItemTrackingClientMockRecorder) GetReportingLinksByLinkType(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReportingLinksByLinkType", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetReportingLinksByLinkType), arg0, arg1) +} + +// GetRevision mocks base method. +func (m *MockWorkItemTrackingClient) GetRevision(arg0 context.Context, arg1 workitemtracking.GetRevisionArgs) (*workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRevision", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRevision indicates an expected call of GetRevision. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRevision(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRevision", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRevision), arg0, arg1) +} + +// GetRevisions mocks base method. +func (m *MockWorkItemTrackingClient) GetRevisions(arg0 context.Context, arg1 workitemtracking.GetRevisionsArgs) (*[]workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRevisions", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRevisions indicates an expected call of GetRevisions. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRevisions(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRevisions", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRevisions), arg0, arg1) +} + +// GetRootNodes mocks base method. +func (m *MockWorkItemTrackingClient) GetRootNodes(arg0 context.Context, arg1 workitemtracking.GetRootNodesArgs) (*[]workitemtracking.WorkItemClassificationNode, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRootNodes", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemClassificationNode) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRootNodes indicates an expected call of GetRootNodes. +func (mr *MockWorkItemTrackingClientMockRecorder) GetRootNodes(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRootNodes", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetRootNodes), arg0, arg1) +} + +// GetTag mocks base method. +func (m *MockWorkItemTrackingClient) GetTag(arg0 context.Context, arg1 workitemtracking.GetTagArgs) (*workitemtracking.WorkItemTagDefinition, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTag", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTagDefinition) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTag indicates an expected call of GetTag. +func (mr *MockWorkItemTrackingClientMockRecorder) GetTag(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTag", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetTag), arg0, arg1) +} + +// GetTags mocks base method. +func (m *MockWorkItemTrackingClient) GetTags(arg0 context.Context, arg1 workitemtracking.GetTagsArgs) (*[]workitemtracking.WorkItemTagDefinition, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTags", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemTagDefinition) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTags indicates an expected call of GetTags. +func (mr *MockWorkItemTrackingClientMockRecorder) GetTags(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTags", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetTags), arg0, arg1) +} + +// GetTemplate mocks base method. +func (m *MockWorkItemTrackingClient) GetTemplate(arg0 context.Context, arg1 workitemtracking.GetTemplateArgs) (*workitemtracking.WorkItemTemplate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplate", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTemplate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplate indicates an expected call of GetTemplate. +func (mr *MockWorkItemTrackingClientMockRecorder) GetTemplate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetTemplate), arg0, arg1) +} + +// GetTemplates mocks base method. +func (m *MockWorkItemTrackingClient) GetTemplates(arg0 context.Context, arg1 workitemtracking.GetTemplatesArgs) (*[]workitemtracking.WorkItemTemplateReference, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplates", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemTemplateReference) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplates indicates an expected call of GetTemplates. +func (mr *MockWorkItemTrackingClientMockRecorder) GetTemplates(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplates", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetTemplates), arg0, arg1) +} + +// GetUpdate mocks base method. +func (m *MockWorkItemTrackingClient) GetUpdate(arg0 context.Context, arg1 workitemtracking.GetUpdateArgs) (*workitemtracking.WorkItemUpdate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUpdate", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemUpdate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUpdate indicates an expected call of GetUpdate. +func (mr *MockWorkItemTrackingClientMockRecorder) GetUpdate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpdate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetUpdate), arg0, arg1) +} + +// GetUpdates mocks base method. +func (m *MockWorkItemTrackingClient) GetUpdates(arg0 context.Context, arg1 workitemtracking.GetUpdatesArgs) (*[]workitemtracking.WorkItemUpdate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUpdates", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemUpdate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUpdates indicates an expected call of GetUpdates. +func (mr *MockWorkItemTrackingClientMockRecorder) GetUpdates(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpdates", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetUpdates), arg0, arg1) +} + +// GetWorkArtifactLinkTypes mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkArtifactLinkTypes(arg0 context.Context, arg1 workitemtracking.GetWorkArtifactLinkTypesArgs) (*[]workitemtracking.WorkArtifactLink, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkArtifactLinkTypes", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkArtifactLink) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkArtifactLinkTypes indicates an expected call of GetWorkArtifactLinkTypes. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkArtifactLinkTypes(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkArtifactLinkTypes", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkArtifactLinkTypes), arg0, arg1) +} + +// GetWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItem(arg0 context.Context, arg1 workitemtracking.GetWorkItemArgs) (*workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItem indicates an expected call of GetWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItem), arg0, arg1) +} + +// GetWorkItemField mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemField(arg0 context.Context, arg1 workitemtracking.GetWorkItemFieldArgs) (*workitemtracking.WorkItemField2, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemField", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemField2) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemField indicates an expected call of GetWorkItemField. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemField(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemField", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemField), arg0, arg1) +} + +// GetWorkItemFields mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemFields(arg0 context.Context, arg1 workitemtracking.GetWorkItemFieldsArgs) (*[]workitemtracking.WorkItemField2, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemFields", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemField2) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemFields indicates an expected call of GetWorkItemFields. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemFields(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemFields", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemFields), arg0, arg1) +} + +// GetWorkItemIconJson mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemIconJson(arg0 context.Context, arg1 workitemtracking.GetWorkItemIconJsonArgs) (*workitemtracking.WorkItemIcon, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemIconJson", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemIcon) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemIconJson indicates an expected call of GetWorkItemIconJson. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemIconJson(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemIconJson", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemIconJson), arg0, arg1) +} + +// GetWorkItemIconSvg mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemIconSvg(arg0 context.Context, arg1 workitemtracking.GetWorkItemIconSvgArgs) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemIconSvg", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemIconSvg indicates an expected call of GetWorkItemIconSvg. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemIconSvg(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemIconSvg", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemIconSvg), arg0, arg1) +} + +// GetWorkItemIconXaml mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemIconXaml(arg0 context.Context, arg1 workitemtracking.GetWorkItemIconXamlArgs) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemIconXaml", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemIconXaml indicates an expected call of GetWorkItemIconXaml. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemIconXaml(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemIconXaml", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemIconXaml), arg0, arg1) +} + +// GetWorkItemIcons mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemIcons(arg0 context.Context, arg1 workitemtracking.GetWorkItemIconsArgs) (*[]workitemtracking.WorkItemIcon, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemIcons", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemIcon) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemIcons indicates an expected call of GetWorkItemIcons. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemIcons(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemIcons", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemIcons), arg0, arg1) +} + +// GetWorkItemNextStatesOnCheckinAction mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemNextStatesOnCheckinAction(arg0 context.Context, arg1 workitemtracking.GetWorkItemNextStatesOnCheckinActionArgs) (*[]workitemtracking.WorkItemNextStateOnTransition, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemNextStatesOnCheckinAction", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemNextStateOnTransition) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemNextStatesOnCheckinAction indicates an expected call of GetWorkItemNextStatesOnCheckinAction. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemNextStatesOnCheckinAction(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemNextStatesOnCheckinAction", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemNextStatesOnCheckinAction), arg0, arg1) +} + +// GetWorkItemTemplate mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTemplate(arg0 context.Context, arg1 workitemtracking.GetWorkItemTemplateArgs) (*workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTemplate", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTemplate indicates an expected call of GetWorkItemTemplate. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTemplate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTemplate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTemplate), arg0, arg1) +} + +// GetWorkItemType mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemType(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeArgs) (*workitemtracking.WorkItemType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemType", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemType indicates an expected call of GetWorkItemType. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemType(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemType", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemType), arg0, arg1) +} + +// GetWorkItemTypeCategories mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypeCategories(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeCategoriesArgs) (*[]workitemtracking.WorkItemTypeCategory, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypeCategories", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemTypeCategory) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypeCategories indicates an expected call of GetWorkItemTypeCategories. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypeCategories(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypeCategories", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypeCategories), arg0, arg1) +} + +// GetWorkItemTypeCategory mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypeCategory(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeCategoryArgs) (*workitemtracking.WorkItemTypeCategory, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypeCategory", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTypeCategory) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypeCategory indicates an expected call of GetWorkItemTypeCategory. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypeCategory(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypeCategory", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypeCategory), arg0, arg1) +} + +// GetWorkItemTypeFieldWithReferences mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypeFieldWithReferences(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeFieldWithReferencesArgs) (*workitemtracking.WorkItemTypeFieldWithReferences, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypeFieldWithReferences", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTypeFieldWithReferences) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypeFieldWithReferences indicates an expected call of GetWorkItemTypeFieldWithReferences. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypeFieldWithReferences(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypeFieldWithReferences", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypeFieldWithReferences), arg0, arg1) +} + +// GetWorkItemTypeFieldsWithReferences mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypeFieldsWithReferences(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeFieldsWithReferencesArgs) (*[]workitemtracking.WorkItemTypeFieldWithReferences, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypeFieldsWithReferences", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemTypeFieldWithReferences) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypeFieldsWithReferences indicates an expected call of GetWorkItemTypeFieldsWithReferences. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypeFieldsWithReferences(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypeFieldsWithReferences", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypeFieldsWithReferences), arg0, arg1) +} + +// GetWorkItemTypeStates mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypeStates(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypeStatesArgs) (*[]workitemtracking.WorkItemStateColor, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypeStates", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemStateColor) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypeStates indicates an expected call of GetWorkItemTypeStates. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypeStates(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypeStates", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypeStates), arg0, arg1) +} + +// GetWorkItemTypes mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemTypes(arg0 context.Context, arg1 workitemtracking.GetWorkItemTypesArgs) (*[]workitemtracking.WorkItemType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemTypes", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItemType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemTypes indicates an expected call of GetWorkItemTypes. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemTypes(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemTypes", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemTypes), arg0, arg1) +} + +// GetWorkItems mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItems(arg0 context.Context, arg1 workitemtracking.GetWorkItemsArgs) (*[]workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItems", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItems indicates an expected call of GetWorkItems. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItems(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItems", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItems), arg0, arg1) +} + +// GetWorkItemsBatch mocks base method. +func (m *MockWorkItemTrackingClient) GetWorkItemsBatch(arg0 context.Context, arg1 workitemtracking.GetWorkItemsBatchArgs) (*[]workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkItemsBatch", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkItemsBatch indicates an expected call of GetWorkItemsBatch. +func (mr *MockWorkItemTrackingClientMockRecorder) GetWorkItemsBatch(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkItemsBatch", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).GetWorkItemsBatch), arg0, arg1) +} + +// MigrateProjectsProcess mocks base method. +func (m *MockWorkItemTrackingClient) MigrateProjectsProcess(arg0 context.Context, arg1 workitemtracking.MigrateProjectsProcessArgs) (*workitemtracking.ProcessMigrationResultModel, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MigrateProjectsProcess", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ProcessMigrationResultModel) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// MigrateProjectsProcess indicates an expected call of MigrateProjectsProcess. +func (mr *MockWorkItemTrackingClientMockRecorder) MigrateProjectsProcess(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MigrateProjectsProcess", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).MigrateProjectsProcess), arg0, arg1) +} + +// QueryById mocks base method. +func (m *MockWorkItemTrackingClient) QueryById(arg0 context.Context, arg1 workitemtracking.QueryByIdArgs) (*workitemtracking.WorkItemQueryResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "QueryById", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemQueryResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// QueryById indicates an expected call of QueryById. +func (mr *MockWorkItemTrackingClientMockRecorder) QueryById(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryById", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).QueryById), arg0, arg1) +} + +// QueryByWiql mocks base method. +func (m *MockWorkItemTrackingClient) QueryByWiql(arg0 context.Context, arg1 workitemtracking.QueryByWiqlArgs) (*workitemtracking.WorkItemQueryResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "QueryByWiql", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemQueryResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// QueryByWiql indicates an expected call of QueryByWiql. +func (mr *MockWorkItemTrackingClientMockRecorder) QueryByWiql(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryByWiql", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).QueryByWiql), arg0, arg1) +} + +// QueryWorkItemsForArtifactUris mocks base method. +func (m *MockWorkItemTrackingClient) QueryWorkItemsForArtifactUris(arg0 context.Context, arg1 workitemtracking.QueryWorkItemsForArtifactUrisArgs) (*workitemtracking.ArtifactUriQueryResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "QueryWorkItemsForArtifactUris", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ArtifactUriQueryResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// QueryWorkItemsForArtifactUris indicates an expected call of QueryWorkItemsForArtifactUris. +func (mr *MockWorkItemTrackingClientMockRecorder) QueryWorkItemsForArtifactUris(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryWorkItemsForArtifactUris", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).QueryWorkItemsForArtifactUris), arg0, arg1) +} + +// ReadReportingDiscussions mocks base method. +func (m *MockWorkItemTrackingClient) ReadReportingDiscussions(arg0 context.Context, arg1 workitemtracking.ReadReportingDiscussionsArgs) (*workitemtracking.ReportingWorkItemRevisionsBatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadReportingDiscussions", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ReportingWorkItemRevisionsBatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReadReportingDiscussions indicates an expected call of ReadReportingDiscussions. +func (mr *MockWorkItemTrackingClientMockRecorder) ReadReportingDiscussions(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadReportingDiscussions", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).ReadReportingDiscussions), arg0, arg1) +} + +// ReadReportingRevisionsGet mocks base method. +func (m *MockWorkItemTrackingClient) ReadReportingRevisionsGet(arg0 context.Context, arg1 workitemtracking.ReadReportingRevisionsGetArgs) (*workitemtracking.ReportingWorkItemRevisionsBatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadReportingRevisionsGet", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ReportingWorkItemRevisionsBatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReadReportingRevisionsGet indicates an expected call of ReadReportingRevisionsGet. +func (mr *MockWorkItemTrackingClientMockRecorder) ReadReportingRevisionsGet(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadReportingRevisionsGet", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).ReadReportingRevisionsGet), arg0, arg1) +} + +// ReadReportingRevisionsPost mocks base method. +func (m *MockWorkItemTrackingClient) ReadReportingRevisionsPost(arg0 context.Context, arg1 workitemtracking.ReadReportingRevisionsPostArgs) (*workitemtracking.ReportingWorkItemRevisionsBatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadReportingRevisionsPost", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.ReportingWorkItemRevisionsBatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReadReportingRevisionsPost indicates an expected call of ReadReportingRevisionsPost. +func (mr *MockWorkItemTrackingClientMockRecorder) ReadReportingRevisionsPost(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadReportingRevisionsPost", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).ReadReportingRevisionsPost), arg0, arg1) +} + +// ReplaceTemplate mocks base method. +func (m *MockWorkItemTrackingClient) ReplaceTemplate(arg0 context.Context, arg1 workitemtracking.ReplaceTemplateArgs) (*workitemtracking.WorkItemTemplate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReplaceTemplate", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTemplate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReplaceTemplate indicates an expected call of ReplaceTemplate. +func (mr *MockWorkItemTrackingClientMockRecorder) ReplaceTemplate(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplaceTemplate", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).ReplaceTemplate), arg0, arg1) +} + +// RestoreWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) RestoreWorkItem(arg0 context.Context, arg1 workitemtracking.RestoreWorkItemArgs) (*workitemtracking.WorkItemDelete, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RestoreWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemDelete) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RestoreWorkItem indicates an expected call of RestoreWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) RestoreWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RestoreWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).RestoreWorkItem), arg0, arg1) +} + +// SearchQueries mocks base method. +func (m *MockWorkItemTrackingClient) SearchQueries(arg0 context.Context, arg1 workitemtracking.SearchQueriesArgs) (*workitemtracking.QueryHierarchyItemsResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SearchQueries", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.QueryHierarchyItemsResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SearchQueries indicates an expected call of SearchQueries. +func (mr *MockWorkItemTrackingClientMockRecorder) SearchQueries(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchQueries", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).SearchQueries), arg0, arg1) +} + +// SendMail mocks base method. +func (m *MockWorkItemTrackingClient) SendMail(arg0 context.Context, arg1 workitemtracking.SendMailArgs) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMail", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMail indicates an expected call of SendMail. +func (mr *MockWorkItemTrackingClientMockRecorder) SendMail(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMail", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).SendMail), arg0, arg1) +} + +// UpdateClassificationNode mocks base method. +func (m *MockWorkItemTrackingClient) UpdateClassificationNode(arg0 context.Context, arg1 workitemtracking.UpdateClassificationNodeArgs) (*workitemtracking.WorkItemClassificationNode, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateClassificationNode", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemClassificationNode) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateClassificationNode indicates an expected call of UpdateClassificationNode. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateClassificationNode(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateClassificationNode", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateClassificationNode), arg0, arg1) +} + +// UpdateComment mocks base method. +func (m *MockWorkItemTrackingClient) UpdateComment(arg0 context.Context, arg1 workitemtracking.UpdateCommentArgs) (*workitemtracking.Comment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateComment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.Comment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateComment indicates an expected call of UpdateComment. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateComment), arg0, arg1) +} + +// UpdateGithubConnectionRepos mocks base method. +func (m *MockWorkItemTrackingClient) UpdateGithubConnectionRepos(arg0 context.Context, arg1 workitemtracking.UpdateGithubConnectionReposArgs) (*[]workitemtracking.GitHubConnectionRepoModel, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateGithubConnectionRepos", arg0, arg1) + ret0, _ := ret[0].(*[]workitemtracking.GitHubConnectionRepoModel) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateGithubConnectionRepos indicates an expected call of UpdateGithubConnectionRepos. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateGithubConnectionRepos(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGithubConnectionRepos", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateGithubConnectionRepos), arg0, arg1) +} + +// UpdateQuery mocks base method. +func (m *MockWorkItemTrackingClient) UpdateQuery(arg0 context.Context, arg1 workitemtracking.UpdateQueryArgs) (*workitemtracking.QueryHierarchyItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateQuery", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.QueryHierarchyItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateQuery indicates an expected call of UpdateQuery. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateQuery(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateQuery", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateQuery), arg0, arg1) +} + +// UpdateTag mocks base method. +func (m *MockWorkItemTrackingClient) UpdateTag(arg0 context.Context, arg1 workitemtracking.UpdateTagArgs) (*workitemtracking.WorkItemTagDefinition, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateTag", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemTagDefinition) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateTag indicates an expected call of UpdateTag. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateTag(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTag", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateTag), arg0, arg1) +} + +// UpdateWorkItem mocks base method. +func (m *MockWorkItemTrackingClient) UpdateWorkItem(arg0 context.Context, arg1 workitemtracking.UpdateWorkItemArgs) (*workitemtracking.WorkItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkItem", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateWorkItem indicates an expected call of UpdateWorkItem. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateWorkItem(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkItem", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateWorkItem), arg0, arg1) +} + +// UpdateWorkItemComment mocks base method. +func (m *MockWorkItemTrackingClient) UpdateWorkItemComment(arg0 context.Context, arg1 workitemtracking.UpdateWorkItemCommentArgs) (*workitemtracking.Comment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkItemComment", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.Comment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateWorkItemComment indicates an expected call of UpdateWorkItemComment. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateWorkItemComment(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkItemComment", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateWorkItemComment), arg0, arg1) +} + +// UpdateWorkItemField mocks base method. +func (m *MockWorkItemTrackingClient) UpdateWorkItemField(arg0 context.Context, arg1 workitemtracking.UpdateWorkItemFieldArgs) (*workitemtracking.WorkItemField2, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkItemField", arg0, arg1) + ret0, _ := ret[0].(*workitemtracking.WorkItemField2) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateWorkItemField indicates an expected call of UpdateWorkItemField. +func (mr *MockWorkItemTrackingClientMockRecorder) UpdateWorkItemField(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkItemField", reflect.TypeOf((*MockWorkItemTrackingClient)(nil).UpdateWorkItemField), arg0, arg1) +} From 96248b60b4e7fe002b3f89d9516161b043541f47 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:22:59 +0000 Subject: [PATCH 07/13] fix: handle AppendObject error in MarshalLogArray Return any error from enc.AppendObject while encoding RemoteSet. Previously errors were ignored which could mask encoding failures; propagate the error so callers can handle logging failures appropriately. --- internal/azdo/remote.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/azdo/remote.go b/internal/azdo/remote.go index afce7cf8..8797f0b4 100644 --- a/internal/azdo/remote.go +++ b/internal/azdo/remote.go @@ -29,7 +29,10 @@ func (r RemoteSet) FindByName(names ...string) (*Remote, error) { func (rs RemoteSet) MarshalLogArray(enc zapcore.ArrayEncoder) error { for _, remote := range rs { - enc.AppendObject(remote) + err := enc.AppendObject(remote) + if err != nil { + return err + } } return nil } From 9ddb60507ee4d244e9806f47db78e43d12272500 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:23:23 +0000 Subject: [PATCH 08/13] fix: handle AppendObject error in MarshalLogArray Return any error from zapcore.ArrayEncoder.AppendObject instead of ignoring it. This prevents silently dropped encoding errors when marshaling remote entries and ensures callers receive the failure for proper handling. --- internal/git/objects.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/git/objects.go b/internal/git/objects.go index 2b81c09f..229e14c8 100644 --- a/internal/git/objects.go +++ b/internal/git/objects.go @@ -19,7 +19,10 @@ func (r RemoteSet) Less(i, j int) bool { func (r RemoteSet) MarshalLogArray(enc zapcore.ArrayEncoder) error { for _, remote := range r { - enc.AppendObject(remote) + err := enc.AppendObject(remote) + if err != nil { + return err + } } return nil } From 1f2af6a86184cfda6b5fcdfcb2175e5859800e4c Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:24:02 +0000 Subject: [PATCH 09/13] feat: add project scope parser Add ParseProjectScope to parse arguments in the form [ORGANIZATION/]PROJECT. When organization is omitted the default organization from the user's configuration is used. The parser trims whitespace, validates non-empty segments, and returns clear errors for invalid input. This centralizes project scope parsing for command usage. --- internal/cmd/util/scope.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/internal/cmd/util/scope.go b/internal/cmd/util/scope.go index 100af33d..c98af5d5 100644 --- a/internal/cmd/util/scope.go +++ b/internal/cmd/util/scope.go @@ -59,6 +59,41 @@ func ParseScope(ctx CmdContext, scope string) (*Scope, error) { return result, nil } +// ParseProjectScope parses arguments in the form [ORGANIZATION/]PROJECT. When the organization +// segment is omitted the default organization from the user's configuration is used. The function +// trims whitespace around individual segments and ensures the resulting values are non-empty. +func ParseProjectScope(ctx CmdContext, arg string) (*Scope, error) { + result := &Scope{} + parts := strings.Split(strings.TrimSpace(arg), "/") + switch len(parts) { + case 1: + result.Project = strings.TrimSpace(parts[0]) + if result.Project == "" { + return nil, fmt.Errorf("project argument cannot be empty") + } + cfg, err := ctx.Config() + if err != nil { + return nil, fmt.Errorf("failed to read configuration: %w", err) + } + org, err := cfg.Authentication().GetDefaultOrganization() + org = strings.TrimSpace(org) + if err != nil || org == "" { + return nil, fmt.Errorf("no organization specified and no default organization configured") + } + result.Organization = org + return result, nil + case 2: + result.Organization = strings.TrimSpace(parts[0]) + result.Project = strings.TrimSpace(parts[1]) + if result.Organization == "" || result.Project == "" { + return nil, fmt.Errorf("invalid project argument %q; expected format ORGANIZATION/PROJECT", arg) + } + return result, nil + default: + return nil, fmt.Errorf("invalid project argument %q; expected format ORGANIZATION/PROJECT", arg) + } +} + // ResolveScopeDescriptor fetches the descriptor representing the project scope when a project is supplied. // It returns the descriptor value along with the project ID string to support callers that need to distinguish // between identically named groups scoped to different projects. From f6f4f1f5f90b666f64b4bd71fbb9d082d8b37343 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:26:28 +0000 Subject: [PATCH 10/13] refactor: use util.ParseProjectScope and simplify progress --- internal/cmd/boards/area/project/list/list.go | 58 ++++--------------- 1 file changed, 11 insertions(+), 47 deletions(-) diff --git a/internal/cmd/boards/area/project/list/list.go b/internal/cmd/boards/area/project/list/list.go index 6942cd94..8ef5b164 100644 --- a/internal/cmd/boards/area/project/list/list.go +++ b/internal/cmd/boards/area/project/list/list.go @@ -94,16 +94,11 @@ func runList(ctx util.CmdContext, opts *listOptions) error { } ios.StartProgressIndicator() - progressStopped := false - defer func() { - if !progressStopped { - ios.StopProgressIndicator() - } - }() + defer ios.StopProgressIndicator() - org, project, err := resolveProjectScope(ctx, opts.scopeArg) + scope, err := util.ParseProjectScope(ctx, opts.scopeArg) if err != nil { - return err + return util.FlagErrorWrap(err) } cfg, err := ctx.Config() @@ -111,17 +106,17 @@ func runList(ctx util.CmdContext, opts *listOptions) error { return fmt.Errorf("failed to load configuration: %w", err) } - orgURL, err := cfg.Authentication().GetURL(org) + orgURL, err := cfg.Authentication().GetURL(scope.Organization) if err != nil { return fmt.Errorf("failed to resolve organization URL: %w", err) } - conn, err := ctx.ConnectionFactory().Connection(org) + conn, err := ctx.ConnectionFactory().Connection(scope.Organization) if err != nil { return fmt.Errorf("failed to create connection: %w", err) } - endpoint, err := buildAreaEndpoint(strings.TrimRight(orgURL, "/"), project, opts.path) + endpoint, err := buildAreaEndpoint(strings.TrimRight(orgURL, "/"), scope.Project, opts.path) if err != nil { return err } @@ -143,8 +138,8 @@ func runList(ctx util.CmdContext, opts *listOptions) error { } zap.L().Debug("listing project area paths", - zap.String("organization", org), - zap.String("project", project), + zap.String("organization", scope.Organization), + zap.String("project", scope.Project), zap.String("path", strings.TrimSpace(opts.path)), zap.Int("depth", opts.depth), zap.String("endpoint", reqURL.String()), @@ -174,18 +169,14 @@ func runList(ctx util.CmdContext, opts *listOptions) error { if opts.exporter != nil { ios.StopProgressIndicator() - progressStopped = true return opts.exporter.Write(ios, nodes) } - tp, err := ctx.Printer("list") + tp, err := ctx.Printer("table") if err != nil { return err } - ios.StopProgressIndicator() - progressStopped = true - tp.AddColumns("Name", "Path", "HasChildren") for _, n := range nodes { tp.AddField(n.Name) @@ -198,36 +189,9 @@ func runList(ctx util.CmdContext, opts *listOptions) error { tp.EndRow() } - return tp.Render() -} + ios.StopProgressIndicator() -func resolveProjectScope(ctx util.CmdContext, arg string) (string, string, error) { - parts := strings.Split(strings.TrimSpace(arg), "/") - switch len(parts) { - case 1: - project := strings.TrimSpace(parts[0]) - if project == "" { - return "", "", util.FlagErrorf("project argument cannot be empty") - } - cfg, err := ctx.Config() - if err != nil { - return "", "", fmt.Errorf("failed to read configuration: %w", err) - } - org, err := cfg.Authentication().GetDefaultOrganization() - if err != nil || strings.TrimSpace(org) == "" { - return "", "", util.FlagErrorf("no organization specified and no default organization configured") - } - return strings.TrimSpace(org), project, nil - case 2: - org := strings.TrimSpace(parts[0]) - project := strings.TrimSpace(parts[1]) - if org == "" || project == "" { - return "", "", util.FlagErrorf("invalid project argument %q; expected format ORGANIZATION/PROJECT", arg) - } - return org, project, nil - default: - return "", "", util.FlagErrorf("invalid project argument %q; expected format ORGANIZATION/PROJECT", arg) - } + return tp.Render() } func buildAreaEndpoint(baseURL, project, path string) (string, error) { From 0dfe333b446a0913ce4fe2bb2c8a87684e261aa0 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:35:22 +0000 Subject: [PATCH 11/13] feat: add iteration project list command Add a new 'boards iteration' command group with a 'project' subgroup and a 'list' command to enumerate iteration/classification nodes for a project. --- internal/cmd/boards/boards.go | 2 + internal/cmd/boards/iteration/iteration.go | 29 ++ .../cmd/boards/iteration/project/list/list.go | 460 ++++++++++++++++++ .../iteration/project/list/list_test.go | 284 +++++++++++ .../cmd/boards/iteration/project/project.go | 28 ++ 5 files changed, 803 insertions(+) create mode 100644 internal/cmd/boards/iteration/iteration.go create mode 100644 internal/cmd/boards/iteration/project/list/list.go create mode 100644 internal/cmd/boards/iteration/project/list/list_test.go create mode 100644 internal/cmd/boards/iteration/project/project.go diff --git a/internal/cmd/boards/boards.go b/internal/cmd/boards/boards.go index 2a132bbe..9e5a45af 100644 --- a/internal/cmd/boards/boards.go +++ b/internal/cmd/boards/boards.go @@ -4,6 +4,7 @@ import ( "github.com/MakeNowJust/heredoc" "github.com/spf13/cobra" "github.com/tmeckel/azdo-cli/internal/cmd/boards/area" + "github.com/tmeckel/azdo-cli/internal/cmd/boards/iteration" "github.com/tmeckel/azdo-cli/internal/cmd/util" ) @@ -23,6 +24,7 @@ func NewCmd(ctx util.CmdContext) *cobra.Command { } cmd.AddCommand(area.NewCmd(ctx)) + cmd.AddCommand(iteration.NewCmd(ctx)) return cmd } diff --git a/internal/cmd/boards/iteration/iteration.go b/internal/cmd/boards/iteration/iteration.go new file mode 100644 index 00000000..53fe9d41 --- /dev/null +++ b/internal/cmd/boards/iteration/iteration.go @@ -0,0 +1,29 @@ +package iteration + +import ( + "github.com/MakeNowJust/heredoc" + "github.com/spf13/cobra" + "github.com/tmeckel/azdo-cli/internal/cmd/boards/iteration/project" + "github.com/tmeckel/azdo-cli/internal/cmd/util" +) + +// NewCmd constructs the 'iteration' command group under 'boards'. +func NewCmd(ctx util.CmdContext) *cobra.Command { + cmd := &cobra.Command{ + Use: "iteration ", + Short: "Work with iteration/classification nodes.", + Example: heredoc.Doc(` + # List iterations for a project + azdo boards iteration project list Fabrikam + `), + Aliases: []string{ + "it", + "i", + }, + } + + // Add subgroups + cmd.AddCommand(project.NewCmd(ctx)) + + return cmd +} diff --git a/internal/cmd/boards/iteration/project/list/list.go b/internal/cmd/boards/iteration/project/list/list.go new file mode 100644 index 00000000..057fe3b2 --- /dev/null +++ b/internal/cmd/boards/iteration/project/list/list.go @@ -0,0 +1,460 @@ +package list + +import ( + "fmt" + "strconv" + "strings" + "time" + + "github.com/MakeNowJust/heredoc" + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" + "github.com/spf13/cobra" + + "github.com/tmeckel/azdo-cli/internal/cmd/boards/shared" + "github.com/tmeckel/azdo-cli/internal/cmd/util" + "github.com/tmeckel/azdo-cli/internal/types" +) + +type listOptions struct { + scopeArg string + path string + depth int + includeDates bool + exporter util.Exporter + startFilter string + finishFilter string +} + +type iterationRow struct { + Name string `json:"name"` + Path string `json:"path"` + Level int `json:"level"` + HasChildren bool `json:"hasChildren"` + StartDate *time.Time `json:"startDate,omitempty"` + FinishDate *time.Time `json:"finishDate,omitempty"` +} + +func NewCmd(ctx util.CmdContext) *cobra.Command { + opts := &listOptions{ + depth: 3, + } + + cmd := &cobra.Command{ + Use: "list [ORGANIZATION/]PROJECT", + Short: "List iteration hierarchy for a project.", + Long: heredoc.Doc(` + List the iteration (sprint) hierarchy for a project within an Azure DevOps organization. + `), + Example: heredoc.Doc(` + # List the top-level iterations (depth 3) + azdo boards iteration project list myorg/myproject + + # List from a specific path + azdo boards iteration project list myproject --path "Release 2025/Sprint 1" + + # Include start and finish dates + azdo boards iteration project list myproject --include-dates + + # List iterations starting today or later + azdo boards iteration project list myproject --start-date ">=today" + + # Filter to iterations finishing before a specific date + azdo boards iteration project list myproject --finish-date "<=2024-12-31" + + # Export JSON + azdo boards iteration project list myproject --json name,path,startDate + `), + Aliases: []string{"ls", "l"}, + Args: util.ExactArgs(1, "project argument required"), + RunE: func(cmd *cobra.Command, args []string) error { + opts.scopeArg = args[0] + return runList(ctx, opts) + }, + } + + cmd.Flags().StringVarP(&opts.path, "path", "p", "", "Iteration path relative to project root") + cmd.Flags().IntVarP(&opts.depth, "depth", "d", opts.depth, "Depth to fetch (1-10)") + cmd.Flags().BoolVar(&opts.includeDates, "include-dates", false, "Include iteration start and finish dates") + cmd.Flags().StringVar(&opts.startFilter, "start-date", "", "Apply a comparison filter to iteration start dates; supports operators like >= and special value \"today\" (e.g., \">=today\")") + cmd.Flags().StringVar(&opts.finishFilter, "finish-date", "", "Apply a comparison filter to iteration finish dates; supports operators like <= and special value \"today\" (e.g., \"<=today\")") + + util.AddJSONFlags(cmd, &opts.exporter, []string{"name", "path", "level", "hasChildren", "startDate", "finishDate"}) + + return cmd +} + +func runList(ctx util.CmdContext, opts *listOptions) error { + ios, err := ctx.IOStreams() + if err != nil { + return err + } + + if opts.depth < 1 || opts.depth > 10 { + return util.FlagErrorf("--depth must be between 1 and 10") + } + + scope, err := util.ParseProjectScope(ctx, opts.scopeArg) + if err != nil { + return util.FlagErrorWrap(err) + } + + normalizedPath, err := shared.BuildClassificationPath(scope.Project, true, "Iteration", opts.path) + if err != nil { + return err + } + + treeGroup := workitemtracking.TreeStructureGroupValues.Iterations + + witClient, err := ctx.ClientFactory().WorkItemTracking(ctx.Context(), scope.Organization) + if err != nil { + return fmt.Errorf("failed to create work item tracking client: %w", err) + } + + ios.StartProgressIndicator() + defer ios.StopProgressIndicator() + + args := workitemtracking.GetClassificationNodeArgs{ + Project: types.ToPtr(scope.Project), + StructureGroup: &treeGroup, + Path: func() *string { + if normalizedPath == "" { + return nil + } + return &normalizedPath + }(), + Depth: &opts.depth, + } + + root, err := witClient.GetClassificationNode(ctx.Context(), args) + if err != nil { + return fmt.Errorf("failed to resolve iteration hierarchy: %w", err) + } + + rows := make([]iterationRow, 0) + flattenIterations(root, 1, &rows) + if len(rows) == 0 { + return util.NewNoResultsError("no iteration nodes found") + } + + startConstraint, err := parseDateConstraint(opts.startFilter, "start-date") + if err != nil { + return err + } + finishConstraint, err := parseDateConstraint(opts.finishFilter, "finish-date") + if err != nil { + return err + } + if err := ensureFilterCompatibility(startConstraint, finishConstraint); err != nil { + return err + } + + rows = filterIterations(rows, startConstraint, finishConstraint) + if len(rows) == 0 { + return util.NewNoResultsError("no iteration nodes matched the provided date filters") + } + + if opts.exporter != nil { + ios.StopProgressIndicator() + return opts.exporter.Write(ios, rows) + } + + tp, err := ctx.Printer("table") + if err != nil { + return err + } + + if opts.includeDates { + tp.AddColumns("Name", "Path", "Level", "HasChildren", "StartDate", "FinishDate") + } else { + tp.AddColumns("Name", "Path", "Level", "HasChildren") + } + tp.EndRow() + + for _, row := range rows { + tp.AddField(row.Name) + tp.AddField(row.Path) + tp.AddField(strconv.Itoa(row.Level)) + tp.AddField(strconv.FormatBool(row.HasChildren)) + if opts.includeDates { + if row.StartDate != nil { + tp.AddField(row.StartDate.Format(time.RFC3339)) + } else { + tp.AddField("") + } + if row.FinishDate != nil { + tp.AddField(row.FinishDate.Format(time.RFC3339)) + } else { + tp.AddField("") + } + } + tp.EndRow() + } + + ios.StopProgressIndicator() + + return tp.Render() +} + +func flattenIterations(node *workitemtracking.WorkItemClassificationNode, level int, rows *[]iterationRow) { + if node == nil { + return + } + + name := types.GetValue(node.Name, "") + path := shared.NormalizeClassificationPath(types.GetValue(node.Path, "")) + hasChildren := types.GetValue(node.HasChildren, false) + + row := iterationRow{ + Name: name, + Path: path, + Level: level, + HasChildren: hasChildren, + StartDate: extractDate(node.Attributes, "startDate"), + FinishDate: extractDate(node.Attributes, "finishDate"), + } + + *rows = append(*rows, row) + + children := types.GetValue(node.Children, []workitemtracking.WorkItemClassificationNode{}) + for i := range children { + child := children[i] + flattenIterations(&child, level+1, rows) + } +} + +func extractDate(attrs *map[string]any, key string) *time.Time { + if attrs == nil { + return nil + } + + raw, ok := (*attrs)[key] + if !ok || raw == nil { + return nil + } + + switch v := raw.(type) { + case string: + if v == "" { + return nil + } + if parsed, err := time.Parse(time.RFC3339, v); err == nil { + return &parsed + } + case time.Time: + parsed := v + return &parsed + case *time.Time: + if v != nil { + parsed := *v + return &parsed + } + } + + return nil +} + +type comparisonOperator int + +const ( + opUnset comparisonOperator = iota + opEqual + opLess + opLessOrEqual + opGreater + opGreaterOrEqual +) + +type dateConstraint struct { + operator comparisonOperator + value time.Time + source string +} + +var nowUTC = func() time.Time { + return time.Now().UTC() +} + +func parseDateConstraint(raw string, flagName string) (*dateConstraint, error) { + raw = strings.TrimSpace(raw) + if raw == "" { + return nil, nil + } + + op, rest := splitOperator(raw) + if op == opUnset || strings.TrimSpace(rest) == "" { + return nil, util.FlagErrorf("invalid %s %q: expected comparison operator followed by a RFC3339 or YYYY-MM-DD date", flagName, raw) + } + + parsed, err := parseFlexibleDate(strings.TrimSpace(rest)) + if err != nil { + return nil, util.FlagErrorf("invalid %s %q: %v", flagName, raw, err) + } + + return &dateConstraint{ + operator: op, + value: parsed, + source: raw, + }, nil +} + +func splitOperator(raw string) (comparisonOperator, string) { + for _, pair := range []struct { + prefix string + op comparisonOperator + }{ + {"<=", opLessOrEqual}, + {">=", opGreaterOrEqual}, + {"==", opEqual}, + {"<", opLess}, + {">", opGreater}, + } { + if strings.HasPrefix(raw, pair.prefix) { + return pair.op, raw[len(pair.prefix):] + } + } + + return opUnset, raw +} + +func parseFlexibleDate(raw string) (time.Time, error) { + trimmed := strings.TrimSpace(raw) + if strings.EqualFold(trimmed, "today") { + current := nowUTC() + return time.Date(current.Year(), current.Month(), current.Day(), 0, 0, 0, 0, time.UTC), nil + } + + if strings.Contains(trimmed, "T") { + return time.Parse(time.RFC3339, trimmed) + } + + return time.Parse("2006-01-02", trimmed) +} + +func ensureFilterCompatibility(start, finish *dateConstraint) error { + if start == nil || finish == nil { + return nil + } + + // handle equality conflicts + if start.operator == opEqual && finish.operator == opEqual && !start.value.Equal(finish.value) { + return util.FlagErrorf("start-date %q conflicts with finish-date %q", start.source, finish.source) + } + + if err := compareBounds(start, finish); err != nil { + return util.FlagErrorf("start-date %q conflicts with finish-date %q: %v", start.source, finish.source, err) + } + + return nil +} + +func compareBounds(start, finish *dateConstraint) error { + finishBefore := func(t time.Time) bool { return t.After(finish.value) } + finishAfter := func(t time.Time) bool { return t.Before(finish.value) } + + switch start.operator { + case opUnset: + return nil + case opEqual: + switch finish.operator { + case opLess: + if !finishBefore(start.value) { + return fmt.Errorf("finish date must be before %s", start.value.Format(time.RFC3339)) + } + case opLessOrEqual: + if finishBefore(start.value) { + return nil + } + if finish.value.Before(start.value) { + return fmt.Errorf("finish date must not be before %s", start.value.Format(time.RFC3339)) + } + case opEqual: + if !finish.value.Equal(start.value) { + return fmt.Errorf("dates must be equal") + } + case opGreater: + if !finishAfter(start.value) { + return fmt.Errorf("finish date must be after %s", start.value.Format(time.RFC3339)) + } + case opGreaterOrEqual: + if finishAfter(start.value) { + return nil + } + if finish.value.After(start.value) { + return fmt.Errorf("finish date must not be after %s", start.value.Format(time.RFC3339)) + } + case opUnset: + return nil + } + case opGreater, opGreaterOrEqual: + switch finish.operator { + case opLess, opLessOrEqual: + if start.value.After(finish.value) { + return fmt.Errorf("start date cannot be after finish date") + } + case opEqual: + if start.value.After(finish.value) { + return fmt.Errorf("start date cannot be after finish date") + } + case opGreater, opGreaterOrEqual: + return nil + case opUnset: + return nil + } + case opLess, opLessOrEqual: + switch finish.operator { + case opEqual: + if start.value.After(finish.value) { + return fmt.Errorf("start date cannot be after finish date") + } + case opLess, opLessOrEqual, opGreater, opGreaterOrEqual, opUnset: + return nil + } + default: + return nil + } + + if finish.operator == opEqual && start.value.After(finish.value) { + return fmt.Errorf("start date cannot be after finish date") + } + + return nil +} + +func filterIterations(rows []iterationRow, start, finish *dateConstraint) []iterationRow { + if start == nil && finish == nil { + return rows + } + + filtered := make([]iterationRow, 0, len(rows)) + for _, row := range rows { + if satisfiesConstraint(row.StartDate, start) && satisfiesConstraint(row.FinishDate, finish) { + filtered = append(filtered, row) + } + } + + return filtered +} + +func satisfiesConstraint(date *time.Time, constraint *dateConstraint) bool { + if constraint == nil { + return true + } + if date == nil { + return false + } + + switch constraint.operator { + case opEqual: + return date.Equal(constraint.value) + case opLess: + return date.Before(constraint.value) + case opLessOrEqual: + return !date.After(constraint.value) + case opGreater: + return date.After(constraint.value) + case opGreaterOrEqual: + return !date.Before(constraint.value) + default: + return true + } +} diff --git a/internal/cmd/boards/iteration/project/list/list_test.go b/internal/cmd/boards/iteration/project/list/list_test.go new file mode 100644 index 00000000..09cdeb79 --- /dev/null +++ b/internal/cmd/boards/iteration/project/list/list_test.go @@ -0,0 +1,284 @@ +package list + +import ( + "testing" + "time" + + "github.com/microsoft/azure-devops-go-api/azuredevops/v7/workitemtracking" + "github.com/tmeckel/azdo-cli/internal/types" +) + +func TestExtractDate(t *testing.T) { + t.Run("parses RFC3339 string", func(t *testing.T) { + date := "2024-01-15T13:45:00Z" + attrs := map[string]any{"startDate": date} + got := extractDate(&attrs, "startDate") + if got == nil { + t.Fatalf("expected date, got nil") + } + if got.Format(time.RFC3339) != date { + t.Fatalf("expected %s, got %s", date, got.Format(time.RFC3339)) + } + }) + + t.Run("returns nil on unknown format", func(t *testing.T) { + attrs := map[string]any{"startDate": 1234} + if got := extractDate(&attrs, "startDate"); got != nil { + t.Fatalf("expected nil for unsupported type, got %v", got) + } + }) +} + +func TestFlattenIterations(t *testing.T) { + child := workitemtracking.WorkItemClassificationNode{ + Name: types.ToPtr("Sprint 1"), + Path: types.ToPtr("Project/Iteration/Sprint 1"), + HasChildren: types.ToPtr(false), + } + children := []workitemtracking.WorkItemClassificationNode{child} + attrs := map[string]any{ + "startDate": "2024-01-01T00:00:00Z", + "finishDate": "2024-01-15T00:00:00Z", + } + root := &workitemtracking.WorkItemClassificationNode{ + Name: types.ToPtr("Project/Iteration"), + Path: types.ToPtr("Project/Iteration"), + HasChildren: types.ToPtr(true), + Attributes: &attrs, + Children: &children, + } + + rows := make([]iterationRow, 0) + flattenIterations(root, 1, &rows) + + if len(rows) != 2 { + t.Fatalf("expected 2 rows, got %d", len(rows)) + } + if rows[0].Level != 1 || rows[0].Name != "Project/Iteration" { + t.Fatalf("unexpected root row: %+v", rows[0]) + } + if rows[0].StartDate == nil || rows[0].StartDate.Format(time.RFC3339) != "2024-01-01T00:00:00Z" { + t.Fatalf("expected parsed start date, got %+v", rows[0].StartDate) + } + if rows[0].FinishDate == nil || rows[0].FinishDate.Format(time.RFC3339) != "2024-01-15T00:00:00Z" { + t.Fatalf("expected parsed finish date, got %+v", rows[0].FinishDate) + } + if rows[1].Level != 2 || rows[1].Name != "Sprint 1" { + t.Fatalf("unexpected child row: %+v", rows[1]) + } + if rows[1].StartDate != nil || rows[1].FinishDate != nil { + t.Fatalf("child dates should be nil: %+v", rows[1]) + } +} + +func TestParseDateConstraint(t *testing.T) { + fixedNow := time.Date(2024, time.April, 5, 10, 30, 0, 0, time.UTC) + originalNow := nowUTC + nowUTC = func() time.Time { return fixedNow } + defer func() { nowUTC = originalNow }() + + t.Run("parses valid operators and formats", func(t *testing.T) { + tests := []struct { + raw string + op comparisonOperator + value string + format string + }{ + {raw: ">=2024-01-01", op: opGreaterOrEqual, value: "2024-01-01", format: "2006-01-02"}, + {raw: "<=2024-02-01T15:00:00Z", op: opLessOrEqual, value: "2024-02-01T15:00:00Z", format: time.RFC3339}, + {raw: "==2025-12-31", op: opEqual, value: "2025-12-31", format: "2006-01-02"}, + {raw: "< 2023-07-04", op: opLess, value: "2023-07-04", format: "2006-01-02"}, + {raw: "> 2026-03-21T00:00:00Z", op: opGreater, value: "2026-03-21T00:00:00Z", format: time.RFC3339}, + {raw: ">=today", op: opGreaterOrEqual, value: "2024-04-05", format: "2006-01-02"}, + } + + for _, tc := range tests { + t.Run(tc.raw, func(t *testing.T) { + got, err := parseDateConstraint(tc.raw, "start-date") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if got == nil { + t.Fatalf("expected constraint") + } + if got.operator != tc.op { + t.Fatalf("expected operator %v, got %v", tc.op, got.operator) + } + want, err := time.Parse(tc.format, tc.value) + if err != nil { + t.Fatalf("failed parsing test expectation: %v", err) + } + if !got.value.Equal(want) { + t.Fatalf("expected value %s, got %s", want.Format(time.RFC3339), got.value.Format(time.RFC3339)) + } + }) + } + }) + + t.Run("returns error on missing operator", func(t *testing.T) { + if _, err := parseDateConstraint("2024-01-01", "start-date"); err == nil { + t.Fatalf("expected error for missing operator") + } + }) + + t.Run("returns error on invalid format", func(t *testing.T) { + if _, err := parseDateConstraint(">=notadate", "start-date"); err == nil { + t.Fatalf("expected error for invalid date") + } + }) +} + +func TestEnsureFilterCompatibility(t *testing.T) { + cases := []struct { + name string + start string + finish string + ok bool + }{ + { + name: "compatible bounds", + start: ">=2024-01-01", + finish: "<=2024-12-31", + ok: true, + }, + { + name: "conflicting equality", + start: "==2024-01-05", + finish: "==2024-01-06", + ok: false, + }, + { + name: "start after finish", + start: ">=2024-02-01", + finish: "<=2024-01-01", + ok: false, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + start, err := parseDateConstraint(tc.start, "start-date") + if err != nil { + t.Fatalf("unexpected error parsing start: %v", err) + } + finish, err := parseDateConstraint(tc.finish, "finish-date") + if err != nil { + t.Fatalf("unexpected error parsing finish: %v", err) + } + + err = ensureFilterCompatibility(start, finish) + if tc.ok && err != nil { + t.Fatalf("expected compatibility, got error %v", err) + } + if !tc.ok && err == nil { + t.Fatalf("expected error due to incompatibility") + } + }) + } +} + +func TestFilterIterations(t *testing.T) { + date := func(year int, month time.Month, day int) *time.Time { + tm := time.Date(year, month, day, 0, 0, 0, 0, time.UTC) + return &tm + } + + originalNow := nowUTC + nowUTC = func() time.Time { return time.Date(2024, time.January, 15, 9, 0, 0, 0, time.UTC) } + defer func() { nowUTC = originalNow }() + + rows := []iterationRow{ + {Name: "A", StartDate: date(2024, time.January, 1), FinishDate: date(2024, time.January, 10)}, + {Name: "B", StartDate: date(2024, time.February, 1), FinishDate: date(2024, time.February, 10)}, + {Name: "C", StartDate: nil, FinishDate: date(2024, time.March, 1)}, + } + + start, err := parseDateConstraint(">=today", "start-date") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + finish, err := parseDateConstraint("<=2024-02-15", "finish-date") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + + filtered := filterIterations(rows, start, finish) + if len(filtered) != 1 { + t.Fatalf("expected 1 row, got %d", len(filtered)) + } + if filtered[0].Name != "B" { + t.Fatalf("expected row B, got %s", filtered[0].Name) + } +} + +func TestCompareBounds(t *testing.T) { + makeConstraint := func(raw, flagName string) *dateConstraint { + c, err := parseDateConstraint(raw, flagName) + if err != nil { + t.Fatalf("failed to parse constraint %q: %v", raw, err) + } + return c + } + + cases := []struct { + name string + start *dateConstraint + finish *dateConstraint + ok bool + }{ + { + name: "compatible greater and less bounds", + start: makeConstraint(">=2024-01-01", "start-date"), + finish: makeConstraint("<=2024-01-10", "finish-date"), + ok: true, + }, + { + name: "start after finish should error", + start: makeConstraint(">=2024-01-11", "start-date"), + finish: makeConstraint("<=2024-01-10", "finish-date"), + ok: false, + }, + { + name: "less-or-equal start against equal finish with inverted range", + start: makeConstraint("<=2024-01-10", "start-date"), + finish: makeConstraint("==2024-01-05", "finish-date"), + ok: false, + }, + { + name: "unset start constraint ignored", + start: &dateConstraint{operator: opUnset}, + finish: makeConstraint("==2024-01-05", "finish-date"), + ok: true, + }, + { + name: "unset finish constraint ignored", + start: makeConstraint("==2024-01-05", "start-date"), + finish: &dateConstraint{operator: opUnset}, + ok: true, + }, + { + name: "greater start and greater finish are compatible", + start: makeConstraint(">2024-01-01", "start-date"), + finish: makeConstraint(">=2024-01-02", "finish-date"), + ok: true, + }, + { + name: "less start and less finish are compatible", + start: makeConstraint("<2024-01-10", "start-date"), + finish: makeConstraint("<=2024-01-15", "finish-date"), + ok: true, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + err := compareBounds(tc.start, tc.finish) + if tc.ok && err != nil { + t.Fatalf("expected success, got error: %v", err) + } + if !tc.ok && err == nil { + t.Fatalf("expected error but got nil") + } + }) + } +} diff --git a/internal/cmd/boards/iteration/project/project.go b/internal/cmd/boards/iteration/project/project.go new file mode 100644 index 00000000..1dcb3df4 --- /dev/null +++ b/internal/cmd/boards/iteration/project/project.go @@ -0,0 +1,28 @@ +package project + +import ( + "github.com/MakeNowJust/heredoc" + "github.com/spf13/cobra" + "github.com/tmeckel/azdo-cli/internal/cmd/boards/iteration/project/list" + "github.com/tmeckel/azdo-cli/internal/cmd/util" +) + +// NewCmd constructs the 'project' subgroup under 'boards iteration'. +func NewCmd(ctx util.CmdContext) *cobra.Command { + cmd := &cobra.Command{ + Use: "project ", + Short: "Project-scoped iteration commands.", + Example: heredoc.Doc(` + # List iterations for a project + azdo boards iteration project list Fabrikam + `), + Aliases: []string{ + "prj", + "p", + }, + } + + cmd.AddCommand(list.NewCmd(ctx)) + + return cmd +} From c99ae07d074aae82d563ec1310a8608bdaefdf91 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:36:10 +0000 Subject: [PATCH 12/13] =?UTF-8?q?docs:=20=F0=9F=93=84=20re-created=20docum?= =?UTF-8?q?entation=20for=20`azdo=20boards=20iteration=20project=20list`?= =?UTF-8?q?=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/azdo_boards.md | 1 + docs/azdo_boards_iteration.md | 23 +++++++ docs/azdo_boards_iteration_project.md | 23 +++++++ docs/azdo_boards_iteration_project_list.md | 79 ++++++++++++++++++++++ docs/azdo_help_reference.md | 41 +++++++++++ 5 files changed, 167 insertions(+) create mode 100644 docs/azdo_boards_iteration.md create mode 100644 docs/azdo_boards_iteration_project.md create mode 100644 docs/azdo_boards_iteration_project_list.md diff --git a/docs/azdo_boards.md b/docs/azdo_boards.md index 0e06b534..4364d7ba 100644 --- a/docs/azdo_boards.md +++ b/docs/azdo_boards.md @@ -5,6 +5,7 @@ Work with Azure Boards resources. ### Available commands * [azdo boards area](./azdo_boards_area.md) +* [azdo boards iteration](./azdo_boards_iteration.md) ### ALIASES diff --git a/docs/azdo_boards_iteration.md b/docs/azdo_boards_iteration.md new file mode 100644 index 00000000..1c2c589d --- /dev/null +++ b/docs/azdo_boards_iteration.md @@ -0,0 +1,23 @@ +## Command `azdo boards iteration` + +Work with iteration/classification nodes. + +### Available commands + +* [azdo boards iteration project](./azdo_boards_iteration_project.md) + +### ALIASES + +- `it` +- `i` + +### Examples + +```bash +# List iterations for a project +azdo boards iteration project list Fabrikam +``` + +### See also + +* [azdo boards](./azdo_boards.md) diff --git a/docs/azdo_boards_iteration_project.md b/docs/azdo_boards_iteration_project.md new file mode 100644 index 00000000..e81146a9 --- /dev/null +++ b/docs/azdo_boards_iteration_project.md @@ -0,0 +1,23 @@ +## Command `azdo boards iteration project` + +Project-scoped iteration commands. + +### Available commands + +* [azdo boards iteration project list](./azdo_boards_iteration_project_list.md) + +### ALIASES + +- `prj` +- `p` + +### Examples + +```bash +# List iterations for a project +azdo boards iteration project list Fabrikam +``` + +### See also + +* [azdo boards iteration](./azdo_boards_iteration.md) diff --git a/docs/azdo_boards_iteration_project_list.md b/docs/azdo_boards_iteration_project_list.md new file mode 100644 index 00000000..deb5186b --- /dev/null +++ b/docs/azdo_boards_iteration_project_list.md @@ -0,0 +1,79 @@ +## Command `azdo boards iteration project list` + +``` +azdo boards iteration project list [ORGANIZATION/]PROJECT [flags] +``` + +List the iteration (sprint) hierarchy for a project within an Azure DevOps organization. + + +### Options + + +* `-d`, `--depth` `int` (default `3`) + + Depth to fetch (1-10) + +* `--finish-date` `string` + + Apply a comparison filter to iteration finish dates; supports operators like <= and special value "today" (e.g., "<=today") + +* `--include-dates` + + Include iteration start and finish dates + +* `-q`, `--jq` `expression` + + Filter JSON output using a jq expression + +* `--json` `fields` + + Output JSON with the specified fields. Prefix a field with '-' to exclude it. + +* `-p`, `--path` `string` + + Iteration path relative to project root + +* `--start-date` `string` + + Apply a comparison filter to iteration start dates; supports operators like >= and special value "today" (e.g., ">=today") + +* `-t`, `--template` `string` + + Format JSON output using a Go template; see "azdo help formatting" + + +### ALIASES + +- `ls` +- `l` + +### JSON Fields + +`finishDate`, `hasChildren`, `level`, `name`, `path`, `startDate` + +### Examples + +```bash +# List the top-level iterations (depth 3) +azdo boards iteration project list myorg/myproject + +# List from a specific path +azdo boards iteration project list myproject --path "Release 2025/Sprint 1" + +# Include start and finish dates +azdo boards iteration project list myproject --include-dates + +# List iterations starting today or later +azdo boards iteration project list myproject --start-date ">=today" + +# Filter to iterations finishing before a specific date +azdo boards iteration project list myproject --finish-date "<=2024-12-31" + +# Export JSON +azdo boards iteration project list myproject --json name,path,startDate +``` + +### See also + +* [azdo boards iteration project](./azdo_boards_iteration_project.md) diff --git a/docs/azdo_help_reference.md b/docs/azdo_help_reference.md index 9b90663f..51070281 100644 --- a/docs/azdo_help_reference.md +++ b/docs/azdo_help_reference.md @@ -81,6 +81,47 @@ Aliases ls, l ``` +### `azdo boards iteration ` + +Work with iteration/classification nodes. + +Aliases + +``` +it, i +``` + +#### `azdo boards iteration project ` + +Project-scoped iteration commands. + +Aliases + +``` +prj, p +``` + +##### `azdo boards iteration project list [ORGANIZATION/]PROJECT [flags]` + +List iteration hierarchy for a project. + +``` +-d, --depth int Depth to fetch (1-10) (default 3) + --finish-date string Apply a comparison filter to iteration finish dates; supports operators like <= and special value "today" (e.g., "<=today") + --include-dates Include iteration start and finish dates +-q, --jq expression Filter JSON output using a jq expression + --json fields[=*] Output JSON with the specified fields. Prefix a field with '-' to exclude it. +-p, --path string Iteration path relative to project root + --start-date string Apply a comparison filter to iteration start dates; supports operators like >= and special value "today" (e.g., ">=today") +-t, --template string Format JSON output using a Go template; see "azdo help formatting" +``` + +Aliases + +``` +ls, l +``` + ## `azdo co` Alias for "pr checkout" From a327fef0b8bed6792464c8d8dcee300470c46b55 Mon Sep 17 00:00:00 2001 From: Codex CLI Date: Tue, 11 Nov 2025 21:37:19 +0000 Subject: [PATCH 13/13] =?UTF-8?q?docs:=20=F0=9F=93=84=20clarify=20code=20i?= =?UTF-8?q?ndentation=20handling=20and=20azdo=20client=20guidance=20in=20A?= =?UTF-8?q?GENTS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index cee37251..e8c26356 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,6 +25,7 @@ Developer: # Repository Guidelines - **CLI Flags:** Use kebab-case (e.g., `--organization-url`). - **Logging:** Use `zap.L()` with structured messages; prefer `%w` for wrapping errors. - **Variables:** Variable names must never collide with any imports or name of GO packages +- **Indentation During Drafts:** Cosmetic indentation mismatches are acceptable while implementing changes. Final formatting is applied with `gofumpt` after coding is complete, so focus on correctness first. ## Testing Guidelines @@ -61,6 +62,19 @@ For a complete guidance on how to implement tests refer to [TESTING.md](./TESTIN - **Output:** Use `ctx.Printer(format)` and repository’s standard `printer` helpers to format output in table or JSON, following patterns from existing commands. For commands that make API calls, always wrap the logic with `ios.StartProgressIndicator()` and `defer ios.StopProgressIndicator()` to provide feedback to the user. When not outputting JSON, provide a clean, human-readable table using the `ctx.Printer("list")` helper for list-like output. Choose the most relevant columns to display. Always call `ios.StopProgressIndicator()` **before** creating any output on the command line. - **Testing:** Create mocks for the relevant client interface methods under `internal/mocks` and write hermetic, table-driven tests alongside the command. +### Handling Missing Azure DevOps SDK Clients + +When a required Azure DevOps client is not available in the vendored Go SDK: + +1. Confirm the absence by searching the upstream SDK using the GitHub MCP server (`https://github.com/microsoft/azure-devops-go-api/blob/dev/azuredevops/v7`). +2. Extend `type ClientFactory interface` in `internal/azdo/connection.go` with the new client method signature. +3. Ask the user to run `go mod tidy` followed by `go mod vendor` after the interface additions (the sandbox cannot do this automatically). +4. Add a matching mock generation entry to `scripts/generate_mocks.sh`. +5. Let the user run `bash ./scripts/generate_mocks.sh` +6. Implement the factory method in `internal/azdo/factory.go` so the new client can be constructed via existing connection plumbing. + +Do not hand-roll HTTP calls if an SDK client can be introduced through this process. + ### Implementing Commands with JSON and Table/Plain Output - **JSON and Table/Plain output are handled via separate code paths.**