Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<openapi-generator-version>7.11.0</openapi-generator-version>
<openapi-generator-version>7.21.0</openapi-generator-version>
</properties>
</project>
633 changes: 214 additions & 419 deletions src/clients/channel-access-token/lib/Api/ChannelAccessTokenApi.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/clients/channel-access-token/lib/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
/**
* ApiException
* PHP version 7.4
* PHP version 8.1
*
* @category Class
* @package LINE\Clients\ChannelAccessToken
Expand All @@ -31,7 +31,7 @@
*
* The version of the OpenAPI document: 0.0.1
* Generated by: https://openapi-generator.tech
* Generator version: 7.11.0
* Generator version: 7.21.0
*/

/**
Expand Down
63 changes: 60 additions & 3 deletions src/clients/channel-access-token/lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
/**
* Configuration
* PHP version 7.4
* PHP version 8.1
*
* @category Class
* @package LINE\Clients\ChannelAccessToken
Expand All @@ -31,7 +31,7 @@
*
* The version of the OpenAPI document: 0.0.1
* Generated by: https://openapi-generator.tech
* Generator version: 7.11.0
* Generator version: 7.21.0
*/

/**
Expand All @@ -44,7 +44,7 @@

/**
* Configuration Class Doc Comment
* PHP version 7.4
* PHP version 8.1
*
* @category Class
* @package LINE\Clients\ChannelAccessToken
Expand Down Expand Up @@ -138,6 +138,20 @@ class Configuration
*/
protected $tempFolderPath;

/**
* Path to a certificate file, for mTLS
*
* @var string
*/
protected $certFile;

/**
* Path to a key file, for mTLS
*
* @var string
*/
protected $keyFile;

/**
* Constructor
*/
Expand Down Expand Up @@ -411,6 +425,49 @@ public function getTempFolderPath()
return $this->tempFolderPath;
}

/**
* Sets the certificate file path, for mTLS
*
* @return $this
*/
public function setCertFile($certFile)
{
$this->certFile = $certFile;
return $this;
}

/**
* Gets the certificate file path, for mTLS
*
* @return string Certificate file path
*/
public function getCertFile()
{
return $this->certFile;
}

/**
* Sets the certificate key path, for mTLS
*
* @return $this
*/
public function setKeyFile($keyFile)
{
$this->keyFile = $keyFile;
return $this;
}

/**
* Gets the certificate key path, for mTLS
*
* @return string Certificate key path
*/
public function getKeyFile()
{
return $this->keyFile;
}


/**
* Gets the default configuration instance
*
Expand Down
261 changes: 261 additions & 0 deletions src/clients/channel-access-token/lib/FormDataProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
<?php
/**
* Copyright 2026 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/**
* FormDataProcessor
* PHP version 7.4
*
* @category Class
* @package LINE\Clients\ChannelAccessToken
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/

/**
* Channel Access Token API
*
* This document describes Channel Access Token API.
*
* The version of the OpenAPI document: 0.0.1
* Generated by: https://openapi-generator.tech
* Generator version: 7.21.0
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

namespace LINE\Clients\ChannelAccessToken;

use ArrayAccess;
use DateTime;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;
use SplFileObject;
use LINE\Clients\ChannelAccessToken\Model\ModelInterface;

/**
* FormDataProcessor Class Doc Comment
*
* @category Class
* @package LINE\Clients\ChannelAccessToken
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class FormDataProcessor
{
/**
* Tags whether payload passed to ::prepare() contains one or more
* SplFileObject or stream values.
*/
public bool $has_file = false;

/**
* Take value and turn it into an array suitable for inclusion in
* the http body (form parameter). If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601
*
* @param array<string|bool|array|DateTime|ArrayAccess|SplFileObject> $values the value of the form parameter
*
* @return array [key => value] of formdata
*/
public function prepare(array $values): array
{
$this->has_file = false;
$result = [];

foreach ($values as $k => $v) {
if ($v === null) {
continue;
}

$result[$k] = $this->makeFormSafe($v);
}

return $result;
}

/**
* Flattens a multi-level array of data and generates a single-level array
* compatible with formdata - a single-level array where the keys use bracket
* notation to signify nested data.
*
* credit: https://github.com/FranBar1966/FlatPHP
*/
public static function flatten(array $source, string $start = ''): array
{
$opt = [
'prefix' => '[',
'suffix' => ']',
'suffix-end' => true,
'prefix-list' => '[',
'suffix-list' => ']',
'suffix-list-end' => true,
];

if ($start === '') {
$currentPrefix = '';
$currentSuffix = '';
$currentSuffixEnd = false;
} elseif (array_is_list($source)) {
$currentPrefix = $opt['prefix-list'];
$currentSuffix = $opt['suffix-list'];
$currentSuffixEnd = $opt['suffix-list-end'];
} else {
$currentPrefix = $opt['prefix'];
$currentSuffix = $opt['suffix'];
$currentSuffixEnd = $opt['suffix-end'];
}

$currentName = $start;
$result = [];

foreach ($source as $key => $val) {
$currentName .= $currentPrefix.$key;

if (is_array($val) && !empty($val)) {
$currentName .= $currentSuffix;
$result += self::flatten($val, $currentName);
} else {
if ($currentSuffixEnd) {
$currentName .= $currentSuffix;
}

if (is_resource($val)) {
$result[$currentName] = $val;
} else {
$result[$currentName] = ObjectSerializer::toString($val);
}
}

$currentName = $start;
}

return $result;
}

/**
* formdata must be limited to scalars or arrays of scalar values,
* or a resource for a file upload. Here we iterate through all available
* data and identify how to handle each scenario
*/
protected function makeFormSafe($value)
{
if ($value instanceof SplFileObject) {
return $this->processFiles([$value])[0];
}

if (is_resource($value)) {
$this->has_file = true;

return $value;
}

if ($value instanceof ModelInterface) {
return $this->processModel($value);
}

if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) {
$data = [];

foreach ($value as $k => $v) {
$data[$k] = $this->makeFormSafe($v);
}

return $data;
}

return ObjectSerializer::toString($value);
}

/**
* We are able to handle nested ModelInterface. We do not simply call
* json_decode(json_encode()) because any given model may have binary data
* or other data that cannot be serialized to a JSON string
*/
protected function processModel(ModelInterface $model): array
{
$result = [];

foreach ($model::openAPITypes() as $name => $type) {
$value = $model->offsetGet($name);

if ($value === null) {
continue;
}

if (strpos($type, '\SplFileObject') !== false) {
$file = is_array($value) ? $value : [$value];
$result[$name] = $this->processFiles($file);

continue;
}

if ($value instanceof ModelInterface) {
$result[$name] = $this->processModel($value);

continue;
}

if (is_array($value) || is_object($value)) {
$result[$name] = $this->makeFormSafe($value);

continue;
}

$result[$name] = ObjectSerializer::toString($value);
}

return $result;
}

/**
* Handle file data
*/
protected function processFiles(array $files): array
{
$this->has_file = true;

$result = [];

foreach ($files as $i => $file) {
if (is_array($file)) {
$result[$i] = $this->processFiles($file);

continue;
}

if ($file instanceof StreamInterface) {
$result[$i] = $file;

continue;
}

if ($file instanceof SplFileObject) {
$result[$i] = $this->tryFopen($file);
}
}

return $result;
}

private function tryFopen(SplFileObject $file)
{
return Utils::tryFopen($file->getRealPath(), 'rb');
}
}
Loading
Loading