docs(backend): document PATCH share endpoint

This commit is contained in:
2025-12-28 19:06:51 +00:00
parent e3d78497e8
commit 0e8c616489
3 changed files with 204 additions and 5 deletions

View File

@@ -301,7 +301,7 @@
"200": { "200": {
"description": "Trashed directories (when trash=true)", "description": "Trashed directories (when trash=true)",
"content": { "content": {
"application/json": { "*/*": {
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@@ -469,7 +469,7 @@
"200": { "200": {
"description": "Trashed directory info (when trash=true)", "description": "Trashed directory info (when trash=true)",
"content": { "content": {
"application/json": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/internal_catalog.DirectoryInfo" "$ref": "#/components/schemas/internal_catalog.DirectoryInfo"
} }
@@ -927,7 +927,7 @@
"200": { "200": {
"description": "Trashed files (when trash=true)", "description": "Trashed files (when trash=true)",
"content": { "content": {
"application/json": { "*/*": {
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@@ -1576,6 +1576,95 @@
} }
} }
} }
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update share link details. Omit expiresAt to keep the current value. Use null to remove the expiry.",
"tags": [
"shares"
],
"summary": "Update share",
"parameters": [
{
"description": "Account ID",
"name": "accountID",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"description": "Share ID",
"name": "shareID",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/internal_sharing.patchShareRequest"
}
}
},
"description": "Share details",
"required": true
},
"responses": {
"200": {
"description": "Updated share",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/internal_sharing.Share"
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"401": {
"description": "Not authenticated",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "Share not found",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
} }
}, },
"/accounts/{accountID}/uploads": { "/accounts/{accountID}/uploads": {
@@ -2533,6 +2622,17 @@
} }
} }
}, },
"internal_sharing.patchShareRequest": {
"description": "Request to update a share link. Omit expiresAt to keep the current value. Use null to remove the expiry.",
"type": "object",
"properties": {
"expiresAt": {
"description": "Optional expiration time for the share (ISO 8601), null clears it.",
"type": "string",
"example": "2025-01-15T00:00:00Z"
}
}
},
"internal_upload.Status": { "internal_upload.Status": {
"description": "Upload status enumeration", "description": "Upload status enumeration",
"type": "string", "type": "string",

View File

@@ -1270,6 +1270,79 @@
} }
} }
} }
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update share link details. Omit expiresAt to keep the current value. Use null to remove the expiry.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"shares"
],
"summary": "Update share",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Account ID",
"name": "accountID",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Share ID",
"name": "shareID",
"in": "path",
"required": true
},
{
"description": "Share details",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_sharing.patchShareRequest"
}
}
],
"responses": {
"200": {
"description": "Updated share",
"schema": {
"$ref": "#/definitions/internal_sharing.Share"
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"401": {
"description": "Not authenticated",
"schema": {
"type": "string"
}
},
"404": {
"description": "Share not found",
"schema": {
"type": "string"
}
}
}
} }
}, },
"/accounts/{accountID}/uploads": { "/accounts/{accountID}/uploads": {
@@ -2131,6 +2204,17 @@
} }
} }
}, },
"internal_sharing.patchShareRequest": {
"description": "Request to update a share link. Omit expiresAt to keep the current value. Use null to remove the expiry.",
"type": "object",
"properties": {
"expiresAt": {
"description": "Optional expiration time for the share (ISO 8601), null clears it.",
"type": "string",
"example": "2025-01-15T00:00:00Z"
}
}
},
"internal_upload.Status": { "internal_upload.Status": {
"description": "Upload status enumeration", "description": "Upload status enumeration",
"type": "string", "type": "string",

View File

@@ -225,6 +225,21 @@ func (h *HTTPHandler) createShare(c *fiber.Ctx) error {
return c.JSON(share) return c.JSON(share)
} }
// updateShare updates a share link
// @Summary Update share
// @Description Update share link details. Omit expiresAt to keep the current value. Use null to remove the expiry.
// @Tags shares
// @Accept json
// @Produce json
// @Param accountID path string true "Account ID" format(uuid)
// @Param shareID path string true "Share ID"
// @Param request body patchShareRequest true "Share details"
// @Success 200 {object} Share "Updated share"
// @Failure 400 {object} map[string]string "Invalid request"
// @Failure 401 {string} string "Not authenticated"
// @Failure 404 {string} string "Share not found"
// @Security BearerAuth
// @Router /accounts/{accountID}/shares/{shareID} [patch]
func (h *HTTPHandler) updateShare(c *fiber.Ctx) error { func (h *HTTPHandler) updateShare(c *fiber.Ctx) error {
shareID := c.Params("shareID") shareID := c.Params("shareID")