Files
nextcloud-autocurrency/openapi.json
Chen Asraf 71577ffb35 feat: add custom currencies (#182)
* feat: add custom currency table & endpoints

* refactor: fix migration versions

* feat: add custom currencies logic to fetch service

* feat: add custom currencies UI to admin settings

* feat: add custom currencies to user settings history

* chore: update admin settings help info

* refactor: use NcTextField instead of input
2025-10-07 10:09:09 +03:00

476 lines
22 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "autocurrency",
"version": "0.0.1",
"description": "Automatically fills the currency rates for your Cospend projects daily.",
"license": {
"name": "agpl"
}
},
"components": {
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
},
"bearer_auth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"OCSMeta": {
"type": "object",
"required": [
"status",
"statuscode"
],
"properties": {
"status": {
"type": "string"
},
"statuscode": {
"type": "integer"
},
"message": {
"type": "string"
},
"totalitems": {
"type": "string"
},
"itemsperpage": {
"type": "string"
}
}
}
}
},
"paths": {
"/ocs/v2.php/apps/autocurrency/api/user-settings": {
"get": {
"operationId": "api-get-user-settings",
"summary": "Get current user settings",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Data returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"supported_currencies"
],
"properties": {
"supported_currencies": {
"type": "array",
"items": {
"type": "object",
"required": [
"code",
"symbol",
"name"
],
"properties": {
"code": {
"type": "string"
},
"symbol": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/autocurrency/api/projects": {
"get": {
"operationId": "api-get-projects",
"summary": "List Cospend projects owned by calling user",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Data returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"projects"
],
"properties": {
"projects": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"name",
"currencyName"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"currencyName": {
"type": "string",
"nullable": true
}
}
}
}
}
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/apps/autocurrency/api/history": {
"get": {
"operationId": "api-get-history",
"summary": "Get rate history for a project (uses the project's base currency)",
"tags": [
"api"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "projectId",
"in": "query",
"description": "Project ID (required)",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "currency",
"in": "query",
"description": "Quoted currency code to filter (e.g. \"eur\")",
"schema": {
"type": "string",
"nullable": true,
"default": null
}
},
{
"name": "from",
"in": "query",
"description": "ISO-8601 datetime (inclusive)",
"schema": {
"type": "string",
"nullable": true,
"default": null
}
},
{
"name": "to",
"in": "query",
"description": "ISO-8601 datetime (inclusive)",
"schema": {
"type": "string",
"nullable": true,
"default": null
}
},
{
"name": "limit",
"in": "query",
"description": "Max rows to return (optional)",
"schema": {
"type": "integer",
"format": "int64",
"nullable": true,
"default": null
}
},
{
"name": "offset",
"in": "query",
"description": "Offset for pagination (optional)",
"schema": {
"type": "integer",
"format": "int64",
"nullable": true,
"default": null
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Data returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"projectId",
"baseCurrency",
"points"
],
"properties": {
"projectId": {
"type": "string"
},
"baseCurrency": {
"type": "string"
},
"points": {
"type": "array",
"items": {
"type": "object",
"required": [
"fetchedAt",
"rate",
"currencyName",
"source"
],
"properties": {
"fetchedAt": {
"type": "string"
},
"rate": {
"type": "string"
},
"currencyName": {
"type": "string"
},
"source": {
"type": "string",
"nullable": true
}
}
}
}
}
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
}
},
"tags": []
}