Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# misc
.idea/

# Dependencies
/vendor

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
}
},
"require": {
"ext-curl": "*",
"php": ">=8.0",
"jane-php/open-api-runtime": "^7.7",
"psr/http-client-implementation": "*",
Expand Down
52 changes: 52 additions & 0 deletions generated/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,33 @@ public function filesCommentsDelete(array $formParameters = [], array $headerPar
return $this->executeEndpoint(new Endpoint\FilesCommentsDelete($formParameters, $headerParameters), $fetch);
}

/**
* Finishes an upload started with files.getUploadURLExternal.
*
* @param array $queryParameters {
*
* @var string $blocks A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the `initial_comment` field is provided, the `blocks` field is ignored.
* @var string $channel_id Channel ID where the file will be shared. If not specified, the file will remain private.
* @var string $channels comma-separated list of channel IDs where the file will be shared
* @var string $files an array of file objects, each containing the `id` of the file to be completed
* @var string $initial_comment the message text introducing the file in specified channels
* @var string $thread_ts Provide another message's `ts` value to upload this file as a reply. Never use a reply's `ts` value; use its parent instead. Also, make sure to provide only one channel when using `thread_ts`.
* }
*
* @param array $formParameters {
*
* @var string $token Authentication token bearing required scopes. Tokens should be passed as an HTTP Authorization header or alternatively, as a POST parameter.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return Model\FilesCompleteUploadExternalPostResponse200|Model\FilesCompleteUploadExternalPostResponsedefault|\Psr\Http\Message\ResponseInterface|null
*/
public function filesCompleteUploadExternal(array $queryParameters = [], array $formParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new Endpoint\FilesCompleteUploadExternal($queryParameters, $formParameters), $fetch);
}

/**
* Deletes a file.
*
Expand All @@ -2500,6 +2527,31 @@ public function filesDelete(array $formParameters = [], array $headerParameters
return $this->executeEndpoint(new Endpoint\FilesDelete($formParameters, $headerParameters), $fetch);
}

/**
* Gets a URL for an edge external file upload.
*
* @param array $queryParameters {
*
* @var string $alt_txt description of image for screen-reader
* @var string $filename name of the file being uploaded
* @var int $length size in bytes of the file being uploaded
* @var string $snippet_type Syntax type of the snippet being uploaded.
* }
*
* @param array $formParameters {
*
* @var string $token Authentication token. Requires scope: `files:write`
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return Model\FilesGetUploadURLExternalPostResponse200|Model\FilesGetUploadURLExternalPostResponsedefault|\Psr\Http\Message\ResponseInterface|null
*/
public function filesGetUploadUrlExternal(array $queryParameters = [], array $formParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executeEndpoint(new Endpoint\FilesGetUploadUrlExternal($queryParameters, $formParameters), $fetch);
}

/**
* Gets information about a file.
*
Expand Down
109 changes: 109 additions & 0 deletions generated/Endpoint/FilesCompleteUploadExternal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php

declare(strict_types=1);

/*
* This file is part of JoliCode's Slack PHP API project.
*
* (c) JoliCode <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace JoliCode\Slack\Api\Endpoint;

class FilesCompleteUploadExternal extends \JoliCode\Slack\Api\Runtime\Client\BaseEndpoint implements \JoliCode\Slack\Api\Runtime\Client\Endpoint
{
use \JoliCode\Slack\Api\Runtime\Client\EndpointTrait;

/**
* Finishes an upload started with files.getUploadURLExternal.
*
* @param array $queryParameters {
*
* @var string $blocks A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the `initial_comment` field is provided, the `blocks` field is ignored.
* @var string $channel_id Channel ID where the file will be shared. If not specified, the file will remain private.
* @var string $channels comma-separated list of channel IDs where the file will be shared
* @var string $files an array of file objects, each containing the `id` of the file to be completed
* @var string $initial_comment the message text introducing the file in specified channels
* @var string $thread_ts Provide another message's `ts` value to upload this file as a reply. Never use a reply's `ts` value; use its parent instead. Also, make sure to provide only one channel when using `thread_ts`.
* }
*
* @param array $formParameters {
*
* @var string $token Authentication token bearing required scopes. Tokens should be passed as an HTTP Authorization header or alternatively, as a POST parameter.
* }
*/
public function __construct(array $queryParameters = [], array $formParameters = [])
{
$this->queryParameters = $queryParameters;
$this->formParameters = $formParameters;
}

public function getMethod(): string
{
return 'POST';
}

public function getUri(): string
{
return '/files.completeUploadExternal';
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return $this->getFormBody();
}

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
}

public function getAuthenticationScopes(): array
{
return ['slackAuth'];
}

protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(['blocks', 'channel_id', 'channels', 'files', 'initial_comment', 'thread_ts']);
$optionsResolver->setRequired(['files']);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('blocks', ['string']);
$optionsResolver->addAllowedTypes('channel_id', ['string']);
$optionsResolver->addAllowedTypes('channels', ['string']);
$optionsResolver->addAllowedTypes('files', ['string']);
$optionsResolver->addAllowedTypes('initial_comment', ['string']);
$optionsResolver->addAllowedTypes('thread_ts', ['string']);

return $optionsResolver;
}

protected function getFormOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getFormOptionsResolver();
$optionsResolver->setDefined(['token']);
$optionsResolver->setRequired([]);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('token', ['string']);

return $optionsResolver;
}

/**
* @return \JoliCode\Slack\Api\Model\FilesCompleteUploadExternalPostResponse200|\JoliCode\Slack\Api\Model\FilesCompleteUploadExternalPostResponsedefault|null
*/
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (200 === $status) {
return $serializer->deserialize($body, 'JoliCode\Slack\Api\Model\FilesCompleteUploadExternalPostResponse200', 'json');
}

return $serializer->deserialize($body, 'JoliCode\Slack\Api\Model\FilesCompleteUploadExternalPostResponsedefault', 'json');
}
}
105 changes: 105 additions & 0 deletions generated/Endpoint/FilesGetUploadUrlExternal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php

declare(strict_types=1);

/*
* This file is part of JoliCode's Slack PHP API project.
*
* (c) JoliCode <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace JoliCode\Slack\Api\Endpoint;

class FilesGetUploadUrlExternal extends \JoliCode\Slack\Api\Runtime\Client\BaseEndpoint implements \JoliCode\Slack\Api\Runtime\Client\Endpoint
{
use \JoliCode\Slack\Api\Runtime\Client\EndpointTrait;

/**
* Gets a URL for an edge external file upload.
*
* @param array $queryParameters {
*
* @var string $alt_txt description of image for screen-reader
* @var string $filename name of the file being uploaded
* @var int $length size in bytes of the file being uploaded
* @var string $snippet_type Syntax type of the snippet being uploaded.
* }
*
* @param array $formParameters {
*
* @var string $token Authentication token. Requires scope: `files:write`
* }
*/
public function __construct(array $queryParameters = [], array $formParameters = [])
{
$this->queryParameters = $queryParameters;
$this->formParameters = $formParameters;
}

public function getMethod(): string
{
return 'POST';
}

public function getUri(): string
{
return '/files.getUploadURLExternal';
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return $this->getFormBody();
}

public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
}

public function getAuthenticationScopes(): array
{
return ['slackAuth'];
}

protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(['alt_txt', 'filename', 'length', 'snippet_type']);
$optionsResolver->setRequired(['filename', 'length']);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('alt_txt', ['string']);
$optionsResolver->addAllowedTypes('filename', ['string']);
$optionsResolver->addAllowedTypes('length', ['int']);
$optionsResolver->addAllowedTypes('snippet_type', ['string']);

return $optionsResolver;
}

protected function getFormOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getFormOptionsResolver();
$optionsResolver->setDefined(['token']);
$optionsResolver->setRequired([]);
$optionsResolver->setDefaults([]);
$optionsResolver->addAllowedTypes('token', ['string']);

return $optionsResolver;
}

/**
* @return \JoliCode\Slack\Api\Model\FilesGetUploadURLExternalPostResponse200|\JoliCode\Slack\Api\Model\FilesGetUploadURLExternalPostResponsedefault|null
*/
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (200 === $status) {
return $serializer->deserialize($body, 'JoliCode\Slack\Api\Model\FilesGetUploadURLExternalPostResponse200', 'json');
}

return $serializer->deserialize($body, 'JoliCode\Slack\Api\Model\FilesGetUploadURLExternalPostResponsedefault', 'json');
}
}
67 changes: 67 additions & 0 deletions generated/Model/FilesCompleteUploadExternalPostResponse200.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

/*
* This file is part of JoliCode's Slack PHP API project.
*
* (c) JoliCode <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace JoliCode\Slack\Api\Model;

class FilesCompleteUploadExternalPostResponse200
{
/**
* @var array
*/
protected $initialized = [];
/**
* @var list<FilesCompleteUploadExternalPostResponse200FilesItem>|null
*/
protected $files;
/**
* @var bool|null
*/
protected $ok;

public function isInitialized($property): bool
{
return \array_key_exists($property, $this->initialized);
}

/**
* @return list<FilesCompleteUploadExternalPostResponse200FilesItem>|null
*/
public function getFiles(): ?array
{
return $this->files;
}

/**
* @param list<FilesCompleteUploadExternalPostResponse200FilesItem>|null $files
*/
public function setFiles(?array $files): self
{
$this->initialized['files'] = true;
$this->files = $files;

return $this;
}

public function getOk(): ?bool
{
return $this->ok;
}

public function setOk(?bool $ok): self
{
$this->initialized['ok'] = true;
$this->ok = $ok;

return $this;
}
}
Loading