|
|
@ -1,4 +1,5 @@
|
|
|
|
# Copyright 2016 OpenMarket Ltd
|
|
|
|
# Copyright 2016 OpenMarket Ltd
|
|
|
|
|
|
|
|
# Copyright 2019 The Matrix.org Foundation C.I.C.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
@ -58,66 +59,41 @@ paths:
|
|
|
|
format: byte
|
|
|
|
format: byte
|
|
|
|
responses:
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
200:
|
|
|
|
description: The MXC URI for the uploaded content.
|
|
|
|
description: The `MXC URI`_ for the uploaded content.
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
type: object
|
|
|
|
required: ["content_uri"]
|
|
|
|
required: ["content_uri"]
|
|
|
|
properties:
|
|
|
|
properties:
|
|
|
|
content_uri:
|
|
|
|
content_uri:
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
description: "The MXC URI to the uploaded content."
|
|
|
|
description: "The `MXC URI`_ to the uploaded content."
|
|
|
|
examples:
|
|
|
|
examples:
|
|
|
|
application/json: {
|
|
|
|
application/json: {
|
|
|
|
"content_uri": "mxc://example.com/AQwafuaFswefuhsfAFAgsw"
|
|
|
|
"content_uri": "mxc://example.com/AQwafuaFswefuhsfAFAgsw"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
429:
|
|
|
|
403:
|
|
|
|
description: This request was rate-limited.
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The user does not have permission to upload the content. Some reasons for this error include:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- The server does not permit the file type.
|
|
|
|
|
|
|
|
- The user has reached a quota for uploaded content.
|
|
|
|
|
|
|
|
examples:
|
|
|
|
|
|
|
|
application/json: {
|
|
|
|
|
|
|
|
"errcode": "M_FORBIDDEN",
|
|
|
|
|
|
|
|
"error": "Cannot upload this content"
|
|
|
|
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
|
"$ref": "definitions/errors/rate_limited.yaml"
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
tags:
|
|
|
|
413:
|
|
|
|
- Media
|
|
|
|
description: |-
|
|
|
|
"/download/{serverName}/{mediaId}":
|
|
|
|
The uploaded content is too large for the server.
|
|
|
|
get:
|
|
|
|
examples:
|
|
|
|
summary: "Download content from the content repository."
|
|
|
|
application/json: {
|
|
|
|
operationId: getContent
|
|
|
|
"errcode": "M_TOO_LARGE",
|
|
|
|
produces: ["*/*"]
|
|
|
|
"error": "Cannot upload files larger than 100mb"
|
|
|
|
parameters:
|
|
|
|
}
|
|
|
|
- in: path
|
|
|
|
|
|
|
|
type: string
|
|
|
|
|
|
|
|
name: serverName
|
|
|
|
|
|
|
|
x-example: matrix.org
|
|
|
|
|
|
|
|
required: true
|
|
|
|
|
|
|
|
description: |
|
|
|
|
|
|
|
|
The server name from the ``mxc://`` URI (the authoritory component)
|
|
|
|
|
|
|
|
- in: path
|
|
|
|
|
|
|
|
type: string
|
|
|
|
|
|
|
|
name: mediaId
|
|
|
|
|
|
|
|
x-example: ascERGshawAWawugaAcauga
|
|
|
|
|
|
|
|
required: true
|
|
|
|
|
|
|
|
description: |
|
|
|
|
|
|
|
|
The media ID from the ``mxc://`` URI (the path component)
|
|
|
|
|
|
|
|
- in: query
|
|
|
|
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
name: allow_remote
|
|
|
|
|
|
|
|
x-example: false
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: true
|
|
|
|
|
|
|
|
description: |
|
|
|
|
|
|
|
|
Indicates to the server that it should not attempt to fetch the media if it is deemed
|
|
|
|
|
|
|
|
remote. This is to prevent routing loops where the server contacts itself. Defaults to
|
|
|
|
|
|
|
|
true if not provided.
|
|
|
|
|
|
|
|
responses:
|
|
|
|
|
|
|
|
200:
|
|
|
|
|
|
|
|
description: "The content that was previously uploaded."
|
|
|
|
|
|
|
|
headers:
|
|
|
|
|
|
|
|
Content-Type:
|
|
|
|
|
|
|
|
description: "The content type of the file that was previously uploaded."
|
|
|
|
|
|
|
|
type: "string"
|
|
|
|
|
|
|
|
Content-Disposition:
|
|
|
|
|
|
|
|
description: "The name of the file that was previously uploaded, if set."
|
|
|
|
|
|
|
|
type: "string"
|
|
|
|
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
|
type: file
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
429:
|
|
|
|
429:
|
|
|
|
description: This request was rate-limited.
|
|
|
|
description: This request was rate-limited.
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
@ -126,8 +102,8 @@ paths:
|
|
|
|
- Media
|
|
|
|
- Media
|
|
|
|
"/download/{serverName}/{mediaId}/{fileName}":
|
|
|
|
"/download/{serverName}/{mediaId}/{fileName}":
|
|
|
|
get:
|
|
|
|
get:
|
|
|
|
summary: "Download content from the content repository as a given filename."
|
|
|
|
summary: "Download content from the content repository."
|
|
|
|
operationId: getContentOverrideName
|
|
|
|
operationId: getContent
|
|
|
|
produces: ["*/*"]
|
|
|
|
produces: ["*/*"]
|
|
|
|
parameters:
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
- in: path
|
|
|
@ -148,9 +124,7 @@ paths:
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
name: fileName
|
|
|
|
name: fileName
|
|
|
|
x-example: filename.jpg
|
|
|
|
x-example: filename.jpg
|
|
|
|
required: true
|
|
|
|
description: An optional filename to give in the ``Content-Disposition`` header.
|
|
|
|
description: |
|
|
|
|
|
|
|
|
The filename to give in the Content-Disposition
|
|
|
|
|
|
|
|
- in: query
|
|
|
|
- in: query
|
|
|
|
type: boolean
|
|
|
|
type: boolean
|
|
|
|
name: allow_remote
|
|
|
|
name: allow_remote
|
|
|
@ -169,10 +143,24 @@ paths:
|
|
|
|
description: "The content type of the file that was previously uploaded."
|
|
|
|
description: "The content type of the file that was previously uploaded."
|
|
|
|
type: "string"
|
|
|
|
type: "string"
|
|
|
|
Content-Disposition:
|
|
|
|
Content-Disposition:
|
|
|
|
description: "The name of file given in the request"
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The ``fileName`` requested or the name of the file that was previously
|
|
|
|
|
|
|
|
uploaded, if set.
|
|
|
|
type: "string"
|
|
|
|
type: "string"
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
|
type: file
|
|
|
|
type: file
|
|
|
|
|
|
|
|
# This is a workaround for us not being able to say the response is required.
|
|
|
|
|
|
|
|
description: "**Required.** The bytes for the uploaded file."
|
|
|
|
|
|
|
|
502:
|
|
|
|
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The content is too large for the server to serve.
|
|
|
|
|
|
|
|
examples:
|
|
|
|
|
|
|
|
application/json: {
|
|
|
|
|
|
|
|
"errcode": "M_TOO_LARGE",
|
|
|
|
|
|
|
|
"error": "Content is too large to serve"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
schema:
|
|
|
|
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
429:
|
|
|
|
429:
|
|
|
|
description: This request was rate-limited.
|
|
|
|
description: This request was rate-limited.
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
@ -181,7 +169,9 @@ paths:
|
|
|
|
- Media
|
|
|
|
- Media
|
|
|
|
"/thumbnail/{serverName}/{mediaId}":
|
|
|
|
"/thumbnail/{serverName}/{mediaId}":
|
|
|
|
get:
|
|
|
|
get:
|
|
|
|
summary: "Download a thumbnail of the content from the content repository."
|
|
|
|
summary: |-
|
|
|
|
|
|
|
|
Download a thumbnail of content from the content repository. See the `thumbnailing <#thumbnails>`_
|
|
|
|
|
|
|
|
section for more information.
|
|
|
|
operationId: getContentThumbnail
|
|
|
|
operationId: getContentThumbnail
|
|
|
|
produces: ["image/jpeg", "image/png"]
|
|
|
|
produces: ["image/jpeg", "image/png"]
|
|
|
|
parameters:
|
|
|
|
parameters:
|
|
|
@ -189,7 +179,7 @@ paths:
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
name: serverName
|
|
|
|
name: serverName
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
x-example: matrix.org
|
|
|
|
x-example: example.org
|
|
|
|
description: |
|
|
|
|
description: |
|
|
|
|
The server name from the ``mxc://`` URI (the authoritory component)
|
|
|
|
The server name from the ``mxc://`` URI (the authoritory component)
|
|
|
|
- in: path
|
|
|
|
- in: path
|
|
|
@ -205,22 +195,24 @@ paths:
|
|
|
|
name: width
|
|
|
|
name: width
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
description: |-
|
|
|
|
description: |-
|
|
|
|
The *desired* width of the thumbnail. The actual thumbnail may not
|
|
|
|
The *desired* width of the thumbnail. The actual thumbnail may be
|
|
|
|
match the size specified.
|
|
|
|
larger than the size specified.
|
|
|
|
- in: query
|
|
|
|
- in: query
|
|
|
|
type: integer
|
|
|
|
type: integer
|
|
|
|
x-example: 64
|
|
|
|
x-example: 64
|
|
|
|
name: height
|
|
|
|
name: height
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
description: |-
|
|
|
|
description: |-
|
|
|
|
The *desired* height of the thumbnail. The actual thumbnail may not
|
|
|
|
The *desired* height of the thumbnail. The actual thumbnail may be
|
|
|
|
match the size specified.
|
|
|
|
larger than the size specified.
|
|
|
|
- in: query
|
|
|
|
- in: query
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
enum: ["crop", "scale"]
|
|
|
|
enum: ["crop", "scale"]
|
|
|
|
name: method
|
|
|
|
name: method
|
|
|
|
x-example: "scale"
|
|
|
|
x-example: "scale"
|
|
|
|
description: The desired resizing method.
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The desired resizing method. See the `thumbnailing <#thumbnails>`_
|
|
|
|
|
|
|
|
section for more information.
|
|
|
|
- in: query
|
|
|
|
- in: query
|
|
|
|
type: boolean
|
|
|
|
type: boolean
|
|
|
|
name: allow_remote
|
|
|
|
name: allow_remote
|
|
|
@ -241,6 +233,40 @@ paths:
|
|
|
|
enum: ["image/jpeg", "image/png"]
|
|
|
|
enum: ["image/jpeg", "image/png"]
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
|
type: file
|
|
|
|
type: file
|
|
|
|
|
|
|
|
# This is a workaround for us not being able to say the response is required.
|
|
|
|
|
|
|
|
description: "**Required.** The bytes for the thumbnail."
|
|
|
|
|
|
|
|
400:
|
|
|
|
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The request does not make sense to the server, or the server cannot thumbnail
|
|
|
|
|
|
|
|
the content. For example, the client requested non-integer dimensions or asked
|
|
|
|
|
|
|
|
for negatively-sized images.
|
|
|
|
|
|
|
|
examples:
|
|
|
|
|
|
|
|
application/json: {
|
|
|
|
|
|
|
|
"errcode": "M_UNKNOWN",
|
|
|
|
|
|
|
|
"error": "Cannot generate thumbnails for the requested content"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
schema:
|
|
|
|
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
|
|
|
|
413:
|
|
|
|
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The local content is too large for the server to thumbnail.
|
|
|
|
|
|
|
|
examples:
|
|
|
|
|
|
|
|
application/json: {
|
|
|
|
|
|
|
|
"errcode": "M_TOO_LARGE",
|
|
|
|
|
|
|
|
"error": "Content is too large to thumbnail"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
schema:
|
|
|
|
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
|
|
|
|
502:
|
|
|
|
|
|
|
|
description: |-
|
|
|
|
|
|
|
|
The remote content is too large for the server to thumbnail.
|
|
|
|
|
|
|
|
examples:
|
|
|
|
|
|
|
|
application/json: {
|
|
|
|
|
|
|
|
"errcode": "M_TOO_LARGE",
|
|
|
|
|
|
|
|
"error": "Content is too large to thumbnail"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
schema:
|
|
|
|
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
|
|
|
429:
|
|
|
|
429:
|
|
|
|
description: This request was rate-limited.
|
|
|
|
description: This request was rate-limited.
|
|
|
|
schema:
|
|
|
|
schema:
|
|
|
@ -259,7 +285,7 @@ paths:
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
x-example: "https://matrix.org"
|
|
|
|
x-example: "https://matrix.org"
|
|
|
|
name: url
|
|
|
|
name: url
|
|
|
|
description: "The URL to get a preview of"
|
|
|
|
description: "The URL to get a preview of."
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
- in: query
|
|
|
|
- in: query
|
|
|
|
type: integer
|
|
|
|
type: integer
|
|
|
@ -287,7 +313,7 @@ paths:
|
|
|
|
"og:image":
|
|
|
|
"og:image":
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
description: |-
|
|
|
|
An MXC URI to the image. Omitted if there is no image.
|
|
|
|
An `MXC URI`_ to the image. Omitted if there is no image.
|
|
|
|
examples:
|
|
|
|
examples:
|
|
|
|
application/json: {
|
|
|
|
application/json: {
|
|
|
|
"og:title": "Matrix Blog Post",
|
|
|
|
"og:title": "Matrix Blog Post",
|
|
|
|