Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Bot configs BotUsername = "azuredevops" BotDisplayName = "Azure DevOps" BotDescription = "A bot account created by the Azure DevOps plugin." // Plugin configs PluginID = "mattermost-plugin-azure-devops" ChannelID = "channel_id" HeaderMattermostUserID = "Mattermost-User-ID" // Command configs CommandTriggerName = "azuredevops" HelpText = "###### Mattermost Azure DevOps Plugin - Slash Command Help\n" + "* `/azuredevops connect` - Connect your Mattermost account to your Azure DevOps account.\n" + "* `/azuredevops disconnect` - Disconnect your Mattermost account from your Azure DevOps account.\n" + "* `/azuredevops link [projectURL]` - Link your project to a current channel.\n" + "* `/azuredevops boards create [title] [description]` - Create a new task for your project.\n" + "* `/azuredevops boards subscription add` - Add a new Boards subscription for your linked projects.\n" + "* `/azuredevops boards subscription list [me or anyone] [all_channels]` - View Boards subscriptions.\n" + "* `/azuredevops boards subscription delete [subscription id]` - Unsubscribe a Boards subscription" InvalidCommand = "Invalid command parameters. Please use `/azuredevops help` for more information." CommandHelp = "help" CommandConnect = "connect" CommandDisconnect = "disconnect" CommandLink = "link" CommandBoards = "boards" CommandRepos = "repos" CommandCreate = "create" CommandSubscription = "subscription" CommandAdd = "add" CommandList = "list" CommandDelete = "delete" // Get task link preview constants HTTPS = "https:" HTTP = "http:" AzureDevopsBaseURL = "dev.azure.com" Workitems = "_workitems" Edit = "edit" // Azure API Versions CreateTaskAPIVersion = "7.1-preview.3" TasksIDAPIVersion = "5.1" TasksAPIVersion = "6.0" // Subscription constants PublisherID = "tfs" ConsumerID = "webHooks" ConsumerActionID = "httpRequest" SubscriptionEventPullRequestCreated = "git.pullrequest.created" SubscriptionEventPullRequestUpdated = "git.pullrequest.updated" SubscriptionEventPullRequestCommented = "ms.vss-code.git-pullrequest-comment-event" SubscriptionEventPullRequestMerged = "git.pullrequest.merged" SubscriptionEventCodePushed = "git.push" SubscriptionEventWorkItemCreated = "workitem.created" SubscriptionEventWorkItemUpdated = "workitem.updated" SubscriptionEventWorkItemDeleted = "workitem.deleted" SubscriptionEventWorkItemCommented = "workitem.commented" // Path params PathParamTeamID = "team_id" // URL query params constants QueryParamProject = "project" QueryParamChannelID = "channel_id" QueryParamCreatedBy = "created_by" QueryParamPage = "page" QueryParamPerPage = "per_page" // Filters FilterCreatedByMe = "me" FilterCreatedByAnyone = "anyone" FilterAllChannels = "all_channels" DefaultPage = 0 DefaultPerPageLimit = 50 // Authorization constants Bearer = "Bearer" Authorization = "Authorization" GetTasksID = "/%s/_apis/wit/wiql" GetTasks = "/%s/_apis/wit/workitems" PageQueryParam = "$top" APIVersionQueryParam = "api-version" IDsQueryParam = "ids" // Websocket events WSEventConnect = "connect" WSEventDisconnect = "disconnect" WSEventSubscriptionDeleted = "subscription_deleted" SubscriptionEventTypeDummy = "dummy" GitBranchIcon = "git-branch-icon.svg" ProjectIcon = "project-icon.svg" )
View Source
const ( // TODO: all these messages are to be verified from Mike at the end // Generic GenericErrorMessage = "Something went wrong, please try again later" ConnectAccount = "[Click here to connect your Azure DevOps account](%s%s)" ConnectAccountFirst = "Your Azure DevOps account is not connected \n%s" UserConnected = "Your Azure DevOps account is successfully connected!" UserAlreadyConnected = "Your Azure DevOps account is already connected" UserDisconnected = "Your Azure DevOps account is now disconnected" CreatedTask = "[%s #%d](%s) (%s) was successfully created by %s." TaskTitle = "[%s #%d: %s](%s)" TaskPreviewMessage = "State: %s\nAssigned To: %s\nDescription: %s" AlreadyLinkedProject = "This project is already linked." NoProjectLinked = "No project is linked, please link a project." // Validations Errors OrganizationRequired = "organization is required" ProjectRequired = "project is required" TaskTypeRequired = "task type is required" TaskTitleRequired = "task title is required" EventTypeRequired = "event type is required" ServiceTypeRequired = "service type is required" ChannelIDRequired = "channel ID is required" MMUserIDRequired = "mattermsot user ID is required" EmptyAzureDevopsAPIBaseURLError = "azure devops API base URL should not be empty" EmptyAzureDevopsOAuthAppIDError = "azure devops OAuth app id should not be empty" // #nosec G101 -- This is a false positive. The below line is not a hardcoded credential EmptyAzureDevopsOAuthClientSecretError = "azure devops OAuth client secret should not be empty" EmptyEncryptionSecretError = "encryption secret should not be empty" ProjectIDRequired = "project ID is required" )
View Source
const ( // Error messages Error = "error" NotAuthorized = "not authorized" UnableToDisconnectUser = "Unable to disconnect user" UnableToCheckIfAlreadyConnected = "Unable to check if user account is already connected" UnableToStoreOauthState = "Unable to store oAuth state for the userID %s" AuthAttemptExpired = "Authentication attempt expired, please try again" InvalidAuthState = "Invalid oauth state, please try again" GetProjectListError = "Error in getting project list" ErrorFetchProjectList = "Error in fetching project list" ErrorDecodingBody = "Error in decoding body" ErrorCreateTask = "Error in creating task" ErrorLinkProject = "Error in linking the project" FetchSubscriptionListError = "Error in fetching subscription list" FetchFilteredSubscriptionListError = "Error in fetching filtered subscription list" CreateSubscriptionError = "Error in creating subscription" ErrorCheckingProjectAdmin = "Error in checking if user is an admin on the project %s" ProjectNotLinked = "Requested project is not linked" GetSubscriptionListError = "Error getting subscription list" SubscriptionAlreadyPresent = "Requested subscription already exists" SubscriptionNotFound = "Requested subscription does not exists" ErrorLoadingUserData = "Error in loading user data" ErrorLoadingDataFromKVStore = "Error in loading data from KV store" ProjectNotFound = "Requested project does not exist" ErrorUnlinkProject = "Error in unlinking the project" InvalidChannelID = "Invalid channel ID" DeleteSubscriptionError = "Error in deleting subscription" GetChannelError = "Error in getting channels for team and user" GetUserError = "Error in getting Mattermost user details" InvalidPaginationQueryParam = "Invalid value for query param(s) page or per_page" ErrorAdminAccess = "" /* 187-byte string literal not displayed */ ErrorFetchSubscriptionList = "Error in fetching subscription list" ErrorMessageForAdmin = "There is no registered handler for the service hooks event type %s" )
View Source
const ( ResponseType = "Assertion" Scopes = "vso.code_full vso.work_full" ClientAssertionType = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" GrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer" GrantTypeRefresh = "refresh_token" // URL BaseOauthURL = "https://app.vssps.visualstudio.com" // Paths PathAuth = "/oauth2/authorize" // #nosec G101 -- This is a false positive PathToken = "/oauth2/token" )
View Source
const ( // Plugin API Routes APIPrefix = "/api/v1" WildRoute = "{anything:.*}" PathOAuthConnect = "/oauth/connect" PathOAuthCallback = "/oauth/complete" PathLinkedProjects = "/project/link" PathGetAllLinkedProjects = "/project/link" PathUnlinkProject = "/project/unlink" PathUser = "/user" PathCreateTasks = "/tasks" PathLinkProject = "/link" PathSubscriptions = "/subscriptions" PathGetSubscriptions = "/subscriptions/{team_id:[A-Za-z0-9]+}" PathSubscriptionNotifications = "/notification" PathGetUserChannelsForTeam = "/channels/{team_id:[A-Za-z0-9]+}" // Azure API paths CreateTask = "/%s/%s/_apis/wit/workitems/$%s?api-version=7.1-preview.3" GetTask = "%s/_apis/wit/workitems/%s?api-version=7.1-preview.3" GetProject = "/%s/_apis/projects/%s?api-version=7.1-preview.4" CreateSubscription = "/%s/_apis/hooks/subscriptions?api-version=6.0" DeleteSubscription = "/%s/_apis/hooks/subscriptions/%s?api-version=6.0" )
View Source
const ( AtomicRetryLimit = 5 AtomicRetryWait = 30 * time.Millisecond TTLSecondsForOAuthState int64 = 60 TokenExpiryTimeBufferInMinutes = 5 UsersPerPage = 100 // KV store prefix keys OAuthPrefix = "oAuth_%s" ProjectKey = "%s_%s" ProjectPrefix = "project_list" SubscriptionPrefix = "subscription_list" UserIDPrefix = "oAuth" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.