From 8811e6c625abe95f5c4a5ca9c2f34954d5148a9c Mon Sep 17 00:00:00 2001 From: Tatevik Date: Wed, 15 Jan 2025 21:17:45 +0400 Subject: [PATCH 1/2] remove apib file --- docs/Api/RestApi.apib | 394 ------------------------------------------ 1 file changed, 394 deletions(-) delete mode 100644 docs/Api/RestApi.apib diff --git a/docs/Api/RestApi.apib b/docs/Api/RestApi.apib deleted file mode 100644 index 026075a..0000000 --- a/docs/Api/RestApi.apib +++ /dev/null @@ -1,394 +0,0 @@ -FORMAT: 1A -HOST: https://example.com/api/v2 - -# phpList REST API v2 - - -# Group Authentication - -Resources related to login and logout. - - -## Session [/sessions] - -### Create a new session (log in) [POST] - -Given valid login data, this will generate a login token that will be -valid for 1 hour. It takes a JSON object containing the following key-value -pairs: - -+ `login_name` (string): the login name of the superuser administrator to log in -+ `password` (string): the plain text password - -Non-superuser administrators cannot authenticate via the REST API. - -The login token then can be passed as basic auth password for requests -that require authentication. (The basic auth user name can be any string.) - -+ Request (application/json) - - { - "login_name": "admin", - "password": "eetIc/Gropvoc1" - } - -+ Response 201 (application/json) - - + Body - - { - "id": 1234, - "key": "2cfe100561473c6cdd99c9e2f26fa974", - "expiry": "2017-07-20T18:22:48+00:00" - } - -+ Response 400 (application/json) - - + Body - - { - "code": 400, - "message": "Empty JSON data" - } - -+ Response 400 (application/json) - - + Body - - { - "code": 400, - "message": 'Invalid json message received' - } - -+ Response 400 (application/json) - - + Body - - { - "code": 400, - "message": "Incomplete credentials" - } - -+ Response 401 (application/json) - - + Body - - { - "code": 401, - "message": "Not authorized" - } - -## Single session [/sessions/{session}] - -### Destroy a the session (log out) [DELETE] - -+ Request (application/json) - -+ Response 204 (application/json) - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "You do not have access to this session." - } - -+ Response 404 (application/json) - - + Body - - { - "code": 404, - "message": "There is no session with that ID." - } - - -# Group Lists - -Resources related to subscriber lists. - -All requests in this group need to be authenticated with a valid session key -provided as basic auth password. (The basic auth user name can be any string.) - - -## Subscriber lists [/lists] - -### Retrieve all subscriber lists [GET] - -+ Request (application/json) - -+ Response 200 (application/json) - - + Body - - { - "name": "News", - "description": "News (and some fun stuff)", - "creation_date": "2016-06-22T15:01:17+00:00", - "list_position": 12, - "subject_prefix": "phpList", - "public": true, - "category": "news", - "id": 1 - }, - { - "name": "More news", - "description": "", - "creation_date": "2016-06-22T15:01:17+00:00", - "list_position": 12, - "subject_prefix": "", - "public": true, - "category": "", - "id": 2 - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -## Single subscriber list [/lists/{list}] - -### Get the list data [GET] - -+ Request (application/json) - -+ Response 200 (application/json) - - + Body - - { - "name": "News", - "description": "News (and some fun stuff)", - "creation_date": "2016-06-22T15:01:17+00:00", - "list_position": 12, - "subject_prefix": "phpList", - "public": true, - "category": "news", - "id": 1 - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 404 (application/json) - - + Body - - { - "code": 404, - "message": "There is no list with that ID." - } - -### Delete a the list [DELETE] - -+ Request (application/json) - -+ Response 204 (application/json) - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 404 (application/json) - - + Body - - { - "code": 404, - "message": "There is no list with that ID." - } - -## Members of a subscriber list [/lists/{list}/members] - -### Retrieve all members of a subscriber list [GET] - -+ Request (application/json) - -+ Response 200 (application/json) - - + Body - - { - "creation_date" => "2016-07-22T15:01:17+00:00", - "email" => "oliver@example.com", - "confirmed" => true, - "blacklisted" => true, - "bounce_count" => 17, - "unique_id" => "95feb7fe7e06e6c11ca8d0c48cb46e89", - "html_email" => true, - "disabled" => true, - "id" => 1, - }, - { - "creation_date" => "2017-07-22T15:12:17+00:00", - "email" => "sam@example.com", - "confirmed" => true, - "blacklisted" => false, - "bounce_count" => 1, - "unique_id" => "95feb7fe7e06e6c11ca8d0c48cb4616d", - "html_email" => false, - "disabled" => false, - "id" => 2, - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 404 (application/json) - - + Body - - { - "code": 404, - "message": "There is no list with that ID." - } - - -## Members of a subscriber list [/lists/{list}/members] - -### Retrieve all members of a subscriber list [GET] - -+ Request (application/json) - -+ Response 200 (application/json) - - + Body - - { - "creation_date" => "2016-07-22T15:01:17+00:00", - "email" => "oliver@example.com", - "confirmed" => true, - "blacklisted" => true, - "bounce_count" => 17, - "unique_id" => "95feb7fe7e06e6c11ca8d0c48cb46e89", - "html_email" => true, - "disabled" => true, - "id" => 1, - }, - { - "creation_date" => "2017-07-22T15:12:17+00:00", - "email" => "sam@example.com", - "confirmed" => true, - "blacklisted" => false, - "bounce_count" => 1, - "unique_id" => "95feb7fe7e06e6c11ca8d0c48cb4616d", - "html_email" => false, - "disabled" => false, - "id" => 2, - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 404 (application/json) - - + Body - - { - "code": 404, - "message": "There is no list with that ID." - } - - -# Group Subscribers - -Resources related to subscribers. - -All requests in this group need to be authenticated with a valid session key -provided as basic auth password. (The basic auth user name can be any string.) - -## Subscribers [/subscribers] - -### Create a new subscriber [POST] - -Given a valid authentication, this will generate a subscriber. It takes a JSON -object containing the following key-value pairs: - -+ `email` (string): the email address of the subscriber (required) -+ `confirmed` (boolean): whether the subscriber already is confirmed (optional) -+ `blacklisted` (boolean): whether the subscriber is blacklisted (optional) -+ `html_email` (boolean): whether the subscriber would like to receive emails - in HTML format (optional) -+ `disabled` (boolean): whether the subscriber is disabled (optional) - -+ Response 201 (application/json) - - + Body - - { - "creation_date": "2017-12-16T18:44:27+00:00", - "email": "subscriber@example.com", - "confirmed": false, - "blacklisted": false, - "bounce_count": 0, - "unique_id": "69f4e92cf50eafca9627f35704f030f4", - "html_email": true, - "disabled": false, - "id": 1 - } - -+ Response 403 (application/json) - - + Body - - { - "code": 403, - "message": "No valid session key was provided as basic auth password." - } - -+ Response 409 (application/json) - - + Body - - { - "code": 409, - "message": "This resource already exists." - } - -+ Response 422 (application/json) - - + Body - - { - "code": 422, - "message": "Some fields invalid: email, confirmed, html_email" - } From 867db22a53f027a741fe013bcea8123ee8fca75a Mon Sep 17 00:00:00 2001 From: Tatevik Date: Wed, 15 Jan 2025 21:21:37 +0400 Subject: [PATCH 2/2] remove workflow --- .github/workflows/restapi-docs.yml | 93 ------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 .github/workflows/restapi-docs.yml diff --git a/.github/workflows/restapi-docs.yml b/.github/workflows/restapi-docs.yml deleted file mode 100644 index 25ab243..0000000 --- a/.github/workflows/restapi-docs.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Publish REST API Docs -on: - push: - branches: - - main - pull_request: - -jobs: - make-restapi-docs: - name: Checkout phpList rest-api and generate docs specification (OpenAPI latest-restapi.json) - runs-on: ubuntu-20.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Setup PHP with Composer and Extensions - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - extensions: mbstring, dom, fileinfo, mysql - - - name: Cache Composer Dependencies - uses: actions/cache@v3 - with: - path: ~/.composer/cache - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Install Composer Dependencies - run: composer install --no-interaction --prefer-dist - - - name: Generate OpenAPI Specification JSON - run: vendor/bin/openapi -o docs/latest-restapi.json --format json src - - - name: Upload REST API Specification - uses: actions/upload-artifact@v3 - with: - name: restapi-json - path: docs/latest-restapi.json - - deploy-docs: - name: Deploy REST API Specification - runs-on: ubuntu-20.04 - needs: make-restapi-docs - steps: - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 14 - - - name: Install openapi-checker - run: npm install -g swagger-cli - - - name: Checkout REST API Docs Repository - uses: actions/checkout@v3 - with: - repository: phpList/restapi-docs - fetch-depth: 0 - token: ${{ secrets.PUSH_REST_API_DOCS }} - - - name: Download Generated REST API Specification - uses: actions/download-artifact@v3 - with: - name: restapi-json - path: docs - - - name: Validate OpenAPI Specification - run: swagger-cli validate docs/latest-restapi.json - - - name: Compare Specifications - run: git diff --no-index --output=restapi-diff.txt docs/latest-restapi.json restapi.json || true - - - name: Check Differences and Decide Deployment - id: allow-deploy - run: | - if [ -s restapi-diff.txt ]; then - echo "Updates detected in the REST API specification. Proceeding with deployment."; - echo 'DEPLOY=true' >> $GITHUB_ENV; - else - echo "No changes detected in the REST API specification. Skipping deployment."; - echo 'DEPLOY=false' >> $GITHUB_ENV; - fi - - - name: Commit and Deploy Updates - if: env.DEPLOY == 'true' - run: | - mv docs/latest-restapi.json docs/restapi.json - git config user.name "github-actions" - git config user.email "github-actions@restapi-docs.workflow" - git add docs/restapi.json - git commit -m "Update REST API documentation `date`" - git push