From dc97e1201a2741d6091495c1972fcb67f821c61a Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 22 Dec 2020 21:31:17 +0200 Subject: [PATCH 1/8] Updated body param parsing --- src/Spec/Swagger2.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 2815ccb0a..26e8afbfb 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -192,10 +192,25 @@ public function getMethods($service) case 'query': $output['parameters']['query'][] = $param; break; - case 'body': case 'formData': $output['parameters']['body'][] = $param; break; + case 'body': + $bodyProperties = $param['schema']['properties'] ?? []; + $bodyRequired = $param['schema']['required'] ?? []; + + foreach ($bodyProperties as $key => $value) { + $param['name'] = $key; + $param['type'] = $value['type'] ?? null; + $param['description'] = $value['description'] ?? ''; + $param['required'] = (in_array($key, $bodyRequired)); + $param['default'] = $value['default'] ?? null; + $param['example'] = $value['x-example'] ?? null; + + $output['parameters']['body'][] = $param; + } + + break; } } From a433152af28650ef2e51b399def49fd784356aee Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 22 Dec 2020 23:52:38 +0200 Subject: [PATCH 2/8] Updated spec for tests --- tests/resources/spec.json | 2293 ++++++++++++++++++++++++++++--------- 1 file changed, 1738 insertions(+), 555 deletions(-) diff --git a/tests/resources/spec.json b/tests/resources/spec.json index 609c56a48..31ab67bdf 100644 --- a/tests/resources/spec.json +++ b/tests/resources/spec.json @@ -1,99 +1,67 @@ { "swagger": "2.0", "info": { - "version": "0.5.3", + "version": "0.7.0", "title": "Appwrite", - "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", - "termsOfService": "https:\/\/appwrite.io\/policy\/terms", + "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)", + "termsOfService": "https://appwrite.io/policy/terms", "contact": { "name": "Appwrite Team", - "url": "https:\/\/appwrite.io\/support", + "url": "https://appwrite.io/support", "email": "team@appwrite.io" }, "license": { "name": "BSD-3-Clause", - "url": "https:\/\/raw.githubusercontent.com\/appwrite\/appwrite\/master\/LICENSE" + "url": "https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE" } }, "host": "appwrite.io", - "basePath": "\/v1", - "schemes": [ - "https" - ], - "consumes": [ - "application\/json", - "multipart\/form-data" - ], - "produces": [ - "application\/json" - ], + "basePath": "/v1", + "schemes": ["https"], + "consumes": ["application/json", "multipart/form-data"], + "produces": ["application/json"], "securityDefinitions": { "Project": { "type": "apiKey", "name": "X-Appwrite-Project", "description": "Your project ID", "in": "header", - "x-appwrite": { - "demo": "5df5acd0d48c2" - } - }, - "Key": { - "type": "apiKey", - "name": "X-Appwrite-Key", - "description": "Your secret API key", - "in": "header", - "x-appwrite": { - "demo": "919c2d18fb5d4...a2ae413da83346ad2" - } + "x-appwrite": { "demo": "5df5acd0d48c2" } }, "Locale": { "type": "apiKey", "name": "X-Appwrite-Locale", "description": "", "in": "header", - "x-appwrite": { - "demo": "en" - } - }, - "Mode": { - "type": "apiKey", - "name": "X-Appwrite-Mode", - "description": "", - "in": "header", - "x-appwrite": { - "demo": "" - } + "x-appwrite": { "demo": "en" } } }, "paths": { - "\/mock\/tests\/bar": { + "/mock/tests/bar": { "get": { "summary": "Mock a get request for SDK tests", - "operationId": "get", - "consumes": [ - "application\/json" - ], - "tags": [ - "bar" - ], + "operationId": "barGet", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["bar"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 50, + "method": "get", + "weight": 173, "cookies": false, - "location": false, - "demo": "docs\/examples\/bar\/get.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a get request for SDK tests", + "type": "", + "demo": "docs/examples/bar/get.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a get request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { "name": "x", @@ -117,270 +85,261 @@ "required": true, "type": "array", "collectionFormat": "multi", - "items": { - "type": "string" - }, + "items": { "type": "string" }, "in": "query" } ] }, "post": { "summary": "Mock a post request for SDK tests", - "operationId": "post", - "consumes": [ - "application\/json" - ], - "tags": [ - "bar" - ], + "operationId": "barPost", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["bar"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 51, + "method": "post", + "weight": 174, "cookies": false, - "location": false, - "demo": "docs\/examples\/bar\/post.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a post request for SDK tests", + "type": "", + "demo": "docs/examples/bar/post.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a post request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "put": { "summary": "Mock a put request for SDK tests", - "operationId": "put", - "consumes": [ - "application\/json" - ], - "tags": [ - "bar" - ], + "operationId": "barPut", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["bar"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 53, + "method": "put", + "weight": 176, "cookies": false, - "location": false, - "demo": "docs\/examples\/bar\/put.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a put request for SDK tests", + "type": "", + "demo": "docs/examples/bar/put.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a put request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "patch": { "summary": "Mock a patch request for SDK tests", - "operationId": "patch", - "consumes": [ - "application\/json" - ], - "tags": [ - "bar" - ], + "operationId": "barPatch", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["bar"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 52, + "method": "patch", + "weight": 175, "cookies": false, - "location": false, - "demo": "docs\/examples\/bar\/patch.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a get request for SDK tests", + "type": "", + "demo": "docs/examples/bar/patch.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a get request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "delete": { "summary": "Mock a delete request for SDK tests", - "operationId": "delete", - "consumes": [ - "application\/json" - ], - "tags": [ - "bar" - ], + "operationId": "barDelete", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["bar"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 54, + "method": "delete", + "weight": 177, "cookies": false, - "location": false, - "demo": "docs\/examples\/bar\/delete.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a delete request for SDK tests", + "type": "", + "demo": "docs/examples/bar/delete.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a delete request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] } }, - "\/mock\/tests\/foo": { + "/mock/tests/foo": { "get": { "summary": "Mock a get request for SDK tests", - "operationId": "get", - "consumes": [ - "application\/json" - ], - "tags": [ - "foo" - ], + "operationId": "fooGet", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["foo"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 45, + "method": "get", + "weight": 168, "cookies": false, - "location": false, - "demo": "docs\/examples\/foo\/get.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a get request for SDK tests", + "type": "", + "demo": "docs/examples/foo/get.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a get request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { "name": "x", @@ -404,420 +363,396 @@ "required": true, "type": "array", "collectionFormat": "multi", - "items": { - "type": "string" - }, + "items": { "type": "string" }, "in": "query" } ] }, "post": { "summary": "Mock a post request for SDK tests", - "operationId": "post", - "consumes": [ - "application\/json" - ], - "tags": [ - "foo" - ], + "operationId": "fooPost", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["foo"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 46, + "method": "post", + "weight": 169, "cookies": false, - "location": false, - "demo": "docs\/examples\/foo\/post.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a post request for SDK tests", + "type": "", + "demo": "docs/examples/foo/post.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a post request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "put": { "summary": "Mock a put request for SDK tests", - "operationId": "put", - "consumes": [ - "application\/json" - ], - "tags": [ - "foo" - ], + "operationId": "fooPut", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["foo"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 48, + "method": "put", + "weight": 171, "cookies": false, - "location": false, - "demo": "docs\/examples\/foo\/put.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a put request for SDK tests", + "type": "", + "demo": "docs/examples/foo/put.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a put request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "patch": { "summary": "Mock a patch request for SDK tests", - "operationId": "patch", - "consumes": [ - "application\/json" - ], - "tags": [ - "foo" - ], + "operationId": "fooPatch", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["foo"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 47, + "method": "patch", + "weight": 170, "cookies": false, - "location": false, - "demo": "docs\/examples\/foo\/patch.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a get request for SDK tests", + "type": "", + "demo": "docs/examples/foo/patch.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a get request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] }, "delete": { "summary": "Mock a delete request for SDK tests", - "operationId": "delete", - "consumes": [ - "application\/json" - ], - "tags": [ - "foo" - ], + "operationId": "fooDelete", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["foo"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 49, + "method": "delete", + "weight": 172, "cookies": false, - "location": false, - "demo": "docs\/examples\/foo\/delete.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a delete request for SDK tests", + "type": "", + "demo": "docs/examples/foo/delete.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a delete request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { - "name": "x", - "description": "Sample string param", - "required": true, - "type": "string", - "x-example": "[]", - "in": "formData" - }, - { - "name": "y", - "description": "Sample numeric param", - "required": true, - "type": "integer", - "format": "int32", - "in": "formData" - }, - { - "name": "z", - "description": "Sample array param", - "required": true, - "type": "array", - "collectionFormat": "multi", - "items": { - "type": "string" - }, - "in": "formData" + "name": "payload", + "in": "body", + "schema": { + "type": "object", + "properties": { + "x": { + "type": "string", + "description": "Sample string param", + "default": null, + "x-example": "[]" + }, + "y": { + "type": "integer", + "description": "Sample numeric param", + "default": null, + "x-example": null + }, + "z": { + "type": "array", + "description": "Sample array param", + "default": null, + "x-example": null, + "items": { "type": "string" } + } + }, + "required": ["x", "y", "z"] + } } ] } }, - "\/mock\/tests\/general\/empty": { + "/mock/tests/general/empty": { "get": { "summary": "Mock a post request for SDK tests", - "operationId": "empty", - "consumes": [ - "application\/json" - ], - "tags": [ - "general" - ], + "operationId": "generalEmpty", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 60, + "method": "empty", + "weight": 183, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/empty.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a redirected request for SDK tests", + "type": "", + "demo": "docs/examples/general/empty.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a redirected request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ] + "security": [{ "Project": [] }] } }, - "\/mock\/tests\/general\/get-cookie": { + "/mock/tests/general/get-cookie": { "get": { "summary": "Mock a cookie request for SDK tests", - "operationId": "getCookie", - "consumes": [ - "application\/json" - ], - "tags": [ - "general" - ], + "operationId": "generalGetCookie", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 59, + "method": "getCookie", + "weight": 182, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/get-cookie.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a get cookie request for SDK tests", + "type": "", + "demo": "docs/examples/general/get-cookie.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a get cookie request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ] + "security": [{ "Project": [] }] } }, - "\/mock\/tests\/general\/redirect": { + "/mock/tests/general/redirect": { "get": { "summary": "Mock a post request for SDK tests", - "operationId": "redirect", - "consumes": [ - "application\/json" - ], - "tags": [ - "general" - ], + "operationId": "generalRedirect", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 56, + "method": "redirect", + "weight": 179, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/redirect.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a redirect request for SDK tests", + "type": "", + "demo": "docs/examples/general/redirect.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a redirect request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ] + "security": [{ "Project": [] }] } }, - "\/mock\/tests\/general\/redirected": { + "/mock/tests/general/redirect/done": { "get": { "summary": "Mock a post request for SDK tests", - "operationId": "redirected", - "consumes": [ - "application\/json" - ], - "tags": [ - "general" - ], + "operationId": "generalRedirected", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 57, + "method": "redirected", + "weight": 180, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/redirected.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a redirected request for SDK tests", + "type": "", + "demo": "docs/examples/general/redirected.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a redirected request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ] + "security": [{ "Project": [] }] } }, - "\/mock\/tests\/general\/set-cookie": { + "/mock/tests/general/set-cookie": { "get": { "summary": "Mock a cookie request for SDK tests", - "operationId": "setCookie", - "consumes": [ - "application\/json" - ], - "tags": [ - "general" - ], + "operationId": "generalSetCookie", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 58, + "method": "setCookie", + "weight": 181, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/set-cookie.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a set cookie request for SDK tests", + "type": "", + "demo": "docs/examples/general/set-cookie.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a set cookie request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ] + "security": [{ "Project": [] }] } }, - "\/mock\/tests\/general\/upload": { + "/mock/tests/general/upload": { "post": { "summary": "Mock a post request for SDK tests", - "operationId": "upload", - "consumes": [ - "multipart\/form-data" - ], - "tags": [ - "general" - ], + "operationId": "generalUpload", + "consumes": ["multipart/form-data"], + "produces": ["application/json"], + "tags": ["general"], "description": "", + "responses": { + "500": { "description": "File", "schema": { "type": "file" } } + }, "x-appwrite": { - "weight": 55, + "method": "upload", + "weight": 178, "cookies": false, - "location": false, - "demo": "docs\/examples\/general\/upload.md", - "edit": "https:\/\/github.com\/appwrite\/appwrite\/edit\/masterMock a delete request for SDK tests", + "type": "", + "demo": "docs/examples/general/upload.md", + "edit": "https://github.com/appwrite/appwrite/edit/masterMock a delete request for SDK tests", "rate-limit": 0, "rate-time": 3600, + "rate-key": "url:{url},ip:{ip}", "scope": "public", - "platforms": [] + "platforms": ["client", "server"] }, - "security": [ - { - "Project": [], - "Key": [] - } - ], + "security": [{ "Project": [] }], "parameters": [ { "name": "x", @@ -841,9 +776,7 @@ "required": true, "type": "array", "collectionFormat": "multi", - "items": { - "type": "string" - }, + "items": { "type": "string" }, "in": "formData" }, { @@ -858,24 +791,1274 @@ } }, "definitions": { - "Error": { - "required": [ - "code", - "message" - ], + "none": { "description": "None", "type": "object" }, + "any": { + "description": "Any", + "type": "object", + "additionalProperties": true + }, + "error": { + "description": "Error", + "type": "object", "properties": { + "message": { + "type": "string", + "description": "Error message.", + "x-example": "Not found" + }, "code": { + "type": "string", + "description": "Error code.", + "x-example": "404" + }, + "version": { + "type": "string", + "description": "Server version number.", + "x-example": "1.0" + } + }, + "required": ["message", "code", "version"] + }, + "collectionList": { + "description": "Collections List", + "type": "object", + "properties": { + "sum": { "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, "format": "int32" }, - "message": { - "type": "string" + "collections": { + "type": "array", + "description": "List of collections.", + "items": { "type": "object", "$ref": "#/definitions/collection" } } - } + }, + "required": ["sum", "collections"] + }, + "documentList": { + "description": "Documents List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "documents": { + "type": "array", + "description": "List of documents.", + "items": { "type": "object", "$ref": "#/definitions/any" } + } + }, + "required": ["sum", "documents"] + }, + "userList": { + "description": "Users List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "users": { + "type": "array", + "description": "List of users.", + "items": { "type": "object", "$ref": "#/definitions/user" } + } + }, + "required": ["sum", "users"] + }, + "sessionList": { + "description": "Sessions List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "sessions": { + "type": "array", + "description": "List of sessions.", + "items": { "type": "object", "$ref": "#/definitions/session" } + } + }, + "required": ["sum", "sessions"] + }, + "logList": { + "description": "Logs List", + "type": "object", + "properties": { + "logs": { + "type": "array", + "description": "List of logs.", + "items": { "type": "object", "$ref": "#/definitions/log" } + } + }, + "required": ["logs"] + }, + "fileList": { + "description": "Files List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "files": { + "type": "array", + "description": "List of files.", + "items": { "type": "object", "$ref": "#/definitions/file" } + } + }, + "required": ["sum", "files"] + }, + "teamList": { + "description": "Teams List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "teams": { + "type": "array", + "description": "List of teams.", + "items": { "type": "object", "$ref": "#/definitions/team" } + } + }, + "required": ["sum", "teams"] + }, + "membershipList": { + "description": "Memberships List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "memberships": { + "type": "array", + "description": "List of memberships.", + "items": { "type": "object", "$ref": "#/definitions/membership" } + } + }, + "required": ["sum", "memberships"] + }, + "functionList": { + "description": "Functions List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "functions": { + "type": "array", + "description": "List of functions.", + "items": { "type": "object", "$ref": "#/definitions/function" } + } + }, + "required": ["sum", "functions"] + }, + "tagList": { + "description": "Tags List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "tags": { + "type": "array", + "description": "List of tags.", + "items": { "type": "object", "$ref": "#/definitions/tag" } + } + }, + "required": ["sum", "tags"] + }, + "executionList": { + "description": "Executions List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "executions": { + "type": "array", + "description": "List of executions.", + "items": { "type": "object", "$ref": "#/definitions/execution" } + } + }, + "required": ["sum", "executions"] + }, + "countryList": { + "description": "Countries List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "countries": { + "type": "array", + "description": "List of countries.", + "items": { "type": "object", "$ref": "#/definitions/country" } + } + }, + "required": ["sum", "countries"] + }, + "continentList": { + "description": "Continents List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "continents": { + "type": "array", + "description": "List of continents.", + "items": { "type": "object", "$ref": "#/definitions/continent" } + } + }, + "required": ["sum", "continents"] + }, + "langaugeList": { + "description": "Languages List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "languages": { + "type": "array", + "description": "List of languages.", + "items": { "type": "object", "$ref": "#/definitions/langauge" } + } + }, + "required": ["sum", "languages"] + }, + "currencyList": { + "description": "Currencies List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "currencies": { + "type": "array", + "description": "List of currencies.", + "items": { "type": "object", "$ref": "#/definitions/currency" } + } + }, + "required": ["sum", "currencies"] + }, + "phoneList": { + "description": "Phones List", + "type": "object", + "properties": { + "sum": { + "type": "integer", + "description": "Total sum of items in the list.", + "x-example": 5, + "format": "int32" + }, + "phones": { + "type": "array", + "description": "List of phones.", + "items": { "type": "object", "$ref": "#/definitions/phone" } + } + }, + "required": ["sum", "phones"] + }, + "permissions": { + "description": "Permissions", + "type": "object", + "properties": { + "read": { + "type": "array", + "description": "Read permissions.", + "items": { "type": "string" } + }, + "write": { + "type": "array", + "description": "Write permissions.", + "items": { "type": "string" } + } + }, + "required": ["read", "write"] + }, + "collection": { + "description": "Collection", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Collection ID.", + "x-example": "5e5ea5c16897e" + }, + "$permissions": { + "type": "object", + "description": "Collection permissions.", + "x-example": {}, + "items": { "type": "object", "$ref": "#/definitions/permissions" } + }, + "name": { + "type": "string", + "description": "Collection name.", + "x-example": "Movies" + }, + "dateCreated": { + "type": "integer", + "description": "Collection creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "dateUpdated": { + "type": "integer", + "description": "Collection creation date in Unix timestamp.", + "x-example": 1592981550, + "format": "int32" + }, + "rules": { + "type": "array", + "description": "Collection rules.", + "items": { "type": "object", "$ref": "#/definitions/rule" } + } + }, + "required": [ + "$id", + "$permissions", + "name", + "dateCreated", + "dateUpdated", + "rules" + ] + }, + "rule": { + "description": "Rule", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Rule ID.", + "x-example": "5e5ea5c16897e" + }, + "$collection": { + "type": "string", + "description": "Rule Collection.", + "x-example": "5e5e66c16897e" + }, + "type": { + "type": "string", + "description": "Rule type. Possible values: ", + "x-example": "title" + }, + "key": { + "type": "string", + "description": "Rule key.", + "x-example": "title" + }, + "label": { + "type": "string", + "description": "Rule label.", + "x-example": "Title" + }, + "default": { + "type": "string", + "description": "Rule default value.", + "x-example": "Movie Name" + }, + "array": { + "type": "boolean", + "description": "Is array?", + "x-example": false + }, + "required": { + "type": "boolean", + "description": "Is required?", + "x-example": true + }, + "list": { + "type": "array", + "description": "List of allowed values", + "items": { "type": "string" } + } + }, + "required": [ + "$id", + "$collection", + "type", + "key", + "label", + "default", + "array", + "required", + "list" + ] + }, + "log": { + "description": "Log", + "type": "object", + "properties": { + "event": { + "type": "string", + "description": "Event name.", + "x-example": "account.sessions.create" + }, + "ip": { + "type": "string", + "description": "IP session in use when the session was created.", + "x-example": "127.0.0.1" + }, + "time": { + "type": "integer", + "description": "Log creation time in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "osCode": { + "type": "string", + "description": "Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json).", + "x-example": "Mac" + }, + "osName": { + "type": "string", + "description": "Operating system name.", + "x-example": "Mac" + }, + "osVersion": { + "type": "string", + "description": "Operating system version.", + "x-example": "Mac" + }, + "clientType": { + "type": "string", + "description": "Client type.", + "x-example": "browser" + }, + "clientCode": { + "type": "string", + "description": "Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json).", + "x-example": "CM" + }, + "clientName": { + "type": "string", + "description": "Client name.", + "x-example": "Chrome Mobile iOS" + }, + "clientVersion": { + "type": "string", + "description": "Client version.", + "x-example": "84.0" + }, + "clientEngine": { + "type": "string", + "description": "Client engine name.", + "x-example": "WebKit" + }, + "clientEngineVersion": { + "type": "string", + "description": "Client engine name.", + "x-example": "605.1.15" + }, + "deviceName": { + "type": "string", + "description": "Device name.", + "x-example": "smartphone" + }, + "deviceBrand": { + "type": "string", + "description": "Device brand name.", + "x-example": "Google" + }, + "deviceModel": { + "type": "string", + "description": "Device model name.", + "x-example": "Nexus 5" + }, + "countryCode": { + "type": "string", + "description": "Country two-character ISO 3166-1 alpha code.", + "x-example": "US" + }, + "countryName": { + "type": "string", + "description": "Country name.", + "x-example": "United States" + } + }, + "required": [ + "event", + "ip", + "time", + "osCode", + "osName", + "osVersion", + "clientType", + "clientCode", + "clientName", + "clientVersion", + "clientEngine", + "clientEngineVersion", + "deviceName", + "deviceBrand", + "deviceModel", + "countryCode", + "countryName" + ] + }, + "user": { + "description": "User", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "User ID.", + "x-example": "5e5ea5c16897e" + }, + "name": { + "type": "string", + "description": "User name.", + "x-example": "John Doe" + }, + "registration": { + "type": "integer", + "description": "User registration date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "status": { + "type": "integer", + "description": "User status. 0 for Unavtivated, 1 for active and 2 is blocked.", + "x-example": 0, + "format": "int32" + }, + "email": { + "type": "string", + "description": "User email address.", + "x-example": "john@appwrite.io" + }, + "emailVerification": { + "type": "boolean", + "description": "Email verification status.", + "x-example": true + }, + "prefs": { + "type": "string", + "description": "User preferences as a key-value object", + "x-example": { "theme": "pink", "timezone": "UTC" } + } + }, + "required": [ + "$id", + "name", + "registration", + "status", + "email", + "emailVerification", + "prefs" + ] + }, + "session": { + "description": "Session", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Session ID.", + "x-example": "5e5ea5c16897e" + }, + "userId": { + "type": "string", + "description": "User ID.", + "x-example": "5e5bb8c16897e" + }, + "expire": { + "type": "integer", + "description": "Session expiration date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "ip": { + "type": "string", + "description": "IP in use when the session was created.", + "x-example": "127.0.0.1" + }, + "osCode": { + "type": "string", + "description": "Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json).", + "x-example": "Mac" + }, + "osName": { + "type": "string", + "description": "Operating system name.", + "x-example": "Mac" + }, + "osVersion": { + "type": "string", + "description": "Operating system version.", + "x-example": "Mac" + }, + "clientType": { + "type": "string", + "description": "Client type.", + "x-example": "browser" + }, + "clientCode": { + "type": "string", + "description": "Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json).", + "x-example": "CM" + }, + "clientName": { + "type": "string", + "description": "Client name.", + "x-example": "Chrome Mobile iOS" + }, + "clientVersion": { + "type": "string", + "description": "Client version.", + "x-example": "84.0" + }, + "clientEngine": { + "type": "string", + "description": "Client engine name.", + "x-example": "WebKit" + }, + "clientEngineVersion": { + "type": "string", + "description": "Client engine name.", + "x-example": "605.1.15" + }, + "deviceName": { + "type": "string", + "description": "Device name.", + "x-example": "smartphone" + }, + "deviceBrand": { + "type": "string", + "description": "Device brand name.", + "x-example": "Google" + }, + "deviceModel": { + "type": "string", + "description": "Device model name.", + "x-example": "Nexus 5" + }, + "countryCode": { + "type": "string", + "description": "Country two-character ISO 3166-1 alpha code.", + "x-example": "US" + }, + "countryName": { + "type": "string", + "description": "Country name.", + "x-example": "United States" + }, + "current": { + "type": "boolean", + "description": "Returns true if this the current user session.", + "x-example": true + } + }, + "required": [ + "$id", + "userId", + "expire", + "ip", + "osCode", + "osName", + "osVersion", + "clientType", + "clientCode", + "clientName", + "clientVersion", + "clientEngine", + "clientEngineVersion", + "deviceName", + "deviceBrand", + "deviceModel", + "countryCode", + "countryName", + "current" + ] + }, + "token": { + "description": "Token", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Token ID.", + "x-example": "bb8ea5c16897e" + }, + "userId": { + "type": "string", + "description": "User ID.", + "x-example": "5e5ea5c168bb8" + }, + "secret": { + "type": "string", + "description": "Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.", + "x-example": "" + }, + "expire": { + "type": "integer", + "description": "Token expiration date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + } + }, + "required": ["$id", "userId", "secret", "expire"] + }, + "locale": { + "description": "Locale", + "type": "object", + "properties": { + "ip": { + "type": "string", + "description": "User IP address.", + "x-example": "127.0.0.1" + }, + "countryCode": { + "type": "string", + "description": "Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format", + "x-example": "US" + }, + "country": { + "type": "string", + "description": "Country name. This field support localization.", + "x-example": "United States" + }, + "continentCode": { + "type": "string", + "description": "Continent code. A two character continent code \"AF\" for Africa, \"AN\" for Antarctica, \"AS\" for Asia, \"EU\" for Europe, \"NA\" for North America, \"OC\" for Oceania, and \"SA\" for South America.", + "x-example": "NA" + }, + "continent": { + "type": "string", + "description": "Continent name. This field support localization.", + "x-example": "North America" + }, + "eu": { + "type": "boolean", + "description": "True if country is part of the Europian Union.", + "x-example": false + }, + "currency": { + "type": "string", + "description": "Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format", + "x-example": "USD" + } + }, + "required": [ + "ip", + "countryCode", + "country", + "continentCode", + "continent", + "eu", + "currency" + ] + }, + "file": { + "description": "File", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "File ID.", + "x-example": "5e5ea5c16897e" + }, + "$permissions": { + "type": "object", + "description": "File permissions.", + "x-example": {}, + "items": { "type": "object", "$ref": "#/definitions/permissions" } + }, + "name": { + "type": "string", + "description": "File name.", + "x-example": "Pink.png" + }, + "dateCreated": { + "type": "integer", + "description": "File creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "signature": { + "type": "string", + "description": "File MD5 signature.", + "x-example": "5d529fd02b544198ae075bd57c1762bb" + }, + "mimeType": { + "type": "string", + "description": "File mime type.", + "x-example": "image/png" + }, + "sizeOriginal": { + "type": "integer", + "description": "File original size in bytes.", + "x-example": 17890, + "format": "int32" + } + }, + "required": [ + "$id", + "$permissions", + "name", + "dateCreated", + "signature", + "mimeType", + "sizeOriginal" + ] + }, + "team": { + "description": "Team", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Team ID.", + "x-example": "5e5ea5c16897e" + }, + "name": { + "type": "string", + "description": "Team name.", + "x-example": "VIP" + }, + "dateCreated": { + "type": "integer", + "description": "Team creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "sum": { + "type": "integer", + "description": "Total sum of team members.", + "x-example": 7, + "format": "int32" + } + }, + "required": ["$id", "name", "dateCreated", "sum"] + }, + "membership": { + "description": "Membership", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Membership ID.", + "x-example": "5e5ea5c16897e" + }, + "userId": { + "type": "string", + "description": "User ID.", + "x-example": "5e5ea5c16897e" + }, + "teamId": { + "type": "string", + "description": "Team ID.", + "x-example": "5e5ea5c16897e" + }, + "name": { + "type": "string", + "description": "User name.", + "x-example": "VIP" + }, + "email": { + "type": "string", + "description": "User email address.", + "x-example": "john@appwrite.io" + }, + "invited": { + "type": "integer", + "description": "Date, the user has been invited to join the team in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "joined": { + "type": "integer", + "description": "Date, the user has accepted the invitation to join the team in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "confirm": { + "type": "boolean", + "description": "User confirmation status, true if the user has joined the team or false otherwise.", + "x-example": false + }, + "roles": { + "type": "array", + "description": "User list of roles", + "items": { "type": "string" } + } + }, + "required": [ + "$id", + "userId", + "teamId", + "name", + "email", + "invited", + "joined", + "confirm", + "roles" + ] + }, + "function": { + "description": "Function", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Function ID.", + "x-example": "5e5ea5c16897e" + }, + "name": { + "type": "string", + "description": "Function name.", + "x-example": "My Function" + }, + "dateCreated": { + "type": "integer", + "description": "Function creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "dateUpdated": { + "type": "integer", + "description": "Function update date in Unix timestamp.", + "x-example": 1592981257, + "format": "int32" + }, + "status": { + "type": "string", + "description": "Function status. Possible values: disabled, enabled", + "x-example": "enabled" + }, + "env": { + "type": "string", + "description": "Function execution environment.", + "x-example": "python-3.8" + }, + "tag": { + "type": "string", + "description": "Function active tag ID.", + "x-example": "5e5ea5c16897e" + }, + "vars": { + "type": "string", + "description": "Function environment variables.", + "x-example": { "key": "value" } + }, + "events": { + "type": "array", + "description": "Function trigger events.", + "items": { "type": "string" } + }, + "schedule": { + "type": "string", + "description": "Function execution schedult in CRON format.", + "x-example": "5 4 * * *" + }, + "scheduleNext": { + "type": "integer", + "description": "Function next scheduled execution date in Unix timestamp.", + "x-example": 1592981292, + "format": "int32" + }, + "schedulePrevious": { + "type": "integer", + "description": "Function next scheduled execution date in Unix timestamp.", + "x-example": 1592981237, + "format": "int32" + }, + "timeout": { + "type": "integer", + "description": "Function execution timeout in seconds.", + "x-example": 1592981237, + "format": "int32" + } + }, + "required": [ + "$id", + "name", + "dateCreated", + "dateUpdated", + "status", + "env", + "tag", + "vars", + "events", + "schedule", + "scheduleNext", + "schedulePrevious", + "timeout" + ] + }, + "tag": { + "description": "Tag", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Tag ID.", + "x-example": "5e5ea5c16897e" + }, + "functionId": { + "type": "string", + "description": "Function ID.", + "x-example": "5e5ea6g16897e" + }, + "dateCreated": { + "type": "integer", + "description": "The tag creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "command": { + "type": "string", + "description": "The entrypoint command in use to execute the tag code.", + "x-example": "enabled" + }, + "size": { + "type": "string", + "description": "The code size in bytes.", + "x-example": "python-3.8" + } + }, + "required": ["$id", "functionId", "dateCreated", "command", "size"] + }, + "execution": { + "description": "Execution", + "type": "object", + "properties": { + "$id": { + "type": "string", + "description": "Execution ID.", + "x-example": "5e5ea5c16897e" + }, + "functionId": { + "type": "string", + "description": "Function ID.", + "x-example": "5e5ea6g16897e" + }, + "dateCreated": { + "type": "integer", + "description": "The execution creation date in Unix timestamp.", + "x-example": 1592981250, + "format": "int32" + }, + "trigger": { + "type": "string", + "description": "The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.", + "x-example": "http" + }, + "status": { + "type": "string", + "description": "The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`.", + "x-example": "processing" + }, + "exitCode": { + "type": "integer", + "description": "The script exit code.", + "x-example": 0, + "format": "int32" + }, + "stdout": { + "type": "string", + "description": "The script stdout output string.", + "x-example": "" + }, + "stderr": { + "type": "string", + "description": "The script stderr output string.", + "x-example": "" + }, + "time": { + "type": "number", + "description": "The script execution time in seconds.", + "x-example": 0.4, + "format": "float" + } + }, + "required": [ + "$id", + "functionId", + "dateCreated", + "trigger", + "status", + "exitCode", + "stdout", + "stderr", + "time" + ] + }, + "country": { + "description": "Country", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Country name.", + "x-example": "United States" + }, + "code": { + "type": "string", + "description": "Country two-character ISO 3166-1 alpha code.", + "x-example": "US" + } + }, + "required": ["name", "code"] + }, + "continent": { + "description": "Continent", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Continent name.", + "x-example": "Europe" + }, + "code": { + "type": "string", + "description": "Continent two letter code.", + "x-example": "EU" + } + }, + "required": ["name", "code"] + }, + "langauge": { + "description": "Language", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Language name.", + "x-example": "Italian" + }, + "code": { + "type": "string", + "description": "Language two-character ISO 639-1 codes.", + "x-example": "it" + }, + "nativeName": { + "type": "string", + "description": "Language native name.", + "x-example": "Italiano" + } + }, + "required": ["name", "code", "nativeName"] + }, + "currency": { + "description": "Currency", + "type": "object", + "properties": { + "symbol": { + "type": "string", + "description": "Currency symbol.", + "x-example": "$" + }, + "name": { + "type": "string", + "description": "Currency name.", + "x-example": "US dollar" + }, + "symbolNative": { + "type": "string", + "description": "Currency native symbol.", + "x-example": "$" + }, + "decimalDigits": { + "type": "integer", + "description": "Number of decimal digits.", + "x-example": 2, + "format": "int32" + }, + "rounding": { + "type": "number", + "description": "Currency digit rounding.", + "x-example": 0, + "format": "float" + }, + "code": { + "type": "string", + "description": "Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format.", + "x-example": "USD" + }, + "namePlural": { + "type": "string", + "description": "Currency plural name", + "x-example": "US dollars" + } + }, + "required": [ + "symbol", + "name", + "symbolNative", + "decimalDigits", + "rounding", + "code", + "namePlural" + ] + }, + "phone": { + "description": "Phone", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Phone code.", + "x-example": "+1" + }, + "countryCode": { + "type": "string", + "description": "Country two-character ISO 3166-1 alpha code.", + "x-example": "US" + }, + "countryName": { + "type": "string", + "description": "Country name.", + "x-example": "United States" + } + }, + "required": ["code", "countryCode", "countryName"] } }, "externalDocs": { "description": "Full API docs, specs and tutorials", - "url": "https:\/\/localhost:2444\/docs" + "url": "https://appwrite.io/docs" } -} \ No newline at end of file +} From f785b1c5b85703b7dd4e6d81821318b33f3609e9 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 22 Dec 2020 23:55:16 +0200 Subject: [PATCH 3/8] Updated defaults --- src/Spec/Swagger2.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 26e8afbfb..96ad95d75 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -167,10 +167,10 @@ public function getMethods($service) foreach ($method['parameters'] as $parameter) { $param = [ - 'name' => $parameter['name'], - 'type' => $parameter['type'], - 'description' => $parameter['description'], - 'required' => (int)$parameter['required'], + 'name' => $parameter['name'] ?? null, + 'type' => $parameter['type'] ?? null, + 'description' => $parameter['description'] ?? '', + 'required' => (int)$parameter['required'] ?? false, 'default' => $parameter['default'] ?? null, 'example' => $parameter['x-example'] ?? null, 'array' => [ From a2223ab660673ef38c42a3ffc023ff92fece8a3f Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 22 Dec 2020 23:57:37 +0200 Subject: [PATCH 4/8] Fixed type --- src/Spec/Swagger2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 96ad95d75..c69bf2649 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -170,7 +170,7 @@ public function getMethods($service) 'name' => $parameter['name'] ?? null, 'type' => $parameter['type'] ?? null, 'description' => $parameter['description'] ?? '', - 'required' => (int)$parameter['required'] ?? false, + 'required' => (int)($parameter['required'] ?? 0), 'default' => $parameter['default'] ?? null, 'example' => $parameter['x-example'] ?? null, 'array' => [ From 8c16f1b15b2ccdb2e4def608e71a3b7d62251bce Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 23 Dec 2020 00:09:27 +0200 Subject: [PATCH 5/8] Fixed spec parser --- src/Spec/Swagger2.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index c69bf2649..e0099b812 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -180,8 +180,6 @@ public function getMethods($service) $param['default'] = (is_array($param['default'])) ? json_encode($param['default']): $param['default']; - $output['parameters']['all'][] = $param; - switch ($parameter['in']) { case 'header': $output['parameters']['header'][] = $param; @@ -196,8 +194,8 @@ public function getMethods($service) $output['parameters']['body'][] = $param; break; case 'body': - $bodyProperties = $param['schema']['properties'] ?? []; - $bodyRequired = $param['schema']['required'] ?? []; + $bodyProperties = $parameter['schema']['properties'] ?? []; + $bodyRequired = $parameter['schema']['required'] ?? []; foreach ($bodyProperties as $key => $value) { $param['name'] = $key; @@ -208,10 +206,15 @@ public function getMethods($service) $param['example'] = $value['x-example'] ?? null; $output['parameters']['body'][] = $param; + $output['parameters']['all'][] = $param; } + + continue 2; break; } + + $output['parameters']['all'][] = $param; } usort($output['parameters']['all'], function ($a, $b) { From 9d519e15ace78d931f961b501f4794bdb6ff7d51 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 23 Dec 2020 08:39:50 +0200 Subject: [PATCH 6/8] Updated CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 57b689313..39bf32018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ notifications: - team@appwrite.io install: + - echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin - composer install script: From 1663c085364860ad6366510f945365a3fa1247c6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 23 Dec 2020 08:41:18 +0200 Subject: [PATCH 7/8] Updated CI 2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39bf32018..de5c04f20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ notifications: - team@appwrite.io install: - - echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin + - echo 'DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=https://mirror.gcr.io"' - composer install script: From b17ca386c09b27fed1031e138db576258b6f3ee6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 23 Dec 2020 13:19:02 +0200 Subject: [PATCH 8/8] Updated CI --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index de5c04f20..3c96dd5ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,11 @@ notifications: email: - team@appwrite.io -install: +before_install: - echo 'DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=https://mirror.gcr.io"' + - sudo service docker restart + +install: - composer install script: