diff --git a/composer.json b/composer.json index af8f27f..af06be9 100755 --- a/composer.json +++ b/composer.json @@ -47,11 +47,11 @@ }, "require": { "php": "^8.1", - "phplist/core": "dev-main", + "phplist/core": "dev-dev", "symfony/twig-bundle": "^6.4", "symfony/webpack-encore-bundle": "^2.2", "symfony/security-bundle": "^6.4", - "tatevikgr/rest-api-client": "dev-main" + "tatevikgr/rest-api-client": "dev-dev" }, "require-dev": { "phpunit/phpunit": "^9.5", diff --git a/openapi.json b/openapi.json index 722bd8a..5396659 100644 --- a/openapi.json +++ b/openapi.json @@ -4,7 +4,7 @@ "title": "phpList API Documentation", "description": "This is the OpenAPI documentation for phpList API.", "contact": { - "email": "support@phplist.com" + "email": "tatevik@phplist.com" }, "license": { "name": "AGPL-3.0-or-later", @@ -1393,10 +1393,18 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BounceView" - } + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BounceView" + } + }, + "pagination": { + "$ref": "#/components/schemas/CursorPagination" + } + }, + "type": "object" } } } @@ -4715,14 +4723,14 @@ } } }, - "/api/v2/subscribe-pages/{id}": { + "/api/v2/subscribe-pages": { "get": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Get subscribe page", + "summary": "Get subscribe pages list", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "390db83b1de32e07d2d52b310eb0c1ea", + "operationId": "1a89921fa5f82ce43daf2ca40dc3f954", "parameters": [ { "name": "php-auth-pw", @@ -4734,12 +4742,26 @@ } }, { - "name": "id", - "in": "path", - "description": "Subscribe page ID", - "required": true, + "name": "after_id", + "in": "query", + "description": "Last id (starting from 0)", + "required": false, "schema": { - "type": "integer" + "type": "integer", + "default": 1, + "minimum": 1 + } + }, + { + "name": "limit", + "in": "query", + "description": "Number of results per page", + "required": false, + "schema": { + "type": "integer", + "default": 25, + "maximum": 100, + "minimum": 1 } } ], @@ -4749,7 +4771,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SubscribePage" + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SubscribePage" + } + }, + "pagination": { + "$ref": "#/components/schemas/CursorPagination" + } + }, + "type": "object" } } } @@ -4776,13 +4809,13 @@ } } }, - "put": { + "post": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Update subscribe page", + "summary": "Create subscribe page", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "a82a0cbe52063758b55279ce7b96657b", + "operationId": "314286c5d8ef80c845f5dfd2d671bad3", "parameters": [ { "name": "php-auth-pw", @@ -4792,15 +4825,6 @@ "schema": { "type": "string" } - }, - { - "name": "id", - "in": "path", - "description": "Subscribe page ID", - "required": true, - "schema": { - "type": "integer" - } } ], "requestBody": { @@ -4810,12 +4834,26 @@ "schema": { "properties": { "title": { - "type": "string", - "nullable": true + "type": "string" }, "active": { "type": "boolean", "nullable": true + }, + "data": { + "type": "array", + "items": { + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "nullable": true } }, "type": "object" @@ -4824,8 +4862,8 @@ } }, "responses": { - "200": { - "description": "Success", + "201": { + "description": "Created", "content": { "application/json": { "schema": { @@ -4844,31 +4882,33 @@ } } }, - "404": { - "description": "Not Found", + "422": { + "description": "Validation failed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundErrorResponse" + "$ref": "#/components/schemas/ValidationErrorResponse" } } } } } - }, - "delete": { + } + }, + "/api/v2/subscribe-pages/{id}": { + "get": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Delete subscribe page", + "summary": "Get subscribe page", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "2881b5de1d076caa070f2b9a1c8487fe", + "operationId": "390db83b1de32e07d2d52b310eb0c1ea", "parameters": [ { "name": "php-auth-pw", "in": "header", "description": "Session key obtained from login", - "required": true, + "required": false, "schema": { "type": "string" } @@ -4884,8 +4924,15 @@ } ], "responses": { - "204": { - "description": "No Content" + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscribePage" + } + } + } }, "403": { "description": "Failure", @@ -4908,16 +4955,14 @@ } } } - } - }, - "/api/v2/subscribe-pages": { - "post": { + }, + "put": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Create subscribe page", + "summary": "Update subscribe page", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "314286c5d8ef80c845f5dfd2d671bad3", + "operationId": "a82a0cbe52063758b55279ce7b96657b", "parameters": [ { "name": "php-auth-pw", @@ -4927,6 +4972,15 @@ "schema": { "type": "string" } + }, + { + "name": "id", + "in": "path", + "description": "Subscribe page ID", + "required": true, + "schema": { + "type": "integer" + } } ], "requestBody": { @@ -4936,11 +4990,27 @@ "schema": { "properties": { "title": { - "type": "string" + "type": "string", + "nullable": true }, "active": { "type": "boolean", "nullable": true + }, + "data": { + "type": "array", + "items": { + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "nullable": true } }, "type": "object" @@ -4949,8 +5019,8 @@ } }, "responses": { - "201": { - "description": "Created", + "200": { + "description": "Success", "content": { "application/json": { "schema": { @@ -4969,27 +5039,25 @@ } } }, - "422": { - "description": "Validation failed", + "404": { + "description": "Not Found", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ValidationErrorResponse" + "$ref": "#/components/schemas/NotFoundErrorResponse" } } } } } - } - }, - "/api/v2/subscribe-pages/{id}/data": { - "get": { + }, + "delete": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Get subscribe page data", + "summary": "Delete subscribe page", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "ffe22f26936614a0e853e7c44e5a0fca", + "operationId": "2881b5de1d076caa070f2b9a1c8487fe", "parameters": [ { "name": "php-auth-pw", @@ -5011,30 +5079,8 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "data": { - "type": "string", - "nullable": true - } - }, - "type": "object" - } - } - } - } + "204": { + "description": "No Content" }, "403": { "description": "Failure", @@ -5057,26 +5103,60 @@ } } } - }, - "put": { + } + }, + "/api/v2/public/subscribe-pages/{pageId}": { + "get": { "tags": [ - "subscriptions" + "subscribe-pages" ], - "summary": "Set subscribe page data item", + "summary": "Get public subscribe page (placeholders replaced with actual values)", "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.", - "operationId": "a71571132947a19d862eac4baf7a98a7", + "operationId": "0ce8d9a7201bd20911aede0e4b62f479", "parameters": [ { - "name": "php-auth-pw", - "in": "header", - "description": "Session key obtained from login", + "name": "pageId", + "in": "path", + "description": "Subscribe page ID", "required": true, "schema": { - "type": "string" + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscribePagePublic" + } + } } }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundErrorResponse" + } + } + } + } + } + }, + "post": { + "tags": [ + "subscribe-pages" + ], + "summary": "Create subscription", + "description": "🚧 **Status: Beta** – This method is under development. Avoid using in production.Subscribe subscriber to a list from subscribe page.", + "operationId": "106ea367d6b2e0925240532f5cf1087c", + "parameters": [ { - "name": "id", + "name": "pageId", "in": "path", "description": "Subscribe page ID", "required": true, @@ -5086,59 +5166,42 @@ } ], "requestBody": { + "description": "", "required": true, "content": { "application/json": { "schema": { - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string", - "nullable": true - } - }, - "type": "object" + "$ref": "#/components/schemas/PublicSubscriptionRequest" } } } }, "responses": { - "200": { + "201": { "description": "Success", "content": { "application/json": { "schema": { - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "data": { - "type": "string", - "nullable": true - } - }, - "type": "object" + "type": "array", + "items": { + "$ref": "#/components/schemas/Subscription" + } } } } }, - "403": { + "400": { "description": "Failure", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnauthorizedResponse" + "$ref": "#/components/schemas/BadRequestResponse" } } } }, "404": { - "description": "Not Found", + "description": "Failure", "content": { "application/json": { "schema": { @@ -5146,6 +5209,16 @@ } } } + }, + "422": { + "description": "Failure", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ValidationErrorResponse" + } + } + } } } } @@ -8247,6 +8320,34 @@ }, "type": "object" }, + "PublicSubscriptionRequest": { + "properties": { + "email": { + "type": "string", + "format": "email", + "example": "lia@example.com" + }, + "confirm_email": { + "type": "string", + "format": "email", + "example": "lia@example.com" + }, + "list_id": { + "type": "integer", + "example": 1 + }, + "attributes": { + "type": "object", + "example": { + "firstname": "John", + "lastname": "Grigoryan", + "country": "Armenia" + }, + "additionalProperties": true + } + }, + "type": "object" + }, "SubscriberAttributeDefinitionRequest": { "required": [ "name" @@ -8507,6 +8608,19 @@ }, "type": "object" }, + "SubscribePageData": { + "properties": { + "key": { + "type": "string", + "example": "button" + }, + "value": { + "type": "string", + "example": "Subscribe to the selected newsletters" + } + }, + "type": "object" + }, "SubscribePage": { "properties": { "id": { @@ -8523,6 +8637,106 @@ }, "owner": { "$ref": "#/components/schemas/Administrator" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SubscribePageData" + } + } + }, + "type": "object" + }, + "SubscribePagePublic": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "title": { + "type": "string", + "example": "Subscribe to our newsletter" + }, + "data": { + "properties": { + "attributes": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "default_value": { + "type": "string", + "nullable": true + }, + "list_order": { + "type": "integer" + }, + "options": { + "type": "array", + "items": { + "type": "object" + } + } + }, + "type": "object" + } + }, + "lists": { + "type": "array", + "items": { + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "list_position": { + "type": "integer" + } + }, + "type": "object" + } + } + }, + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "object" + } + }, + { + "type": "object" + } + ] + } } }, "type": "object" @@ -8790,6 +9004,10 @@ "name": "subscriptions", "description": "subscriptions" }, + { + "name": "subscribe-pages", + "description": "subscribe-pages" + }, { "name": "subscriber-attributes", "description": "subscriber-attributes" @@ -8803,4 +9021,4 @@ "description": "lists" } ] -} +} \ No newline at end of file