Skip to content

Commit

Permalink
Update focalboard endpoints to v2 namespace (#2781)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdelacroix committed Apr 13, 2022
1 parent 42d24d2 commit 4c61ae9
Show file tree
Hide file tree
Showing 13 changed files with 15,425 additions and 3,986 deletions.
2 changes: 1 addition & 1 deletion experiments/webext/src/utils/networking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare global {
}

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',
'headers': {
'Accept': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion server/admin-scripts/reset-password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [[ $# < 2 ]] ; then
exit 1
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'" }'
194 changes: 97 additions & 97 deletions server/api/api.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions server/api/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
)

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.
//
Expand Down Expand Up @@ -85,7 +85,7 @@ func (a *API) handleArchiveExportBoard(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.
//
Expand Down Expand Up @@ -154,7 +154,7 @@ func (a *API) handleArchiveExportTeam(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.
//
Expand Down
8 changes: 4 additions & 4 deletions server/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func isValidPassword(password string) error {
}

func (a *API) handleLogin(w http.ResponseWriter, r *http.Request) {
// swagger:operation POST /api/v1/login login
// swagger:operation POST /login login
//
// Login user
//
Expand Down Expand Up @@ -220,7 +220,7 @@ func (a *API) handleLogin(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
//
Expand Down Expand Up @@ -271,7 +271,7 @@ func (a *API) handleLogout(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
//
Expand Down Expand Up @@ -369,7 +369,7 @@ func (a *API) handleRegister(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
//
Expand Down
2 changes: 1 addition & 1 deletion server/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

const (
APIURLSuffix = "/api/v1"
APIURLSuffix = "/api/v2"
)

type RequestReaderError struct {
Expand Down
2 changes: 1 addition & 1 deletion server/main/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Schemes: http, https
// Host: localhost
// BasePath: /api/v1
// BasePath: /api/v2
// Version: 1.0.0
// License: Custom https://github.com/mattermost/focalboard/blob/main/LICENSE.txt
// Contact: Focalboard<api@focalboard.com> https://www.focalboard.com
Expand Down
2 changes: 1 addition & 1 deletion server/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

```
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.
Expand Down
Loading

0 comments on commit 4c61ae9

Please sign in to comment.