Files
FileRise/src/openapi/Components.php

168 lines
5.8 KiB
PHP

<?php
// src/openapi/Components.php
use OpenApi\Annotations as OA;
/**
* @OA\Info(
* title="FileRise API",
* version="1.5.2"
* )
*
* @OA\Server(
* url="/",
* description="Same-origin server"
* )
*
* @OA\Tag(
* name="Admin",
* description="Admin endpoints"
* )
*
* @OA\Components(
* @OA\SecurityScheme(
* securityScheme="cookieAuth",
* type="apiKey",
* in="cookie",
* name="PHPSESSID",
* description="Session cookie used for authenticated endpoints"
* ),
* @OA\SecurityScheme(
* securityScheme="CsrfHeader",
* type="apiKey",
* in="header",
* name="X-CSRF-Token",
* description="CSRF token header required for state-changing requests"
* ),
*
* @OA\Response(
* response="Unauthorized",
* description="Unauthorized (no session)",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="error", type="string", example="Unauthorized")
* )
* ),
* @OA\Response(
* response="Forbidden",
* description="Forbidden (not enough privileges)",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="error", type="string", example="Invalid CSRF token.")
* )
* ),
*
* @OA\Schema(
* schema="SimpleSuccess",
* type="object",
* @OA\Property(property="success", type="boolean", example=true)
* ),
* @OA\Schema(
* schema="SimpleError",
* type="object",
* @OA\Property(property="error", type="string", example="Something went wrong")
* ),
*
* @OA\Schema(
* schema="LoginOptionsPublic",
* type="object",
* @OA\Property(property="disableFormLogin", type="boolean"),
* @OA\Property(property="disableBasicAuth", type="boolean"),
* @OA\Property(property="disableOIDCLogin", type="boolean")
* ),
* @OA\Schema(
* schema="LoginOptionsAdminExtra",
* type="object",
* @OA\Property(property="authBypass", type="boolean", nullable=true),
* @OA\Property(property="authHeaderName", type="string", nullable=true, example="X-Remote-User")
* ),
* @OA\Schema(
* schema="OIDCConfigPublic",
* type="object",
* @OA\Property(property="providerUrl", type="string", example="https://accounts.example.com"),
* @OA\Property(property="redirectUri", type="string", example="https://your.filerise.app/callback")
* ),
*
* @OA\Schema(
* schema="AdminGetConfigPublic",
* type="object",
* required={"header_title","loginOptions","globalOtpauthUrl","enableWebDAV","sharedMaxUploadSize","oidc"},
* @OA\Property(property="header_title", type="string", example="FileRise"),
* @OA\Property(property="loginOptions", ref="#/components/schemas/LoginOptionsPublic"),
* @OA\Property(property="globalOtpauthUrl", type="string"),
* @OA\Property(property="enableWebDAV", type="boolean"),
* @OA\Property(property="sharedMaxUploadSize", type="integer", format="int64"),
* @OA\Property(property="oidc", ref="#/components/schemas/OIDCConfigPublic")
* ),
* @OA\Schema(
* schema="AdminGetConfigAdmin",
* allOf={
* @OA\Schema(ref="#/components/schemas/AdminGetConfigPublic"),
* @OA\Schema(
* type="object",
* @OA\Property(
* property="loginOptions",
* allOf={
* @OA\Schema(ref="#/components/schemas/LoginOptionsPublic"),
* @OA\Schema(ref="#/components/schemas/LoginOptionsAdminExtra")
* }
* )
* )
* }
* ),
*
* @OA\Schema(
* schema="AdminUpdateConfigRequest",
* type="object",
* additionalProperties=false,
* @OA\Property(property="header_title", type="string", maxLength=100, example="FileRise"),
* @OA\Property(
* property="loginOptions",
* type="object",
* additionalProperties=false,
* @OA\Property(property="disableFormLogin", type="boolean", example=false),
* @OA\Property(property="disableBasicAuth", type="boolean", example=false),
* @OA\Property(property="disableOIDCLogin", type="boolean", example=true, description="false = OIDC enabled"),
* @OA\Property(property="authBypass", type="boolean", example=false),
* @OA\Property(
* property="authHeaderName",
* type="string",
* pattern="^[A-Za-z0-9\\-]+$",
* example="X-Remote-User",
* description="Letters/numbers/dashes only"
* )
* ),
* @OA\Property(property="globalOtpauthUrl", type="string", example="otpauth://totp/{label}?secret={secret}&issuer=FileRise"),
* @OA\Property(property="enableWebDAV", type="boolean", example=false),
* @OA\Property(property="sharedMaxUploadSize", type="integer", format="int64", minimum=0, example=52428800),
* @OA\Property(
* property="oidc",
* type="object",
* additionalProperties=false,
* description="When disableOIDCLogin=false (OIDC enabled), providerUrl, redirectUri, and clientId are required.",
* @OA\Property(property="providerUrl", type="string", format="uri", example="https://issuer.example.com"),
* @OA\Property(property="clientId", type="string", example="my-client-id"),
* @OA\Property(property="clientSecret", type="string", writeOnly=true, example="***"),
* @OA\Property(property="redirectUri", type="string", format="uri", example="https://app.example.com/auth/callback")
* )
* )
* )
*/
/**
* @OA\RequestBody(
* request="MoveFilesRequest",
* required=true,
* @OA\JsonContent(
* type="object",
* required={"source","destination","files"},
* @OA\Property(property="source", type="string", example="inbox"),
* @OA\Property(property="destination", type="string", example="archive"),
* @OA\Property(property="files", type="array", @OA\Items(type="string"))
* )
* )
*/
final class OpenAPIComponents {}