feat: Mediaアップロードのエンドポイントを追加

This commit is contained in:
usbharu 2023-10-04 01:45:55 +09:00
parent 6b632c81c7
commit 9e570dc1bf
3 changed files with 62 additions and 0 deletions

View File

@ -60,6 +60,8 @@ tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask:
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
additionalProperties.put("useTags", "true")
importMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
}
repositories {

View File

@ -0,0 +1,19 @@
package dev.usbharu.hideout.controller.mastodon
import dev.usbharu.hideout.controller.mastodon.generated.MediaApi
import dev.usbharu.hideout.domain.mastodon.model.generated.MediaAttachment
import org.springframework.http.ResponseEntity
import org.springframework.stereotype.Controller
import org.springframework.web.multipart.MultipartFile
@Controller
class MastodonMediaApiController : MediaApi {
override fun apiV1MediaPost(
file: MultipartFile,
thumbnail: MultipartFile?,
description: String?,
focus: String?
): ResponseEntity<MediaAttachment> {
}
}

View File

@ -17,6 +17,8 @@ tags:
description: instance
- name: timeline
description: timeline
- name: media
description: media
paths:
/api/v2/instance:
@ -291,9 +293,48 @@ paths:
type: array
items:
$ref: "#/components/schemas/Status"
/api/v1/media:
post:
tags:
- media
security:
- OAuth2:
- "write:media"
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/V1MediaRequest"
encoding:
file:
contentType: image/jpeg, image/png
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/MediaAttachment"
components:
schemas:
V1MediaRequest:
type: object
properties:
file:
type: string
format: binary
thumbnail:
type: string
format: binary
description:
type: string
focus:
type: string
required:
- file
AccountsCreateRequest:
type: object
properties: