Move API Reference (#23777)
* merge mattermost-api-reference unchanged * api: update repostiory paths * api: drop GitPod for api (for now) * api: improved node_modules target * api: relocate GitHub actions to root * Update .github/workflows/api.yml Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com> * fix cache-dependency-path * adopt node-version-file * pin versions for uses * tidy steps/runs * api/.gitpod.yml: tidy * api: rm now unused .gitlab-ci.yml --------- Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3f99b7618d
Коммит
d9614cbb12
129
api/v4/source/brand.yaml
Обычный файл
129
api/v4/source/brand.yaml
Обычный файл
@@ -0,0 +1,129 @@
|
||||
/api/v4/brand/image:
|
||||
get:
|
||||
tags:
|
||||
- brand
|
||||
summary: Get brand image
|
||||
description: >
|
||||
Get the previously uploaded brand image. Returns 404 if no brand image
|
||||
has been uploaded.
|
||||
|
||||
##### Permissions
|
||||
|
||||
No permission required.
|
||||
operationId: GetBrandImage
|
||||
responses:
|
||||
"200":
|
||||
description: Brand image retrieval successful
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
"501":
|
||||
$ref: "#/components/responses/NotImplemented"
|
||||
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")
|
||||
|
||||
// GetBrandImage
|
||||
img, err := Client.GetBrandImage()
|
||||
post:
|
||||
tags:
|
||||
- brand
|
||||
summary: Upload brand image
|
||||
description: |
|
||||
Uploads a brand image.
|
||||
##### Permissions
|
||||
Must have `manage_system` permission.
|
||||
operationId: UploadBrandImage
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
image:
|
||||
description: The image to be uploaded
|
||||
type: string
|
||||
format: binary
|
||||
required:
|
||||
- image
|
||||
responses:
|
||||
"201":
|
||||
description: Brand image upload successful
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/StatusOK"
|
||||
"400":
|
||||
$ref: "#/components/responses/BadRequest"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"413":
|
||||
$ref: "#/components/responses/TooLarge"
|
||||
"501":
|
||||
$ref: "#/components/responses/NotImplemented"
|
||||
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")
|
||||
|
||||
file, err := os.Open("<Your image>")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
data := &bytes.Buffer{}
|
||||
if _, err := io.Copy(data, file); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ok, resp := Client.UploadBrandImage(data.Bytes())
|
||||
delete:
|
||||
tags:
|
||||
- brand
|
||||
summary: Delete current brand image
|
||||
description: >
|
||||
Deletes the previously uploaded brand image. Returns 404 if no brand
|
||||
image has been uploaded.
|
||||
|
||||
##### Permissions
|
||||
|
||||
Must have `manage_system` permission.
|
||||
|
||||
__Minimum server version: 5.6__
|
||||
operationId: DeleteBrandImage
|
||||
responses:
|
||||
"200":
|
||||
description: Brand image succesfully deleted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/StatusOK"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
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")
|
||||
|
||||
// Delete brand image
|
||||
resp := Client.DeleteBrandImage()
|
||||
Ссылка в новой задаче
Block a user