diff --git a/src/YouTrackSharp/Constants.cs b/src/YouTrackSharp/Constants.cs index 8ea447f..851c32d 100644 --- a/src/YouTrackSharp/Constants.cs +++ b/src/YouTrackSharp/Constants.cs @@ -24,44 +24,43 @@ public static class FieldsQueryStrings /// /// Fields query for activities resource. /// - public static string ACTIVITIES = - "$type,added($type,agile(id),attachments($type,author(fullName,id,ringId),comment(id),created,id,imageDimensions(height,width),issue(id,project(id,ringId)),mimeType,name,removed,size,thumbnailURL,url,visibility($type,implicitPermittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),permittedGroups($type,allUsersGroup,icon,id,name,ringId),permittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId))),author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),color(id),commands(end,errorText,hasError,start),comment(id),created,creator($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),date,deleted,duration(id,minutes,presentation),fetched,files,hasEmail,id,idReadable,isDraft,isLocked,issue(id,project(id,ringId)),localizedName,mimeType,minutes,name,noHubUserReason(id),noUserReason(id),numberInProject,presentation,processors($type,id),project($type,id,isDemo,leader(id),name,plugins(timeTrackingSettings(enabled,estimate(field(id,name),id),timeSpent(field(id,name),id)),vcsIntegrationSettings(processors(enabled,migrationFailed,server(enabled,url),upsourceHubResourceKey,url))),ringId,shortName),reaction,reactionOrder,reactions(author($type,fullName,id,isLocked),id,reaction),removed,reopened,resolved,shortName,size,state(id),summary,text,textPreview,thumbnailURL,type(id,name),url,urls,user($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),userName,usesMarkdown,version,visibility($type,implicitPermittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),permittedGroups($type,allUsersGroup,icon,id,name,ringId),permittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId))),author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),authorGroup(icon,name),category(id),field($type,customField(fieldType(isMultiValue,valueType),id),id,linkId,presentation),id,markup,pullRequest(author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),date,fetched,files,id,idExternal,noHubUserReason(id),noUserReason(id),textPreview,titlePreview,url,user($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),userName),removed($type,agile(id),color(id),id,idReadable,isDraft,isLocked,localizedName,name,numberInProject,project($type,id,isDemo,leader(id),name,plugins(timeTrackingSettings(enabled,estimate(field(id,name),id),timeSpent(field(id,name),id)),vcsIntegrationSettings(processors(enabled,migrationFailed,server(enabled,url),upsourceHubResourceKey,url))),ringId,shortName),reaction,resolved,state(id),summary,text),target(created,id,usesMarkdown),targetMember,targetSubMember,timestamp,type"; + public const string Activities = "$type,added($type,agile(id),attachments($type,author(fullName,id,ringId),comment(id),created,id,imageDimensions(height,width),issue(id,project(id,ringId)),mimeType,name,removed,size,thumbnailURL,url,visibility($type,implicitPermittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),permittedGroups($type,allUsersGroup,icon,id,name,ringId),permittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId))),author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),color(id),commands(end,errorText,hasError,start),comment(id),created,creator($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),date,deleted,duration(id,minutes,presentation),fetched,files,hasEmail,id,idReadable,isDraft,isLocked,issue(id,project(id,ringId)),localizedName,mimeType,minutes,name,noHubUserReason(id),noUserReason(id),numberInProject,presentation,processors($type,id),project($type,id,isDemo,leader(id),name,plugins(timeTrackingSettings(enabled,estimate(field(id,name),id),timeSpent(field(id,name),id)),vcsIntegrationSettings(processors(enabled,migrationFailed,server(enabled,url),upsourceHubResourceKey,url))),ringId,shortName),reaction,reactionOrder,reactions(author($type,fullName,id,isLocked),id,reaction),removed,reopened,resolved,shortName,size,state(id),summary,text,textPreview,thumbnailURL,type(id,name),url,urls,user($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),userName,usesMarkdown,version,visibility($type,implicitPermittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),permittedGroups($type,allUsersGroup,icon,id,name,ringId),permittedUsers($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId))),author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),authorGroup(icon,name),category(id),field($type,customField(fieldType(isMultiValue,valueType),id),id,linkId,presentation),id,markup,pullRequest(author($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),date,fetched,files,id,idExternal,noHubUserReason(id),noUserReason(id),textPreview,titlePreview,url,user($type,avatarUrl,email,fullName,id,isLocked,issueRelatedGroup(icon),login,name,online,profiles(general(trackOnlineStatus)),ringId),userName),removed($type,agile(id),color(id),id,idReadable,isDraft,isLocked,localizedName,name,numberInProject,project($type,id,isDemo,leader(id),name,plugins(timeTrackingSettings(enabled,estimate(field(id,name),id),timeSpent(field(id,name),id)),vcsIntegrationSettings(processors(enabled,migrationFailed,server(enabled,url),upsourceHubResourceKey,url))),ringId,shortName),reaction,resolved,state(id),summary,text),target(created,id,usesMarkdown),targetMember,targetSubMember,timestamp,type"; /// /// Fields query for attachments (sub)resource. /// - public static string ATTACHMENTS = + public const string Attachments = "id,url,name,author(login),visibility(permittedGroups(name)),created"; /// /// Fields query for comments (sub)resource. /// - public static string COMMENTS = + public const string Comments = "id,author(id,login,fullName),issue(idReadable),deleted,usesMarkdown,text,textPreview,created,updated,visibility(permittedGroups(name))"; - private static string ISSUES_FIELD_DESCRIPTION = "description"; + private const string IssuesFieldDescription = "description"; - private static string ISSUES_FIELD_WIKIFIED_DESCRIPTION = "wikifiedDescription"; + private const string IssuesFieldWikifiedDescription = "wikifiedDescription"; /// /// Fields query for links (sub)resource. /// - public static string ISSUE_LINKS = + public const string IssueLinks = "direction,linkType(name,targetToSource,localizedTargetToSource,sourceToTarget,localizedSourceToTarget),issues(id,idReadable)"; - private static string ISSUES_FIELDS_NO_DESCRIPTION = "comments(" + COMMENTS + "),links(" + ISSUE_LINKS + - "),attachments(" + ATTACHMENTS + - "),id,idReadable,externalIssue(id),project(id,name,shortName),usesMarkdown,reporter(id,login,fullName),created,updated,resolved,votes,watchers(hasStar),numberInProject,updater(id,login,fullName),commentsCount,summary,tags(id,name),customFields(id,name,value(id,name,fullName,localizedName,text,markdownText,login,minutes,color(id,background,foreground))),visibility(permittedGroups(id,name))"; + private const string IssuesFieldsNoDescription = "comments(" + Comments + "),links(" + IssueLinks + + "),attachments(" + Attachments + + "),id,idReadable,externalIssue(id),project(id,name,shortName),usesMarkdown,reporter(id,login,fullName),created,updated,resolved,votes,watchers(hasStar),numberInProject,updater(id,login,fullName),commentsCount,summary,tags(id,name),customFields(id,name,value(id,name,fullName,localizedName,text,markdownText,login,minutes,color(id,background,foreground))),visibility(permittedGroups(id,name))"; /// /// Fields query for issues resource with issue description wikified. /// - public static string ISSUES_WIKIFIED = ISSUES_FIELD_WIKIFIED_DESCRIPTION + "," + ISSUES_FIELDS_NO_DESCRIPTION; + public const string IssuesWikified = IssuesFieldWikifiedDescription + "," + IssuesFieldsNoDescription; /// /// Fields query for issues resource with issue description not wikified. /// - public static string ISSUES_NOT_WIKIFIED = ISSUES_FIELD_DESCRIPTION + "," + ISSUES_FIELDS_NO_DESCRIPTION; + public const string IssuesNotWikified = IssuesFieldDescription + "," + IssuesFieldsNoDescription; } } } \ No newline at end of file diff --git a/src/YouTrackSharp/Issues/IssuesService.Attachments.cs b/src/YouTrackSharp/Issues/IssuesService.Attachments.cs index 181d133..d2df2df 100644 --- a/src/YouTrackSharp/Issues/IssuesService.Attachments.cs +++ b/src/YouTrackSharp/Issues/IssuesService.Attachments.cs @@ -82,7 +82,7 @@ public async Task> GetAttachmentsForIssue(string issueId var client = await _connection.GetAuthenticatedApiClient(); var response = - await client.IssuesAttachmentsGetAsync(issueId, Constants.FieldsQueryStrings.ATTACHMENTS, 0, -1); + await client.IssuesAttachmentsGetAsync(issueId, Constants.FieldsQueryStrings.Attachments, 0, -1); return response.Select(Attachment.FromApiEntity); } diff --git a/src/YouTrackSharp/Issues/IssuesService.Comments.cs b/src/YouTrackSharp/Issues/IssuesService.Comments.cs index e743517..231e228 100644 --- a/src/YouTrackSharp/Issues/IssuesService.Comments.cs +++ b/src/YouTrackSharp/Issues/IssuesService.Comments.cs @@ -18,7 +18,7 @@ public async Task> GetCommentsForIssue(string issueId, bool } var client = await _connection.GetAuthenticatedApiClient(); - var response = await client.IssuesCommentsGetAsync(issueId, Constants.FieldsQueryStrings.COMMENTS, 0, -1); + var response = await client.IssuesCommentsGetAsync(issueId, Constants.FieldsQueryStrings.Comments, 0, -1); return response.Select(comment => Comment.FromApiEntity(comment, wikifyDescription)); } diff --git a/src/YouTrackSharp/Issues/IssuesService.History.cs b/src/YouTrackSharp/Issues/IssuesService.History.cs index d0be8a9..f835f67 100644 --- a/src/YouTrackSharp/Issues/IssuesService.History.cs +++ b/src/YouTrackSharp/Issues/IssuesService.History.cs @@ -20,7 +20,7 @@ public async Task> GetChangeHistoryForIssue(string issueId) var client = await _connection.GetAuthenticatedApiClient(); var response = await client.IssuesActivitiesGetAsync(issueId, - ACTIVITIES_CATEGORIES, false, null, null, null, Constants.FieldsQueryStrings.ACTIVITIES); + ACTIVITIES_CATEGORIES, false, null, null, null, Constants.FieldsQueryStrings.Activities); return response.Select(Change.FromApiEntity).ToList(); } diff --git a/src/YouTrackSharp/Issues/IssuesService.Querying.cs b/src/YouTrackSharp/Issues/IssuesService.Querying.cs index 40171d6..37665b4 100644 --- a/src/YouTrackSharp/Issues/IssuesService.Querying.cs +++ b/src/YouTrackSharp/Issues/IssuesService.Querying.cs @@ -35,7 +35,7 @@ public async Task> GetIssues(string filter = null, int? skip { var client = await _connection.GetAuthenticatedApiClient(); var response = await client.IssuesGetAsync(filter, - wikifyDescription ? Constants.FieldsQueryStrings.ISSUES_WIKIFIED : Constants.FieldsQueryStrings.ISSUES_NOT_WIKIFIED, + wikifyDescription ? Constants.FieldsQueryStrings.IssuesWikified : Constants.FieldsQueryStrings.IssuesNotWikified, skip, take); return response.Select(issue => Issue.FromApiEntity(issue, wikifyDescription, wikifyContents)).ToList(); diff --git a/src/YouTrackSharp/Issues/IssuesService.cs b/src/YouTrackSharp/Issues/IssuesService.cs index a469043..0321b97 100644 --- a/src/YouTrackSharp/Issues/IssuesService.cs +++ b/src/YouTrackSharp/Issues/IssuesService.cs @@ -41,7 +41,7 @@ public async Task GetIssue(string issueId, bool wikifyDescription = false try { var response = await client.IssuesGetAsync(issueId, - wikifyDescription ? Constants.FieldsQueryStrings.ISSUES_WIKIFIED : Constants.FieldsQueryStrings.ISSUES_NOT_WIKIFIED, + wikifyDescription ? Constants.FieldsQueryStrings.IssuesWikified : Constants.FieldsQueryStrings.IssuesNotWikified, default(System.Threading.CancellationToken)); return Issue.FromApiEntity(response, wikifyDescription, wikifyContents); } @@ -261,7 +261,7 @@ public async Task> GetLinksForIssue(string issueId) } var client = await _connection.GetAuthenticatedApiClient(); - var response = await client.IssuesLinksGetAsync(issueId, Constants.FieldsQueryStrings.ISSUE_LINKS, 0, -1); + var response = await client.IssuesLinksGetAsync(issueId, Constants.FieldsQueryStrings.IssueLinks, 0, -1); return Link.FromApiEntities(response, issueId); }