From d57d6a6327887563899d208819396c807aff02ee Mon Sep 17 00:00:00 2001 From: freespiritstays <33014720+freespiritstays@users.noreply.github.com> Date: Sun, 8 May 2022 02:33:37 -0700 Subject: [PATCH 1/3] Create php.yml --- .github/workflows/php.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..5ff27cd --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,39 @@ +name: PHP Composer + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md + + # - name: Run test suite + # run: composer run-script test From 9318ff4f4795e89e90d23bcd6df1e31f1946d83f Mon Sep 17 00:00:00 2001 From: fsalomon Date: Wed, 9 Nov 2022 23:55:59 +0200 Subject: [PATCH 2/3] Minimal multipart post support --- src/Client/RequestBuilder.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Client/RequestBuilder.php b/src/Client/RequestBuilder.php index 85c3a65..c606285 100644 --- a/src/Client/RequestBuilder.php +++ b/src/Client/RequestBuilder.php @@ -118,7 +118,11 @@ public function create(): RequestInterface if ($this->data['method'] !== self::HTTP_GET) { curl_setopt($this->curl, CURLOPT_POST, true); - curl_setopt($this->curl, CURLOPT_POSTFIELDS, json_encode($this->data['fields'])); + if ($this->isMultipart()) { + curl_setopt($this->curl, CURLOPT_POSTFIELDS, $this->data['fields']); + } else { + curl_setopt($this->curl, CURLOPT_POSTFIELDS, json_encode($this->data['fields'])); + } } $request = new Request($this->curl); @@ -137,7 +141,7 @@ private function buildHeaders(): array { $headers = [ ZohoOAuthConstants::AUTHORIZATION . ':' . ZohoOAuthConstants::OAUTH_HEADER_PREFIX . $this->client->getAccessToken(), - 'Content-Type:application/json' + 'Content-Type: ' . ($this->isMultipart() ? 'multipart/form-data' : 'application/json'), ]; if ($this->client->getOrgId()) { @@ -147,6 +151,10 @@ private function buildHeaders(): array return $headers; } + private function isMultipart() { + return isset($this->data['fields']['file']) && $this->data['fields']['file'] instanceof \CURLFile; + } + private function buildUrl(): string { $url = sprintf( From 44922db8c9ae55c8f337b80d66d7b97a848bb54b Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Tue, 2 Apr 2024 21:16:44 +0200 Subject: [PATCH 3/3] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 8498966..9dddac1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,7 +1,7 @@ # These are supported funding model platforms #github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: thomas_klein # Replace with a single Patreon username +#patreon: thomas_klein # Replace with a single Patreon username #open_collective: # Replace with a single Open Collective username #ko_fi: # Replace with a single Ko-fi username #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel