constants

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

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"
	// TODO: Change later according to the needs.
	HeaderMattermostUserIDAPI = "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 boards create` - Create a new task for your project.\n" +
		"* `/azuredevops link [projectURL]` - Link your project to a current channel.\n"
	InvalidCommand = "Invalid command parameters. Please use `/azuredevops help` for more information."

	// Get task link preview constants
	HTTPS              = "https:"
	HTTP               = "http:"
	AzureDevopsBaseURL = "dev.azure.com"
	Workitems          = "_workitems"
	Edit               = "edit"

	// Authorization constants
	Bearer        = "Bearer"
	Authorization = "Authorization"
)
View Source
const (
	// Generic
	ConnectAccount       = "[Click here to link your Azure DevOps account](%s%s)"
	ConnectAccountFirst  = "You do not have any Azure Devops account connected. Kindly link the account first"
	UserConnected        = "Your Azure Devops account is succesfully connected!"
	UserAlreadyConnected = "Your Azure Devops account is already connected"
	UserDisconnected     = "Your Azure Devops account is now disconnected"
	CreatedTask          = "Link for newly created task: %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
	OrganizationRequired = "organization is required"
	ProjectRequired      = "project is required"
	TaskTypeRequired     = "task type is required"
	TaskTitleRequired    = "task title is required"
)

TODO: all these messages are to be verified from Mike at the end

View Source
const (
	// Error messages
	Error                           = "error"
	NotAuthorized                   = "not authorized"
	GenericErrorMessage             = "Something went wrong, please try again later"
	ErrorFetchProjectList           = "Error in fetching project list"
	ErrorUnlinkProject              = "Error in unlinking the project"
	ErrorDecodingBody               = "Error in decoding body"
	GetProjectListError             = "Error getting Project List"
	ProjectNotFound                 = "Requested project does not exists"
	UnableToDisconnectUser          = "Unable to disconnect user"
	UnableToStoreOauthState         = "Unable to store oAuth state for the userID %s"
	InvalidAuthState                = "Invalid oauth state, please try again"
	UnableToCheckIfAlreadyConnected = "Unable to check if user account is already connected"
	AuthAttemptExpired              = "Authentication attempt expired, please try again"
)
View Source
const (
	ResponseType        = "Assertion"
	Scopes              = "vso.code 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"
	PathGetAllLinkedProjects = "/project/link"
	PathUnlinkProject        = "/project/unlink"
	PathUser                 = "/user"
	PathCreateTasks          = "/tasks"
	PathLinkProject          = "/link"

	// 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"
)
View Source
const (
	AtomicRetryLimit              = 5
	AtomicRetryWait               = 30 * time.Millisecond
	TTLSecondsForOAuthState int64 = 60
	// KV store prefix keys
	OAuthPrefix   = "oAuth_%s"
	ProjectKey    = "%s_%s"
	ProjectPrefix = "project_list"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL