mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-08 15:06:08 +02:00
Update focalboard endpoints to v2 namespace (#2781)
This commit is contained in:
parent
42d24d279a
commit
4c61ae9623
@ -10,7 +10,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function request(method: string, host: string, resource: string, body: any, token: string | null) {
|
async function request(method: string, host: string, resource: string, body: any, token: string | null) {
|
||||||
const response = await fetch(`${host}/api/v1/${resource}`, {
|
const response = await fetch(`${host}/api/v2/${resource}`, {
|
||||||
'credentials': 'include',
|
'credentials': 'include',
|
||||||
'headers': {
|
'headers': {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
@ -5,4 +5,4 @@ if [[ $# < 2 ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl --unix-socket /var/tmp/focalboard_local.socket http://localhost/api/v1/admin/users/$1/password -X POST -H 'Content-Type: application/json' -d '{ "password": "'$2'" }'
|
curl --unix-socket /var/tmp/focalboard_local.socket http://localhost/api/v2/admin/users/$1/password -X POST -H 'Content-Type: application/json' -d '{ "password": "'$2'" }'
|
||||||
|
@ -68,94 +68,94 @@ func NewAPI(app *app.App, singleUserToken string, authService string, permission
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) RegisterRoutes(r *mux.Router) {
|
func (a *API) RegisterRoutes(r *mux.Router) {
|
||||||
apiv1 := r.PathPrefix("/api/v1").Subrouter()
|
apiv2 := r.PathPrefix("/api/v2").Subrouter()
|
||||||
apiv1.Use(a.panicHandler)
|
apiv2.Use(a.panicHandler)
|
||||||
apiv1.Use(a.requireCSRFToken)
|
apiv2.Use(a.requireCSRFToken)
|
||||||
|
|
||||||
// Board APIs
|
// Board APIs
|
||||||
apiv1.HandleFunc("/teams/{teamID}/boards", a.sessionRequired(a.handleGetBoards)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}/boards", a.sessionRequired(a.handleGetBoards)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/boards/search", a.sessionRequired(a.handleSearchBoards)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}/boards/search", a.sessionRequired(a.handleSearchBoards)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/templates", a.sessionRequired(a.handleGetTemplates)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}/templates", a.sessionRequired(a.handleGetTemplates)).Methods("GET")
|
||||||
apiv1.HandleFunc("/boards", a.sessionRequired(a.handleCreateBoard)).Methods("POST")
|
apiv2.HandleFunc("/boards", a.sessionRequired(a.handleCreateBoard)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}", a.attachSession(a.handleGetBoard, false)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}", a.attachSession(a.handleGetBoard, false)).Methods("GET")
|
||||||
apiv1.HandleFunc("/boards/{boardID}", a.sessionRequired(a.handlePatchBoard)).Methods("PATCH")
|
apiv2.HandleFunc("/boards/{boardID}", a.sessionRequired(a.handlePatchBoard)).Methods("PATCH")
|
||||||
apiv1.HandleFunc("/boards/{boardID}", a.sessionRequired(a.handleDeleteBoard)).Methods("DELETE")
|
apiv2.HandleFunc("/boards/{boardID}", a.sessionRequired(a.handleDeleteBoard)).Methods("DELETE")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/duplicate", a.sessionRequired(a.handleDuplicateBoard)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/duplicate", a.sessionRequired(a.handleDuplicateBoard)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/undelete", a.sessionRequired(a.handleUndeleteBoard)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/undelete", a.sessionRequired(a.handleUndeleteBoard)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks", a.attachSession(a.handleGetBlocks, false)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}/blocks", a.attachSession(a.handleGetBlocks, false)).Methods("GET")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks", a.sessionRequired(a.handlePostBlocks)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/blocks", a.sessionRequired(a.handlePostBlocks)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks", a.sessionRequired(a.handlePatchBlocks)).Methods("PATCH")
|
apiv2.HandleFunc("/boards/{boardID}/blocks", a.sessionRequired(a.handlePatchBlocks)).Methods("PATCH")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks/{blockID}", a.sessionRequired(a.handleDeleteBlock)).Methods("DELETE")
|
apiv2.HandleFunc("/boards/{boardID}/blocks/{blockID}", a.sessionRequired(a.handleDeleteBlock)).Methods("DELETE")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks/{blockID}", a.sessionRequired(a.handlePatchBlock)).Methods("PATCH")
|
apiv2.HandleFunc("/boards/{boardID}/blocks/{blockID}", a.sessionRequired(a.handlePatchBlock)).Methods("PATCH")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks/{blockID}/undelete", a.sessionRequired(a.handleUndeleteBlock)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/blocks/{blockID}/undelete", a.sessionRequired(a.handleUndeleteBlock)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/blocks/{blockID}/duplicate", a.sessionRequired(a.handleDuplicateBlock)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/blocks/{blockID}/duplicate", a.sessionRequired(a.handleDuplicateBlock)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/metadata", a.sessionRequired(a.handleGetBoardMetadata)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}/metadata", a.sessionRequired(a.handleGetBoardMetadata)).Methods("GET")
|
||||||
|
|
||||||
// Member APIs
|
// Member APIs
|
||||||
apiv1.HandleFunc("/boards/{boardID}/members", a.sessionRequired(a.handleGetMembersForBoard)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}/members", a.sessionRequired(a.handleGetMembersForBoard)).Methods("GET")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/members", a.sessionRequired(a.handleAddMember)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/members", a.sessionRequired(a.handleAddMember)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/members/{userID}", a.sessionRequired(a.handleUpdateMember)).Methods("PUT")
|
apiv2.HandleFunc("/boards/{boardID}/members/{userID}", a.sessionRequired(a.handleUpdateMember)).Methods("PUT")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/members/{userID}", a.sessionRequired(a.handleDeleteMember)).Methods("DELETE")
|
apiv2.HandleFunc("/boards/{boardID}/members/{userID}", a.sessionRequired(a.handleDeleteMember)).Methods("DELETE")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/join", a.sessionRequired(a.handleJoinBoard)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/join", a.sessionRequired(a.handleJoinBoard)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/leave", a.sessionRequired(a.handleLeaveBoard)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/leave", a.sessionRequired(a.handleLeaveBoard)).Methods("POST")
|
||||||
|
|
||||||
// Sharing APIs
|
// Sharing APIs
|
||||||
apiv1.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handlePostSharing)).Methods("POST")
|
apiv2.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handlePostSharing)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handleGetSharing)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handleGetSharing)).Methods("GET")
|
||||||
|
|
||||||
// Team APIs
|
// Team APIs
|
||||||
apiv1.HandleFunc("/teams", a.sessionRequired(a.handleGetTeams)).Methods("GET")
|
apiv2.HandleFunc("/teams", a.sessionRequired(a.handleGetTeams)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}", a.sessionRequired(a.handleGetTeam)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}", a.sessionRequired(a.handleGetTeam)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/regenerate_signup_token", a.sessionRequired(a.handlePostTeamRegenerateSignupToken)).Methods("POST")
|
apiv2.HandleFunc("/teams/{teamID}/regenerate_signup_token", a.sessionRequired(a.handlePostTeamRegenerateSignupToken)).Methods("POST")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/users", a.sessionRequired(a.handleGetTeamUsers)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}/users", a.sessionRequired(a.handleGetTeamUsers)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/archive/export", a.sessionRequired(a.handleArchiveExportTeam)).Methods("GET")
|
apiv2.HandleFunc("/teams/{teamID}/archive/export", a.sessionRequired(a.handleArchiveExportTeam)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/{boardID}/files", a.sessionRequired(a.handleUploadFile)).Methods("POST")
|
apiv2.HandleFunc("/teams/{teamID}/{boardID}/files", a.sessionRequired(a.handleUploadFile)).Methods("POST")
|
||||||
|
|
||||||
// User APIs
|
// User APIs
|
||||||
apiv1.HandleFunc("/users/me", a.sessionRequired(a.handleGetMe)).Methods("GET")
|
apiv2.HandleFunc("/users/me", a.sessionRequired(a.handleGetMe)).Methods("GET")
|
||||||
apiv1.HandleFunc("/users/me/memberships", a.sessionRequired(a.handleGetMyMemberships)).Methods("GET")
|
apiv2.HandleFunc("/users/me/memberships", a.sessionRequired(a.handleGetMyMemberships)).Methods("GET")
|
||||||
apiv1.HandleFunc("/users/{userID}", a.sessionRequired(a.handleGetUser)).Methods("GET")
|
apiv2.HandleFunc("/users/{userID}", a.sessionRequired(a.handleGetUser)).Methods("GET")
|
||||||
apiv1.HandleFunc("/users/{userID}/changepassword", a.sessionRequired(a.handleChangePassword)).Methods("POST")
|
apiv2.HandleFunc("/users/{userID}/changepassword", a.sessionRequired(a.handleChangePassword)).Methods("POST")
|
||||||
apiv1.HandleFunc("/users/{userID}/config", a.sessionRequired(a.handleUpdateUserConfig)).Methods(http.MethodPut)
|
apiv2.HandleFunc("/users/{userID}/config", a.sessionRequired(a.handleUpdateUserConfig)).Methods(http.MethodPut)
|
||||||
|
|
||||||
// BoardsAndBlocks APIs
|
// BoardsAndBlocks APIs
|
||||||
apiv1.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handleCreateBoardsAndBlocks)).Methods("POST")
|
apiv2.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handleCreateBoardsAndBlocks)).Methods("POST")
|
||||||
apiv1.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handlePatchBoardsAndBlocks)).Methods("PATCH")
|
apiv2.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handlePatchBoardsAndBlocks)).Methods("PATCH")
|
||||||
apiv1.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handleDeleteBoardsAndBlocks)).Methods("DELETE")
|
apiv2.HandleFunc("/boards-and-blocks", a.sessionRequired(a.handleDeleteBoardsAndBlocks)).Methods("DELETE")
|
||||||
|
|
||||||
// Auth APIs
|
// Auth APIs
|
||||||
apiv1.HandleFunc("/login", a.handleLogin).Methods("POST")
|
apiv2.HandleFunc("/login", a.handleLogin).Methods("POST")
|
||||||
apiv1.HandleFunc("/logout", a.sessionRequired(a.handleLogout)).Methods("POST")
|
apiv2.HandleFunc("/logout", a.sessionRequired(a.handleLogout)).Methods("POST")
|
||||||
apiv1.HandleFunc("/register", a.handleRegister).Methods("POST")
|
apiv2.HandleFunc("/register", a.handleRegister).Methods("POST")
|
||||||
apiv1.HandleFunc("/clientConfig", a.getClientConfig).Methods("GET")
|
apiv2.HandleFunc("/clientConfig", a.getClientConfig).Methods("GET")
|
||||||
|
|
||||||
// Category APIs
|
// Category APIs
|
||||||
apiv1.HandleFunc("/teams/{teamID}/categories", a.sessionRequired(a.handleCreateCategory)).Methods(http.MethodPost)
|
apiv2.HandleFunc("/teams/{teamID}/categories", a.sessionRequired(a.handleCreateCategory)).Methods(http.MethodPost)
|
||||||
apiv1.HandleFunc("/teams/{teamID}/categories/{categoryID}", a.sessionRequired(a.handleUpdateCategory)).Methods(http.MethodPut)
|
apiv2.HandleFunc("/teams/{teamID}/categories/{categoryID}", a.sessionRequired(a.handleUpdateCategory)).Methods(http.MethodPut)
|
||||||
apiv1.HandleFunc("/teams/{teamID}/categories/{categoryID}", a.sessionRequired(a.handleDeleteCategory)).Methods(http.MethodDelete)
|
apiv2.HandleFunc("/teams/{teamID}/categories/{categoryID}", a.sessionRequired(a.handleDeleteCategory)).Methods(http.MethodDelete)
|
||||||
|
|
||||||
// Category Block APIs
|
// Category Block APIs
|
||||||
apiv1.HandleFunc("/teams/{teamID}/categories", a.sessionRequired(a.handleGetUserCategoryBlocks)).Methods(http.MethodGet)
|
apiv2.HandleFunc("/teams/{teamID}/categories", a.sessionRequired(a.handleGetUserCategoryBlocks)).Methods(http.MethodGet)
|
||||||
apiv1.HandleFunc("/teams/{teamID}/categories/{categoryID}/blocks/{blockID}", a.sessionRequired(a.handleUpdateCategoryBlock)).Methods(http.MethodPost)
|
apiv2.HandleFunc("/teams/{teamID}/categories/{categoryID}/blocks/{blockID}", a.sessionRequired(a.handleUpdateCategoryBlock)).Methods(http.MethodPost)
|
||||||
|
|
||||||
// Get Files API
|
// Get Files API
|
||||||
apiv1.HandleFunc("/files/teams/{teamID}/{boardID}/{filename}", a.attachSession(a.handleServeFile, false)).Methods("GET")
|
apiv2.HandleFunc("/files/teams/{teamID}/{boardID}/{filename}", a.attachSession(a.handleServeFile, false)).Methods("GET")
|
||||||
|
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
apiv1.HandleFunc("/subscriptions", a.sessionRequired(a.handleCreateSubscription)).Methods("POST")
|
apiv2.HandleFunc("/subscriptions", a.sessionRequired(a.handleCreateSubscription)).Methods("POST")
|
||||||
apiv1.HandleFunc("/subscriptions/{blockID}/{subscriberID}", a.sessionRequired(a.handleDeleteSubscription)).Methods("DELETE")
|
apiv2.HandleFunc("/subscriptions/{blockID}/{subscriberID}", a.sessionRequired(a.handleDeleteSubscription)).Methods("DELETE")
|
||||||
apiv1.HandleFunc("/subscriptions/{subscriberID}", a.sessionRequired(a.handleGetSubscriptions)).Methods("GET")
|
apiv2.HandleFunc("/subscriptions/{subscriberID}", a.sessionRequired(a.handleGetSubscriptions)).Methods("GET")
|
||||||
|
|
||||||
// onboarding tour endpoints
|
// onboarding tour endpoints
|
||||||
apiv1.HandleFunc("/teams/{teamID}/onboard", a.sessionRequired(a.handleOnboard)).Methods(http.MethodPost)
|
apiv2.HandleFunc("/teams/{teamID}/onboard", a.sessionRequired(a.handleOnboard)).Methods(http.MethodPost)
|
||||||
|
|
||||||
// archives
|
// archives
|
||||||
apiv1.HandleFunc("/boards/{boardID}/archive/export", a.sessionRequired(a.handleArchiveExportBoard)).Methods("GET")
|
apiv2.HandleFunc("/boards/{boardID}/archive/export", a.sessionRequired(a.handleArchiveExportBoard)).Methods("GET")
|
||||||
apiv1.HandleFunc("/teams/{teamID}/archive/import", a.sessionRequired(a.handleArchiveImport)).Methods("POST")
|
apiv2.HandleFunc("/teams/{teamID}/archive/import", a.sessionRequired(a.handleArchiveImport)).Methods("POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) RegisterAdminRoutes(r *mux.Router) {
|
func (a *API) RegisterAdminRoutes(r *mux.Router) {
|
||||||
r.HandleFunc("/api/v1/admin/users/{username}/password", a.adminRequired(a.handleAdminSetPassword)).Methods("POST")
|
r.HandleFunc("/api/v2/admin/users/{username}/password", a.adminRequired(a.handleAdminSetPassword)).Methods("POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUserID(r *http.Request) string {
|
func getUserID(r *http.Request) string {
|
||||||
@ -230,7 +230,7 @@ func (a *API) hasValidReadTokenForBoard(r *http.Request, boardID string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID}/blocks getBlocks
|
// swagger:operation GET /boards/{boardID}/blocks getBlocks
|
||||||
//
|
//
|
||||||
// Returns blocks
|
// Returns blocks
|
||||||
//
|
//
|
||||||
@ -591,7 +591,7 @@ func (a *API) handleUpdateCategoryBlock(w http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/blocks updateBlocks
|
// swagger:operation POST /boards/{boardID}/blocks updateBlocks
|
||||||
//
|
//
|
||||||
// Insert blocks. The specified IDs will only be used to link
|
// Insert blocks. The specified IDs will only be used to link
|
||||||
// blocks with existing ones, the rest will be replaced by server
|
// blocks with existing ones, the rest will be replaced by server
|
||||||
@ -719,7 +719,7 @@ func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleUpdateUserConfig(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleUpdateUserConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation PATCH /api/v1/users/{userID}/config updateUserConfig
|
// swagger:operation PATCH /users/{userID}/config updateUserConfig
|
||||||
//
|
//
|
||||||
// Updates user config
|
// Updates user config
|
||||||
//
|
//
|
||||||
@ -793,7 +793,7 @@ func (a *API) handleUpdateUserConfig(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetUser(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetUser(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/users/{userID} getUser
|
// swagger:operation GET /users/{userID} getUser
|
||||||
//
|
//
|
||||||
// Returns a user
|
// Returns a user
|
||||||
//
|
//
|
||||||
@ -842,7 +842,7 @@ func (a *API) handleGetUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetMe(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetMe(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/users/me getMe
|
// swagger:operation GET /users/me getMe
|
||||||
//
|
//
|
||||||
// Returns the currently logged-in user
|
// Returns the currently logged-in user
|
||||||
//
|
//
|
||||||
@ -899,7 +899,7 @@ func (a *API) handleGetMe(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetMyMemberships(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetMyMemberships(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/users/me/memberships getMyMemberships
|
// swagger:operation GET /users/me/memberships getMyMemberships
|
||||||
//
|
//
|
||||||
// Returns the currently users board memberships
|
// Returns the currently users board memberships
|
||||||
//
|
//
|
||||||
@ -944,7 +944,7 @@ func (a *API) handleGetMyMemberships(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDeleteBlock(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDeleteBlock(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation DELETE /api/v1/boards/{boardID}/blocks/{blockID} deleteBlock
|
// swagger:operation DELETE /boards/{boardID}/blocks/{blockID} deleteBlock
|
||||||
//
|
//
|
||||||
// Deletes a block
|
// Deletes a block
|
||||||
//
|
//
|
||||||
@ -1012,7 +1012,7 @@ func (a *API) handleDeleteBlock(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleUndeleteBlock(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleUndeleteBlock(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/blocks/{blockID}/undelete undeleteBlock
|
// swagger:operation POST /boards/{boardID}/blocks/{blockID}/undelete undeleteBlock
|
||||||
//
|
//
|
||||||
// Undeletes a block
|
// Undeletes a block
|
||||||
//
|
//
|
||||||
@ -1105,7 +1105,7 @@ func (a *API) handleUndeleteBlock(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleUndeleteBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleUndeleteBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/undelete undeleteBoard
|
// swagger:operation POST /boards/{boardID}/undelete undeleteBoard
|
||||||
//
|
//
|
||||||
// Undeletes a board
|
// Undeletes a board
|
||||||
//
|
//
|
||||||
@ -1157,7 +1157,7 @@ func (a *API) handleUndeleteBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePatchBlock(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePatchBlock(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation PATCH /api/v1/boards/{boardID}/blocks/{blockID} patchBlock
|
// swagger:operation PATCH /boards/{boardID}/blocks/{blockID} patchBlock
|
||||||
//
|
//
|
||||||
// Partially updates a block
|
// Partially updates a block
|
||||||
//
|
//
|
||||||
@ -1244,7 +1244,7 @@ func (a *API) handlePatchBlock(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePatchBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePatchBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation PATCH /api/v1/boards/{boardID}/blocks/ patchBlocks
|
// swagger:operation PATCH /boards/{boardID}/blocks/ patchBlocks
|
||||||
//
|
//
|
||||||
// Partially updates batch of blocks
|
// Partially updates batch of blocks
|
||||||
//
|
//
|
||||||
@ -1327,7 +1327,7 @@ func (a *API) handlePatchBlocks(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Sharing
|
// Sharing
|
||||||
|
|
||||||
func (a *API) handleGetSharing(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetSharing(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID}/sharing getSharing
|
// swagger:operation GET /boards/{boardID}/sharing getSharing
|
||||||
//
|
//
|
||||||
// Returns sharing information for a board
|
// Returns sharing information for a board
|
||||||
//
|
//
|
||||||
@ -1396,7 +1396,7 @@ func (a *API) handleGetSharing(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePostSharing(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePostSharing(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/sharing postSharing
|
// swagger:operation POST /boards/{boardID}/sharing postSharing
|
||||||
//
|
//
|
||||||
// Sets sharing information for a board
|
// Sets sharing information for a board
|
||||||
//
|
//
|
||||||
@ -1491,7 +1491,7 @@ func (a *API) handlePostSharing(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Team
|
// Team
|
||||||
|
|
||||||
func (a *API) handleGetTeams(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetTeams(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams getTeams
|
// swagger:operation GET /teams getTeams
|
||||||
//
|
//
|
||||||
// Returns information of all the teams
|
// Returns information of all the teams
|
||||||
//
|
//
|
||||||
@ -1534,7 +1534,7 @@ func (a *API) handleGetTeams(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetTeam(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetTeam(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID} getTeam
|
// swagger:operation GET /teams/{teamID} getTeam
|
||||||
//
|
//
|
||||||
// Returns information of the root team
|
// Returns information of the root team
|
||||||
//
|
//
|
||||||
@ -1603,7 +1603,7 @@ func (a *API) handleGetTeam(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePostTeamRegenerateSignupToken(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePostTeamRegenerateSignupToken(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/teams/{teamID}/regenerate_signup_token regenerateSignupToken
|
// swagger:operation POST /teams/{teamID}/regenerate_signup_token regenerateSignupToken
|
||||||
//
|
//
|
||||||
// Regenerates the signup token for the root team
|
// Regenerates the signup token for the root team
|
||||||
//
|
//
|
||||||
@ -1654,7 +1654,7 @@ func (a *API) handlePostTeamRegenerateSignupToken(w http.ResponseWriter, r *http
|
|||||||
// File upload
|
// File upload
|
||||||
|
|
||||||
func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET "api/v1/files/teams/{teamID}/{boardID}/{filename} getFile
|
// swagger:operation GET "api/v2/files/teams/{teamID}/{boardID}/{filename} getFile
|
||||||
//
|
//
|
||||||
// Returns the contents of an uploaded file
|
// Returns the contents of an uploaded file
|
||||||
//
|
//
|
||||||
@ -1765,7 +1765,7 @@ func FileUploadResponseFromJSON(data io.Reader) (*FileUploadResponse, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleUploadFile(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleUploadFile(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/teams/{teamID}/boards/{boardID}/files uploadFile
|
// swagger:operation POST /teams/{teamID}/boards/{boardID}/files uploadFile
|
||||||
//
|
//
|
||||||
// Upload a binary file, attached to a root block
|
// Upload a binary file, attached to a root block
|
||||||
//
|
//
|
||||||
@ -1866,7 +1866,7 @@ func (a *API) handleUploadFile(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetTeamUsers(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetTeamUsers(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID}/users getTeamUsers
|
// swagger:operation GET /teams/{teamID}/users getTeamUsers
|
||||||
//
|
//
|
||||||
// Returns team users
|
// Returns team users
|
||||||
//
|
//
|
||||||
@ -1931,7 +1931,7 @@ func (a *API) handleGetTeamUsers(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetBoards(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetBoards(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID}/boards getBoards
|
// swagger:operation GET /teams/{teamID}/boards getBoards
|
||||||
//
|
//
|
||||||
// Returns team boards
|
// Returns team boards
|
||||||
//
|
//
|
||||||
@ -1996,7 +1996,7 @@ func (a *API) handleGetBoards(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetTemplates(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetTemplates(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID}/templates getTemplates
|
// swagger:operation GET /teams/{teamID}/templates getTemplates
|
||||||
//
|
//
|
||||||
// Returns team templates
|
// Returns team templates
|
||||||
//
|
//
|
||||||
@ -2072,7 +2072,7 @@ func (a *API) handleGetTemplates(w http.ResponseWriter, r *http.Request) {
|
|||||||
// subscriptions
|
// subscriptions
|
||||||
|
|
||||||
func (a *API) handleCreateSubscription(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleCreateSubscription(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/subscriptions createSubscription
|
// swagger:operation POST /subscriptions createSubscription
|
||||||
//
|
//
|
||||||
// Creates a subscription to a block for a user. The user will receive change notifications for the block.
|
// Creates a subscription to a block for a user. The user will receive change notifications for the block.
|
||||||
//
|
//
|
||||||
@ -2159,7 +2159,7 @@ func (a *API) handleCreateSubscription(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDeleteSubscription(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDeleteSubscription(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation DELETE /api/v1/subscriptions/{blockID}/{subscriberID} deleteSubscription
|
// swagger:operation DELETE /subscriptions/{blockID}/{subscriberID} deleteSubscription
|
||||||
//
|
//
|
||||||
// Deletes a subscription a user has for a a block. The user will no longer receive change notifications for the block.
|
// Deletes a subscription a user has for a a block. The user will no longer receive change notifications for the block.
|
||||||
//
|
//
|
||||||
@ -2221,7 +2221,7 @@ func (a *API) handleDeleteSubscription(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/subscriptions/{subscriberID} getSubscriptions
|
// swagger:operation GET /subscriptions/{subscriberID} getSubscriptions
|
||||||
//
|
//
|
||||||
// Gets subscriptions for a user.
|
// Gets subscriptions for a user.
|
||||||
//
|
//
|
||||||
@ -2286,7 +2286,7 @@ func (a *API) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleCreateBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleCreateBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards createBoard
|
// swagger:operation POST /boards createBoard
|
||||||
//
|
//
|
||||||
// Creates a new board
|
// Creates a new board
|
||||||
//
|
//
|
||||||
@ -2375,7 +2375,7 @@ func (a *API) handleCreateBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleOnboard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleOnboard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/team/{teamID}/onboard onboard
|
// swagger:operation POST /team/{teamID}/onboard onboard
|
||||||
//
|
//
|
||||||
// Onboards a user on Boards.
|
// Onboards a user on Boards.
|
||||||
//
|
//
|
||||||
@ -2427,7 +2427,7 @@ func (a *API) handleOnboard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID} getBoard
|
// swagger:operation GET /boards/{boardID} getBoard
|
||||||
//
|
//
|
||||||
// Returns a board
|
// Returns a board
|
||||||
//
|
//
|
||||||
@ -2508,7 +2508,7 @@ func (a *API) handleGetBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePatchBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePatchBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation PATCH /api/v1/boards/{boardID} patchBoard
|
// swagger:operation PATCH /boards/{boardID} patchBoard
|
||||||
//
|
//
|
||||||
// Partially updates a board
|
// Partially updates a board
|
||||||
//
|
//
|
||||||
@ -2613,7 +2613,7 @@ func (a *API) handlePatchBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDeleteBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDeleteBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation DELETE /api/v1/boards/{boardID} deleteBoard
|
// swagger:operation DELETE /boards/{boardID} deleteBoard
|
||||||
//
|
//
|
||||||
// Removes a board
|
// Removes a board
|
||||||
//
|
//
|
||||||
@ -2673,7 +2673,7 @@ func (a *API) handleDeleteBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDuplicateBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDuplicateBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/duplicate duplicateBoard
|
// swagger:operation POST /boards/{boardID}/duplicate duplicateBoard
|
||||||
//
|
//
|
||||||
// Returns the new created board and all the blocks
|
// Returns the new created board and all the blocks
|
||||||
//
|
//
|
||||||
@ -2765,7 +2765,7 @@ func (a *API) handleDuplicateBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDuplicateBlock(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDuplicateBlock(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards/{boardID}/blocks/{blockID}/duplicate duplicateBlock
|
// swagger:operation POST /boards/{boardID}/blocks/{blockID}/duplicate duplicateBlock
|
||||||
//
|
//
|
||||||
// Returns the new created blocks
|
// Returns the new created blocks
|
||||||
//
|
//
|
||||||
@ -2868,7 +2868,7 @@ func (a *API) handleDuplicateBlock(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetBoardMetadata(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetBoardMetadata(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID}/metadata getBoardMetadata
|
// swagger:operation GET /boards/{boardID}/metadata getBoardMetadata
|
||||||
//
|
//
|
||||||
// Returns a board's metadata
|
// Returns a board's metadata
|
||||||
//
|
//
|
||||||
@ -2943,7 +2943,7 @@ func (a *API) handleGetBoardMetadata(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleSearchBoards(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleSearchBoards(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID}/boards/search searchBoards
|
// swagger:operation GET /teams/{teamID}/boards/search searchBoards
|
||||||
//
|
//
|
||||||
// Returns the boards that match with a search term
|
// Returns the boards that match with a search term
|
||||||
//
|
//
|
||||||
@ -3019,7 +3019,7 @@ func (a *API) handleSearchBoards(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleGetMembersForBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleGetMembersForBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID}/members getMembersForBoard
|
// swagger:operation GET /boards/{boardID}/members getMembersForBoard
|
||||||
//
|
//
|
||||||
// Returns the members of the board
|
// Returns the members of the board
|
||||||
//
|
//
|
||||||
@ -3453,7 +3453,7 @@ func (a *API) handleUpdateMember(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDeleteMember(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDeleteMember(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation DELETE /api/v1/boards/{boardID}/members/{userID} deleteMember
|
// swagger:operation DELETE /boards/{boardID}/members/{userID} deleteMember
|
||||||
//
|
//
|
||||||
// Deletes a member from a board
|
// Deletes a member from a board
|
||||||
//
|
//
|
||||||
@ -3529,7 +3529,7 @@ func (a *API) handleDeleteMember(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleCreateBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleCreateBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/boards-and-blocks insertBoardsAndBlocks
|
// swagger:operation POST /boards-and-blocks insertBoardsAndBlocks
|
||||||
//
|
//
|
||||||
// Creates new boards and blocks
|
// Creates new boards and blocks
|
||||||
//
|
//
|
||||||
@ -3673,7 +3673,7 @@ func (a *API) handleCreateBoardsAndBlocks(w http.ResponseWriter, r *http.Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handlePatchBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handlePatchBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation PATCH /api/v1/boards-and-blocks patchBoardsAndBlocks
|
// swagger:operation PATCH /boards-and-blocks patchBoardsAndBlocks
|
||||||
//
|
//
|
||||||
// Patches a set of related boards and blocks
|
// Patches a set of related boards and blocks
|
||||||
//
|
//
|
||||||
@ -3811,7 +3811,7 @@ func (a *API) handlePatchBoardsAndBlocks(w http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleDeleteBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleDeleteBoardsAndBlocks(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation DELETE /api/v1/boards-and-blocks deleteBoardsAndBlocks
|
// swagger:operation DELETE /boards-and-blocks deleteBoardsAndBlocks
|
||||||
//
|
//
|
||||||
// Deletes boards and blocks
|
// Deletes boards and blocks
|
||||||
//
|
//
|
||||||
|
@ -17,7 +17,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (a *API) handleArchiveExportBoard(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleArchiveExportBoard(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/boards/{boardID}/archive/export archiveExportBoard
|
// swagger:operation GET /boards/{boardID}/archive/export archiveExportBoard
|
||||||
//
|
//
|
||||||
// Exports an archive of all blocks for one boards.
|
// Exports an archive of all blocks for one boards.
|
||||||
//
|
//
|
||||||
@ -85,7 +85,7 @@ func (a *API) handleArchiveExportBoard(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleArchiveExportTeam(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleArchiveExportTeam(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation GET /api/v1/teams/{teamID}/archive/export archiveExportTeam
|
// swagger:operation GET /teams/{teamID}/archive/export archiveExportTeam
|
||||||
//
|
//
|
||||||
// Exports an archive of all blocks for all the boards in a team.
|
// Exports an archive of all blocks for all the boards in a team.
|
||||||
//
|
//
|
||||||
@ -154,7 +154,7 @@ func (a *API) handleArchiveExportTeam(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleArchiveImport(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleArchiveImport(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/teams/{teamID}/archive/import archiveImport
|
// swagger:operation POST /teams/{teamID}/archive/import archiveImport
|
||||||
//
|
//
|
||||||
// Import an archive of boards.
|
// Import an archive of boards.
|
||||||
//
|
//
|
||||||
|
@ -139,7 +139,7 @@ func isValidPassword(password string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleLogin(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/login login
|
// swagger:operation POST /login login
|
||||||
//
|
//
|
||||||
// Login user
|
// Login user
|
||||||
//
|
//
|
||||||
@ -220,7 +220,7 @@ func (a *API) handleLogin(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleLogout(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleLogout(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/logout logout
|
// swagger:operation POST /logout logout
|
||||||
//
|
//
|
||||||
// Logout user
|
// Logout user
|
||||||
//
|
//
|
||||||
@ -271,7 +271,7 @@ func (a *API) handleLogout(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleRegister(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleRegister(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/register register
|
// swagger:operation POST /register register
|
||||||
//
|
//
|
||||||
// Register new user
|
// Register new user
|
||||||
//
|
//
|
||||||
@ -369,7 +369,7 @@ func (a *API) handleRegister(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) handleChangePassword(w http.ResponseWriter, r *http.Request) {
|
func (a *API) handleChangePassword(w http.ResponseWriter, r *http.Request) {
|
||||||
// swagger:operation POST /api/v1/users/{userID}/changepassword changePassword
|
// swagger:operation POST /users/{userID}/changepassword changePassword
|
||||||
//
|
//
|
||||||
// Change a user's password
|
// Change a user's password
|
||||||
//
|
//
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
APIURLSuffix = "/api/v1"
|
APIURLSuffix = "/api/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RequestReaderError struct {
|
type RequestReaderError struct {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
// Schemes: http, https
|
// Schemes: http, https
|
||||||
// Host: localhost
|
// Host: localhost
|
||||||
// BasePath: /api/v1
|
// BasePath: /api/v2
|
||||||
// Version: 1.0.0
|
// Version: 1.0.0
|
||||||
// License: Custom https://github.com/mattermost/focalboard/blob/main/LICENSE.txt
|
// License: Custom https://github.com/mattermost/focalboard/blob/main/LICENSE.txt
|
||||||
// Contact: Focalboard<api@focalboard.com> https://www.focalboard.com
|
// Contact: Focalboard<api@focalboard.com> https://www.focalboard.com
|
||||||
|
@ -34,7 +34,7 @@ Refer to the [Mattermost API documentation here](https://api.mattermost.com/#tag
|
|||||||
Pass this token as a bearer token to the Boards APIs, e.g.
|
Pass this token as a bearer token to the Boards APIs, e.g.
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -i -H "X-Requested-With: XMLHttpRequest" -H 'Authorization: Bearer abcdefghijklmnopqrstuvwxyz' https://community.mattermost.com/plugins/focalboard/api/v1/workspaces
|
curl -i -H "X-Requested-With: XMLHttpRequest" -H 'Authorization: Bearer abcdefghijklmnopqrstuvwxyz' https://community.mattermost.com/plugins/focalboard/api/v2/workspaces
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the `X-Requested-With: XMLHttpRequest` header is required to pass the CSRF check.
|
Note that the `X-Requested-With: XMLHttpRequest` header is required to pass the CSRF check.
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ import {UserConfigPatch} from '../../src/user'
|
|||||||
Cypress.Commands.add('apiRegisterUser', (data: Cypress.UserData, token?: string, failOnError?: boolean) => {
|
Cypress.Commands.add('apiRegisterUser', (data: Cypress.UserData, token?: string, failOnError?: boolean) => {
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/register',
|
url: '/api/v2/register',
|
||||||
body: {
|
body: {
|
||||||
...data,
|
...data,
|
||||||
token,
|
token,
|
||||||
@ -22,7 +22,7 @@ Cypress.Commands.add('apiRegisterUser', (data: Cypress.UserData, token?: string,
|
|||||||
Cypress.Commands.add('apiLoginUser', (data: Cypress.LoginData) => {
|
Cypress.Commands.add('apiLoginUser', (data: Cypress.LoginData) => {
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/login',
|
url: '/api/v2/login',
|
||||||
body: {
|
body: {
|
||||||
...data,
|
...data,
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
@ -55,7 +55,7 @@ Cypress.Commands.add('apiInitServer', () => {
|
|||||||
Cypress.Commands.add('apiDeleteBoard', (id: string) => {
|
Cypress.Commands.add('apiDeleteBoard', (id: string) => {
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: `/api/v1/boards/${encodeURIComponent(id)}`,
|
url: `/api/v2/boards/${encodeURIComponent(id)}`,
|
||||||
...headers(),
|
...headers(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -71,7 +71,7 @@ const deleteBoards = (ids: string[]) => {
|
|||||||
Cypress.Commands.add('apiResetBoards', () => {
|
Cypress.Commands.add('apiResetBoards', () => {
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/api/v1/teams/0/boards',
|
url: '/api/v2/teams/0/boards',
|
||||||
...headers(),
|
...headers(),
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (Array.isArray(response.body)) {
|
if (Array.isArray(response.body)) {
|
||||||
@ -91,7 +91,7 @@ Cypress.Commands.add('apiSkipTour', (userID: string) => {
|
|||||||
|
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: `/api/v1/users/${encodeURIComponent(userID)}/config`,
|
url: `/api/v2/users/${encodeURIComponent(userID)}/config`,
|
||||||
...headers(),
|
...headers(),
|
||||||
body,
|
body,
|
||||||
})
|
})
|
||||||
@ -100,7 +100,7 @@ Cypress.Commands.add('apiSkipTour', (userID: string) => {
|
|||||||
Cypress.Commands.add('apiGetMe', () => {
|
Cypress.Commands.add('apiGetMe', () => {
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/api/v1/users/me',
|
url: '/api/v2/users/me',
|
||||||
...headers(),
|
...headers(),
|
||||||
}).then((response) => response.body.id)
|
}).then((response) => response.body.id)
|
||||||
})
|
})
|
||||||
@ -109,7 +109,7 @@ Cypress.Commands.add('apiChangePassword', (userId: string, oldPassword: string,
|
|||||||
const body = {oldPassword, newPassword}
|
const body = {oldPassword, newPassword}
|
||||||
return cy.request({
|
return cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `/api/v1/users/${encodeURIComponent(userId)}/changepassword`,
|
url: `/api/v2/users/${encodeURIComponent(userId)}/changepassword`,
|
||||||
...headers(),
|
...headers(),
|
||||||
body,
|
body,
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async login(username: string, password: string): Promise<boolean> {
|
async login(username: string, password: string): Promise<boolean> {
|
||||||
const path = '/api/v1/login'
|
const path = '/api/v2/login'
|
||||||
const body = JSON.stringify({username, password, type: 'normal'})
|
const body = JSON.stringify({username, password, type: 'normal'})
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -81,7 +81,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logout(): Promise<boolean> {
|
async logout(): Promise<boolean> {
|
||||||
const path = '/api/v1/logout'
|
const path = '/api/v2/logout'
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -95,7 +95,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getClientConfig(): Promise<ClientConfig | null> {
|
async getClientConfig(): Promise<ClientConfig | null> {
|
||||||
const path = '/api/v1/clientConfig'
|
const path = '/api/v2/clientConfig'
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -109,7 +109,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async register(email: string, username: string, password: string, token?: string): Promise<{code: number, json: {error?: string}}> {
|
async register(email: string, username: string, password: string, token?: string): Promise<{code: number, json: {error?: string}}> {
|
||||||
const path = '/api/v1/register'
|
const path = '/api/v2/register'
|
||||||
const body = JSON.stringify({email, username, password, token})
|
const body = JSON.stringify({email, username, password, token})
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -121,7 +121,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async changePassword(userId: string, oldPassword: string, newPassword: string): Promise<{code: number, json: {error?: string}}> {
|
async changePassword(userId: string, oldPassword: string, newPassword: string): Promise<{code: number, json: {error?: string}}> {
|
||||||
const path = `/api/v1/users/${encodeURIComponent(userId)}/changepassword`
|
const path = `/api/v2/users/${encodeURIComponent(userId)}/changepassword`
|
||||||
const body = JSON.stringify({oldPassword, newPassword})
|
const body = JSON.stringify({oldPassword, newPassword})
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -148,15 +148,15 @@ class OctoClient {
|
|||||||
teamIdToUse = this.teamId === Constants.globalTeamId ? UserSettings.lastTeamId || this.teamId : this.teamId
|
teamIdToUse = this.teamId === Constants.globalTeamId ? UserSettings.lastTeamId || this.teamId : this.teamId
|
||||||
}
|
}
|
||||||
|
|
||||||
return `/api/v1/teams/${teamIdToUse}`
|
return `/api/v2/teams/${teamIdToUse}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private teamsPath(): string {
|
private teamsPath(): string {
|
||||||
return '/api/v1/teams'
|
return '/api/v2/teams'
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMe(): Promise<IUser | undefined> {
|
async getMe(): Promise<IUser | undefined> {
|
||||||
const path = '/api/v1/users/me'
|
const path = '/api/v2/users/me'
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return undefined
|
return undefined
|
||||||
@ -166,7 +166,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMyBoardMemberships(): Promise<BoardMember[]> {
|
async getMyBoardMemberships(): Promise<BoardMember[]> {
|
||||||
const path = '/api/v1/users/me/memberships'
|
const path = '/api/v2/users/me/memberships'
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return []
|
return []
|
||||||
@ -176,7 +176,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUser(userId: string): Promise<IUser | undefined> {
|
async getUser(userId: string): Promise<IUser | undefined> {
|
||||||
const path = `/api/v1/users/${encodeURIComponent(userId)}`
|
const path = `/api/v2/users/${encodeURIComponent(userId)}`
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return undefined
|
return undefined
|
||||||
@ -186,7 +186,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async patchUserConfig(userID: string, patch: UserConfigPatch): Promise<Record<string, string> | undefined> {
|
async patchUserConfig(userID: string, patch: UserConfigPatch): Promise<Record<string, string> | undefined> {
|
||||||
const path = `/api/v1/users/${encodeURIComponent(userID)}/config`
|
const path = `/api/v2/users/${encodeURIComponent(userID)}/config`
|
||||||
const body = JSON.stringify(patch)
|
const body = JSON.stringify(patch)
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -202,12 +202,12 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async exportBoardArchive(boardID: string): Promise<Response> {
|
async exportBoardArchive(boardID: string): Promise<Response> {
|
||||||
const path = `/api/v1/boards/${boardID}/archive/export`
|
const path = `/api/v2/boards/${boardID}/archive/export`
|
||||||
return fetch(this.getBaseURL() + path, {headers: this.headers()})
|
return fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
}
|
}
|
||||||
|
|
||||||
async exportFullArchive(teamID: string): Promise<Response> {
|
async exportFullArchive(teamID: string): Promise<Response> {
|
||||||
const path = `/api/v1/teams/${teamID}/archive/export`
|
const path = `/api/v2/teams/${teamID}/archive/export`
|
||||||
return fetch(this.getBaseURL() + path, {headers: this.headers()})
|
return fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBlocksWithBlockID(blockID: string, boardID: string, optionalReadToken?: string): Promise<Block[]> {
|
async getBlocksWithBlockID(blockID: string, boardID: string, optionalReadToken?: string): Promise<Block[]> {
|
||||||
let path = `/api/v1/boards/${boardID}/blocks?block_id=${blockID}`
|
let path = `/api/v2/boards/${boardID}/blocks?block_id=${blockID}`
|
||||||
const readToken = optionalReadToken || Utils.getReadToken()
|
const readToken = optionalReadToken || Utils.getReadToken()
|
||||||
if (readToken) {
|
if (readToken) {
|
||||||
path += `&read_token=${readToken}`
|
path += `&read_token=${readToken}`
|
||||||
@ -252,7 +252,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAllBlocks(boardID: string): Promise<Block[]> {
|
async getAllBlocks(boardID: string): Promise<Block[]> {
|
||||||
let path = `/api/v1/boards/${boardID}/blocks?all=true`
|
let path = `/api/v2/boards/${boardID}/blocks?all=true`
|
||||||
const readToken = Utils.getReadToken()
|
const readToken = Utils.getReadToken()
|
||||||
if (readToken) {
|
if (readToken) {
|
||||||
path += `&read_token=${readToken}`
|
path += `&read_token=${readToken}`
|
||||||
@ -301,7 +301,7 @@ class OctoClient {
|
|||||||
async patchBlock(boardId: string, blockId: string, blockPatch: BlockPatch): Promise<Response> {
|
async patchBlock(boardId: string, blockId: string, blockPatch: BlockPatch): Promise<Response> {
|
||||||
Utils.log(`patchBlock: ${blockId} block`)
|
Utils.log(`patchBlock: ${blockId} block`)
|
||||||
const body = JSON.stringify(blockPatch)
|
const body = JSON.stringify(blockPatch)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}/blocks/${blockId}`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}/blocks/${blockId}`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -324,7 +324,7 @@ class OctoClient {
|
|||||||
|
|
||||||
async deleteBlock(boardId: string, blockId: string): Promise<Response> {
|
async deleteBlock(boardId: string, blockId: string): Promise<Response> {
|
||||||
Utils.log(`deleteBlock: ${blockId} on board ${boardId}`)
|
Utils.log(`deleteBlock: ${blockId} on board ${boardId}`)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}/blocks/${encodeURIComponent(blockId)}`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}/blocks/${encodeURIComponent(blockId)}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
@ -332,7 +332,7 @@ class OctoClient {
|
|||||||
|
|
||||||
async undeleteBlock(boardId: string, blockId: string): Promise<Response> {
|
async undeleteBlock(boardId: string, blockId: string): Promise<Response> {
|
||||||
Utils.log(`undeleteBlock: ${blockId}`)
|
Utils.log(`undeleteBlock: ${blockId}`)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${encodeURIComponent(boardId)}/blocks/${encodeURIComponent(blockId)}/undelete`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${encodeURIComponent(boardId)}/blocks/${encodeURIComponent(blockId)}/undelete`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
@ -340,7 +340,7 @@ class OctoClient {
|
|||||||
|
|
||||||
async undeleteBoard(boardId: string): Promise<Response> {
|
async undeleteBoard(boardId: string): Promise<Response> {
|
||||||
Utils.log(`undeleteBoard: ${boardId}`)
|
Utils.log(`undeleteBoard: ${boardId}`)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}/undelete`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}/undelete`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
@ -354,7 +354,7 @@ class OctoClient {
|
|||||||
subscriberId: userId,
|
subscriberId: userId,
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(this.getBaseURL() + '/api/v1/subscriptions', {
|
return fetch(this.getBaseURL() + '/api/v2/subscriptions', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
@ -362,7 +362,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async unfollowBlock(blockId: string, blockType: string, userId: string): Promise<Response> {
|
async unfollowBlock(blockId: string, blockType: string, userId: string): Promise<Response> {
|
||||||
return fetch(this.getBaseURL() + `/api/v1/subscriptions/${blockId}/${userId}`, {
|
return fetch(this.getBaseURL() + `/api/v2/subscriptions/${blockId}/${userId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
@ -378,7 +378,7 @@ class OctoClient {
|
|||||||
Utils.log(`\t ${block.type}, ${block.id}, ${block.title?.substr(0, 50) || ''}`)
|
Utils.log(`\t ${block.type}, ${block.id}, ${block.title?.substr(0, 50) || ''}`)
|
||||||
})
|
})
|
||||||
const body = JSON.stringify(blocks)
|
const body = JSON.stringify(blocks)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}/blocks` + (sourceBoardID ? `?sourceBoardID=${encodeURIComponent(sourceBoardID)}` : ''), {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}/blocks` + (sourceBoardID ? `?sourceBoardID=${encodeURIComponent(sourceBoardID)}` : ''), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -395,7 +395,7 @@ class OctoClient {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const body = JSON.stringify(bab)
|
const body = JSON.stringify(bab)
|
||||||
return fetch(this.getBaseURL() + '/api/v1/boards-and-blocks', {
|
return fetch(this.getBaseURL() + '/api/v2/boards-and-blocks', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -408,7 +408,7 @@ class OctoClient {
|
|||||||
Utils.log(`\t Blocks ${blockIds.join(', ')}`)
|
Utils.log(`\t Blocks ${blockIds.join(', ')}`)
|
||||||
|
|
||||||
const body = JSON.stringify({boards: boardIds, blocks: blockIds})
|
const body = JSON.stringify({boards: boardIds, blocks: blockIds})
|
||||||
return fetch(this.getBaseURL() + '/api/v1/boards-and-blocks', {
|
return fetch(this.getBaseURL() + '/api/v2/boards-and-blocks', {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -420,7 +420,7 @@ class OctoClient {
|
|||||||
Utils.log(`createBoardMember: user ${member.userId} and board ${member.boardId}`)
|
Utils.log(`createBoardMember: user ${member.userId} and board ${member.boardId}`)
|
||||||
|
|
||||||
const body = JSON.stringify(member)
|
const body = JSON.stringify(member)
|
||||||
const response = await fetch(this.getBaseURL() + `/api/v1/boards/${member.boardId}/members`, {
|
const response = await fetch(this.getBaseURL() + `/api/v2/boards/${member.boardId}/members`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -436,7 +436,7 @@ class OctoClient {
|
|||||||
async joinBoard(boardId: string): Promise<BoardMember|undefined> {
|
async joinBoard(boardId: string): Promise<BoardMember|undefined> {
|
||||||
Utils.log(`joinBoard: board ${boardId}`)
|
Utils.log(`joinBoard: board ${boardId}`)
|
||||||
|
|
||||||
const response = await fetch(this.getBaseURL() + `/api/v1/boards/${boardId}/join`, {
|
const response = await fetch(this.getBaseURL() + `/api/v2/boards/${boardId}/join`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers()
|
headers: this.headers()
|
||||||
})
|
})
|
||||||
@ -452,7 +452,7 @@ class OctoClient {
|
|||||||
Utils.log(`udpateBoardMember: user ${member.userId} and board ${member.boardId}`)
|
Utils.log(`udpateBoardMember: user ${member.userId} and board ${member.boardId}`)
|
||||||
|
|
||||||
const body = JSON.stringify(member)
|
const body = JSON.stringify(member)
|
||||||
return fetch(this.getBaseURL() + `/api/v1/boards/${member.boardId}/members/${member.userId}`, {
|
return fetch(this.getBaseURL() + `/api/v2/boards/${member.boardId}/members/${member.userId}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -462,7 +462,7 @@ class OctoClient {
|
|||||||
async deleteBoardMember(member: BoardMember): Promise<Response> {
|
async deleteBoardMember(member: BoardMember): Promise<Response> {
|
||||||
Utils.log(`deleteBoardMember: user ${member.userId} and board ${member.boardId}`)
|
Utils.log(`deleteBoardMember: user ${member.userId} and board ${member.boardId}`)
|
||||||
|
|
||||||
return fetch(this.getBaseURL() + `/api/v1/boards/${member.boardId}/members/${member.userId}`, {
|
return fetch(this.getBaseURL() + `/api/v2/boards/${member.boardId}/members/${member.userId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
@ -474,7 +474,7 @@ class OctoClient {
|
|||||||
Utils.log(`\t Blocks ${babp.blockIDs.join(', ')}`)
|
Utils.log(`\t Blocks ${babp.blockIDs.join(', ')}`)
|
||||||
|
|
||||||
const body = JSON.stringify(babp)
|
const body = JSON.stringify(babp)
|
||||||
return fetch(this.getBaseURL() + '/api/v1/boards-and-blocks', {
|
return fetch(this.getBaseURL() + '/api/v2/boards-and-blocks', {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -483,7 +483,7 @@ class OctoClient {
|
|||||||
|
|
||||||
// Sharing
|
// Sharing
|
||||||
async getSharing(boardID: string): Promise<ISharing | undefined> {
|
async getSharing(boardID: string): Promise<ISharing | undefined> {
|
||||||
const path = `/api/v1/boards/${boardID}/sharing`
|
const path = `/api/v2/boards/${boardID}/sharing`
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return undefined
|
return undefined
|
||||||
@ -492,7 +492,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async setSharing(boardID: string, sharing: ISharing): Promise<boolean> {
|
async setSharing(boardID: string, sharing: ISharing): Promise<boolean> {
|
||||||
const path = `/api/v1/boards/${boardID}/sharing`
|
const path = `/api/v2/boards/${boardID}/sharing`
|
||||||
const body = JSON.stringify(sharing)
|
const body = JSON.stringify(sharing)
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
this.getBaseURL() + path,
|
this.getBaseURL() + path,
|
||||||
@ -557,7 +557,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getFileAsDataUrl(boardId: string, fileId: string): Promise<string> {
|
async getFileAsDataUrl(boardId: string, fileId: string): Promise<string> {
|
||||||
let path = '/api/v1/files/teams/' + this.teamId + '/' + boardId + '/' + fileId
|
let path = '/api/v2/files/teams/' + this.teamId + '/' + boardId + '/' + fileId
|
||||||
const readToken = Utils.getReadToken()
|
const readToken = Utils.getReadToken()
|
||||||
if (readToken) {
|
if (readToken) {
|
||||||
path += `?read_token=${readToken}`
|
path += `?read_token=${readToken}`
|
||||||
@ -627,7 +627,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBoard(boardID: string): Promise<Board | undefined> {
|
async getBoard(boardID: string): Promise<Board | undefined> {
|
||||||
let path = `/api/v1/boards/${boardID}`
|
let path = `/api/v2/boards/${boardID}`
|
||||||
const readToken = Utils.getReadToken()
|
const readToken = Utils.getReadToken()
|
||||||
if (readToken) {
|
if (readToken) {
|
||||||
path += `?read_token=${readToken}`
|
path += `?read_token=${readToken}`
|
||||||
@ -653,7 +653,7 @@ class OctoClient {
|
|||||||
query += `&toTeam=${encodeURIComponent(toTeam)}`
|
query += `&toTeam=${encodeURIComponent(toTeam)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = `/api/v1/boards/${boardID}/duplicate${query}`
|
const path = `/api/v2/boards/${boardID}/duplicate${query}`
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -671,7 +671,7 @@ class OctoClient {
|
|||||||
if (asTemplate) {
|
if (asTemplate) {
|
||||||
query = '?asTemplate=true'
|
query = '?asTemplate=true'
|
||||||
}
|
}
|
||||||
const path = `/api/v1/boards/${boardID}/blocks/${blockID}/duplicate${query}`
|
const path = `/api/v2/boards/${boardID}/blocks/${blockID}/duplicate${query}`
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -690,7 +690,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBoardMembers(teamId: string, boardId: string): Promise<BoardMember[]> {
|
async getBoardMembers(teamId: string, boardId: string): Promise<BoardMember[]> {
|
||||||
const path = `/api/v1/boards/${boardId}/members`
|
const path = `/api/v2/boards/${boardId}/members`
|
||||||
return this.getBoardMembersWithPath(path)
|
return this.getBoardMembersWithPath(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,7 +706,7 @@ class OctoClient {
|
|||||||
async patchBoard(boardId: string, boardPatch: BoardPatch): Promise<Response> {
|
async patchBoard(boardId: string, boardPatch: BoardPatch): Promise<Response> {
|
||||||
Utils.log(`patchBoard: ${boardId} board`)
|
Utils.log(`patchBoard: ${boardId} board`)
|
||||||
const body = JSON.stringify(boardPatch)
|
const body = JSON.stringify(boardPatch)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
body,
|
body,
|
||||||
@ -715,14 +715,14 @@ class OctoClient {
|
|||||||
|
|
||||||
async deleteBoard(boardId: string): Promise<Response> {
|
async deleteBoard(boardId: string): Promise<Response> {
|
||||||
Utils.log(`deleteBoard: ${boardId}`)
|
Utils.log(`deleteBoard: ${boardId}`)
|
||||||
return fetch(`${this.getBaseURL()}/api/v1/boards/${boardId}`, {
|
return fetch(`${this.getBaseURL()}/api/v2/boards/${boardId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSidebarCategories(teamID: string): Promise<Array<CategoryBlocks>> {
|
async getSidebarCategories(teamID: string): Promise<Array<CategoryBlocks>> {
|
||||||
const path = `/api/v1/teams/${teamID}/categories`
|
const path = `/api/v2/teams/${teamID}/categories`
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return []
|
return []
|
||||||
@ -732,7 +732,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createSidebarCategory(category: Category): Promise<Response> {
|
async createSidebarCategory(category: Category): Promise<Response> {
|
||||||
const path = `/api/v1/teams/${category.teamID}/categories`
|
const path = `/api/v2/teams/${category.teamID}/categories`
|
||||||
const body = JSON.stringify(category)
|
const body = JSON.stringify(category)
|
||||||
return fetch(this.getBaseURL() + path, {
|
return fetch(this.getBaseURL() + path, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -742,7 +742,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteSidebarCategory(teamID: string, categoryID: string): Promise<Response> {
|
async deleteSidebarCategory(teamID: string, categoryID: string): Promise<Response> {
|
||||||
const url = `/api/v1/teams/${teamID}/categories/${categoryID}`
|
const url = `/api/v2/teams/${teamID}/categories/${categoryID}`
|
||||||
return fetch(this.getBaseURL() + url, {
|
return fetch(this.getBaseURL() + url, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
@ -750,7 +750,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateSidebarCategory(category: Category): Promise<Response> {
|
async updateSidebarCategory(category: Category): Promise<Response> {
|
||||||
const path = `/api/v1/teams/${category.teamID}/categories/${category.id}`
|
const path = `/api/v2/teams/${category.teamID}/categories/${category.id}`
|
||||||
const body = JSON.stringify(category)
|
const body = JSON.stringify(category)
|
||||||
return fetch(this.getBaseURL() + path, {
|
return fetch(this.getBaseURL() + path, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
@ -760,7 +760,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async moveBlockToCategory(teamID: string, blockID: string, toCategoryID: string, fromCategoryID: string): Promise<Response> {
|
async moveBlockToCategory(teamID: string, blockID: string, toCategoryID: string, fromCategoryID: string): Promise<Response> {
|
||||||
const url = `/api/v1/teams/${teamID}/categories/${toCategoryID || '0'}/blocks/${blockID}`
|
const url = `/api/v2/teams/${teamID}/categories/${toCategoryID || '0'}/blocks/${blockID}`
|
||||||
const payload = {
|
const payload = {
|
||||||
fromCategoryID,
|
fromCategoryID,
|
||||||
}
|
}
|
||||||
@ -788,7 +788,7 @@ class OctoClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUserBlockSubscriptions(userId: string): Promise<Array<Subscription>> {
|
async getUserBlockSubscriptions(userId: string): Promise<Array<Subscription>> {
|
||||||
const path = `/api/v1/subscriptions/${userId}`
|
const path = `/api/v2/subscriptions/${userId}`
|
||||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
return []
|
return []
|
||||||
@ -799,7 +799,7 @@ class OctoClient {
|
|||||||
|
|
||||||
// onboarding
|
// onboarding
|
||||||
async prepareOnboarding(teamId: string): Promise<PrepareOnboardingResponse | undefined> {
|
async prepareOnboarding(teamId: string): Promise<PrepareOnboardingResponse | undefined> {
|
||||||
const path = `/api/v1/teams/${teamId}/onboard`
|
const path = `/api/v2/teams/${teamId}/onboard`
|
||||||
const response = await fetch(this.getBaseURL() + path, {
|
const response = await fetch(this.getBaseURL() + path, {
|
||||||
headers: this.headers(),
|
headers: this.headers(),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -40,7 +40,7 @@ if [[ $# < 2 ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl --unix-socket /var/tmp/focalboard_local.socket http://localhost/api/v1/admin/users/$1/password -X POST -H 'Content-Type: application/json' -d '{ "password": "'$2'" }'
|
curl --unix-socket /var/tmp/focalboard_local.socket http://localhost/api/v2/admin/users/$1/password -X POST -H 'Content-Type: application/json' -d '{ "password": "'$2'" }'
|
||||||
```
|
```
|
||||||
|
|
||||||
After resetting a user's password (e.g. if they forgot it), direct them to change it from the user menu, by clicking on their username at the top of the sidebar.
|
After resetting a user's password (e.g. if they forgot it), direct them to change it from the user menu, by clicking on their username at the top of the sidebar.
|
||||||
|
Loading…
Reference in New Issue
Block a user