Updated API Code Samples (#24141)
* api: remove PHP code samples * api: remove Curl code samples * api: remove Go code samples * link out to marketplace exclusively for community-built drivers * absolute path to V4_SRC * programmatically extract x-codeSamples * initial batch of examples * Update api/server/main.go Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * Update api/server/main.go Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * Update api/server/main.go Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * updated examples --------- Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
72b648cf81
Коммит
885802eae7
@@ -21,18 +21,6 @@
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalServerError"
|
||||
x-code-samples:
|
||||
- lang: Go
|
||||
source: >
|
||||
import "github.com/mattermost/mattermost-server/v5/model"
|
||||
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
|
||||
Client.Login("email@domain.com", "Password1")
|
||||
|
||||
exports, response := Client.ListExports()
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl 'http://localhost:8065/api/v4/exports' \
|
||||
-H 'Authorization: Bearer 9kg8nqrnxprd9jbykqeg4r51hw'
|
||||
"/api/v4/exports/{export_name}":
|
||||
get:
|
||||
tags:
|
||||
@@ -66,26 +54,6 @@
|
||||
$ref: "#/components/responses/NotFound"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalServerError"
|
||||
x-code-samples:
|
||||
- lang: Go
|
||||
source: |
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
}
|
||||
|
||||
|
||||
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
|
||||
Client.Login("email@domain.com", "Password1")
|
||||
|
||||
outFile, _ := os.Create("export.zip")
|
||||
|
||||
n, response := Client.DownloadExport("export.zip", outFile, 0)
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl 'http://localhost:8065/api/v4/exports/export.zip' \
|
||||
-H 'Authorization: Bearer 9kg8nqrnxprd9jbykqeg4r51hw'
|
||||
delete:
|
||||
tags:
|
||||
- exports
|
||||
@@ -116,17 +84,3 @@
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalServerError"
|
||||
x-code-samples:
|
||||
- lang: Go
|
||||
source: |
|
||||
import "github.com/mattermost/mattermost-server/v5/model"
|
||||
|
||||
|
||||
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
|
||||
Client.Login("email@domain.com", "Password1")
|
||||
|
||||
ok, response := Client.DeleteExport("export.zip")
|
||||
- lang: Curl
|
||||
source: |
|
||||
curl -X DELETE 'http://localhost:8065/api/v4/exports/export.zip' \
|
||||
-H 'Authorization: Bearer 9kg8nqrnxprd9jbykqeg4r51hw'
|
||||
|
||||
Ссылка в новой задаче
Block a user