repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/NullProducer.php
NullProducer.php
<?php declare(strict_types=1); namespace Enqueue\Null; use Interop\Queue\Destination; use Interop\Queue\Message; use Interop\Queue\Producer; class NullProducer implements Producer { private $priority; private $timeToLive; private $deliveryDelay; public function send(Destination $destination, Message $message): void { } /** * @return NullProducer */ public function setDeliveryDelay(?int $deliveryDelay = null): Producer { $this->deliveryDelay = $deliveryDelay; return $this; } public function getDeliveryDelay(): ?int { return $this->deliveryDelay; } /** * @return NullProducer */ public function setPriority(?int $priority = null): Producer { $this->priority = $priority; return $this; } public function getPriority(): ?int { return $this->priority; } /** * @return NullProducer */ public function setTimeToLive(?int $timeToLive = null): Producer { $this->timeToLive = $timeToLive; return $this; } public function getTimeToLive(): ?int { return $this->timeToLive; } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/NullConnectionFactory.php
NullConnectionFactory.php
<?php declare(strict_types=1); namespace Enqueue\Null; use Interop\Queue\ConnectionFactory; use Interop\Queue\Context; class NullConnectionFactory implements ConnectionFactory { /** * @return NullContext */ public function createContext(): Context { return new NullContext(); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/NullMessage.php
NullMessage.php
<?php declare(strict_types=1); namespace Enqueue\Null; use Interop\Queue\Message; class NullMessage implements Message { /** * @var string */ private $body; /** * @var array */ private $properties; /** * @var array */ private $headers; /** * @var bool */ private $redelivered; public function __construct(string $body = '', array $properties = [], array $headers = []) { $this->body = $body; $this->properties = $properties; $this->headers = $headers; $this->redelivered = false; } public function setBody(string $body): void { $this->body = $body; } public function getBody(): string { return $this->body; } public function setProperties(array $properties): void { $this->properties = $properties; } public function getProperties(): array { return $this->properties; } public function setProperty(string $name, $value): void { $this->properties[$name] = $value; } public function getProperty(string $name, $default = null) { return array_key_exists($name, $this->properties) ? $this->properties[$name] : $default; } public function setHeaders(array $headers): void { $this->headers = $headers; } public function getHeaders(): array { return $this->headers; } public function setHeader(string $name, $value): void { $this->headers[$name] = $value; } public function getHeader(string $name, $default = null) { return array_key_exists($name, $this->headers) ? $this->headers[$name] : $default; } public function isRedelivered(): bool { return $this->redelivered; } public function setRedelivered(bool $redelivered): void { $this->redelivered = $redelivered; } public function setCorrelationId(?string $correlationId = null): void { $headers = $this->getHeaders(); $headers['correlation_id'] = (string) $correlationId; $this->setHeaders($headers); } public function getCorrelationId(): ?string { return $this->getHeader('correlation_id'); } public function setMessageId(?string $messageId = null): void { $headers = $this->getHeaders(); $headers['message_id'] = (string) $messageId; $this->setHeaders($headers); } public function getMessageId(): ?string { return $this->getHeader('message_id'); } public function getTimestamp(): ?int { $value = $this->getHeader('timestamp'); return null === $value ? null : (int) $value; } public function setTimestamp(?int $timestamp = null): void { $headers = $this->getHeaders(); $headers['timestamp'] = (int) $timestamp; $this->setHeaders($headers); } public function setReplyTo(?string $replyTo = null): void { $this->setHeader('reply_to', $replyTo); } public function getReplyTo(): ?string { return $this->getHeader('reply_to'); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/NullContext.php
NullContext.php
<?php declare(strict_types=1); namespace Enqueue\Null; use Interop\Queue\Consumer; use Interop\Queue\Context; use Interop\Queue\Destination; use Interop\Queue\Message; use Interop\Queue\Producer; use Interop\Queue\Queue; use Interop\Queue\SubscriptionConsumer; use Interop\Queue\Topic; class NullContext implements Context { /** * @return NullMessage */ public function createMessage(string $body = '', array $properties = [], array $headers = []): Message { $message = new NullMessage(); $message->setBody($body); $message->setProperties($properties); $message->setHeaders($headers); return $message; } /** * @return NullQueue */ public function createQueue(string $name): Queue { return new NullQueue($name); } /** * @return NullQueue */ public function createTemporaryQueue(): Queue { return $this->createQueue(uniqid('', true)); } /** * @return NullTopic */ public function createTopic(string $name): Topic { return new NullTopic($name); } /** * @return NullConsumer */ public function createConsumer(Destination $destination): Consumer { return new NullConsumer($destination); } /** * @return NullProducer */ public function createProducer(): Producer { return new NullProducer(); } /** * @return NullSubscriptionConsumer */ public function createSubscriptionConsumer(): SubscriptionConsumer { return new NullSubscriptionConsumer(); } public function purgeQueue(Queue $queue): void { } public function close(): void { } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/NullQueue.php
NullQueue.php
<?php declare(strict_types=1); namespace Enqueue\Null; use Interop\Queue\Queue; class NullQueue implements Queue { /** * @var string */ private $name; public function __construct(string $name) { $this->name = $name; } public function getQueueName(): string { return $this->name; } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullMessageTest.php
Tests/NullMessageTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Message; use PHPUnit\Framework\TestCase; class NullMessageTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementMessageInterface() { $this->assertClassImplements(Message::class, NullMessage::class); } public function testCouldBeConstructedWithoutAnyArguments() { $message = new NullMessage(); $this->assertSame('', $message->getBody()); $this->assertSame([], $message->getProperties()); $this->assertSame([], $message->getHeaders()); } public function testCouldBeConstructedWithOptionalArguments() { $message = new NullMessage('theBody', ['barProp' => 'barPropVal'], ['fooHeader' => 'fooHeaderVal']); $this->assertSame('theBody', $message->getBody()); $this->assertSame(['barProp' => 'barPropVal'], $message->getProperties()); $this->assertSame(['fooHeader' => 'fooHeaderVal'], $message->getHeaders()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullQueueTest.php
Tests/NullQueueTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Queue; use PHPUnit\Framework\TestCase; class NullQueueTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementQueueInterface() { $this->assertClassImplements(Queue::class, NullQueue::class); } public function testShouldAllowGetNameSetInConstructor() { $queue = new NullQueue('theName'); $this->assertEquals('theName', $queue->getQueueName()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullConsumerTest.php
Tests/NullConsumerTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullConsumer; use Enqueue\Null\NullMessage; use Enqueue\Null\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; use PHPUnit\Framework\TestCase; class NullConsumerTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementMessageConsumerInterface() { $this->assertClassImplements(Consumer::class, NullConsumer::class); } public function testShouldAlwaysReturnNullOnReceive() { $consumer = new NullConsumer(new NullQueue('theQueueName')); $this->assertNull($consumer->receive()); $this->assertNull($consumer->receive()); $this->assertNull($consumer->receive()); } public function testShouldAlwaysReturnNullOnReceiveNoWait() { $consumer = new NullConsumer(new NullQueue('theQueueName')); $this->assertNull($consumer->receiveNoWait()); $this->assertNull($consumer->receiveNoWait()); $this->assertNull($consumer->receiveNoWait()); } /** * @doesNotPerformAssertions */ public function testShouldDoNothingOnAcknowledge() { $consumer = new NullConsumer(new NullQueue('theQueueName')); $consumer->acknowledge(new NullMessage()); } /** * @doesNotPerformAssertions */ public function testShouldDoNothingOnReject() { $consumer = new NullConsumer(new NullQueue('theQueueName')); $consumer->reject(new NullMessage()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullContextTest.php
Tests/NullContextTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullConsumer; use Enqueue\Null\NullContext; use Enqueue\Null\NullMessage; use Enqueue\Null\NullProducer; use Enqueue\Null\NullQueue; use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use PHPUnit\Framework\TestCase; class NullContextTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementSessionInterface() { $this->assertClassImplements(Context::class, NullContext::class); } public function testShouldAllowCreateMessageWithoutAnyArguments() { $context = new NullContext(); $message = $context->createMessage(); $this->assertInstanceOf(NullMessage::class, $message); $this->assertSame('', $message->getBody()); $this->assertSame([], $message->getHeaders()); $this->assertSame([], $message->getProperties()); } public function testShouldAllowCreateCustomMessage() { $context = new NullContext(); $message = $context->createMessage('theBody', ['theProperty'], ['theHeader']); $this->assertInstanceOf(NullMessage::class, $message); $this->assertSame('theBody', $message->getBody()); $this->assertSame(['theProperty'], $message->getProperties()); $this->assertSame(['theHeader'], $message->getHeaders()); } public function testShouldAllowCreateQueue() { $context = new NullContext(); $queue = $context->createQueue('aName'); $this->assertInstanceOf(NullQueue::class, $queue); } public function testShouldAllowCreateTopic() { $context = new NullContext(); $topic = $context->createTopic('aName'); $this->assertInstanceOf(NullTopic::class, $topic); } public function testShouldAllowCreateConsumerForGivenQueue() { $context = new NullContext(); $queue = new NullQueue('aName'); $consumer = $context->createConsumer($queue); $this->assertInstanceOf(NullConsumer::class, $consumer); } public function testShouldAllowCreateProducer() { $context = new NullContext(); $producer = $context->createProducer(); $this->assertInstanceOf(NullProducer::class, $producer); } public function testShouldCreateTemporaryQueueWithUniqueName() { $context = new NullContext(); $firstTmpQueue = $context->createTemporaryQueue(); $secondTmpQueue = $context->createTemporaryQueue(); $this->assertInstanceOf(NullQueue::class, $firstTmpQueue); $this->assertInstanceOf(NullQueue::class, $secondTmpQueue); $this->assertNotEquals($firstTmpQueue->getQueueName(), $secondTmpQueue->getQueueName()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullConnectionFactoryTest.php
Tests/NullConnectionFactoryTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullConnectionFactory; use Enqueue\Null\NullContext; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\ConnectionFactory; use PHPUnit\Framework\TestCase; class NullConnectionFactoryTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementConnectionFactoryInterface() { $this->assertClassImplements(ConnectionFactory::class, NullConnectionFactory::class); } public function testShouldReturnNullContextOnCreateContextCall() { $factory = new NullConnectionFactory(); $context = $factory->createContext(); $this->assertInstanceOf(NullContext::class, $context); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullProducerTest.php
Tests/NullProducerTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullMessage; use Enqueue\Null\NullProducer; use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Producer; use PHPUnit\Framework\TestCase; class NullProducerTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementProducerInterface() { $this->assertClassImplements(Producer::class, NullProducer::class); } /** * @doesNotPerformAssertions */ public function testShouldDoNothingOnSend() { $producer = new NullProducer(); $producer->send(new NullTopic('aName'), new NullMessage()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/NullTopicTest.php
Tests/NullTopicTest.php
<?php namespace Enqueue\Null\Tests; use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Topic; use PHPUnit\Framework\TestCase; class NullTopicTest extends TestCase { use ClassExtensionTrait; public function testShouldImplementTopicInterface() { $this->assertClassImplements(Topic::class, NullTopic::class); } public function testShouldAllowGetNameSetInConstructor() { $topic = new NullTopic('theName'); $this->assertEquals('theName', $topic->getTopicName()); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
php-enqueue/null
https://github.com/php-enqueue/null/blob/25d9df714fcf607682e58c67bb55791fb60289c1/Tests/Spec/NullMessageTest.php
Tests/Spec/NullMessageTest.php
<?php namespace Enqueue\Null\Tests\Spec; use Enqueue\Null\NullMessage; use Interop\Queue\Spec\MessageSpec; class NullMessageTest extends MessageSpec { protected function createMessage() { return new NullMessage(); } }
php
MIT
25d9df714fcf607682e58c67bb55791fb60289c1
2026-01-05T05:05:31.847668Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/Aws.php
src/Aws.php
<?php namespace Aws\Resource; use Aws\Sdk; /** * Service locator and starting point of the AWS Resource APIs. * * @method Resource cloudformation(array $args = []) * @method Resource dynamodb(array $args = []) * @method Resource ec2(array $args = []) * @method Resource glacier(array $args = []) * @method Resource iam(array $args = []) * @method Resource opsworks(array $args = []) * @method Resource rds(array $args = []) * @method Resource s3(array $args = []) * @method Resource sns(array $args = []) * @property \Aws\Resource\Resource $cloudformation * @property \Aws\Resource\Resource $dynamodb * @property \Aws\Resource\Resource $ec2 * @property \Aws\Resource\Resource $glacier * @property \Aws\Resource\Resource $iam * @property \Aws\Resource\Resource $opsworks * @property \Aws\Resource\Resource $rds * @property \Aws\Resource\Resource $s3 * @property \Aws\Resource\Resource $sns */ class Aws { /** @var Sdk Instance of Sdk for creating API clients. */ private $sdk; /** @var array Cache of service clients. */ private $services = []; /** * @param Sdk|array $args */ public function __construct($args = []) { $this->sdk = ($args instanceof Sdk) ? $args : new Sdk($args); } /** * @param string $name * * @return Resource */ public function __get($name) { return $this->makeService($name); } /** * @param string $name * @param array $args * * @return Resource */ public function __call($name, $args) { return $this->makeService($name, $args ? $args[0] : []); } /** * Introspects which resources are accessible to call on this object. * * @param string|null $name * * @return array|bool */ public function respondsTo($name = null) { static $services; if (!$services) { $services = []; foreach (glob(__DIR__ . "/models/*.resources.php") as $file) { $services[] = substr(basename($file), 0, -25); } $services = array_unique($services); } return $name ? in_array($name, $services, true) : $services; } /** * @param string $name * @param array $args * * @return mixed */ private function makeService($name, array $args = []) { if (!isset($this->services[$name]) || $args) { $apiClient = $this->sdk->createClient($name, $args); $model = $this->loadModel($name, $apiClient->getApi()->getApiVersion()); $resourceClient = new ResourceClient($apiClient, $model); $this->services[$name] = new Resource($resourceClient, 'service', [], []); } return $this->services[$name]; } /** * @param string $service * @param string $version * * @return Model * @throws \RuntimeException */ private function loadModel($service, $version) { $path = __DIR__ . "/models/{$service}-{$version}.resources.php"; if (!is_readable($path)) { throw new \RuntimeException( "The resources model file \"{$path}\" was not found." ); } return new Model($service, include $path); } public function __toString() { return "Resource <AWS> [ ]"; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/Collection.php
src/Collection.php
<?php namespace Aws\Resource; class Collection implements \IteratorAggregate { use HasTypeTrait; private $results; public function __construct( ResourceClient $client, $type, \Iterator $results, callable $toBatchFn ) { $this->client = $client; $this->type = $type; $this->results = $results; $this->toBatchFn = $toBatchFn; } public function getIterator() { return \Aws\flatmap($this->results, $this->toBatchFn); } public function getBatches($size = null) { $items = $this->results; $mapFn = $this->toBatchFn; if ($size) { $items = \Aws\partition(\Aws\flatmap($items, $mapFn), $size); $mapFn = function ($resources) { return new Batch($this->client, $this->type, $resources); }; } return \Aws\map($items, $mapFn); } public function __debugInfo() { return [ 'object' => 'collection', 'type' => $this->type, ]; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/Batch.php
src/Batch.php
<?php namespace Aws\Resource; class Batch implements \Countable, \Iterator { use HasTypeTrait; private $resources; private $index = 0; public function __construct(ResourceClient $client, $type, array $resources = []) { $this->client = $client; $this->type = $type; $this->resources = $resources; } public function current() { return $this->resources[$this->index]; } public function key() { return $this->index; } public function valid() { return isset($this->resources[$this->index]); } public function next() { $this->index++; } public function rewind() { $this->index = 0; } public function count() { return count($this->resources); } public function toArray() { return $this->resources; } public function __debugInfo() { return [ 'object' => 'batch', 'type' => $this->type, 'count' => $this->count(), ]; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/Resource.php
src/Resource.php
<?php namespace Aws\Resource; /** * A resource object represents a single, identifiable AWS resource, such as an * Amazon S3 bucket or an Amazon SQS queue. * * A resource object encapsulates the information about how to identify the * resource and load its data, the actions that can be performed on * the resource, and the other resources to which it the resource is related. */ class Resource implements \IteratorAggregate, \ArrayAccess { use HasTypeTrait; /** @var array Data for the resource. */ protected $data = []; /** @var array Identity of the resource. */ private $identity; /** @var bool Whether the resource has been loaded. */ private $loaded; /** @var array Resource metadata (e.g., actions, relationships, etc.) */ private $meta; /** * @param ResourceClient $client * @param string $type * @param array $identity * @param array $data */ public function __construct( ResourceClient $client, $type, array $identity, array $data = null ) { $this->client = $client; $this->type = $type; $this->identity = $identity; $this->meta = $this->client->getMetaData($type); if (is_array($data)) { $this->data = $data; $this->loaded = true; } else { $this->data = []; $this->loaded = false; } } public function getMeta() { return $this->meta; } public function getIdentity() { return $this->identity; } public function getData() { if (!$this->loaded) { $this->load(); } return $this->data; } public function isLoaded() { return $this->loaded; } public function load() { $this->data = $this->client->loadResourceData($this); $this->loaded = true; return $this; } /** * Introspects which resources and actions are accessible on this resource. * * @param string|null $name * * @return array|bool */ public function respondsTo($name = null) { if ($name) { return isset($this->meta['methods'][$name]); } else { return array_keys($this->meta['methods']); } } public function getIterator() { return new \ArrayIterator($this->getData()); } public function offsetGet($offset) { $data = $this->getData(); if (isset($data[$offset])) { return $data[$offset]; } if (isset($this->identity[$offset])) { return $this->identity[$offset]; } return null; } public function offsetSet($offset, $value) { throw new \RuntimeException('You cannot mutate a resource\'s data.'); } public function offsetExists($offset) { $data = $this->getData(); return isset($data[$offset]) || isset($this->identity[$offset]); } public function offsetUnset($offset) { throw new \RuntimeException('You cannot mutate a resource\'s data.'); } public function toArray() { return $this->getData(); } public function __get($name) { return $this->handleMethod($name); } public function __call($name, array $args) { return $this->handleMethod($name, $args); } public function __toString() { $id = '[ '; foreach ($this->identity as $k => $v) { $id .= "{$k} => {$v}, "; } $id = rtrim($id, ', ') . ' ]'; $service = ucfirst($this->meta['serviceName']); $type = ($this->type !== 'service') ? '.' . $this->type : ''; return "Resource <AWS.{$service}{$type}> {$id}"; } public function __debugInfo() { return $this->meta + [ 'object' => 'resource', 'type' => $this->type, 'identity' => $this->identity, 'loaded' => $this->loaded, 'data' => $this->data, ]; } private function handleMethod($name, array $args = []) { $type = isset($this->meta['methods'][$name]) ? $this->meta['methods'][$name] : null; $name = ucfirst($name); switch ($type) { case 'related': return $this->client->makeRelated($name, $args, $this); case 'collections': return $this->client->makeCollection($name, $args, $this); case 'actions': return $this->client->performAction($name, $args, $this); case 'waiters': return $this->client->waitUntil(substr($name, 9), $args, $this); case 'exists': return $this->client->checkIfExists($this); default: throw new \BadMethodCallException( "You cannot call {$name} on the {$this->type} resource." ); } } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/Model.php
src/Model.php
<?php namespace Aws\Resource; use JmesPath as jp; /** * @internal */ class Model { /** @var array */ protected $data = []; private static $paths = [ 'action' => '%s.actions.%s', 'related' => '%s.has.%s.resource', 'collection' => '%s.hasMany.%s', 'load' => '%s.load', 'waiter' => '%s.waiters.%s', ]; public function __construct($service, array $data) { if (!isset($data['service']) || !isset($data['resources'])) { throw new \InvalidArgumentException('Resource models must contain ' . 'the keys "service" and "resources" at the top level.'); } $data['service']['_meta'] = $this->createMeta($data['service'], $service); foreach ($data['resources'] as $type => $info) { $data['resources'][$type]['_meta'] = $this->createMeta($info, $service); } $this->data = $data; } public function search($expr, $resource = null, $action = null) { if ($resource || $action) { if (!isset(self::$paths[$expr])) { throw new \InvalidArgumentException( "Named expression, \"{$resource}\", does not exist." ); } if ($resource !== 'service') { $resource = 'resources.' . $resource; } $expr = sprintf(self::$paths[$expr], $resource, $action); } return jp\search($expr, $this->data); } private function createMeta(array $data, $service) { $meta = jp\search('{' . '"actions": keys(actions||`[]`),' . '"related": keys(has||`[]`),' . '"collections": keys(hasMany||`[]`),' . '"waiters": keys(waiters||`[]`)' . '}', $data); $methods = []; foreach ($meta as $key => $items) { foreach ($items as $item) { if ($key === 'waiters') { $methods["waitUntil{$item}"] = $key; if ($item === 'Exists') { $methods['exists'] = 'exists'; } } else { $methods[lcfirst($item)] = $key; } } } $meta['methods'] = $methods; $meta['serviceName'] = $service; return $meta; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/ResourceClient.php
src/ResourceClient.php
<?php namespace Aws\Resource; use Aws\AwsClientInterface; use Aws\Command; use Aws\Result; use Aws\ResultInterface; use JmesPath as jp; /** * @internal */ class ResourceClient { /** @var AwsClientInterface */ private $apiClient; /** @var Model */ private $model; public function __construct(AwsClientInterface $apiClient, Model $model) { $this->apiClient = $apiClient; $this->model = $model; } public function getApiClient() { return $this->apiClient; } public function getModel() { return $this->model; } public function getMetaData($type) { $type = ($type !== 'service') ? 'resources.' . $type : $type; return $this->model->search("{$type}._meta"); } public function loadResourceData(Resource $resource) { if ($load = $this->model->search('load', $resource->getType())) { $command = $this->prepareCommand($load['request'], $resource); $result = $this->apiClient->execute($command); $expr = ($load['path'] === '$') ? '@' : $load['path']; return $result->search($expr) ?: []; } return []; } public function makeRelated($name, array $args, Resource $parent) { $resource = $this->model->search('related', $parent->getType(), $name); $id = $this->createIdentityForRelatedResource( $resource['identifiers'], function (array $param) use ($parent, &$args) { $value = ($param['source'] === 'input') ? array_shift($args) : $this->resolveValue($param, $parent); if ($value === null) { throw new \InvalidArgumentException('Invalid identity.'); } return $value; } ); return $this->createResources($resource, $parent, $id); } /** * @param string $name * @param array $args * @param Resource $resource * * @return ResultInterface|Batch|Resource */ public function performAction($name, array $args, Resource $resource) { if (isset($args[0]) && is_array($args[0])) { $args = $args[0]; } $action = $this->model->search('action', $resource->getType(), $name); $command = $this->prepareCommand($action['request'], $resource, $args); $result = $this->apiClient->execute($command); if (isset($action['resource'])) { $id = $this->createIdentityForRelatedResource( $action['resource']['identifiers'], function (array $param) use ($resource, $command, $result) { return $this->resolveValue($param, $resource, $command, $result); } ); return $this->createResources($action['resource'], $result, $id); } else { return $result; } } public function makeCollection($name, array $args, Resource $parent) { if (isset($args[0]) && is_array($args[0])) { $args = $args[0]; } // Get the information on how to process the collection. $info = $this->model->search('collection', $parent->getType(), $name); // Create a paginator or an iterator that yields a single command's result. $command = $this->prepareCommand($info['request'], $parent, $args); if ($this->apiClient->getApi()->hasPaginator($command->getName())) { $paginator = $this->apiClient->getPaginator( $command->getName(), $command->toArray() ); } else { $paginator = \Aws\map([$command], function (Command $command) { return $this->apiClient->execute($command); }); } // Create a new from the paginator, including a lambda that coverts // results to batches by using info from the resources model. return new Collection( $this, $parent->getType(), $paginator, function (Result $result) use ($info, $parent, $command) { $ids = $this->createIdentityForRelatedResource( $info['resource']['identifiers'], function (array $param) use ($parent, $command, $result) { return $this->resolveValue($param, $parent, $command, $result); } ); return ($ids === null) ? new Batch($this, $info['resource']['type'], []) : $this->createResources($info['resource'], $result, $ids); } ); } public function waitUntil($name, array $args, Resource $resource) { $config = isset($args[0]) ? $args[0] : []; $args = $config ? ['@waiter' => $config] : []; $waiter = $this->model->search('waiter', $resource->getType(), $name); $this->prepareArgs($waiter['params'], $resource, $args); $this->apiClient->waitUntil($waiter['waiterName'], $args); return $resource; } public function checkIfExists(Resource $resource) { $args = ['@waiter' => ['maxAttempts' => 1, 'delay' => 0, 'initDelay' => 0]]; if (!($waiter = $this->model->search('waiter', $resource->getType(), 'Exists'))) { throw new \UnexpectedValueException('Resource does not have an Exists waiter.'); } $this->prepareArgs($waiter['params'], $resource, $args); return $this->apiClient->getWaiter($waiter['waiterName'], $args) ->promise() ->then(function () {return true;}, function () {return false;}) ->wait(); } /** * @param array $request * @param Resource $resource * @param array $args * * @return Command */ private function prepareCommand( array $request, Resource $resource, array $args = [] ) { if (isset($request['params'])) { $this->prepareArgs($request['params'], $resource, $args); } return $this->apiClient->getCommand($request['operation'], $args); } /** * @param array $params * @param Resource $resource * @param array $args */ private function prepareArgs( array $params, Resource $resource, array &$args ) { // Star is used track the index for targets with "[*]". $star = null; // Resolve and set the arguments for the operation. foreach ($params as $param) { $value = $this->resolveValue($param, $resource); $this->setArgValue($param['target'], $value, $args, $star); } } /** * @param array $info * @param ResultInterface|Resource $data * @param array $identity * * @return Resource|Batch */ private function createResources(array $info, $data, array $identity) { $data = isset($info['path']) ? jp\search($info['path'], $data) : null; if (isset($identity[0])) { $resources = []; foreach ($identity as $index => $id) { $datum = isset($data[$index]) ? $data[$index] : $data; $resources[] = new Resource($this, $info['type'], $id, $datum); } return new Batch($this, $info['type'], $resources); } else { return new Resource($this, $info['type'], $identity, $data); } } private function resolveValue( array $param, Resource $resource, Command $command = null, ResultInterface $result = null ) { switch ($param['source']) { // Source is pulled from the resource's identifier. case 'identifier': $id = $resource->getIdentity(); return isset($id[$param['name']]) ? $id[$param['name']] : null; // Source is pulled from the resource's data. case 'data': return jp\search($param['path'], $resource); // Source is pulled from the command parameters. case 'requestParameter': return $command[$param['path']]; // Source is pulled from the result. case 'response': return $result ? $result->search($param['path']) : null; // Source is a literal value from the resource model. case 'string': case 'integer': case 'boolean': return $param['value']; // Invalid source type. default: throw new \InvalidArgumentException('The value "' . $param['source'] . '" is an invalid for source.'); } } private function setArgValue($target, $value, array &$args, &$star) { // Split up the target into tokens for evaluation. if (!preg_match_all('/\w+|\.|\[\]|\[[0-9*]+\]/', $target, $tokens)) { throw new \UnexpectedValueException('Invalid target expression.'); } // Initialize the cursor at the args array root. $cursor = &$args; // Create/traverse an args array structure based on the tokens. foreach ($tokens[0] as $token) { $trimmedToken = trim($token, '[]'); if ($token === '.') { // Handle hash context. if (!is_array($cursor)) { $cursor = []; } continue; } elseif ($token === '[]') { // Handle list context. $index = count($cursor); } elseif ($trimmedToken === '*') { // Handle list context with pairing. if ($star === null) { $star = count($cursor); } $index = $star; } elseif (is_numeric($trimmedToken)) { // Handle list context with specific index. $index = $trimmedToken; } else { // Handle identifier context. $index = $token; } // Make sure the index exists. if (!isset($cursor[$index])) { $cursor[$index] = null; } // Move the cursor. $cursor =& $cursor[$index]; } // Finally, set the value. $cursor = $value; } public function createIdentityForRelatedResource( array $identifiers, callable $resolve ) { $data = []; $plurals = []; foreach ($identifiers as $info) { $data[$info['target']] = $resolve($info); if (is_null($data[$info['target']])) { return null; } elseif (is_array($data[$info['target']])) { $plurals[$info['target']] = count($data[$info['target']]); } else { $plurals[$info['target']] = 0; } } if (($numIds = max($plurals)) > 0) { $ids = []; for ($i = 0; $i < $numIds; $i++) { $id = []; foreach ($data as $key => $value) { $id[$key] = is_array($value) ? $value[$i] : $value; } $ids[] = $id; } return $ids; } return $data; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/HasTypeTrait.php
src/HasTypeTrait.php
<?php namespace Aws\Resource; use Aws\AwsClientInterface; /** * Contains common properties and methods of the Resource, Batch, and Collection * objects and is not intended for external use. * * @internal */ trait HasTypeTrait { /** @var ResourceClient */ private $client; /** @var string */ private $type; /** * @return AwsClientInterface */ public function getClient() { return $this->client->getApiClient(); } /** * @return string */ public function getType() { return $this->type; } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/rds-2014-10-31.resources.php
src/models/rds-2014-10-31.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateDBInstance' => [ 'request' => [ 'operation' => 'CreateDBInstance', ], 'resource' => [ 'type' => 'DBInstance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'requestParameter', 'path' => 'DBInstanceIdentifier', ], ], ], ], ], 'has' => [ 'DBInstance' => [ 'resource' => [ 'type' => 'DBInstance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'DBInstances' => [ 'request' => [ 'operation' => 'DescribeDBInstances', ], 'resource' => [ 'type' => 'DBInstance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'DBInstances[].DBInstanceIdentifier', ], ], ], ], ], ], 'resources' => [ 'DBInstance' => [ 'identifiers' => [ [ 'name' => 'Id', ], ], 'shape' => 'DBInstance', 'load' => [ 'request' => [ 'operation' => 'DescribeDBInstances', 'params' => [ [ 'target' => 'DBInstanceIdentifier', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'DBInstances[0]', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteDBInstance', 'params' => [ [ 'target' => 'DBInstanceIdentifier', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Modify' => [ 'request' => [ 'operation' => 'ModifyDBInstance', 'params' => [ [ 'target' => 'DBInstanceIdentifier', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/cloudformation-2010-05-15.resources.php
src/models/cloudformation-2010-05-15.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateStack' => [ 'request' => [ 'operation' => 'CreateStack', ], 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'StackName', ], ], ], ], ], 'has' => [ 'Event' => [ 'resource' => [ 'type' => 'Event', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Stack' => [ 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Stacks' => [ 'request' => [ 'operation' => 'DescribeStacks', ], 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Stacks[].StackName', ], ], ], ], ], ], 'resources' => [ 'Event' => [ 'identifiers' => [ [ 'name' => 'Id', 'memberName' => 'EventId', ], ], 'shape' => 'StackEvent', ], 'Stack' => [ 'identifiers' => [ [ 'name' => 'Name', 'memberName' => 'StackName', ], ], 'shape' => 'Stack', 'load' => [ 'request' => [ 'operation' => 'DescribeStacks', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'path' => 'Stacks[0]', ], 'actions' => [ 'CancelUpdate' => [ 'request' => [ 'operation' => 'CancelUpdateStack', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteStack', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Update' => [ 'request' => [ 'operation' => 'UpdateStack', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'has' => [ 'Resource' => [ 'resource' => [ 'type' => 'StackResource', 'identifiers' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'LogicalId', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Events' => [ 'request' => [ 'operation' => 'DescribeStackEvents', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Event', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'StackEvents[].EventId', ], ], 'path' => 'StackEvents[]', ], ], 'ResourceSummaries' => [ 'request' => [ 'operation' => 'ListStackResources', 'params' => [ [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'StackResourceSummary', 'identifiers' => [ [ 'target' => 'LogicalId', 'source' => 'response', 'path' => 'StackResourceSummaries[].LogicalResourceId', ], [ 'target' => 'StackName', 'source' => 'requestParameter', 'path' => 'StackName', ], ], 'path' => 'StackResourceSummaries[]', ], ], ], ], 'StackResource' => [ 'identifiers' => [ [ 'name' => 'StackName', ], [ 'name' => 'LogicalId', 'memberName' => 'LogicalResourceId', ], ], 'shape' => 'StackResourceDetail', 'load' => [ 'request' => [ 'operation' => 'DescribeStackResource', 'params' => [ [ 'target' => 'LogicalResourceId', 'source' => 'identifier', 'name' => 'LogicalId', ], [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'StackName', ], ], ], 'path' => 'StackResourceDetail', ], 'has' => [ 'Stack' => [ 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'StackName', ], ], ], ], ], ], 'StackResourceSummary' => [ 'identifiers' => [ [ 'name' => 'StackName', ], [ 'name' => 'LogicalId', 'memberName' => 'LogicalResourceId', ], ], 'shape' => 'StackResourceSummary', 'has' => [ 'Resource' => [ 'resource' => [ 'type' => 'StackResource', 'identifiers' => [ [ 'target' => 'LogicalId', 'source' => 'identifier', 'name' => 'LogicalId', ], [ 'target' => 'StackName', 'source' => 'identifier', 'name' => 'StackName', ], ], ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/iam-2010-05-08.resources.php
src/models/iam-2010-05-08.resources.php
<?php return [ 'service' => [ 'actions' => [ 'ChangePassword' => [ 'request' => [ 'operation' => 'ChangePassword', ], ], 'CreateAccountAlias' => [ 'request' => [ 'operation' => 'CreateAccountAlias', ], ], 'CreateAccountPasswordPolicy' => [ 'request' => [ 'operation' => 'UpdateAccountPasswordPolicy', ], 'resource' => [ 'type' => 'AccountPasswordPolicy', 'identifiers' => [ ], ], ], 'CreateGroup' => [ 'request' => [ 'operation' => 'CreateGroup', ], 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'GroupName', ], ], 'path' => 'Group', ], ], 'CreateInstanceProfile' => [ 'request' => [ 'operation' => 'CreateInstanceProfile', ], 'resource' => [ 'type' => 'InstanceProfile', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'InstanceProfileName', ], ], 'path' => 'InstanceProfile', ], ], 'CreatePolicy' => [ 'request' => [ 'operation' => 'CreatePolicy', ], 'resource' => [ 'type' => 'Policy', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Policy.Arn', ], ], ], ], 'CreateRole' => [ 'request' => [ 'operation' => 'CreateRole', ], 'resource' => [ 'type' => 'Role', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'RoleName', ], ], 'path' => 'Role', ], ], 'CreateSamlProvider' => [ 'request' => [ 'operation' => 'CreateSAMLProvider', ], 'resource' => [ 'type' => 'SamlProvider', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'SAMLProviderArn', ], ], ], ], 'CreateServerCertificate' => [ 'request' => [ 'operation' => 'UploadServerCertificate', ], 'resource' => [ 'type' => 'ServerCertificate', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'ServerCertificateName', ], ], ], ], 'CreateSigningCertificate' => [ 'request' => [ 'operation' => 'UploadSigningCertificate', ], 'resource' => [ 'type' => 'SigningCertificate', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Certificate.CertificateId', ], ], 'path' => 'Certificate', ], ], 'CreateUser' => [ 'request' => [ 'operation' => 'CreateUser', ], 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'UserName', ], ], 'path' => 'User', ], ], 'CreateVirtualMfaDevice' => [ 'request' => [ 'operation' => 'CreateVirtualMFADevice', ], 'resource' => [ 'type' => 'VirtualMfaDevice', 'identifiers' => [ [ 'target' => 'SerialNumber', 'source' => 'response', 'path' => 'VirtualMFADevice.SerialNumber', ], ], 'path' => 'VirtualMFADevice', ], ], ], 'has' => [ 'AccountPasswordPolicy' => [ 'resource' => [ 'type' => 'AccountPasswordPolicy', 'identifiers' => [ ], ], ], 'AccountSummary' => [ 'resource' => [ 'type' => 'AccountSummary', 'identifiers' => [ ], ], ], 'CurrentUser' => [ 'resource' => [ 'type' => 'CurrentUser', 'identifiers' => [ ], ], ], 'Group' => [ 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'InstanceProfile' => [ 'resource' => [ 'type' => 'InstanceProfile', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'Policy' => [ 'resource' => [ 'type' => 'Policy', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], 'Role' => [ 'resource' => [ 'type' => 'Role', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'SamlProvider' => [ 'resource' => [ 'type' => 'SamlProvider', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], 'ServerCertificate' => [ 'resource' => [ 'type' => 'ServerCertificate', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'User' => [ 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'VirtualMfaDevice' => [ 'resource' => [ 'type' => 'VirtualMfaDevice', 'identifiers' => [ [ 'target' => 'SerialNumber', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Groups' => [ 'request' => [ 'operation' => 'ListGroups', ], 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Groups[].GroupName', ], ], 'path' => 'Groups[]', ], ], 'InstanceProfiles' => [ 'request' => [ 'operation' => 'ListInstanceProfiles', ], 'resource' => [ 'type' => 'InstanceProfile', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'InstanceProfiles[].InstanceProfileName', ], ], 'path' => 'InstanceProfiles[]', ], ], 'Policies' => [ 'request' => [ 'operation' => 'ListPolicies', ], 'resource' => [ 'type' => 'Policy', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Policies[].Arn', ], ], 'path' => 'Policies[]', ], ], 'Roles' => [ 'request' => [ 'operation' => 'ListRoles', ], 'resource' => [ 'type' => 'Role', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Roles[].RoleName', ], ], 'path' => 'Roles[]', ], ], 'SamlProviders' => [ 'request' => [ 'operation' => 'ListSAMLProviders', ], 'resource' => [ 'type' => 'SamlProvider', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'SAMLProviderList[].Arn', ], ], ], ], 'ServerCertificates' => [ 'request' => [ 'operation' => 'ListServerCertificates', ], 'resource' => [ 'type' => 'ServerCertificate', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'ServerCertificateMetadataList[].ServerCertificateName', ], ], ], ], 'Users' => [ 'request' => [ 'operation' => 'ListUsers', ], 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Users[].UserName', ], ], 'path' => 'Users[]', ], ], 'VirtualMfaDevices' => [ 'request' => [ 'operation' => 'ListVirtualMFADevices', ], 'resource' => [ 'type' => 'VirtualMfaDevice', 'identifiers' => [ [ 'target' => 'SerialNumber', 'source' => 'response', 'path' => 'VirtualMFADevices[].SerialNumber', ], ], 'path' => 'VirtualMFADevices[]', ], ], ], ], 'resources' => [ 'AccessKey' => [ 'identifiers' => [ [ 'name' => 'UserName', 'memberName' => 'UserName', ], [ 'name' => 'Id', 'memberName' => 'AccessKeyId', ], ], 'shape' => 'AccessKeyMetadata', 'actions' => [ 'Activate' => [ 'request' => [ 'operation' => 'UpdateAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Status', 'source' => 'string', 'value' => 'Active', ], ], ], ], 'Deactivate' => [ 'request' => [ 'operation' => 'UpdateAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Status', 'source' => 'string', 'value' => 'Inactive', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'has' => [ 'User' => [ 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'UserName', ], ], ], ], ], ], 'AccessKeyPair' => [ 'identifiers' => [ [ 'name' => 'UserName', 'memberName' => 'UserName', ], [ 'name' => 'Id', 'memberName' => 'AccessKeyId', ], [ 'name' => 'Secret', 'memberName' => 'SecretAccessKey', ], ], 'shape' => 'AccessKey', 'actions' => [ 'Activate' => [ 'request' => [ 'operation' => 'UpdateAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Status', 'source' => 'string', 'value' => 'Active', ], ], ], ], 'Deactivate' => [ 'request' => [ 'operation' => 'UpdateAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Status', 'source' => 'string', 'value' => 'Inactive', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteAccessKey', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'AccessKeyId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], ], 'AccountPasswordPolicy' => [ 'identifiers' => [ ], 'shape' => 'PasswordPolicy', 'load' => [ 'request' => [ 'operation' => 'GetAccountPasswordPolicy', ], 'path' => 'PasswordPolicy', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteAccountPasswordPolicy', ], ], 'Update' => [ 'request' => [ 'operation' => 'UpdateAccountPasswordPolicy', ], ], ], ], 'AccountSummary' => [ 'identifiers' => [ ], 'shape' => 'GetAccountSummaryResponse', 'load' => [ 'request' => [ 'operation' => 'GetAccountSummary', ], 'path' => '@', ], ], 'AssumeRolePolicy' => [ 'identifiers' => [ [ 'name' => 'RoleName', ], ], 'actions' => [ 'Update' => [ 'request' => [ 'operation' => 'UpdateAssumeRolePolicy', 'params' => [ [ 'target' => 'RoleName', 'source' => 'identifier', 'name' => 'RoleName', ], ], ], ], ], 'has' => [ 'Role' => [ 'resource' => [ 'type' => 'Role', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'RoleName', ], ], ], ], ], ], 'CurrentUser' => [ 'identifiers' => [ ], 'shape' => 'User', 'load' => [ 'request' => [ 'operation' => 'GetUser', ], 'path' => 'User', ], 'has' => [ 'User' => [ 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'data', 'path' => 'UserName', ], ], ], ], ], 'hasMany' => [ 'AccessKeys' => [ 'request' => [ 'operation' => 'ListAccessKeys', ], 'resource' => [ 'type' => 'AccessKey', 'identifiers' => [ [ 'target' => 'UserName', 'source' => 'response', 'path' => 'AccessKeyMetadata[].UserName', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'AccessKeyMetadata[].AccessKeyId', ], ], 'path' => 'AccessKeyMetadata[]', ], ], 'MfaDevices' => [ 'request' => [ 'operation' => 'ListMFADevices', ], 'resource' => [ 'type' => 'MfaDevice', 'identifiers' => [ [ 'target' => 'UserName', 'source' => 'response', 'path' => 'MFADevices[].UserName', ], [ 'target' => 'SerialNumber', 'source' => 'response', 'path' => 'MFADevices[].SerialNumber', ], ], 'path' => 'MFADevices[]', ], ], 'SigningCertificates' => [ 'request' => [ 'operation' => 'ListSigningCertificates', ], 'resource' => [ 'type' => 'SigningCertificate', 'identifiers' => [ [ 'target' => 'UserName', 'source' => 'response', 'path' => 'Certificates[].UserName', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'Certificates[].CertificateId', ], ], 'path' => 'Certificates[]', ], ], ], ], 'Group' => [ 'identifiers' => [ [ 'name' => 'Name', 'memberName' => 'GroupName', ], ], 'shape' => 'Group', 'load' => [ 'request' => [ 'operation' => 'GetGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'path' => 'Group', ], 'actions' => [ 'AddUser' => [ 'request' => [ 'operation' => 'AddUserToGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'AttachPolicy' => [ 'request' => [ 'operation' => 'AttachGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Create' => [ 'request' => [ 'operation' => 'CreateGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'GroupName', ], ], 'path' => 'Group', ], ], 'CreatePolicy' => [ 'request' => [ 'operation' => 'PutGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'GroupPolicy', 'identifiers' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'PolicyName', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'DetachPolicy' => [ 'request' => [ 'operation' => 'DetachGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'RemoveUser' => [ 'request' => [ 'operation' => 'RemoveUserFromGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Update' => [ 'request' => [ 'operation' => 'UpdateGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'NewGroupName', ], ], ], ], ], 'has' => [ 'Policy' => [ 'resource' => [ 'type' => 'GroupPolicy', 'identifiers' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Name', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'AttachedPolicies' => [ 'request' => [ 'operation' => 'ListAttachedGroupPolicies', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Policy', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'AttachedPolicies[].PolicyArn', ], ], ], ], 'Policies' => [ 'request' => [ 'operation' => 'ListGroupPolicies', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'GroupPolicy', 'identifiers' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Name', 'source' => 'response', 'path' => 'PolicyNames[]', ], ], ], ], 'Users' => [ 'request' => [ 'operation' => 'GetGroup', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Users[].UserName', ], ], 'path' => 'Users[]', ], ], ], ], 'GroupPolicy' => [ 'identifiers' => [ [ 'name' => 'GroupName', 'memberName' => 'GroupName', ], [ 'name' => 'Name', 'memberName' => 'PolicyName', ], ], 'shape' => 'GetGroupPolicyResponse', 'load' => [ 'request' => [ 'operation' => 'GetGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'GroupName', ], [ 'target' => 'PolicyName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'GroupName', ], [ 'target' => 'PolicyName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutGroupPolicy', 'params' => [ [ 'target' => 'GroupName', 'source' => 'identifier', 'name' => 'GroupName', ], [ 'target' => 'PolicyName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'has' => [ 'Group' => [ 'resource' => [ 'type' => 'Group', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'GroupName', ], ], ], ], ], ], 'InstanceProfile' => [ 'identifiers' => [ [ 'name' => 'Name', 'memberName' => 'InstanceProfileName', ], ], 'shape' => 'InstanceProfile', 'load' => [ 'request' => [ 'operation' => 'GetInstanceProfile', 'params' => [ [ 'target' => 'InstanceProfileName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'path' => 'InstanceProfile', ], 'actions' => [ 'AddRole' => [ 'request' => [ 'operation' => 'AddRoleToInstanceProfile', 'params' => [ [ 'target' => 'InstanceProfileName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteInstanceProfile', 'params' => [ [ 'target' => 'InstanceProfileName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'RemoveRole' => [ 'request' => [ 'operation' => 'RemoveRoleFromInstanceProfile', 'params' => [ [ 'target' => 'InstanceProfileName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'waiters' => [ 'Exists' => [ 'waiterName' => 'InstanceProfileExists', 'params' => [ [ 'target' => 'InstanceProfileName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'has' => [ 'Roles' => [ 'resource' => [ 'type' => 'Role', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'data', 'path' => 'Roles[].RoleName', ], ], 'path' => 'Roles[]', ], ], ], ], 'LoginProfile' => [ 'identifiers' => [ [ 'name' => 'UserName', 'memberName' => 'UserName', ], ], 'shape' => 'LoginProfile', 'load' => [ 'request' => [ 'operation' => 'GetLoginProfile', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], ], ], 'path' => 'LoginProfile', ], 'actions' => [ 'Create' => [ 'request' => [ 'operation' => 'CreateLoginProfile', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], ], ], 'resource' => [ 'type' => 'LoginProfile', 'identifiers' => [ [ 'target' => 'UserName', 'source' => 'response', 'path' => 'LoginProfile.UserName', ], ], 'path' => 'LoginProfile', ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteLoginProfile', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], ], ], ], 'Update' => [ 'request' => [ 'operation' => 'UpdateLoginProfile', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], ], ], ], ], 'has' => [ 'User' => [ 'resource' => [ 'type' => 'User', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'UserName', ], ], ], ], ], ], 'MfaDevice' => [ 'identifiers' => [ [ 'name' => 'UserName', 'memberName' => 'UserName', ], [ 'name' => 'SerialNumber', 'memberName' => 'SerialNumber', ], ], 'shape' => 'MFADevice', 'actions' => [ 'Associate' => [ 'request' => [ 'operation' => 'EnableMFADevice', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'SerialNumber', 'source' => 'identifier', 'name' => 'SerialNumber', ], ], ], ], 'Disassociate' => [ 'request' => [ 'operation' => 'DeactivateMFADevice', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'SerialNumber', 'source' => 'identifier', 'name' => 'SerialNumber', ], ], ], ], 'Resync' => [ 'request' => [ 'operation' => 'ResyncMFADevice', 'params' => [ [ 'target' => 'UserName', 'source' => 'identifier', 'name' => 'UserName', ], [ 'target' => 'SerialNumber', 'source' => 'identifier', 'name' => 'SerialNumber', ],
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
true
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/sns-2010-03-31.resources.php
src/models/sns-2010-03-31.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreatePlatformApplication' => [ 'request' => [ 'operation' => 'CreatePlatformApplication', ], 'resource' => [ 'type' => 'PlatformApplication', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'PlatformApplicationArn', ], ], ], ], 'CreateTopic' => [ 'request' => [ 'operation' => 'CreateTopic', ], 'resource' => [ 'type' => 'Topic', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'TopicArn', ], ], ], ], ], 'has' => [ 'PlatformApplication' => [ 'resource' => [ 'type' => 'PlatformApplication', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], 'PlatformEndpoint' => [ 'resource' => [ 'type' => 'PlatformEndpoint', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], 'Subscription' => [ 'resource' => [ 'type' => 'Subscription', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], 'Topic' => [ 'resource' => [ 'type' => 'Topic', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'PlatformApplications' => [ 'request' => [ 'operation' => 'ListPlatformApplications', ], 'resource' => [ 'type' => 'PlatformApplication', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'PlatformApplications[].PlatformApplicationArn', ], ], ], ], 'Subscriptions' => [ 'request' => [ 'operation' => 'ListSubscriptions', ], 'resource' => [ 'type' => 'Subscription', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Subscriptions[].SubscriptionArn', ], ], ], ], 'Topics' => [ 'request' => [ 'operation' => 'ListTopics', ], 'resource' => [ 'type' => 'Topic', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Topics[].TopicArn', ], ], ], ], ], ], 'resources' => [ 'PlatformApplication' => [ 'identifiers' => [ [ 'name' => 'Arn', ], ], 'shape' => 'GetPlatformApplicationAttributesResponse', 'load' => [ 'request' => [ 'operation' => 'GetPlatformApplicationAttributes', 'params' => [ [ 'target' => 'PlatformApplicationArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'path' => '@', ], 'actions' => [ 'CreatePlatformEndpoint' => [ 'request' => [ 'operation' => 'CreatePlatformEndpoint', 'params' => [ [ 'target' => 'PlatformApplicationArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'resource' => [ 'type' => 'PlatformEndpoint', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'EndpointArn', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeletePlatformApplication', 'params' => [ [ 'target' => 'PlatformApplicationArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'SetAttributes' => [ 'request' => [ 'operation' => 'SetPlatformApplicationAttributes', 'params' => [ [ 'target' => 'PlatformApplicationArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], ], 'hasMany' => [ 'Endpoints' => [ 'request' => [ 'operation' => 'ListEndpointsByPlatformApplication', 'params' => [ [ 'target' => 'PlatformApplicationArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'resource' => [ 'type' => 'PlatformEndpoint', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Endpoints[].EndpointArn', ], ], ], ], ], ], 'PlatformEndpoint' => [ 'identifiers' => [ [ 'name' => 'Arn', ], ], 'shape' => 'GetEndpointAttributesResponse', 'load' => [ 'request' => [ 'operation' => 'GetEndpointAttributes', 'params' => [ [ 'target' => 'EndpointArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteEndpoint', 'params' => [ [ 'target' => 'EndpointArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'Publish' => [ 'request' => [ 'operation' => 'Publish', 'params' => [ [ 'target' => 'TargetArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'SetAttributes' => [ 'request' => [ 'operation' => 'SetEndpointAttributes', 'params' => [ [ 'target' => 'EndpointArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], ], ], 'Subscription' => [ 'identifiers' => [ [ 'name' => 'Arn', ], ], 'shape' => 'GetSubscriptionAttributesResponse', 'load' => [ 'request' => [ 'operation' => 'GetSubscriptionAttributes', 'params' => [ [ 'target' => 'SubscriptionArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'Unsubscribe', 'params' => [ [ 'target' => 'SubscriptionArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'SetAttributes' => [ 'request' => [ 'operation' => 'SetSubscriptionAttributes', 'params' => [ [ 'target' => 'SubscriptionArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], ], ], 'Topic' => [ 'identifiers' => [ [ 'name' => 'Arn', ], ], 'shape' => 'GetTopicAttributesResponse', 'load' => [ 'request' => [ 'operation' => 'GetTopicAttributes', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'path' => '@', ], 'actions' => [ 'AddPermission' => [ 'request' => [ 'operation' => 'AddPermission', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'ConfirmSubscription' => [ 'request' => [ 'operation' => 'ConfirmSubscription', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'resource' => [ 'type' => 'Subscription', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'SubscriptionArn', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteTopic', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'Publish' => [ 'request' => [ 'operation' => 'Publish', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'RemovePermission' => [ 'request' => [ 'operation' => 'RemovePermission', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'SetAttributes' => [ 'request' => [ 'operation' => 'SetTopicAttributes', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], ], 'Subscribe' => [ 'request' => [ 'operation' => 'Subscribe', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'resource' => [ 'type' => 'Subscription', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'SubscriptionArn', ], ], ], ], ], 'hasMany' => [ 'Subscriptions' => [ 'request' => [ 'operation' => 'ListSubscriptionsByTopic', 'params' => [ [ 'target' => 'TopicArn', 'source' => 'identifier', 'name' => 'Arn', ], ], ], 'resource' => [ 'type' => 'Subscription', 'identifiers' => [ [ 'target' => 'Arn', 'source' => 'response', 'path' => 'Subscriptions[].SubscriptionArn', ], ], ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/s3-2006-03-01.resources.php
src/models/s3-2006-03-01.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateBucket' => [ 'request' => [ 'operation' => 'CreateBucket', ], 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'Bucket', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Buckets' => [ 'request' => [ 'operation' => 'ListBuckets', ], 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'Buckets[].Name', ], ], 'path' => 'Buckets[]', ], ], ], ], 'resources' => [ 'Bucket' => [ 'identifiers' => [ [ 'name' => 'Name', ], ], 'shape' => 'Bucket', 'actions' => [ 'Create' => [ 'request' => [ 'operation' => 'CreateBucket', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucket', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'DeleteObjects' => [ 'request' => [ 'operation' => 'DeleteObjects', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'PutObject' => [ 'request' => [ 'operation' => 'PutObject', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Object', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Key', 'source' => 'requestParameter', 'path' => 'Key', ], ], ], ], ], 'waiters' => [ 'Exists' => [ 'waiterName' => 'BucketExists', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'NotExists' => [ 'waiterName' => 'BucketNotExists', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'has' => [ 'Acl' => [ 'resource' => [ 'type' => 'BucketAcl', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Cors' => [ 'resource' => [ 'type' => 'BucketCors', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Lifecycle' => [ 'resource' => [ 'type' => 'BucketLifecycle', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Logging' => [ 'resource' => [ 'type' => 'BucketLogging', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Notification' => [ 'resource' => [ 'type' => 'BucketNotification', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Object' => [ 'resource' => [ 'type' => 'Object', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Key', 'source' => 'input', ], ], ], ], 'Policy' => [ 'resource' => [ 'type' => 'BucketPolicy', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'RequestPayment' => [ 'resource' => [ 'type' => 'BucketRequestPayment', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Tagging' => [ 'resource' => [ 'type' => 'BucketTagging', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Versioning' => [ 'resource' => [ 'type' => 'BucketVersioning', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Website' => [ 'resource' => [ 'type' => 'BucketWebsite', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'hasMany' => [ 'MultipartUploads' => [ 'request' => [ 'operation' => 'ListMultipartUploads', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'MultipartUpload', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'ObjectKey', 'source' => 'response', 'path' => 'Uploads[].Key', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'Uploads[].UploadId', ], ], 'path' => 'Uploads[]', ], ], 'ObjectVersions' => [ 'request' => [ 'operation' => 'ListObjectVersions', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'ObjectVersion', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'ObjectKey', 'source' => 'response', 'path' => '[Versions,DeleteMarkers]|[].Key', ], [ 'target' => 'Id', 'source' => 'response', 'path' => '[Versions,DeleteMarkers]|[].VersionId', ], ], 'path' => '[Versions,DeleteMarkers]|[]', ], ], 'Objects' => [ 'request' => [ 'operation' => 'ListObjects', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'ObjectSummary', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Key', 'source' => 'response', 'path' => 'Contents[].Key', ], ], 'path' => 'Contents[]', ], ], ], ], 'BucketAcl' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketAclOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketAcl', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Put' => [ 'request' => [ 'operation' => 'PutBucketAcl', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketCors' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketCorsOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketCors', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucketCors', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketCors', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketLifecycle' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketLifecycleOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketLifecycle', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucketLifecycle', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketLifecycle', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketLogging' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketLoggingOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketLogging', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Put' => [ 'request' => [ 'operation' => 'PutBucketLogging', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketNotification' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'NotificationConfiguration', 'load' => [ 'request' => [ 'operation' => 'GetBucketNotificationConfiguration', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Put' => [ 'request' => [ 'operation' => 'PutBucketNotificationConfiguration', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketPolicy' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketPolicyOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketPolicy', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucketPolicy', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketPolicy', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketRequestPayment' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketRequestPaymentOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketRequestPayment', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Put' => [ 'request' => [ 'operation' => 'PutBucketRequestPayment', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketTagging' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketTaggingOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketTagging', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucketTagging', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketTagging', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketVersioning' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketVersioningOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketVersioning', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Enable' => [ 'request' => [ 'operation' => 'PutBucketVersioning', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'VersioningConfiguration.Status', 'source' => 'string', 'value' => 'Enabled', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketVersioning', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Suspend' => [ 'request' => [ 'operation' => 'PutBucketVersioning', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'VersioningConfiguration.Status', 'source' => 'string', 'value' => 'Suspended', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'BucketWebsite' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], ], 'shape' => 'GetBucketWebsiteOutput', 'load' => [ 'request' => [ 'operation' => 'GetBucketWebsite', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], 'path' => '@', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteBucketWebsite', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], 'Put' => [ 'request' => [ 'operation' => 'PutBucketWebsite', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], 'has' => [ 'Bucket' => [ 'resource' => [ 'type' => 'Bucket', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'BucketName', ], ], ], ], ], ], 'MultipartUpload' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], [ 'name' => 'ObjectKey', ], [ 'name' => 'Id', ], ], 'shape' => 'MultipartUpload', 'actions' => [ 'Abort' => [ 'request' => [ 'operation' => 'AbortMultipartUpload', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'UploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Complete' => [ 'request' => [ 'operation' => 'CompleteMultipartUpload', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'UploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Object', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], ], ], ], ], 'has' => [ 'Object' => [ 'resource' => [ 'type' => 'Object', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], ], ], ], 'Part' => [ 'resource' => [ 'type' => 'MultipartUploadPart', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'ObjectKey', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'MultipartUploadId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'PartNumber', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Parts' => [ 'request' => [ 'operation' => 'ListParts', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'UploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'MultipartUploadPart', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'requestParameter', 'path' => 'Bucket', ], [ 'target' => 'ObjectKey', 'source' => 'requestParameter', 'path' => 'Key', ], [ 'target' => 'MultipartUploadId', 'source' => 'requestParameter', 'path' => 'UploadId', ], [ 'target' => 'PartNumber', 'source' => 'response', 'path' => 'Parts[].PartNumber', ], ], 'path' => 'Parts[]', ], ], ], ], 'MultipartUploadPart' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], [ 'name' => 'ObjectKey', ], [ 'name' => 'MultipartUploadId', ], [ 'name' => 'PartNumber', 'type' => 'integer', 'memberName' => 'PartNumber', ], ], 'shape' => 'Part', 'actions' => [ 'CopyFrom' => [ 'request' => [ 'operation' => 'UploadPartCopy', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'UploadId', 'source' => 'identifier', 'name' => 'MultipartUploadId', ], [ 'target' => 'PartNumber', 'source' => 'identifier', 'name' => 'PartNumber', ], ], ], ], 'Upload' => [ 'request' => [ 'operation' => 'UploadPart', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'UploadId', 'source' => 'identifier', 'name' => 'MultipartUploadId', ], [ 'target' => 'PartNumber', 'source' => 'identifier', 'name' => 'PartNumber', ], ], ], ], ], 'has' => [ 'MultipartUpload' => [ 'resource' => [ 'type' => 'MultipartUpload', 'identifiers' => [ [ 'target' => 'BucketName', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'ObjectKey', 'source' => 'identifier', 'name' => 'ObjectKey', ], [ 'target' => 'Id', 'source' => 'identifier', 'name' => 'MultipartUploadId', ], ], ], ], ], ], 'Object' => [ 'identifiers' => [ [ 'name' => 'BucketName', ], [ 'name' => 'Key', ], ], 'shape' => 'HeadObjectOutput', 'load' => [ 'request' => [ 'operation' => 'HeadObject', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'Key', ], ], ], 'path' => '@', ], 'actions' => [ 'CopyFrom' => [ 'request' => [ 'operation' => 'CopyObject', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'Key', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteObject', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ], [ 'target' => 'Key', 'source' => 'identifier', 'name' => 'Key', ], ], ], ], 'Get' => [ 'request' => [ 'operation' => 'GetObject', 'params' => [ [ 'target' => 'Bucket', 'source' => 'identifier', 'name' => 'BucketName', ],
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
true
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/dynamodb-2012-08-10.resources.php
src/models/dynamodb-2012-08-10.resources.php
<?php return [ 'service' => [ 'actions' => [ 'BatchGetItem' => [ 'request' => [ 'operation' => 'BatchGetItem', ], ], 'BatchWriteItem' => [ 'request' => [ 'operation' => 'BatchWriteItem', ], ], 'CreateTable' => [ 'request' => [ 'operation' => 'CreateTable', ], 'resource' => [ 'type' => 'Table', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'TableDescription.TableName', ], ], 'path' => 'TableDescription', ], ], ], 'has' => [ 'Table' => [ 'resource' => [ 'type' => 'Table', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Tables' => [ 'request' => [ 'operation' => 'ListTables', ], 'resource' => [ 'type' => 'Table', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'TableNames[]', ], ], ], ], ], ], 'resources' => [ 'Table' => [ 'identifiers' => [ [ 'name' => 'Name', 'memberName' => 'TableName', ], ], 'shape' => 'TableDescription', 'load' => [ 'request' => [ 'operation' => 'DescribeTable', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'path' => 'Table', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteTable', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'DeleteItem' => [ 'request' => [ 'operation' => 'DeleteItem', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'GetItem' => [ 'request' => [ 'operation' => 'GetItem', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'PutItem' => [ 'request' => [ 'operation' => 'PutItem', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Query' => [ 'request' => [ 'operation' => 'Query', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Scan' => [ 'request' => [ 'operation' => 'Scan', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'Update' => [ 'request' => [ 'operation' => 'UpdateTable', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Table', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'Name', ], ], 'path' => 'TableDescription', ], ], 'UpdateItem' => [ 'request' => [ 'operation' => 'UpdateItem', 'params' => [ [ 'target' => 'TableName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/opsworks-2013-02-18.resources.php
src/models/opsworks-2013-02-18.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateStack' => [ 'request' => [ 'operation' => 'CreateStack', ], 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'StackId', ], ], ], ], ], 'has' => [ 'Layer' => [ 'resource' => [ 'type' => 'Layer', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Stack' => [ 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Stacks' => [ 'request' => [ 'operation' => 'DescribeStacks', ], 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Stacks[].StackId', ], ], 'path' => 'Stacks[]', ], ], ], ], 'resources' => [ 'Layer' => [ 'identifiers' => [ [ 'name' => 'Id', ], ], 'shape' => 'Layer', 'load' => [ 'request' => [ 'operation' => 'DescribeLayers', 'params' => [ [ 'target' => 'LayerIds[]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'Layers[0]', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteLayer', 'params' => [ [ 'target' => 'LayerId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'has' => [ 'Stack' => [ 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'data', 'path' => 'StackId', ], ], ], ], ], ], 'Stack' => [ 'identifiers' => [ [ 'name' => 'Id', ], ], 'shape' => 'Stack', 'load' => [ 'request' => [ 'operation' => 'DescribeStacks', 'params' => [ [ 'target' => 'StackIds[]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'Stacks[0]', ], 'actions' => [ 'CreateLayer' => [ 'request' => [ 'operation' => 'CreateLayer', 'params' => [ [ 'target' => 'StackId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Layer', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'LayerId', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteStack', 'params' => [ [ 'target' => 'StackId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'has' => [ 'Summary' => [ 'resource' => [ 'type' => 'StackSummary', 'identifiers' => [ [ 'target' => 'StackId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'hasMany' => [ 'Layers' => [ 'request' => [ 'operation' => 'DescribeLayers', 'params' => [ [ 'target' => 'StackId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Layer', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Layers[].LayerId', ], ], 'path' => 'Layers[]', ], ], ], ], 'StackSummary' => [ 'identifiers' => [ [ 'name' => 'StackId', ], ], 'shape' => 'StackSummary', 'load' => [ 'request' => [ 'operation' => 'DescribeStackSummary', 'params' => [ [ 'target' => 'StackId', 'source' => 'identifier', 'name' => 'StackId', ], ], ], 'path' => 'StackSummary', ], 'has' => [ 'Stack' => [ 'resource' => [ 'type' => 'Stack', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'identifier', 'name' => 'StackId', ], ], ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/ec2-2015-04-15.resources.php
src/models/ec2-2015-04-15.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateDhcpOptions' => [ 'request' => [ 'operation' => 'CreateDhcpOptions', ], 'resource' => [ 'type' => 'DhcpOptions', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'DhcpOptions.DhcpOptionsId', ], ], 'path' => 'DhcpOptions', ], ], 'CreateInstances' => [ 'request' => [ 'operation' => 'RunInstances', ], 'resource' => [ 'type' => 'Instance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Instances[].InstanceId', ], ], 'path' => 'Instances[]', ], ], 'CreateInternetGateway' => [ 'request' => [ 'operation' => 'CreateInternetGateway', ], 'resource' => [ 'type' => 'InternetGateway', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'InternetGateway.InternetGatewayId', ], ], 'path' => 'InternetGateway', ], ], 'CreateKeyPair' => [ 'request' => [ 'operation' => 'CreateKeyPair', ], 'resource' => [ 'type' => 'KeyPair', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'KeyName', ], ], ], ], 'CreateNetworkAcl' => [ 'request' => [ 'operation' => 'CreateNetworkAcl', ], 'resource' => [ 'type' => 'NetworkAcl', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'NetworkAcl.NetworkAclId', ], ], 'path' => 'NetworkAcl', ], ], 'CreateNetworkInterface' => [ 'request' => [ 'operation' => 'CreateNetworkInterface', ], 'resource' => [ 'type' => 'NetworkInterface', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'NetworkInterface.NetworkInterfaceId', ], ], 'path' => 'NetworkInterface', ], ], 'CreatePlacementGroup' => [ 'request' => [ 'operation' => 'CreatePlacementGroup', ], 'resource' => [ 'type' => 'PlacementGroup', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'GroupName', ], ], ], ], 'CreateRouteTable' => [ 'request' => [ 'operation' => 'CreateRouteTable', ], 'resource' => [ 'type' => 'RouteTable', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'RouteTable.RouteTableId', ], ], 'path' => 'RouteTable', ], ], 'CreateSecurityGroup' => [ 'request' => [ 'operation' => 'CreateSecurityGroup', ], 'resource' => [ 'type' => 'SecurityGroup', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'GroupId', ], ], ], ], 'CreateSnapshot' => [ 'request' => [ 'operation' => 'CreateSnapshot', ], 'resource' => [ 'type' => 'Snapshot', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'SnapshotId', ], ], 'path' => '@', ], ], 'CreateSubnet' => [ 'request' => [ 'operation' => 'CreateSubnet', ], 'resource' => [ 'type' => 'Subnet', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Subnet.SubnetId', ], ], 'path' => 'Subnet', ], ], 'CreateTags' => [ 'request' => [ 'operation' => 'CreateTags', ], 'resource' => [ 'type' => 'Tag', 'identifiers' => [ [ 'target' => 'ResourceId', 'source' => 'requestParameter', 'path' => 'Resources[]', ], [ 'target' => 'Key', 'source' => 'requestParameter', 'path' => 'Tags[].Key', ], [ 'target' => 'Value', 'source' => 'requestParameter', 'path' => 'Tags[].Value', ], ], ], ], 'CreateVolume' => [ 'request' => [ 'operation' => 'CreateVolume', ], 'resource' => [ 'type' => 'Volume', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'VolumeId', ], ], 'path' => '@', ], ], 'CreateVpc' => [ 'request' => [ 'operation' => 'CreateVpc', ], 'resource' => [ 'type' => 'Vpc', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Vpc.VpcId', ], ], 'path' => 'Vpc', ], ], 'CreateVpcPeeringConnection' => [ 'request' => [ 'operation' => 'CreateVpcPeeringConnection', ], 'resource' => [ 'type' => 'VpcPeeringConnection', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'VpcPeeringConnection.VpcPeeringConnectionId', ], ], 'path' => 'VpcPeeringConnection', ], ], 'DisassociateRouteTable' => [ 'request' => [ 'operation' => 'DisassociateRouteTable', ], ], 'ImportKeyPair' => [ 'request' => [ 'operation' => 'ImportKeyPair', ], 'resource' => [ 'type' => 'KeyPair', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'KeyName', ], ], ], ], 'RegisterImage' => [ 'request' => [ 'operation' => 'RegisterImage', ], 'resource' => [ 'type' => 'Image', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'ImageId', ], ], ], ], ], 'has' => [ 'DhcpOptions' => [ 'resource' => [ 'type' => 'DhcpOptions', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Image' => [ 'resource' => [ 'type' => 'Image', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Instance' => [ 'resource' => [ 'type' => 'Instance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'InternetGateway' => [ 'resource' => [ 'type' => 'InternetGateway', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'KeyPair' => [ 'resource' => [ 'type' => 'KeyPair', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'NetworkAcl' => [ 'resource' => [ 'type' => 'NetworkAcl', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'NetworkInterface' => [ 'resource' => [ 'type' => 'NetworkInterface', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'PlacementGroup' => [ 'resource' => [ 'type' => 'PlacementGroup', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'input', ], ], ], ], 'RouteTable' => [ 'resource' => [ 'type' => 'RouteTable', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'RouteTableAssociation' => [ 'resource' => [ 'type' => 'RouteTableAssociation', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'SecurityGroup' => [ 'resource' => [ 'type' => 'SecurityGroup', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Snapshot' => [ 'resource' => [ 'type' => 'Snapshot', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Subnet' => [ 'resource' => [ 'type' => 'Subnet', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Volume' => [ 'resource' => [ 'type' => 'Volume', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Vpc' => [ 'resource' => [ 'type' => 'Vpc', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'VpcPeeringConnection' => [ 'resource' => [ 'type' => 'VpcPeeringConnection', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'ClassicAddresses' => [ 'request' => [ 'operation' => 'DescribeAddresses', 'params' => [ [ 'target' => 'Filters[0].Name', 'source' => 'string', 'value' => 'domain', ], [ 'target' => 'Filters[0].Values[0]', 'source' => 'string', 'value' => 'standard', ], ], ], 'resource' => [ 'type' => 'ClassicAddress', 'identifiers' => [ [ 'target' => 'PublicIp', 'source' => 'response', 'path' => 'Addresses[].PublicIp', ], ], 'path' => 'Addresses[]', ], ], 'DhcpOptionsSets' => [ 'request' => [ 'operation' => 'DescribeDhcpOptions', ], 'resource' => [ 'type' => 'DhcpOptions', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'DhcpOptions[].DhcpOptionsId', ], ], 'path' => 'DhcpOptions[]', ], ], 'Images' => [ 'request' => [ 'operation' => 'DescribeImages', ], 'resource' => [ 'type' => 'Image', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Images[].ImageId', ], ], 'path' => 'Images[]', ], ], 'Instances' => [ 'request' => [ 'operation' => 'DescribeInstances', ], 'resource' => [ 'type' => 'Instance', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Reservations[].Instances[].InstanceId', ], ], 'path' => 'Reservations[].Instances[]', ], ], 'InternetGateways' => [ 'request' => [ 'operation' => 'DescribeInternetGateways', ], 'resource' => [ 'type' => 'InternetGateway', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'InternetGateways[].InternetGatewayId', ], ], 'path' => 'InternetGateways[]', ], ], 'KeyPairs' => [ 'request' => [ 'operation' => 'DescribeKeyPairs', ], 'resource' => [ 'type' => 'KeyPair', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'KeyPairs[].KeyName', ], ], 'path' => 'KeyPairs[]', ], ], 'NetworkAcls' => [ 'request' => [ 'operation' => 'DescribeNetworkAcls', ], 'resource' => [ 'type' => 'NetworkAcl', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'NetworkAcls[].NetworkAclId', ], ], 'path' => 'NetworkAcls[]', ], ], 'NetworkInterfaces' => [ 'request' => [ 'operation' => 'DescribeNetworkInterfaces', ], 'resource' => [ 'type' => 'NetworkInterface', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'NetworkInterfaces[].NetworkInterfaceId', ], ], 'path' => 'NetworkInterfaces[]', ], ], 'PlacementGroups' => [ 'request' => [ 'operation' => 'DescribePlacementGroups', ], 'resource' => [ 'type' => 'PlacementGroup', 'identifiers' => [ [ 'target' => 'Name', 'source' => 'response', 'path' => 'PlacementGroups[].GroupName', ], ], 'path' => 'PlacementGroups[]', ], ], 'RouteTables' => [ 'request' => [ 'operation' => 'DescribeRouteTables', ], 'resource' => [ 'type' => 'RouteTable', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'RouteTables[].RouteTableId', ], ], 'path' => 'RouteTables[]', ], ], 'SecurityGroups' => [ 'request' => [ 'operation' => 'DescribeSecurityGroups', ], 'resource' => [ 'type' => 'SecurityGroup', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'SecurityGroups[].GroupId', ], ], 'path' => 'SecurityGroups[]', ], ], 'Snapshots' => [ 'request' => [ 'operation' => 'DescribeSnapshots', ], 'resource' => [ 'type' => 'Snapshot', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Snapshots[].SnapshotId', ], ], 'path' => 'Snapshots[]', ], ], 'Subnets' => [ 'request' => [ 'operation' => 'DescribeSubnets', ], 'resource' => [ 'type' => 'Subnet', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Subnets[].SubnetId', ], ], 'path' => 'Subnets[]', ], ], 'Volumes' => [ 'request' => [ 'operation' => 'DescribeVolumes', ], 'resource' => [ 'type' => 'Volume', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Volumes[].VolumeId', ], ], 'path' => 'Volumes[]', ], ], 'VpcAddresses' => [ 'request' => [ 'operation' => 'DescribeAddresses', 'params' => [ [ 'target' => 'Filters[0].Name', 'source' => 'string', 'value' => 'domain', ], [ 'target' => 'Filters[0].Values[0]', 'source' => 'string', 'value' => 'vpc', ], ], ], 'resource' => [ 'type' => 'VpcAddress', 'identifiers' => [ [ 'target' => 'AllocationId', 'source' => 'response', 'path' => 'Addresses[].AllocationId', ], ], 'path' => 'Addresses[]', ], ], 'VpcPeeringConnections' => [ 'request' => [ 'operation' => 'DescribeVpcPeeringConnections', ], 'resource' => [ 'type' => 'VpcPeeringConnection', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'VpcPeeringConnections[].VpcPeeringConnectionId', ], ], 'path' => 'VpcPeeringConnections[]', ], ], 'Vpcs' => [ 'request' => [ 'operation' => 'DescribeVpcs', ], 'resource' => [ 'type' => 'Vpc', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'Vpcs[].VpcId', ], ], 'path' => 'Vpcs[]', ], ], ], ], 'resources' => [ 'ClassicAddress' => [ 'identifiers' => [ [ 'name' => 'PublicIp', ], ], 'shape' => 'Address', 'load' => [ 'request' => [ 'operation' => 'DescribeAddresses', 'params' => [ [ 'target' => 'PublicIp', 'source' => 'identifier', 'name' => 'PublicIp', ], ], ], 'path' => 'Addresses[0]', ], 'actions' => [ 'Associate' => [ 'request' => [ 'operation' => 'AssociateAddress', 'params' => [ [ 'target' => 'PublicIp', 'source' => 'identifier', 'name' => 'PublicIp', ], ], ], ], 'Disassociate' => [ 'request' => [ 'operation' => 'DisassociateAddress', 'params' => [ [ 'target' => 'PublicIp', 'source' => 'data', 'path' => 'PublicIp', ], ], ], ], 'Release' => [ 'request' => [ 'operation' => 'ReleaseAddress', 'params' => [ [ 'target' => 'PublicIp', 'source' => 'data', 'path' => 'PublicIp', ], ], ], ], ], ], 'DhcpOptions' => [ 'identifiers' => [ [ 'name' => 'Id', 'memberName' => 'DhcpOptionsId', ], ], 'shape' => 'DhcpOptions', 'load' => [ 'request' => [ 'operation' => 'DescribeDhcpOptions', 'params' => [ [ 'target' => 'DhcpOptionsIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'DhcpOptions[0]', ], 'actions' => [ 'AssociateWithVpc' => [ 'request' => [ 'operation' => 'AssociateDhcpOptions', 'params' => [ [ 'target' => 'DhcpOptionsId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'CreateTags' => [ 'request' => [ 'operation' => 'CreateTags', 'params' => [ [ 'target' => 'Resources[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Tag', 'identifiers' => [ [ 'target' => 'ResourceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Key', 'source' => 'requestParameter', 'path' => 'Tags[].Key', ], [ 'target' => 'Value', 'source' => 'requestParameter', 'path' => 'Tags[].Value', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteDhcpOptions', 'params' => [ [ 'target' => 'DhcpOptionsId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], ], 'Image' => [ 'identifiers' => [ [ 'name' => 'Id', 'memberName' => 'ImageId', ], ], 'shape' => 'Image', 'load' => [ 'request' => [ 'operation' => 'DescribeImages', 'params' => [ [ 'target' => 'ImageIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'Images[0]', ], 'actions' => [ 'CreateTags' => [ 'request' => [ 'operation' => 'CreateTags', 'params' => [ [ 'target' => 'Resources[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Tag', 'identifiers' => [ [ 'target' => 'ResourceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Key', 'source' => 'requestParameter', 'path' => 'Tags[].Key', ], [ 'target' => 'Value', 'source' => 'requestParameter', 'path' => 'Tags[].Value', ], ], ], ], 'Deregister' => [ 'request' => [ 'operation' => 'DeregisterImage', 'params' => [ [ 'target' => 'ImageId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'DescribeAttribute' => [ 'request' => [ 'operation' => 'DescribeImageAttribute', 'params' => [ [ 'target' => 'ImageId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ModifyAttribute' => [ 'request' => [ 'operation' => 'ModifyImageAttribute', 'params' => [ [ 'target' => 'ImageId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ResetAttribute' => [ 'request' => [ 'operation' => 'ResetImageAttribute', 'params' => [ [ 'target' => 'ImageId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], ], 'Instance' => [ 'identifiers' => [ [ 'name' => 'Id', 'memberName' => 'InstanceId', ], ], 'shape' => 'Instance', 'load' => [ 'request' => [ 'operation' => 'DescribeInstances', 'params' => [ [ 'target' => 'InstanceIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => 'Reservations[0].Instances[0]', ], 'actions' => [ 'AttachClassicLinkVpc' => [ 'request' => [ 'operation' => 'AttachClassicLinkVpc', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'AttachVolume' => [ 'request' => [ 'operation' => 'AttachVolume', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ConsoleOutput' => [ 'request' => [ 'operation' => 'GetConsoleOutput', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'CreateImage' => [ 'request' => [ 'operation' => 'CreateImage', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Image', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'ImageId', ], ], ], ], 'CreateTags' => [ 'request' => [ 'operation' => 'CreateTags', 'params' => [ [ 'target' => 'Resources[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Tag', 'identifiers' => [ [ 'target' => 'ResourceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Key', 'source' => 'requestParameter', 'path' => 'Tags[].Key', ], [ 'target' => 'Value', 'source' => 'requestParameter', 'path' => 'Tags[].Value', ], ], ], ], 'DescribeAttribute' => [ 'request' => [ 'operation' => 'DescribeInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'DetachClassicLinkVpc' => [ 'request' => [ 'operation' => 'DetachClassicLinkVpc', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'DetachVolume' => [ 'request' => [ 'operation' => 'DetachVolume', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ModifyAttribute' => [ 'request' => [ 'operation' => 'ModifyInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Monitor' => [ 'request' => [ 'operation' => 'MonitorInstances', 'params' => [ [ 'target' => 'InstanceIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'PasswordData' => [ 'request' => [ 'operation' => 'GetPasswordData', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Reboot' => [ 'request' => [ 'operation' => 'RebootInstances', 'params' => [ [ 'target' => 'InstanceIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ReportStatus' => [ 'request' => [ 'operation' => 'ReportInstanceStatus', 'params' => [ [ 'target' => 'Instances[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ResetAttribute' => [ 'request' => [ 'operation' => 'ResetInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'ResetKernel' => [ 'request' => [ 'operation' => 'ResetInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Attribute', 'source' => 'string', 'value' => 'kernel', ], ], ], ], 'ResetRamdisk' => [ 'request' => [ 'operation' => 'ResetInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Attribute', 'source' => 'string', 'value' => 'ramdisk', ], ], ], ], 'ResetSourceDestCheck' => [ 'request' => [ 'operation' => 'ResetInstanceAttribute', 'params' => [ [ 'target' => 'InstanceId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Attribute', 'source' => 'string', 'value' => 'sourceDestCheck', ], ], ], ], 'Start' => [ 'request' => [ 'operation' => 'StartInstances', 'params' => [ [ 'target' => 'InstanceIds[0]', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Stop' => [ 'request' => [ 'operation' => 'StopInstances', 'params' => [
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
true
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/src/models/glacier-2012-06-01.resources.php
src/models/glacier-2012-06-01.resources.php
<?php return [ 'service' => [ 'actions' => [ 'CreateVault' => [ 'request' => [ 'operation' => 'CreateVault', 'params' => [ [ 'target' => 'accountId', 'source' => 'string', 'value' => '-', ], ], ], 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'requestParameter', 'path' => 'accountId', ], [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'vaultName', ], ], ], ], ], 'has' => [ 'Account' => [ 'resource' => [ 'type' => 'Account', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Vaults' => [ 'request' => [ 'operation' => 'ListVaults', 'params' => [ [ 'target' => 'accountId', 'source' => 'string', 'value' => '-', ], ], ], 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'requestParameter', 'path' => 'accountId', ], [ 'target' => 'Name', 'source' => 'response', 'path' => 'VaultList[].VaultName', ], ], 'path' => 'VaultList[]', ], ], ], ], 'resources' => [ 'Account' => [ 'identifiers' => [ [ 'name' => 'Id', ], ], 'actions' => [ 'CreateVault' => [ 'request' => [ 'operation' => 'CreateVault', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Name', 'source' => 'requestParameter', 'path' => 'vaultName', ], ], ], ], ], 'has' => [ 'Vault' => [ 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Name', 'source' => 'input', ], ], ], ], ], 'hasMany' => [ 'Vaults' => [ 'request' => [ 'operation' => 'ListVaults', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'Id', ], [ 'target' => 'Name', 'source' => 'response', 'path' => 'VaultList[].VaultName', ], ], 'path' => 'VaultList[]', ], ], ], ], 'Archive' => [ 'identifiers' => [ [ 'name' => 'AccountId', ], [ 'name' => 'VaultName', ], [ 'name' => 'Id', ], ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteArchive', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'archiveId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'InitiateArchiveRetrieval' => [ 'request' => [ 'operation' => 'InitiateJob', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'jobParameters.Type', 'source' => 'string', 'value' => 'archive-retrieval', ], [ 'target' => 'jobParameters.ArchiveId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'jobId', ], [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], 'has' => [ 'Vault' => [ 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], ], 'Job' => [ 'identifiers' => [ [ 'name' => 'AccountId', ], [ 'name' => 'VaultName', ], [ 'name' => 'Id', 'memberName' => 'JobId', ], ], 'shape' => 'GlacierJobDescription', 'load' => [ 'request' => [ 'operation' => 'DescribeJob', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'jobId', 'source' => 'identifier', 'name' => 'Id', ], ], ], 'path' => '@', ], 'actions' => [ 'GetOutput' => [ 'request' => [ 'operation' => 'GetJobOutput', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'jobId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'has' => [ 'Vault' => [ 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], ], 'MultipartUpload' => [ 'identifiers' => [ [ 'name' => 'AccountId', ], [ 'name' => 'VaultName', ], [ 'name' => 'Id', 'memberName' => 'MultipartUploadId', ], ], 'shape' => 'UploadListElement', 'actions' => [ 'Abort' => [ 'request' => [ 'operation' => 'AbortMultipartUpload', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'uploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Complete' => [ 'request' => [ 'operation' => 'CompleteMultipartUpload', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'uploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'Parts' => [ 'request' => [ 'operation' => 'ListParts', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'uploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], 'UploadPart' => [ 'request' => [ 'operation' => 'UploadMultipartPart', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], [ 'target' => 'uploadId', 'source' => 'identifier', 'name' => 'Id', ], ], ], ], ], 'has' => [ 'Vault' => [ 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], ], 'Notification' => [ 'identifiers' => [ [ 'name' => 'AccountId', ], [ 'name' => 'VaultName', ], ], 'shape' => 'VaultNotificationConfig', 'load' => [ 'request' => [ 'operation' => 'GetVaultNotifications', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], 'path' => 'vaultNotificationConfig', ], 'actions' => [ 'Delete' => [ 'request' => [ 'operation' => 'DeleteVaultNotifications', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], 'Set' => [ 'request' => [ 'operation' => 'SetVaultNotifications', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], 'has' => [ 'Vault' => [ 'resource' => [ 'type' => 'Vault', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'Name', 'source' => 'identifier', 'name' => 'VaultName', ], ], ], ], ], ], 'Vault' => [ 'identifiers' => [ [ 'name' => 'AccountId', ], [ 'name' => 'Name', 'memberName' => 'VaultName', ], ], 'shape' => 'DescribeVaultOutput', 'load' => [ 'request' => [ 'operation' => 'DescribeVault', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], 'path' => '@', ], 'actions' => [ 'Create' => [ 'request' => [ 'operation' => 'CreateVault', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], ], 'Delete' => [ 'request' => [ 'operation' => 'DeleteVault', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], ], 'InitiateInventoryRetrieval' => [ 'request' => [ 'operation' => 'InitiateJob', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'jobParameters.Type', 'source' => 'string', 'value' => 'inventory-retrieval', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'jobId', ], [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'InitiateMultipartUpload' => [ 'request' => [ 'operation' => 'InitiateMultipartUpload', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], 'resource' => [ 'type' => 'MultipartUpload', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'uploadId', ], [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], 'UploadArchive' => [ 'request' => [ 'operation' => 'UploadArchive', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], 'resource' => [ 'type' => 'Archive', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'response', 'path' => 'archiveId', ], [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'has' => [ 'Account' => [ 'resource' => [ 'type' => 'Account', 'identifiers' => [ [ 'target' => 'Id', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], ], 'Archive' => [ 'resource' => [ 'type' => 'Archive', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Job' => [ 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'MultipartUpload' => [ 'resource' => [ 'type' => 'MultipartUpload', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'input', ], ], ], ], 'Notification' => [ 'resource' => [ 'type' => 'Notification', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], ], ], ], ], 'hasMany' => [ 'CompletedJobs' => [ 'request' => [ 'operation' => 'ListJobs', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'completed', 'source' => 'string', 'value' => 'true', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'JobList[].JobId', ], ], 'path' => 'JobList[]', ], ], 'FailedJobs' => [ 'request' => [ 'operation' => 'ListJobs', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'statuscode', 'source' => 'string', 'value' => 'Failed', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'JobList[].JobId', ], ], 'path' => 'JobList[]', ], ], 'Jobs' => [ 'request' => [ 'operation' => 'ListJobs', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'JobList[].JobId', ], ], 'path' => 'JobList[]', ], ], 'JobsInProgress' => [ 'request' => [ 'operation' => 'ListJobs', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'statuscode', 'source' => 'string', 'value' => 'InProgress', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'JobList[].JobId', ], ], 'path' => 'JobList[]', ], ], 'MultipartUplaods' => [ 'request' => [ 'operation' => 'ListMultipartUploads', 'params' => [ [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], ], ], 'resource' => [ 'type' => 'MultipartUpload', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'UploadsList[].MultipartUploadId', ], ], 'path' => 'UploadsList[]', ], ], 'SucceededJobs' => [ 'request' => [ 'operation' => 'ListJobs', 'params' => [ [ 'target' => 'accountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'vaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'statuscode', 'source' => 'string', 'value' => 'Succeeded', ], ], ], 'resource' => [ 'type' => 'Job', 'identifiers' => [ [ 'target' => 'AccountId', 'source' => 'identifier', 'name' => 'AccountId', ], [ 'target' => 'VaultName', 'source' => 'identifier', 'name' => 'Name', ], [ 'target' => 'Id', 'source' => 'response', 'path' => 'JobList[].JobId', ], ], 'path' => 'JobList[]', ], ], ], ], ], ];
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/CollectionTest.php
tests/CollectionTest.php
<?php namespace Aws\Resource\Test; use Aws\Resource\Batch; use Aws\Resource\Collection; use Aws\Resource\ResourceClient; use Aws\Resource\Resource; /** * @covers Aws\Resource\Collection */ class CollectionTest extends \PHPUnit_Framework_TestCase { public function testDividingACollectionIntoBatchesYieldsCorrectSizes() { $collection = $this->createCollection('foo', 3, 4); $this->assertEquals(12, iterator_count($collection->getIterator())); $this->assertEquals(3, iterator_count($collection->getBatches())); $this->assertEquals(2, iterator_count($collection->getBatches(7))); $batches = iterator_to_array($collection->getBatches(20), false); $this->assertCount(1, $batches); $this->assertInstanceOf('Aws\Resource\Batch', $batches[0]); } public function testDebuggingCollectionReturnsMetaData() { $collection = $this->createCollection('bar', 2, 2); $this->assertEquals( ['object' => 'collection', 'type' => 'bar'], $collection->__debugInfo() ); } private function createCollection($type, $n, $m) { $rc = $this->getMockBuilder(ResourceClient::class) ->disableOriginalConstructor() ->getMock(); $fn = function ($whoCares) use ($rc, $type, $m) { $resources = []; for ($i = 0; $i < $m; $i++) { $resources[$i] = $this->getMockBuilder(Resource::class) ->disableOriginalConstructor() ->getMock(); } return new Batch($rc, $type, $resources); }; $iter = new \ArrayIterator(range(1, $n)); return new Collection($rc, $type, $iter, $fn); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/AwsTest.php
tests/AwsTest.php
<?php namespace Aws\Resource\Test; use Aws\Resource\Aws; use Aws\Sdk; use Aws\Signature\S3SignatureV4; /** * @covers Aws\Resource\Aws */ class AwsTest extends \PHPUnit_Framework_TestCase { use TestHelperTrait; public function testInstantiatingTheResourceSdkWorksWithArgsOrSdkObject() { $config = ['version' => 'latest', 'region' => 'us-east-1']; $aws_1 = new Aws($config); $aws_2 = new Aws(new Sdk($config)); $this->assertInstanceOf('Aws\\Resource\\Aws', $aws_1); $this->assertInstanceOf('Aws\\Resource\\Aws', $aws_2); } public function testCreatingServiceWithoutArgsReturnsSameObject() { $aws = $this->getTestAws(); $s3_1 = $aws->s3; $s3_2 = $aws->s3; $this->assertInstanceOf('Aws\\Resource\\Resource', $s3_1); $this->assertEquals('s3', $s3_1->getMeta()['serviceName']); $this->assertSame($s3_1, $s3_2); } public function testCreatingServiceWithArgsOverwritesConfig() { $s3 = $this ->getTestAws(['region' => 'us-west-2']) ->s3(['region' => 'us-west-1']); $this->assertEquals('us-west-1', $s3->getClient()->getRegion()); } /** * @expectedException \RuntimeException * @expectedExceptionMessage The resources model file */ public function testAccessingUnsupportedResourceServiceThrowsException() { $aws = $this->getTestAws(); $efs = $aws->efs; } public function testCallingRespondstoShowsServicesThatCanBeCreated() { $aws = $this->getTestAws(); $this->assertTrue($aws->respondsTo('s3')); $this->assertTrue($aws->respondsTo('iam')); $this->assertFalse($aws->respondsTo('foo')); $this->assertContains('s3', $aws->respondsTo()); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/TestHelperTrait.php
tests/TestHelperTrait.php
<?php namespace Aws\Resource\Test; use Aws\AwsClientInterface; use Aws\MockHandler; use Aws\Result; use Aws\Resource\Aws; use Aws\Resource\Model; use Aws\Sdk; /** * @internal */ trait TestHelperTrait { /** * @param array $args * * @return Aws */ private function getTestAws(array $args = []) { return new Aws($this->getTestSdk($args)); } /** * @param array $args * * @return Sdk */ private function getTestSdk(array $args = []) { // Disable network access unless INTEGRATION if (!isset($_SERVER['INTEGRATION'])) { $args['http_handler'] = function () { throw new \RuntimeException('No network access.'); }; } return new Sdk($args + [ 'region' => 'us-east-1', 'version' => 'latest', 'credentials' => false, 'retries' => 0 ]); } /** * @param string $service * @param array $args * * @return AwsClientInterface */ private function getTestClient($service, array $args = []) { return $this->getTestSdk()->createClient($service, $args); } /** * Queues up mock Result objects for a client. * * @param AwsClientInterface $client * @param Result[] $results */ private function setMockResults(AwsClientInterface $client, array $results) { $client->getHandlerList()->setHandler(new MockHandler($results)); } /** * @param string $service * * @return Model|array */ private function getModel($service, $raw = false, callable $modifyFn = null) { static $models = []; if (!isset($models[$service])) { $paths = glob(dirname(__DIR__) . "/src/models/{$service}-*.resources.php"); rsort($paths); $models[$service] = include reset($paths); } $data = $models[$service]; if ($modifyFn) { $data = $modifyFn($data); } return $raw ? $data : new Model($service, $data); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/ResourceClientTest.php
tests/ResourceClientTest.php
<?php namespace Aws\Resource\Test; use Aws\AwsClientInterface; use Aws\Middleware; use Aws\Result; use Aws\Resource\Model; use Aws\Resource\Resource; use Aws\Resource\ResourceClient; /** * @covers Aws\Resource\ResourceClient */ class ResourceClientTest extends \PHPUnit_Framework_TestCase { use TestHelperTrait; public function testInstantiatingClientAndGettersWork() { $apiClient = $this->getMock(AwsClientInterface::class); $model = new Model('s3', ['service' => [], 'resources' => []]); $resourceClient = new ResourceClient($apiClient, $model); $this->assertSame($apiClient, $resourceClient->getApiClient()); $this->assertSame($model, $resourceClient->getModel()); $meta = $resourceClient->getMetaData('service'); $this->assertEquals('s3', $meta['serviceName']); $this->assertArrayHasKey('actions', $meta); } /** * @dataProvider getTestCasesForLoadingAResource */ public function testLoadingAResourceRetrievesItsData($path, array $expected) { // Setup API client $client = $this->getTestClient('s3'); $client->getHandlerList()->appendBuild( Middleware::tap(function ($c) use (&$command) { $command = $c; }) ); $this->setMockResults($client, [ new Result(['A' => 1, 'B' => ['C' => 3]]) ]); // Setup model $model = $this->getModel('s3', false, function ($data) use ($path) { $data['resources']['Object']['load']['path'] = $path; return $data; }); // Setup resource client and call loadResourceData $rc = new ResourceClient($client, $model); $data = $rc->loadResourceData(new Resource($rc, 'Object', [ 'BucketName' => 'foo', 'Key' => 'bar', ])); $params = $command->toArray(); // Filter out stuff we don't want to compare unset($data['@metadata']); unset($params['@http']); // Verify the results are as expected $this->assertEquals($expected, $data); $this->assertEquals(['Bucket' => 'foo', 'Key' => 'bar'], $params); } public function getTestCasesForLoadingAResource() { return [ ['@', ['A' => 1, 'B' => ['C' => 3]]], ['B', ['C' => 3]], ['D', []], ]; } public function testLoadingAResourceWithoutALoadOperationReturnsEmptyData() { $rc = new ResourceClient( $this->getTestClient('s3'), $this->getModel('s3') ); $data = $rc->loadResourceData( new Resource($rc, 'Bucket', ['Name' => 'foo']) ); $this->assertEquals([], $data); } public function testCreatingRelatedResourceUsesDataFromParentAndProvidedArgs() { $rc = new ResourceClient( $this->getTestClient('s3'), $this->getModel('s3') ); $parent = new Resource($rc, 'Bucket', ['Name' => 'foo']); $resource = $rc->makeRelated('Object', ['bar'], $parent); $this->assertEquals('Object', $resource->getType()); $this->assertEquals( ['BucketName' => 'foo', 'Key' => 'bar'], $resource->getIdentity() ); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid identity. */ public function testCreatingRelatedResourceFailsWhenMissingIdentityParts() { $rc = new ResourceClient( $this->getTestClient('s3'), $this->getModel('s3') ); $parent = new Resource($rc, 'Bucket', ['Name' => 'foo']); $resource = $rc->makeRelated('Object', [], $parent); } public function testCreatingRelatedResourceReturnsNewResourceForBelongsToTypeRelationship() { $rc = new ResourceClient( $this->getTestClient('iam'), $this->getModel('iam') ); $parent = new Resource( $rc, 'VirtualMfaDevice', ['SerialNumber' => 'foo'], [ 'User' => [ 'UserName' => 'a', 'UserId' => 'b', 'Arn' => 'c', ] ] ); $resource = $rc->makeRelated('User', [], $parent); $this->assertInstanceOf('Aws\Resource\Resource', $resource); $this->assertEquals(['Name' => 'a'], $resource->getIdentity()); } public function testCreatingRelatedResourceWithMultiRelationshipReturnsABatch() { $rc = new ResourceClient( $this->getTestClient('iam'), $this->getModel('iam') ); $parent = new Resource( $rc, 'InstanceProfile', ['Name' => 'foo'], ['Roles' => [ ['RoleName' => 'a'], ['RoleName' => 'b'], ['RoleName' => 'c'], ]] ); $resources = $rc->makeRelated('Roles', [], $parent); $this->assertInstanceOf('Aws\Resource\Batch', $resources); $data = []; foreach ($resources as $resource) { $data[] = $resource->getIdentity(); } $this->assertEquals([ ['Name' => 'a'], ['Name' => 'b'], ['Name' => 'c'], ], $data); } public function testWaitingForSomethingCallsClientWaiters() { $client = $this->getTestClient('s3'); $this->setMockResults($client, [new Result([])]); $rc = new ResourceClient($client, $this->getModel('s3')); $resource = new Resource($rc, 'Bucket', ['Name' => 'foo']); $result = $rc->waitUntil('Exists', [], $resource); $this->assertSame($result, $resource); } public function testCheckingForExistenceCallsClientWaiters() { $client = $this->getTestClient('s3'); $this->setMockResults($client, [ new Result(['@metadata' => ['statusCode' => 200]]), new Result(['@metadata' => ['statusCode' => 404]]), ]); $rc = new ResourceClient($client, $this->getModel('s3')); $resource1 = new Resource($rc, 'Bucket', ['Name' => 'existing-bucket']); $resource2 = new Resource($rc, 'Bucket', ['Name' => 'not-found-bucket']); $this->assertTrue($rc->checkIfExists($resource1)); $this->assertFalse($rc->checkIfExists($resource2)); } public function testPerformingAnActionCanReturnResourcesOrResults() { // Setup client and parent resource for test. $client = $this->getTestClient('s3'); $this->setMockResults($client, [ new Result(['bucket' => 1]), new Result(['bucket' => 2]) ]); $rc = new ResourceClient($client, $this->getModel('s3')); $s3 = new Resource($rc, 'service', [], []);; // Perform action that returns resource. $bucket = $rc->performAction('CreateBucket', [['Bucket' => 'foo']], $s3); $this->assertInstanceOf(Resource::class, $bucket); $this->assertEquals('Bucket', $bucket->getType()); $this->assertEquals(['Name' => 'foo'], $bucket->getIdentity()); // Perform action that returns result. $result = $rc->performAction('Create', [], $bucket); $this->assertInstanceOf('Aws\ResultInterface', $result); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/ModelTest.php
tests/ModelTest.php
<?php namespace Aws\Resource\Test; use Aws\Resource\Model; /** * @covers Aws\Resource\Model */ class ModelTest extends \PHPUnit_Framework_TestCase { use TestHelperTrait; public function testInstantiatingAModelAddsAdditionalModelData() { $data = $this->getModel('s3', true); $model = new Model('s3', $data); $service = $model->search('service'); $this->assertArrayHasKey('_meta', $service); $this->assertArrayHasKey('has', $service); $this->assertArrayHasKey('_meta', $model->search('resources.Bucket')); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/ResourceTest.php
tests/ResourceTest.php
<?php namespace Aws\Resource\Test; use Aws\AwsClientInterface; use Aws\Resource\Resource; use Aws\Resource\ResourceClient; /** * @covers Aws\Resource\Resource * @covers Aws\Resource\HasTypeTrait */ class ResourceTest extends \PHPUnit_Framework_TestCase { use TestHelperTrait; public function testAccessingMetaInfoAboutResourceObjectsWorks() { $bucket = $this->getTestAws()->s3->bucket('foo'); // Test getType() and getIdentity() $this->assertEquals('Bucket', $bucket->getType()); $this->assertEquals(['Name' => 'foo'], $bucket->getIdentity()); // Test respondsTo() $this->assertTrue($bucket->respondsTo('create')); $this->assertTrue($bucket->respondsTo('objectVersions')); $this->assertFalse($bucket->respondsTo('fooBar')); $this->assertContains('create', $bucket->respondsTo()); // Test isLoaded() $this->assertFalse($bucket->isLoaded()); // Test getClient() $client = $bucket->getClient(); $this->assertInstanceOf(AwsClientInterface::class, $client); // Test __toString() $this->assertEquals('Resource <AWS.S3.Bucket> [ Name => foo ]', $bucket); // Test __debugInfo() and getMeta() $this->assertEmpty(array_diff( array_keys($bucket->getMeta()), array_keys($bucket->__debugInfo()), ['object' => 'resource'] )); } public function testAccessingResourceDataTriggersLoad() { $bucket = $this->getTestAws()->s3->bucket('foo'); // Test toArray() and getIterator() // Note: Implicitly calls getData() and load() $this->assertEquals($bucket->toArray(), iterator_to_array($bucket)); } public function testAccessingDataViaArrayAccessChecksDataAndIdentity() { $resource = new Resource( $this->getMockBuilder(ResourceClient::class) ->disableOriginalConstructor() ->getMock(), 'whatever', ['a' => 'b', 'b' => 'c'], ['b' => 'z', 'c' => 'd'] ); $this->assertEquals('b', $resource['a']); $this->assertEquals('z', $resource['b']); $this->assertEquals('d', $resource['c']); $this->assertEquals(null, $resource['d']); $this->assertTrue(isset($resource['a'])); $this->assertTrue(isset($resource['b'])); $this->assertTrue(isset($resource['c'])); $this->assertFalse(isset($resource['d'])); } public function testModifyingDataFromResourceObjectFails() { $bucket = $this->getTestAws()->s3->bucket('foo'); $this->setExpectedException('RuntimeException'); $bucket['Name'] = 'bar'; } public function testDeletingDataFromResourceObjectFails() { $bucket = $this->getTestAws()->s3->bucket('foo'); $this->setExpectedException('RuntimeException'); unset($bucket['Name']); } public function testAccessingRelationshipsWorksForAllTypes() { $rc = $this->getMockBuilder(ResourceClient::class) ->disableOriginalConstructor() ->setMethods([ 'getMetaData', 'makeRelated', 'performAction', 'makeCollection', 'waitUntil', 'checkIfExists', ]) ->getMock(); $rc->expects($this->once())->method('getMetaData')->willReturn([ 'actions' => ['A'], 'related' => ['B'], 'collections' => ['C'], 'waiters' => ['D'], 'methods' => [ 'a' => 'actions', 'b' => 'related', 'c' => 'collections', 'd' => 'waiters', 'e' => 'exists', ] ]); $rc->expects($this->once())->method('makeRelated'); $rc->expects($this->once())->method('performAction'); $rc->expects($this->once())->method('makeCollection'); $rc->expects($this->once())->method('waitUntil'); $rc->expects($this->once())->method('checkIfExists'); $resource = new Resource($rc, 'Thing', []); foreach ($resource->respondsTo() as $property) { $resource->{$property}; } $this->setExpectedException('BadMethodCallException'); $resource->explode(); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/bootstrap.php
tests/bootstrap.php
<?php error_reporting(-1); date_default_timezone_set('UTC'); // Include the composer autoloader $loader = require dirname(__DIR__) . '/vendor/autoload.php'; $loader->addPsr4('Aws\\Resource\\Test\\', __DIR__); // Clear our any JMESPath cache if necessary (e.g., COMPILE_DIR is enabled) $runtime = JmesPath\Env::cleanCompileDir();
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/BatchTest.php
tests/BatchTest.php
<?php namespace Aws\Resource\Test; use Aws\Resource\Batch; use Aws\Resource\ResourceClient; use Aws\Resource\Resource; /** * @covers Aws\Resource\Batch */ class BatchTest extends \PHPUnit_Framework_TestCase { public function testCountingBatchReturnsExpectedSize() { $batch = $this->createBatch('foo', 3, $original); $this->assertCount(3, $batch); $this->assertSame($original, $batch->toArray()); $items = []; foreach ($batch as $i => $item) { $items[$i] = $item; } $this->assertSame($original, $items); } public function testDebuggingBatchReturnsMetaData() { $batch = $this->createBatch('bar', 5); $this->assertEquals( ['object' => 'batch', 'type' => 'bar', 'count' => 5], $batch->__debugInfo() ); } private function createBatch($type, $size, &$resources = null) { $rc = $this->getMockBuilder(ResourceClient::class) ->disableOriginalConstructor() ->getMock(); $resource = $this->getMockBuilder(Resource::class) ->disableOriginalConstructor() ->getMock(); $resources = []; for ($i = 0; $i < $size; $i++) { $resources[$i] = clone $resource; } return new Batch($rc, $type, $resources); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/tests/IntegrationTest.php
tests/IntegrationTest.php
<?php namespace Aws\Resource\Test; use Aws\AwsClientInterface; use Aws\Command; use Aws\CommandPool; use Aws\Middleware; use Aws\Resource\Aws; class IntegrationTest extends \PHPUnit_Framework_TestCase { public function testCreationAndTearDownOfResources() { $aws = new Aws([ 'profile' => 'integ', 'version' => 'latest', 'region' => 'us-east-1', ]); $this->attachCommandMiddleware($aws->s3->getClient()); if (!$aws->s3->respondsTo('createBucket')) { $this->fail('Methods are not available.'); } $this->log('Creating a bucket...'); $bucket = $aws->s3->createBucket([ 'Bucket' => uniqid('php-resources-test-') ]); $bucket->waitUntilExists(); $this->log('Loading the bucket...'); $this->assertFalse($bucket->isLoaded()); $bucket->load(); $this->assertTrue($bucket->isLoaded()); $this->log('Uploading an object...'); $object1 = $bucket->object('test-file1'); $result = $object1->put(['Body' => 'foo']); $this->assertEquals( "https://s3.amazonaws.com/{$bucket['Name']}/{$object1['Key']}", $result['ObjectURL'] ); $this->log('Uploading another object...'); $object2 = $bucket->putObject(['Key' => 'test-file2', 'Body' => 'foo']); $this->assertEquals( "https://s3.amazonaws.com/{$bucket['Name']}/test-file2", $bucket->getClient()->getObjectUrl($object2['BucketName'], $object2['Key']) ); $this->log('Getting an object...'); $result = $object1->get(); $this->assertEquals('foo', (string) $result['Body']); $this->log('Deleting the objects and bucket...'); $object1->delete(); $object2->delete(); $object2->bucket->delete(); } public function testWorkflowWithCollections() { $aws = new Aws([ 'profile' => 'integ', 'version' => 'latest', 'region' => 'us-west-2', ]); $this->attachCommandMiddleware($aws->s3->getClient()); $this->log('Creating a bucket...'); $bucket = $aws->s3->createBucket([ 'Bucket' => uniqid('php-resources-test-'), 'CreateBucketConfiguration' => [ 'LocationConstraint' => 'us-west-2', ] ]); $bucket->waitUntilExists(); $this->log('Uploading 20 dummy objects...'); CommandPool::batch($bucket->getClient(), array_map( function ($value) use ($bucket) { return $bucket->getClient()->getCommand('PutObject', [ 'Bucket' => $bucket['Name'], 'Key' => ($value <= 10 ? 'foo' : 'bar') . $value, ]); }, range(1, 20) )); $this->log('Creating a collection of objects with prefix "bar"...'); $objects = $bucket->objects(['Prefix' => 'bar']); $this->assertEquals(10, iterator_count($objects)); $this->log('Creating a collection from zero results...'); $objects = $bucket->objects(['Prefix' => 'invalid']); $this->assertEquals(0, iterator_count($objects)); $this->log('Getting batches of objects to count and delete...'); $batches = $bucket->objects->getBatches(6); $counts = []; foreach ($batches as $i => $batch) { $counts[$i] = 0; foreach ($batch as $object) { $counts[$i]++; $object->delete(); } } $this->log('Verifying batch sizes...'); $this->assertSame([6, 6, 6, 2], $counts); $this->log('Deleting the bucket...'); $bucket->delete(); } private function log($message) { fwrite(STDOUT, $message . "\n"); } private function attachCommandMiddleware(AwsClientInterface $client) { $client->getHandlerList()->appendBuild(Middleware::tap(function (Command $command) { $this->log( '> Executed a "' . $command->getName(). '" command' . ($command['Key'] ? " (Key: {$command['Key']})." : '.') ); })); } }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
awslabs/aws-sdk-php-resources
https://github.com/awslabs/aws-sdk-php-resources/blob/07dc483fc45d38dacfb5e030de676fb967a8fca4/build/api.php
build/api.php
<?php /* * Loads the JSON models from the provided directory, converts them to .php * files, does some pre-processing, and places them into the src/models. */ require __DIR__ . '/../vendor/autoload.php'; if (!isset($argv[1])) { die('A source path was not provided in argument 1'); } $dir = $argv[1]; if (is_file($dir)) { copyJson($dir); } elseif (is_dir($dir)) { $files = \Aws\recursive_dir_iterator(rtrim($dir, '/')); $files = \Aws\filter($files, function ($file) { return substr($file, -16) === 'resources-1.json'; }); foreach ($files as $file) { copyJson($file, $dir); } } else { die('Invalid file/directory'); } function copyJson($file, $baseDir) { $phpFile = __DIR__ . '/../src/models/' . strtr($file, [ $baseDir => '', '/resources-1.json' => '.resources.php', '/' => '-', ]); $json = json_decode(file_get_contents($file), true); $script = "<?php return " . var_export($json, true) . ";\n"; // Convert "array()" to "[]" $script = str_replace('array (', '[', $script); $script = str_replace(')', ']', $script); // Removing trailing whitespace $script = preg_replace('/\s+$/m', '', $script); // Move arrays to the same line $script = preg_replace('/=>\s*\n\s*\[/', '=> [', $script); // Get rid of numbered array indexes $script = preg_replace('/(\s*)(\d+ => )/', '$1', $script); // Adding trailing new line $script .= "\n"; echo "Creating {$phpFile}\n"; file_put_contents($phpFile, $script); }
php
Apache-2.0
07dc483fc45d38dacfb5e030de676fb967a8fca4
2026-01-05T05:05:43.692724Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/src/Messenger.php
src/Messenger.php
<?php namespace GeneaLabs\LaravelMessenger; use Illuminate\View\View; class Messenger { public function deliver() : View { $message = session('genealabs-laravel-messenger.message'); session()->forget('genealabs-laravel-messenger.message'); if (! $message) { return view("genealabs-laravel-messenger::empty"); } return view("genealabs-laravel-messenger::{$message->framework}.{$message->type}")->with([ 'autoHide' => $message->autoHide, "id" => $message->id, 'message' => $message->message, 'level' => $message->level, 'section' => $message->section, 'title' => $message->title, ]); } public function send( string $text, string $title = null, string $level = null, bool $autoHide = null, string $framework = null, string $type = null ) { $message = new Message([ 'message' => $text, 'title' => $title, 'level' => $level, 'autoHide' => $autoHide, 'framework' => $framework, 'type' => $type, ]); if ($text) { session(['genealabs-laravel-messenger.message' => $message]); } } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/src/Message.php
src/Message.php
<?php declare(strict_types=1); namespace GeneaLabs\LaravelMessenger; use Illuminate\Support\Str; use Jenssegers\Model\Model; class Message extends Model { protected $appends = [ "id", 'autoHide', 'framework', 'message', 'level', 'title', 'type', ]; protected $casts = [ 'autoHide' => 'boolean', ]; protected $fillable = [ "id", 'autoHide', 'framework', 'message', 'level', 'title', 'type', ]; public function getIdAttribute(): string { $this->attributes["id"] = $this->attributes["id"] ?? Str::random(16); return $this->attributes["id"]; } public function getAutoHideAttribute(): bool { return ($this->attributes['autoHide'] === true); } public function getFrameworkAttribute(): string { return $this->attributes['framework'] ?: config('genealabs-laravel-messenger.framework'); } public function getMessageAttribute(): string { return $this->attributes['message'] ?: ''; } public function getLevelAttribute(): string { return $this->attributes['level'] ?: 'info'; } public function getTitleAttribute(): string { return $this->attributes['title'] ?: ''; } public function getTypeAttribute(): string { return $this->attributes['type'] ?: 'alert'; } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/src/Facades/Messenger.php
src/Facades/Messenger.php
<?php namespace GeneaLabs\LaravelMessenger\Facades; use Illuminate\Support\Facades\Facade; class Messenger extends Facade { protected static function getFacadeAccessor() { return 'messenger'; } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/src/Console/Commands/Publish.php
src/Console/Commands/Publish.php
<?php declare(strict_types=1); namespace GeneaLabs\LaravelMessenger\Console\Commands; use Illuminate\Console\Command; use GeneaLabs\LaravelMessenger\Providers\Service; class Publish extends Command { protected $signature = 'messenger:publish {--config} {--views}'; protected $description = 'Publish configuration file of the Laravel Messenger package.'; public function handle() { if ($this->option('config')) { $this->call('vendor:publish', [ '--provider' => Service::class, '--tag' => ['config'], '--force' => true, ]); } if ($this->option('views')) { $this->call('vendor:publish', [ '--provider' => Service::class, '--tag' => ['views'], '--force' => true, ]); } } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/src/Providers/Service.php
src/Providers/Service.php
<?php declare(strict_types=1); namespace GeneaLabs\LaravelMessenger\Providers; use Exception; use GeneaLabs\LaravelMessenger\Messenger; use GeneaLabs\LaravelMessenger\Console\Commands\Publish; use Illuminate\Support\ServiceProvider; class Service extends ServiceProvider { protected $defer = false; public function boot(): void { if (! $this->app->routesAreCached()) { require __DIR__ . '/../../routes/web.php'; } $this->loadViewsFrom( __DIR__ . '/../../resources/views', 'genealabs-laravel-messenger' ); $this->publishes([ __DIR__ . '/../../resources/views' => resource_path('views/vendor/genealabs/laravel-messenger'), ], "views"); $configPath = __DIR__ . '/../../config/genealabs-laravel-messenger.php'; $this->mergeConfigFrom($configPath, 'genealabs-laravel-messenger'); $this->publishes([ $configPath => config_path('genealabs-laravel-messenger.php') ], 'config'); } public function register(): void { $this->commands(Publish::class); $this->app->singleton('messenger', function () { return new Messenger; }); $this->registerBladeDirective('deliver'); $this->registerBladeDirective('send'); } private function registerBladeDirective($formMethod, $alias = null): void { $alias = $alias ?: $formMethod; $blade = app('view')->getEngineResolver() ->resolve('blade') ->getCompiler(); if (array_key_exists($alias, $blade->getCustomDirectives())) { throw new Exception("Blade directive '{$alias}' is already registered."); } $blade->directive($alias, function ($parameters) use ($formMethod) { $parameters = trim($parameters, "()"); return "<?php echo app('messenger')->{$formMethod}({$parameters}); ?>"; }); } public function provides(): array { return [ 'genealabs-laravel-messenger', ]; } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/TestCase.php
tests/TestCase.php
<?php namespace GeneaLabs\LaravelMessenger\Tests; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { use CreatesApplication; }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/CreatesApplication.php
tests/CreatesApplication.php
<?php namespace GeneaLabs\LaravelMessenger\Tests; use GeneaLabs\LaravelMessenger\Providers\Service as LaravelMessengerService; use Illuminate\Contracts\Console\Kernel; trait CreatesApplication { public function createApplication() { $this->loadRoutes(); $app = require __DIR__ . '/../vendor/laravel/laravel/bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); $app->register(LaravelMessengerService::class); return $app; } protected function loadRoutes() { $routes = file_get_contents(__DIR__ . '/../routes/web.php'); file_put_contents(__DIR__ . '/../vendor/laravel/laravel/routes/web.php', $routes); } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/Feature/MessengerTest.php
tests/Feature/MessengerTest.php
<?php namespace GeneaLabs\LaravelMessenger\Tests\Feature; use GeneaLabs\LaravelMessenger\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; class MessengerTest extends TestCase { public function testBootstrap3TestPageCanLoad() { $response = $this->get(route('genealabs-laravel-messenger.tests.bootstrap3')); $response->assertStatus(200); } public function testBootstrap4TestPageCanLoad() { $response = $this->get(route('genealabs-laravel-messenger.tests.bootstrap4')); $response->assertStatus(200); } public function testDeliveryOfSuccessMessageForBootstrap3() { app('messenger')->send( 'success message with <a href="">link</a>.', 'title with <a href="">link</a>', 'success', true, 'bootstrap3' ); $response = $this->get( route('genealabs-laravel-messenger.tests.bootstrap4') ); $response->assertStatus(200); $response->assertSee('<p>success message with <a href="">link</a>.</p>'); $response->assertSee('<h4>title with <a href="">link</a></h4>'); $response->assertSee('<div class="genealabs-laravel-messenger alert alert-dismissable alert-success" role="alert">'); } public function testDeliveryOfSuccessMessageForBootstrap4() { app('messenger')->send( 'success message with <a href="">link</a>.', 'title with <a href="">link</a>', 'success', true, 'bootstrap4' ); $response = $this->get( route('genealabs-laravel-messenger.tests.bootstrap4') ); $response->assertStatus(200); $response->assertSee('<p>success message with <a href="">link</a>.</p>'); $response->assertSee('<h4>title with <a href="">link</a></h4>'); $response->assertSee('<div class="genealabs-laravel-messenger alert alert-dismissable alert-success" role="alert">'); } public function testDeliveryOfModalMessageForBootstrap3() { app('messenger')->send( 'success message with <a href="">link</a>.', 'title with <a href="">link</a>', 'success', true, 'bootstrap3', 'modal' ); $response = $this->get( route('genealabs-laravel-messenger.tests.bootstrap4') ); $response->assertStatus(200); $response->assertSee('<p>success message with <a href="">link</a>.</p>'); $response->assertSee('<h4 class="modal-title">title with <a href="">link</a></h4>'); $response->assertSee('<button type="button" class="btn btn-block btn-success" data-dismiss="modal">I Understand</button>'); } public function testDeliveryOfModalMessageForBootstrap4() { app('messenger')->send( 'success message with <a href="">link</a>.', 'title with <a href="">link</a>', 'success', true, 'bootstrap4', 'modal' ); $response = $this->get( route('genealabs-laravel-messenger.tests.bootstrap4') ); $response->assertStatus(200); $response->assertSee('<p>success message with <a href="">link</a>.</p>'); $response->assertSee('<h4 class="modal-title">title with <a href="">link</a></h4>'); $response->assertSee('<button type="button" class="btn btn-block btn-success" data-dismiss="modal">I Understand</button>'); } public function testSessionVariablesAreSetWhenSending() { $message = 'success message with <a href="">link</a>.'; $title = 'title with <a href="">link</a>'; $level = 'success'; $autoHide = true; $framework = 'bootstrap4'; $type = 'modal'; app('messenger')->send($message, $title, $level,$autoHide, $framework, $type); $this->assertEquals( $message, session('genealabs-laravel-messenger.message')->message ); $this->assertEquals( $title, session('genealabs-laravel-messenger.message')->title ); $this->assertEquals( $level, session('genealabs-laravel-messenger.message')->level ); $this->assertEquals( $autoHide, session('genealabs-laravel-messenger.message')->autoHide ); $this->assertEquals( $framework, session('genealabs-laravel-messenger.message')->framework ); $this->assertEquals( $type, session('genealabs-laravel-messenger.message')->type ); } public function testSessionVariablesAreClearedAfterDelivery() { $message = 'success message with <a href="">link</a>.'; $title = 'title with <a href="">link</a>'; $level = 'success'; $autoHide = true; $framework = 'bootstrap4'; app('messenger')->send($message, $title, $level,$autoHide, $framework); $this->get( route('genealabs-laravel-messenger.tests.bootstrap4') ); $this->assertNull(session('genealabs-laravel-messenger.message')); $this->assertNull(session('genealabs-laravel-messenger.title')); $this->assertNull(session('genealabs-laravel-messenger.level')); $this->assertNull(session('genealabs-laravel-messenger.autoHide')); $this->assertNull(session('genealabs-laravel-messenger.framework')); } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/Unit/FacadeTest.php
tests/Unit/FacadeTest.php
<?php namespace GeneaLabs\LaravelMessenger\Tests\Unit; use GeneaLabs\LaravelMessenger\Facades\Messenger as Facade; use GeneaLabs\LaravelMessenger\Messenger; use GeneaLabs\LaravelMessenger\Tests\TestCase; class FacadeTest extends TestCase { public function testFacadeProvidesCorrectClass() { $expectedResult = new Messenger; $actualResult = Facade::getFacadeRoot(); $this->assertEquals($expectedResult, $actualResult); } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/Unit/ServiceTest.php
tests/Unit/ServiceTest.php
<?php namespace GeneaLabs\LaravelMessenger\Tests\Unit; use Exception; use GeneaLabs\LaravelMessenger\Providers\Service; use GeneaLabs\LaravelMessenger\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; class ServiceTest extends TestCase { public function testServiceProviderHint() { $expectedResult = ['genealabs-laravel-messenger']; $actualResult = (new Service(app()))->provides(); $this->assertEquals($expectedResult, $actualResult); } public function testBladeDirectiveConflictThrowsException() { $this->expectException(Exception::class); $response = (new Service(app()))->register(); } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/tests/Unit/Console/Commands/PublishTest.php
tests/Unit/Console/Commands/PublishTest.php
<?php namespace GeneaLabs\LaravelMessenger\Tests\Unit\Console\Commands; use GeneaLabs\LaravelMessenger\Tests\TestCase; class PublishTest extends TestCase { public function testConfigFileGetsPublished() { app('artisan')::getFacadeRoot()->call('messenger:publish', ['--config' => true]); $this->assertFileExists(base_path('config/genealabs-laravel-messenger.php')); } public function testConfigFileContainsCorrectSettings() { $settings = file_get_contents(base_path('config/genealabs-laravel-messenger.php')); $this->assertStringContainsString("'framework' => 'bootstrap4',", $settings); $this->assertStringContainsString("'javascript-blade-section' => 'js',", $settings); } }
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/routes/web.php
routes/web.php
<?php Route::view( 'genealabs-laravel-messenger/tests/bootstrap3', 'genealabs-laravel-messenger::tests.bootstrap3' )->name('genealabs-laravel-messenger.tests.bootstrap3'); Route::view( 'genealabs-laravel-messenger/tests/bootstrap4', 'genealabs-laravel-messenger::tests.bootstrap4' )->name('genealabs-laravel-messenger.tests.bootstrap4');
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/config/genealabs-laravel-messenger.php
config/genealabs-laravel-messenger.php
<?php return [ /* |-------------------------------------------------------------------------- | CSS Framework Configuration |-------------------------------------------------------------------------- | | Here you may configure the CSS framework to be used by Messenger for | Laravel. This allows you to switch or upgrade frameworks without | having to recreate all your alerts. | | Available Settings: "bootstrap3", "bootstrap4" | */ 'framework' => 'bootstrap4', /* |-------------------------------------------------------------------------- | JavaScript Blade Section |-------------------------------------------------------------------------- | | Your layout blade template will need to have a section dedicated to | inline JavaScript methods and commands that are injected by this | package. This will eliminate conflicts with Vue, as well as | making sure that JS is run after all deps are loaded. | */ 'javascript-blade-section' => 'js', ];
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/empty.blade.php
resources/views/empty.blade.php
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/bootstrap4/alert.blade.php
resources/views/bootstrap4/alert.blade.php
@if ($message || $title) <div class="genealabs-laravel-messenger alert alert-dismissable alert-{{ $level }}" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true" > x </button> @if ($title) <h4>{!! $title !!}</h4> @endif @if ($message) <p>{!! $message !!}</p> @endif </div> @endif @section ($section) @if ($autoHide) <script> window.setTimeout(function() { $(".genealabs-laravel-messenger.alert-success").slideUp(750, function() { $(this).remove(); }); $(".genealabs-laravel-messenger.alert-info").slideUp(750, function() { $(this).remove(); }); }, 15000); </script> @endif @endsection
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/bootstrap4/modal.blade.php
resources/views/bootstrap4/modal.blade.php
@if ($message || $title) <div class="genealabs-laravel-messenger modal fade"> <div class="modal-dialog" role="document"> <div class="modal-content" style="overflow: hidden;"> @if ($title) <div class="modal-header alert-{{ $level }}"> <h4 class="modal-title">{!! $title !!}</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> @endif @if ($message) <div class="modal-body"> <p>{!! $message !!}</p> </div> @endif <div class="modal-footer"> <button type="button" class="btn btn-block btn-{{ $level }}" data-dismiss="modal">I Understand</button> </div> </div> </div> </div> @endif @section ($section) <script> $(document).ready(function () { $('.genealabs-laravel-messenger.modal').modal('show'); }); </script> @endsection
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/tests/bootstrap4.blade.php
resources/views/tests/bootstrap4.blade.php
<!DOCTYPE html> <html lang="{{ app()->getLocale() }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <link href="{{ asset('css/app.css') }}" rel="stylesheet"> </head> <body> <div id="app"> <div class="container"> @deliver </div> </div> </body> </html>
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/tests/bootstrap3.blade.php
resources/views/tests/bootstrap3.blade.php
<!DOCTYPE html> <html lang="{{ app()->getLocale() }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <link href="{{ asset('css/app.css') }}" rel="stylesheet"> </head> <body> <div id="app"> <div class="container"> @deliver </div> </div> </body> </html>
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/bootstrap3/alert.blade.php
resources/views/bootstrap3/alert.blade.php
@if ($message || $title) <div class="genealabs-laravel-messenger alert alert-dismissable alert-{{ $level }}" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true" > x </button> @if ($title) <h4>{!! $title !!}</h4> @endif @if ($message) <p>{!! $message !!}</p> @endif </div> @endif @section ($section) @if ($autoHide) <script> window.setTimeout(function() { $(".genealabs-laravel-messenger.alert-success").slideUp(750, function() { $(this).remove(); }); $(".genealabs-laravel-messenger.alert-info").slideUp(750, function() { $(this).remove(); }); }, 15000); </script> @endif @endsection
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
mikebronner/laravel-messenger
https://github.com/mikebronner/laravel-messenger/blob/eb3c187568077fe72685a13ddcbb2b087939f076/resources/views/bootstrap3/modal.blade.php
resources/views/bootstrap3/modal.blade.php
@if ($message || $title) <div class="genealabs-laravel-messenger modal fade" role="dialog" tabindex="-1"> <div class="modal-dialog" role="document"> <div class="modal-content" style="overflow: hidden"> @if ($title) <div class="modal-header alert-{{ $level }}"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title">{!! $title !!}</h4> </div> @endif @if ($message) <div class="modal-body"> <p>{!! $message !!}</p> </div> @endif <div class="modal-footer"> <button type="button" class="btn btn-block btn-{{ $level }}" data-dismiss="modal">I Understand</button> </div> </div> </div> </div> @endif @section ($section) <script> $(document).ready(function () { $('.genealabs-laravel-messenger.modal').modal('show'); }); </script> @endsection
php
MIT
eb3c187568077fe72685a13ddcbb2b087939f076
2026-01-05T05:05:52.418367Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Autoloader.php
RongCloud/Autoloader.php
<?php function autoload($class){ if(is_file(str_replace("\\", "/", RONGCLOUOD_ROOT.'../'."$class".'.'.'php'))){ require(str_replace("\\", "/", RONGCLOUOD_ROOT.'../'."$class".'.'.'php')); } } spl_autoload_register("autoload");
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/RongCloud.php
RongCloud/RongCloud.php
<?php /** * RongCloud server SDK */ namespace RongCloud; use RongCloud\Lib\Chatroom\Chatroom; use RongCloud\Lib\Conversation\Conversation; use RongCloud\Lib\Group\Group; use RongCloud\Lib\Ultragroup\Ultragroup; use RongCloud\Lib\Message\Message; use RongCloud\Lib\Sensitive\Sensitive; use RongCloud\Lib\User\User; use RongCloud\Lib\Push\Push; use RongCloud\Lib\Entrust\Entrust; error_reporting(0); if (!defined('RONGCLOUOD_ROOT')) { define('RONGCLOUOD_ROOT', dirname(__FILE__) . '/'); require('Autoloader.php'); } //Whether to enable domain name switching true to enable (default) false to disable if (!defined('RONGCLOUOD_DOMAIN_CHANGE')) { define('RONGCLOUOD_DOMAIN_CHANGE', true); } class RongCloud { /** * Application appkey * * @var string */ public static $appkey; /** * Application appSecret * * @var string */ public static $appSecret; /** * Global data center API address, default to domestic data center * * @var string */ public static $apiUrl; /** * CURLOPT_CONNECTTIMEOUT * * @var int */ public static $connectTimeout = 20; /** * CURLOPT_TIMEOUT * * @var int */ public static $timeout = 30; /** * User object * * @var User */ public $_user; /** * Message Object * * @var Message */ public $_message; /** * Group object * * @var Group */ public $_group; /** * Ultragroup Object * * @var Ultragroup */ public $_ultragroup; /** * Conversation object * * @var Conversation */ public $_conversation; /** * Chatroom object * * @var Chatroom */ public $_chatroom; /** * Sensitive object * * @var Sensitive */ public $_sensitive; /** * Push module object * * @var Push */ public $_push; /** * Information Escrow Module Object * * @var Entrust */ public $_entrust; /** * RongCloud constructor. * @param string $appKey Entity appKey application key * @param string $appSecret Entity appSecret application secret */ public function __construct($appKey="",$appSecret="",$apiUrl="") { // Set key and secret if($appKey){ self::$appkey = $appKey; self::$appSecret = $appSecret; } if($apiUrl) self::$apiUrl = $apiUrl; // Create User $this->_user = new User(); // Create Group $this->_group = new Group(); // Create Chatroom $this->_chatroom = new Chatroom(); // Create Conversation $this->_conversation= new Conversation(); // Create Message $this->_message = new Message(); // Create Sensitive $this->_sensitive= new Sensitive(); // Create Push $this->_push= new Push(); // Create Ultragroup $this->_ultragroup = new Ultragroup(); // Create Entrust $this->_entrust = new Entrust(); } /** * Retrieve the user object * * @return User */ public function getUser(){ return $this->_user; } /** * Get the message object * * @return Message */ public function getMessage(){ return $this->_message; } /** * Get the group object * * @return Group */ public function getGroup(){ return $this->_group; } /** * Get the chatroom object * * @return Chatroom */ public function getChatroom(){ return $this->_chatroom; } /** * Get the conversation object * * @return Conversation */ public function getConversation(){ return $this->_conversation; } /** * Get sensitive word object * * @return Sensitive */ public function getSensitive(){ return $this->_sensitive; } /** * Get the push object * * @return Push */ public function getPush(){ return $this->_push; } /** * Get the ultragroup object * * @return Ultragroup */ public function getUltragroup(){ return $this->_ultragroup; } /** * Get the information entrust object * * @return Entrust */ public function getEntrust(){ return $this->_entrust; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestConversation.php
RongCloud/tests/TestConversation.php
<?php /** * Session module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET',''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY,APPSECRET); function testConversation($RongSDK){ $Conversation = $RongSDK->getConversation(); $params = [ 'type'=> 'PRIVATE',// Session types PRIVATE, GROUP, DISCUSSION, SYSTEM 'userId'=>'mka091amn',// Session Owner 'targetId'=>'adm1klnm'// session id ]; Utils::dump("Set user's session screen push success",$Conversation->mute($params)); Utils::dump("Set the user's session screen push type error",$Conversation->mute()); $params = [ 'type'=> 'PRIVATE',// Conversation types PRIVATE, GROUP, DISCUSSION, SYSTEM 'userId'=>'mka091amn',// Session owner 'targetId'=>'adm1klnm'// Session ID ]; Utils::dump("Set the user's session to successfully receive Push",$Conversation->unmute($params)); Utils::dump("Set the user's session to receive Push type errors",$Conversation->unmute()); } testConversation($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestUltragroup.php
RongCloud/tests/TestUltragroup.php
<?php /** * Super cluster module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET',''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY,APPSECRET); function testGroup($RongSDK){ $Group = $RongSDK->getUltragroup(); $params = [ 'id'=> 'watergroup1',// Super group ID 'name'=> 'watergroup',// Super group name 'member'=>['id'=> 'group999'],// Create a userId ]; Utils::dump("Create super group success",$Group->create($params)); Utils::dump("Create super group error",$Group->create()); $params = [ 'id'=> 'watergroup',// Supergroup ID 'member'=>['id'=> 'group999'],// Group member information ]; Utils::dump("Joined the super group successfully",$Group->joins($params)); Utils::dump("Error adding supergroup member",$Group->joins()); $params = [ 'member'=>['id'=> 'group999'], ]; Utils::dump("Error in adding super group ID",$Group->joins($params)); $params = [ 'id'=> 'watergroup',// Super group ID 'member'=>['id'=> 'group999']// Exit personnel information ]; Utils::dump("Exit supergroup successfully",$Group->quit($params)); Utils::dump("Error in exiting super group ID",$Group->quit()); $params = [ 'id'=> 'watergroup',// Supergroup ID 'name'=>"watergroup"// group name ]; Utils::dump("Modify group information successfully",$Group->update($params)); $params = [ 'id'=> '',// Super group ID 'name'=>"watergroup"// group name ]; Utils::dump("Modify group message ID error",$Group->update($params)); $params = [ 'id'=> 'watergroup',// Super group ID 'name'=>""// group name ]; Utils::dump("Modify group information name error",$Group->update($params)); $params = [ 'id'=> 'watergroup',// ultra group id ]; Utils::dump("Disband the supergroup successfully",$Group->dismiss($params)); Utils::dump("Resolve supergroup ID error",$Group->dismiss()); $params = [ 'id'=> 'watergroup',// Super group ID 'member'=>"userId1"// Member ID ]; Utils::dump("Whether the super group member exists successfully",$Group->isExist($params)); Utils::dump("Whether the super group member exists ID error",$Group->isExist()); } testGroup($RongSDK); function testGroupGag($RongSDK){ $Group = $RongSDK->getUltragroup()->Gag(); $params = [ 'id'=> 'watergroup1',// Super group ID 'members'=>[// Prohibited personnel list ['id'=> 'group9994'] ] ]; Utils::dump("Add super group ban word success",$Group->add($params)); Utils::dump("Add super group ban parameter error",$Group->add()); $params = [ 'id'=> 'watergroup1',// Supergroup ID 'members'=>[// Forbidden personnel list ['id'=> 'group9994'] ] ]; Utils::dump("Unblocking successful",$Group->remove($params)); Utils::dump("Remove prohibition parameter error",$Group->remove()); $params = [ 'id'=> 'watergroup1', 'members'=>[] ]; Utils::dump("Remove forbidden word members error",$Group->remove($params)); $params = [ 'id'=> 'watergroup1',// ultra group id ]; Utils::dump("Query the banned member list successfully",$Group->getList($params)); Utils::dump("Query forbidden word list parameter error",$Group->getList()); } testGroupGag($RongSDK); function testGroupMuteAllMembers($RongSDK){ $Group = $RongSDK->getUltragroup()->MuteAllMembers(); $params = [ 'id'=> 'watergroup1',// Super group ID 'status'=>true ]; Utils::dump("Add specified supergroup full ban success",$Group->set($params)); Utils::dump("Add specified super group all forbidden parameters error",$Group->set()); $params = [ 'id'=> 'watergroup1',// ultra group id ]; Utils::dump("Successfully queried the complete ban list of the specified supergroup.",$Group->get($params)); } testGroupMuteAllMembers($RongSDK); function testGroupMuteWhiteList($RongSDK){ $Group = $RongSDK->getUltragroup()->MuteWhiteList(); $params = [ 'id'=> 'watergroup1',// Super group ID 'members'=>[// Prohibited whitelist personnel list ['id'=> 'group9994'] ], ]; Utils::dump("Successfully added to the super group ban list whitelist",$Group->add($params)); Utils::dump("Add super group ban whitelist parameter error",$Group->add()); $params = [ 'id'=> 'watergroup1',// Super group ID 'members'=>[// Prohibited whitelist personnel list ['id'=> 'group9994'] ] ]; Utils::dump("Successfully removed from the blocklist",$Group->remove($params)); Utils::dump("Remove the whitelist parameter error from the prohibition list",$Group->remove()); $params = [ 'id'=> 'watergroup1', 'members'=>[] ]; Utils::dump("Unblock whitelist members error",$Group->remove($params)); $params = [ 'id'=> 'watergroup1',// Ultra group ID ]; Utils::dump("Querying the banned words whitelist member list successfully",$Group->getList($params)); Utils::dump("Query forbidden word whitelist member list parameter error",$Group->getList()); } testGroupMuteWhiteList($RongSDK); function testGroupBusChannel($RongSDK){ $Group = $RongSDK->getUltragroup()->BusChannel(); $params = [ 'id'=> 'phpgroup1',// Super group ID 'busChannel'=> 'busChannel',// Super Group Channel 'type'=>0 ]; Utils::dump("Add super group channel successfully",$Group->add($params)); Utils::dump("Error in adding super group channel parameters",$Group->add()); Utils::dump("Query super group channel list successfully",$Group->getList("phpgroup1")); Utils::dump("Successfully deleted the super group channel",$Group->remove($params)); Utils::dump("Delete super group channel error",$Group->remove()); Utils::dump("Query super group channel list parameter error",$Group->getList()); Utils::dump("Supergroup channel type switch succeeded",$Group->change($params)); Utils::dump("Super group channel type switching parameter error",$Group->change()); $group = [ 'id'=> 'phpgroup1',// Super group ID 'busChannel'=>'', 'members'=>[// Add supergroup private channel member ['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI'] ] ]; Utils::dump("Super Group Private Channel Member Addition",$Group->addPrivateUsers($group)); Utils::dump("Error in adding supergroup private channel member parameters",$Group->addPrivateUsers()); Utils::dump("Super group private channel member removal",$Group->removePrivateUsers($group)); Utils::dump("Super group private channel member removal parameter error",$Group->removePrivateUsers()); $group = [ 'id'=> 'phpgroup1',// Super group ID 'busChannel'=>'', ]; Utils::dump("Super group private channel member acquisition success",$Group->getPrivateUserList($group)); Utils::dump("Super group private channel member parameter acquisition error",$Group->getPrivateUserList()); } testGroupBusChannel($RongSDK); function testGroupNotdisturb($RongSDK){ $Group = $RongSDK->getUltragroup()->Notdisturb(); $params = [ 'id'=> 'phpgroup1',// Super group ID 'busChannel'=> 'busChannel',// Super group channel 'unpushLevel'=>1 ]; Utils::dump("Set super group do not disturb",$Group->set($params)); Utils::dump("Set super cluster anti-disturbance parameter error",$Group->set()); $params = [ 'id'=> 'phpgroup1',// Super Group ID 'busChannel'=> 'busChannel',// Super group channel ]; Utils::dump("Query super group do not disturb",$Group->get($params)); } testGroupNotdisturb($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestMessage.php
RongCloud/tests/TestMessage.php
<?php /** * Message module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET',''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY, APPSECRET); function testMessageChatroom($RongSDK) { $Message = $RongSDK->getMessage()->Chatroom(); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'kkj9o01', // Chat room ID "objectName" => 'RC:TxtMsg', // Message type Text 'content' => json_encode(['content' => 'Hello live streaming host']) // Message content ]; Utils::dump("Chat room message sent successfully", $Message->send($params)); Utils::dump("Chat room message sending parameter error", $Message->send()); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => '', "objectName" => 'RC:TxtMsg', 'content' => json_encode(['content' => 'Hello live streaming host']) ]; Utils::dump("Chat room message sending targetId error", $Message->send($params)); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => 'kkj9o01', "objectName" => '', 'content' => json_encode(['content' => 'Hello live streaming host']) ]; Utils::dump("Chatroom message sending objectName error", $Message->send($params)); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => 'kkj9o01', "objectName" => 'RC:TxtMsg', 'content' => [] ]; Utils::dump("Chat room message sending content error", $Message->send($params)); $params = [ 'senderId' => 'ujadk90ha', // Sender ID "objectName" => 'RC:TxtMsg', // Message type: Text 'content' => json_encode(['content' => 'Hello live streaming host'])// Message content ]; Utils::dump("Chat room broadcast message successful", $Message->broadcast($params)); Utils::dump("Chat room broadcast message parameter error", $Message->broadcast()); $params = [ 'senderId' => 'ujadk90ha', "objectName" => '', 'content' => json_encode(['content' => 'Hello live streaming host']) ]; Utils::dump("Chat room broadcast message objectName error", $Message->broadcast($params)); $params = [ 'senderId' => 'ujadk90ha', "objectName" => 'RC:TxtMsg', 'content' => [] ]; Utils::dump("Chat room broadcast message content error", $Message->broadcast($params)); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'markoiwm', // Chat room Id "uId" => '5GSB-RPM1-KP8H-9JHF', // The unique identifier of the message 'sentTime' => '1519444243981' // Message sending time ]; Utils::dump("Successfully recalled the sent chat room message", $Message->recall($params)); Utils::dump("Revoke sent chat room message parameter error", $Message->recall()); $params = [ 'senderId' => 'ujadk90ha', "uId" => '5GSB-RPM1-KP8H-9JHF', 'sentTime' => '1519444243981' ]; Utils::dump("Revoke the sent chat room message with targetId error", $Message->recall($params)); } testMessageChatroom($RongSDK); function testMessageGroup($RongSDK) { $Message = $RongSDK->getMessage()->Group(); $params = [ 'senderId' => 'ujadk90ha', // sender id 'targetId' => 'kkj9o01', // Chat room ID "objectName" => 'RC:TxtMsg', // Message type Text 'content' => json_encode(['content' => 'Hello live streaming host']) // Message content ]; Utils::dump("Group message sent successfully", $Message->send($params)); Utils::dump("Group message sending parameter error @param error in group message sending parameters", $Message->send()); Utils::dump("Group message sent successfully", $Message->sendStatusMessage($params)); Utils::dump("Group send status message parameter error", $Message->sendStatusMessage()); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => '', "objectName" => 'RC:TxtMsg', 'content' => json_encode(['content' => 'Hello live streaming host']) ]; Utils::dump("Error in sending group message targetId", $Message->send($params)); Utils::dump("Group sending status message targetId error", $Message->sendStatusMessage($params)); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => 'kkj9o01', "objectName" => '', 'content' => json_encode(['content' => 'Hello live streaming host']) ]; Utils::dump("Group message sending error objectName", $Message->send($params)); Utils::dump("Group sending status message objectName error", $Message->sendStatusMessage($params)); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => 'kkj9o01', "objectName" => 'RC:TxtMsg', ]; Utils::dump("Group message sending error", $Message->send($params)); Utils::dump("Group send status message content error", $Message->sendStatusMessage($params)); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'markoiwm', // Group ID "objectName" => 'RC:TxtMsg', // Message type Text 'content' => json_encode([ // Message content 'content' => 'Hello Xiaoming', 'mentionedInfo' => [ 'type' => '1', // @function type, 1 represents @all. 2 represents @specified user 'userIds' => ['kladd', 'almmn1'], // The @ list must be filled when the type is 2, and can be empty when the type is 1 'pushContent' => 'greeting message' // Custom @ Message push content ] ]) ]; Utils::dump("Message sent successfully", $Message->sendMention($params)); Utils::dump("Send @ message parameter error", $Message->sendMention()); $params = [ 'senderId' => 'ujadk90ha', 'targetId' => '', "objectName" => '', ]; Utils::dump("Failed to send message to targetId", $Message->sendMention($params)); $params = [ 'senderId' => 'ujadk90ha', "objectName" => 'RC:TxtMsg', 'targetId' => 'markoiwm', ]; Utils::dump("Send @ message content error", $Message->sendMention($params)); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'markoiwm', // Group ID "uId" => '5GSB-RPM1-KP8H-9JHF', // The unique identifier of the message 'sentTime' => '1519444243981' // Message sending time ]; Utils::dump("Successfully revoked the sent group chat message", $Message->recall($params)); Utils::dump("Withdraw the mistakenly sent group chat message parameter", $Message->recall()); $params = [ 'senderId' => 'ujadk90ha', "uId" => '5GSB-RPM1-KP8H-9JHF', 'sentTime' => '1519444243981' ]; Utils::dump("Revoke the sent group chat message with an incorrect targetId", $Message->recall($params)); } testMessageGroup($RongSDK); function testMessageHistory($RongSDK) { $Message = $RongSDK->getMessage()->History(); $params = [ 'date' => '2018030613', // Date ]; Utils::dump("Historical message retrieval successful", $Message->get($params)); Utils::dump("Historical message retrieval parameter error", $Message->get()); $params = [ 'date' => '2018030613', // Date ]; Utils::dump("Historical message file deleted successfully", $Message->remove($params)); Utils::dump("Historical message file deletion parameter error", $Message->remove()); $params = [ 'conversationType'=> '1', //Conversation types, supporting single chat, group chat, and system notifications. Single chat is 1, group chat is 3, and system notification is 6. 'fromUserId'=>"fromUserId", //User ID, delete historical messages before the specified session msgTimestamp 'targetId'=>"userId", //Target session ID to be cleared 'msgTimestamp'=>"1588838388320", //Clear all historical messages before this timestamp, accurate to the millisecond, to empty all historical messages of this session. ]; Utils::dump("Message cleared successfully", $Message->clean($params)); Utils::dump("Clear message parameter error", $Message->clean()); } testMessageHistory($RongSDK); function testMessagePerson($RongSDK) { $Message = $RongSDK->getMessage()->Person(); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'markoiwm', // Recipient ID "objectName" => 'RC:TxtMsg', // Message type: Text 'content' => json_encode(['content' => 'Hello, this is a message.'])// Message content ]; Utils::dump("Message sent successfully", $Message->send($params)); Utils::dump("Error in sending two-person message parameters", $Message->send()); Utils::dump("Two-person status message sent successfully", $Message->sendStatusMessage($params)); Utils::dump("Error in sending two-person status message parameters", $Message->sendStatusMessage()); $params = [ 'senderId' => 'kamdnq', // Sender ID 'objectName' => 'RC:TxtMsg', // Message type Text 'template' => json_encode(['content' => '{name}, Language score {score}']), // Template content 'content' => json_encode([ 'sea9901' => [ // Recipient ID 'data' => ['{name}' => 'Xiaoming', '{score}' => '90'], // Template data 'push' => '{name} Your grades are in.', // Push content ], 'sea9902' => [ // Recipient ID 'data' => ['{name}' => 'Xiaohong', '{score}' => '95'], // Template data 'push' => '{name} Your grades are in.', // push notification content ] ]) ]; Utils::dump("Successfully sent different content messages to multiple users", $Message->sendTemplate($params)); Utils::dump("@param Error in sending different content messages to multiple users", $Message->sendTemplate()); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => 'markoiwm', // Recipient ID "uId" => '5GSB-RPM1-KP8H-9JHF', // Message unique identifier The unique identifier of the message, each end SDK will return uId after successfully sending the message 'sentTime' => '1519444243981' // Send time The time when the message is sent, each SDK will return sentTime after successfully sending the message ]; Utils::dump("Two-person message recall successful", $Message->recall($params)); Utils::dump("Two-person message recall parameter error", $Message->recall()); } testMessagePerson($RongSDK); function testMessageSystem($RongSDK) { $Message = $RongSDK->getMessage()->System(); $params = [ 'senderId' => '__system__', // Sender ID /* Sender ID */ 'targetId' => 'markoiwm', // Receive release id "objectName" => 'RC:TxtMsg', // Message type: Text 'content' => ['content' => 'Hello Xiaoming'] // Message Body ]; Utils::dump("System message successfully sent", $Message->send($params)); Utils::dump("System message delivery parameter error /* System message delivery parameter error */", $Message->send()); $params = [ 'senderId' => '__system__', // Sender ID 'objectName' => 'RC:TxtMsg', // Message type Text 'template' => json_encode(['content' => '{name}, Language score {score}']),// Template content 'content' => json_encode([ 'sea9901' => [//Recipient ID 'data' => ['{name}' => 'Xiaoming', '{score}' => '90'], //Template Data 'push' => '{name} Your grades are in.', // Push content ], 'sea9902' => [// recipient id 'data' => ['{name}' => 'Xiaohong', '{score}' => '95'],// Template data 'push' => '{name} Your grades are in.', // push notification content ] ]) ]; Utils::dump("System template message succeeded", $Message->sendTemplate($params)); Utils::dump("System template message parameter error", $Message->sendTemplate()); $params = [ 'senderId' => '__system__', // Sender ID "objectName" => 'RC:TxtMsg', // Message type 'content' => ['content' => 'Hello Xiaoming'] // Message content ]; Utils::dump("System broadcast message successful", $Message->broadcast($params)); Utils::dump("System broadcast message parameter error", $Message->broadcast()); $params = [ 'userIds' => ["user1","user2"], // Recipient ID 'notification' => [ "pushContent">"push notification content", "title">"push notification title" ] ]; Utils::dump("Notification of successful deployment", $Message->pushUser($params)); Utils::dump("Notification parameter error", $Message->pushUser()); } testMessageSystem($RongSDK); function testMessageBroadcast($RongSDK) { $Message = $RongSDK->getMessage()->Broadcast(); $message = [ 'senderId' => 'test', // Sender ID "objectName" => 'RC:RcCmd', // Message type 'content' => json_encode([ 'uId' => 'xxxxx', // The unique identifier of the message, obtained after broadcasting the message via /push, the returned name is id. 'isAdmin' => '0', // Whether it is an administrator, default is 0; when set to 1, the IMKit SDK will display the gray bar as "Administrator has withdrawn a message" after receiving this message. 'isDelete' => '0' // Whether to delete the message, default is 0 to revoke the message while the client deletes and replaces it with a small gray bar revocation prompt message; when it is 1, after deleting the message, it will not be replaced with a small gray bar prompt message. ]) ]; $Result = $Message->recall($message); Utils::dump("Broadcast message withdrawal successful", $Result); $message = [ "objectName" => 'RC:RcCmd', // Message type 'content' => json_encode([ 'uId' => 'xxxxx', 'isAdmin' => '0', 'isDelete' => '0' ]) ]; $Result = $Message->recall($message); Utils::dump("Broadcast message withdrawal parameter error", $Result); } testMessageBroadcast($RongSDK); function textExpansionSet($RongSDK) { $Expansion = $RongSDK->getMessage()->Expansion(); $message = [ 'msgUID' => 'BS45-NPH4-HV87-10LM', //Message unique identifier ID, which can be obtained by the server through the full message routing function. 'userId' => 'WNYZbMqpH', //Set the extended message delivery user Id. 'targetId' => 'tjw3zbMrU', //Target ID, depending on the conversationType, could be a user ID or a group ID. 'conversationType' => '1', //Conversation type, private chat is 1, group chat is 3, only supports private and group chat types. 'extraKeyVal' => ['type1' => '1', 'type2' => '2', 'type3' => '3', 'type4' => '4',] // Custom message extension content, JSON structure, set in Key, Value format ]; $Result = $Expansion->set($message); Utils::dump("Set message extension", $Result); } textExpansionSet($RongSDK); function textExpansionDelete($RongSDK) { $Expansion = $RongSDK->getMessage()->Expansion(); $message = [ 'msgUID' => 'BS45-NPH4-HV87-10LM', //The unique message identifier, which the server can obtain through the full message routing function. 'userId' => 'WNYZbMqpH', //The user ID for sending extended messages needs to be set. 'targetId' => 'tjw3zbMrU', //Target ID, which could be a user ID or group ID depending on the conversationType. 'conversationType' => '1', //Conversation type, one-on-one chat is 1, group chat is 3, only supports single chat and group chat types. 'extraKey' => ['type1', 'type2'] //The Key value of the extension information to be deleted, with a maximum of 100 extension information items that can be deleted at once ]; $Result = $Expansion->delete($message); Utils::dump("Delete message extension", $Result); } textExpansionDelete($RongSDK); function textExpansionGetList($RongSDK) { $Expansion = $RongSDK->getMessage()->Expansion(); $message = [ 'msgUID' => 'BS45-NPH4-HV87-10LM', //The unique identifier of the message, which can be obtained by the server through the full message routing function. 'pageNo' => 1 //Number of pages, default returns 300 extended information. ]; $Result = $Expansion->getList($message); Utils::dump("Get extension information", $Result); } textExpansionGetList($RongSDK); function textUltragroup($RongSDK) { $Ultragroup = $RongSDK->getMessage()->Ultragroup(); $params = [ 'senderId' => 'ujadk90ha', // Sender ID 'targetId' => ['kkj9o01'], // Super group ID "objectName" => 'RC:TxtMsg', // Message type Text 'content' => json_encode(['content' => 'Hello live streaming host']) // Message content ]; Utils::dump("Super group message sent successfully", $Ultragroup->send($params)); Utils::dump("Super group message sending parameter error", $Ultragroup->send()); $params = [ 'senderId'=> 'ujadk90ha', //Sender ID 'targetId'=> ['STRe0shISpQlSOBvek1FfU'], //Supergroup ID "objectName"=>'RC:TxtMsg', //Message type Text 'content'=>json_encode([ //Message content 'content'=>'PHP group @ messege Hello Xiaoming', 'mentionedInfo'=>[ 'type'=>'1', //@ Function type, 1 indicates @ everyone. 2 indicates @ specified user. 'userIds'=>['uPj70HUrRSUk-ixtt7iIGc'], //The @ list must be filled when type is 2, and can be empty when type is 1 'pushContent'=>'php push greeting message' //Customize @ message push content ] ]) ]; Utils::dump("Super group message sent @ message successful", $Ultragroup->sendMention($params)); Utils::dump("Super group send @ message parameter error", $Ultragroup->sendMention()); } textUltragroup($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestEntrust.php
RongCloud/tests/TestEntrust.php
<?php /** * Group information hosting module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET', ''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY, APPSECRET); /** * Create a group */ function testGroupCreate($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->Group()->create($param); Utils::dump('Failed to create group, missing required parameter name', $result); $param['name'] = 'RC_NAME_1'; $result = $RongSDK->getEntrust()->Group()->create($param); Utils::dump('Failed to create group, missing required parameter owner', $result); $param = [ 'groupId' => 'RC_GROUP_1', 'name' => 'RC_NAME_1', 'owner' => 'RC_OWNER_1', 'userIds' => ['C_U_1', 'C_U_2', 'C_U_3'] ]; $result = $RongSDK->getEntrust()->Group()->create($param); Utils::dump('Group creation successful', $result); } testGroupCreate($RongSDK); /** * Set group resources */ function testGroupUpdate($RongSDK) { $param = ['groupId' => 'CHIQ_GROUP_2']; $result = $RongSDK->getEntrust()->Group()->update($param); Utils::dump("Set group resource failure, missing required parameter name", $result); $param = [ 'groupId' => 'CHIQ_GROUP_2', 'name' => 'RC_NAME_2', 'groupProfile' => ['introduction' => 'i', 'announcement' => 'a', 'portraitUrl' => ''], 'permissions' => ['joinPerm' => 0, 'removePerm' => 0, 'memInvitePerm' => 0, 'invitePerm' => 0, 'profilePerm' => 0, 'memProfilePerm' => 0], 'groupExtProfile' => ['key' => 'value'] ]; $result = $RongSDK->getEntrust()->Group()->update($param); Utils::dump("Set group resources successfully", $result); } testGroupUpdate($RongSDK); /** * Exit the group */ function testGroupQuit($RongSDK) { $param = ['groupId' => 'CHIQ_GROUP_2']; $result = $RongSDK->getEntrust()->Group()->quit($param); Utils::dump("Failed to exit the group, missing required parameter userIds", $result); $param = [ 'groupId' => 'CHIQ_GROUP_2', 'userIds' => ['123', '456'], 'isDelBan' => 1, 'isDelWhite' => 1, 'isDelFollowed' => 1 ]; $result = $RongSDK->getEntrust()->Group()->quit($param); Utils::dump("Successfully exited the group", $result); } testGroupQuit($RongSDK); /** * Dissolve group */ function testGroupDismiss($RongSDK) { $param = [ 'groupId' => 'CHIQ_GROUP_2' ]; $result = $RongSDK->getEntrust()->Group()->dismiss($param); Utils::dump("Disband group success", $result); } testGroupDismiss($RongSDK); /** * Join the group */ function testGroupJoin($RongSDK) { $param = ['groupId' => 'CHIQ_GROUP_2']; $result = $RongSDK->getEntrust()->Group()->join($param); Utils::dump("Failed to join group, missing required parameter userIds", $result); $param = [ 'groupId' => 'CHIQ_GROUP_2', 'userIds' => ['123', '456'] ]; $result = $RongSDK->getEntrust()->Group()->join($param); Utils::dump("Group join successful", $result); } testGroupJoin($RongSDK); /** * Transfer group */ function testGroupTransferOwner($RongSDK) { $param = ['groupId' => 'CHIQ_GROUP_2']; $result = $RongSDK->getEntrust()->Group()->transferOwner($param); Utils::dump("Transfer group failed, missing required parameter newOwner", $result); $param = [ 'groupId' => 'CHIQ_GROUP_2', 'newOwner' => '123', 'isQuit' => 0, 'isDelBan' => 1, 'isDelWhite' => 1, 'isDelFollowed' => 1 ]; $result = $RongSDK->getEntrust()->Group()->transferOwner($param); Utils::dump("Group transfer successful", $result); } testGroupTransferOwner($RongSDK); /** * Group hosting import */ function testGroupImport($RongSDK) { $param = ['name' => 'RC_NAME_1']; $result = $RongSDK->getEntrust()->Group()->import($param); Utils::dump("Group hosting import failed, missing required parameter groupId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'name' => 'RC_NAME_1', 'owner' => 'RC_OWNER_1', 'groupProfile' => ['introduction' => 'i', 'announcement' => 'a', 'portraitUrl' => ''], 'permissions' => ['joinPerm' => 0, 'removePerm' => 0, 'memInvitePerm' => 0, 'invitePerm' => 0, 'profilePerm' => 0, 'memProfilePerm' => 0], 'groupExtProfile' => ['key' => 'value'] ]; $result = $RongSDK->getEntrust()->Group()->import($param); Utils::dump("Group hosting import successful", $result); } testGroupImport($RongSDK); /** * Pagination query application group information */ function testGroupQuery($RongSDK) { $param = [ 'pageToken' => '', 'size' => 50, 'order' => 1 ]; $result = $RongSDK->getEntrust()->Group()->query($param); Utils::dump("Pagination query application group information succeeded", $result); } testGroupQuery($RongSDK); /** * Query users added to a group by page */ function testGroupJoinedQuery($RongSDK) { $param = ['role' => 0]; $result = $RongSDK->getEntrust()->Group()->joinedQuery($param); Utils::dump("Failed to query the user's joined groups by page, missing required parameter userId", $result); $param = [ 'userId' => '10', 'role' => 0, 'pageToken' => 'xxxx', 'size' => 50, 'order' => 1 ]; $result = $RongSDK->getEntrust()->Group()->joinedQuery($param); Utils::dump("Pagination query for user-added groups successful", $result); } testGroupJoinedQuery($RongSDK); /** * Batch query group data */ function testGroupProfileQuery($RongSDK) { $param = []; $result = $RongSDK->getEntrust()->Group()->profileQuery($param); Utils::dump("Batch query group data failed, missing required parameter groupIds", $result); $param = [ 'groupIds' => ['RC_GROUP_1', 'CHIQ_GROUP_2'] ]; $result = $RongSDK->getEntrust()->Group()->profileQuery($param); Utils::dump("Batch query group data successful", $result); } testGroupProfileQuery($RongSDK); /** * Set group administrator (Add group administrator) */ function testGroupManagerAdd($RongSDK) { $param = []; $result = $RongSDK->getEntrust()->GroupManager()->add($param); Utils::dump("Failed to set group administrator (add group administrator), missing required parameter groupId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userIds' => ['C_U_1', 'C_U_2', 'C_U_3'] ]; $result = $RongSDK->getEntrust()->GroupManager()->add($param); Utils::dump("Set group administrator (add group administrator) successful", $result); } testGroupManagerAdd($RongSDK); /** * Remove group administrator */ function testGroupManagerRemove($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupManager()->remove($param); Utils::dump("Failed to remove group administrator, missing required parameter userIds", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userIds' => ['C_U_1', 'C_U_2', 'C_U_3'] ]; $result = $RongSDK->getEntrust()->GroupManager()->remove($param); Utils::dump("Remove group administrator successfully", $result); } testGroupManagerRemove($RongSDK); /** * Set member information */ function testGroupMemberSet($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->set($param); Utils::dump("Failed to set group member information, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222', 'nickname' => 'rongcloud', 'extra' => 'xxxxxx' ]; $result = $RongSDK->getEntrust()->GroupMember()->set($param); Utils::dump("Set group member information successfully", $result); } testGroupMemberSet($RongSDK); /** * Exit group */ function testGroupMemberKick($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->kick($param); Utils::dump("Failed to leave the group, missing required parameter userIds", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userIds' => ['123', '456'], 'isDelBan' => 1, 'isDelWhite' => 1, 'isDelFollowed' => 1 ]; $result = $RongSDK->getEntrust()->GroupMember()->kick($param); Utils::dump("Successfully kicked out of the group", $result); } testGroupMemberKick($RongSDK); /** * Specify the user to kick out all groups */ function testGroupMemberKickAll($RongSDK) { $param = []; $result = $RongSDK->getEntrust()->GroupMember()->kickAll($param); Utils::dump("Specifies that the user has failed to exit all groups, missing the required parameter userId", $result); $param = [ 'userId' => '111' ]; $result = $RongSDK->getEntrust()->GroupMember()->kickAll($param); Utils::dump("Specifies the user successfully exits all groups", $result); } testGroupMemberKickAll($RongSDK); /** * Set user-specified group special attention user */ function testGroupMemberFollow($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->follow($param); Utils::dump("Set user specified group special attention user failure, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222', 'followUserIds' => ['111', '222'] ]; $result = $RongSDK->getEntrust()->GroupMember()->follow($param); Utils::dump("Set user-specified group to particularly focus on successful users", $result); } testGroupMemberFollow($RongSDK); /** * Remove a specific user from the specified group's special attention list */ function testGroupMemberUnFollow($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->unFollow($param); Utils::dump("Failed to remove the specified user from the group, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222', 'followUserIds' => ['111', '222'] ]; $result = $RongSDK->getEntrust()->GroupMember()->unFollow($param); Utils::dump("Successfully delete the specified user from the group's special attention list", $result); } testGroupMemberUnFollow($RongSDK); /** * Query the list of members in the user-specified group with special attention */ function testGroupMemberGetFollowed($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->getFollowed($param); Utils::dump("Failed to query the list of members of the specified group that the user is particularly interested in, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222', ]; $result = $RongSDK->getEntrust()->GroupMember()->getFollowed($param); Utils::dump("Query the user-specified group's special attention member list successfully", $result); } testGroupMemberGetFollowed($RongSDK); /** * Retrieve member information by pagination */ function testGroupMemberQuery($RongSDK) { $param = []; $result = $RongSDK->getEntrust()->GroupMember()->query($param); Utils::dump("Failed to get group member information due to missing required parameter groupId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'type' => 0, 'pageToken' => '', 'size' => 50, 'order' => 1 ]; $result = $RongSDK->getEntrust()->GroupMember()->query($param); Utils::dump("Successfully retrieved group member information for pagination", $result); } testGroupMemberQuery($RongSDK); /** * Get specified member information */ function testGroupMemberSpecificQuery($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupMember()->specificQuery($param); Utils::dump("Failed to retrieve specified member information, missing required parameter userIds", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userIds' => ['111', '222'] ]; $result = $RongSDK->getEntrust()->GroupMember()->specificQuery($param); Utils::dump("Successfully obtained the specified group member information", $result); } testGroupMemberSpecificQuery($RongSDK); /** * Set the user-specified group name as the backup name */ function testGroupRemarkNameSet($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupRemarkName()->set($param); Utils::dump("Failed to set the user-specified group name remark, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222', 'remarkName' => 'rongcloud' ]; $result = $RongSDK->getEntrust()->GroupRemarkName()->set($param); Utils::dump("Set the user-specified group name annotation successfully", $result); } testGroupRemarkNameSet($RongSDK); /** * Set the user-specified group name annotation */ function testGroupRemarkNameDelete($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupRemarkName()->delete($param); Utils::dump("Failed to set the user-specified group name annotation, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222' ]; $result = $RongSDK->getEntrust()->GroupRemarkName()->delete($param); Utils::dump("Set the user-specified group name annotation successfully", $result); } testGroupRemarkNameDelete($RongSDK); /** * Query the specified group name annotation */ function testGroupRemarkNameQuery($RongSDK) { $param = ['groupId' => 'RC_GROUP_1']; $result = $RongSDK->getEntrust()->GroupRemarkName()->query($param); Utils::dump("Failed to query the user-specified group name remark, missing required parameter userId", $result); $param = [ 'groupId' => 'RC_GROUP_1', 'userId' => '222' ]; $result = $RongSDK->getEntrust()->GroupRemarkName()->query($param); Utils::dump("Query the user-specified group name backup note successfully", $result); } testGroupRemarkNameQuery($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestGroup.php
RongCloud/tests/TestGroup.php
<?php /** * Group module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET',''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY,APPSECRET); function testGroup($RongSDK){ $Group = $RongSDK->getGroup(); $params = [ 'id'=> 'ujadk90ha',// User ID 'groups'=>[['id'=> 'group9998', 'name'=> 'RongCloud']]// User group information ]; Utils::dump("Group information synchronized successfully",$Group->sync($params)); Utils::dump("Set the user's session push screen ID error",$Group->sync()); $params = [ 'id'=> 'watergroup1',// Group ID 'name'=> 'watergroup',// Group name 'members'=>[ // Member List ['id'=> 'group9991111113'] ] ]; Utils::dump("Create group success",$Group->create($params)); Utils::dump("Create group error",$Group->create()); $params = [ 'id'=> 'watergroup',// Group ID 'name'=>"watergroup",// Group Name 'member'=>['id'=> 'group999'],// Group member information ]; Utils::dump("Join group successfully",$Group->joins($params)); Utils::dump("Join group member error",$Group->joins()); $params = [ 'member'=>['id'=> 'group999'], ]; Utils::dump("Incorrect group ID",$Group->joins($params)); $params = [ 'id'=> 'watergroup',// Group ID 'member'=>['id'=> 'group999']// Exit personnel information ]; Utils::dump("Exit group successfully",$Group->quit($params)); Utils::dump("Invalid group ID",$Group->quit()); $params = [ 'id'=> 'watergroup',// Group ID 'member'=>['id'=> 'group999']// Exiting personnel information ]; Utils::dump("Group disbanded successfully",$Group->dismiss($params)); Utils::dump("Cluster ID error",$Group->dismiss()); $params = [ 'id'=> 'watergroup',// Group ID 'name'=>"watergroup"// group name ]; Utils::dump("Successfully modified group information",$Group->update($params)); $params = [ 'id'=> '',// Group ID 'name'=>"watergroup"// group name ]; Utils::dump("Modify group information ID error",$Group->update($params)); $params = [ 'id'=> 'watergroup',// Group ID 'name'=>""// group name ]; Utils::dump("Modify group information name error",$Group->update($params)); } testGroup($RongSDK); function testGroupGag($RongSDK){ $Group = $RongSDK->getGroup()->Gag(); $params = [ 'id'=> 'watergroup1',// Group ID 'members'=>[// Forbidden personnel list ['id'=> 'group9994'] ], 'minute'=>500 // Forbidden duration ]; Utils::dump("Add group mute success",$Group->add($params)); Utils::dump("@param Error in adding group ban word parameter",$Group->add()); $params = [ 'id'=> 'watergroup1', 'members'=>[ ['id'=> 'group9994'] ], 'minute'=>0 ]; Utils::dump("Add group ban minute error",$Group->add($params)); $params = [ 'id'=> 'watergroup1',// Group ID 'members'=>[// Forbidden personnel list ['id'=> 'group9994'] ] ]; Utils::dump("Successfully lifted the ban",$Group->remove($params)); Utils::dump("Remove forbidden parameter error",$Group->remove()); $params = [ 'id'=> 'watergroup1', 'members'=>[] ]; Utils::dump("Remove ban error for members",$Group->remove($params)); $params = [ 'id'=> 'watergroup1',// group id ]; Utils::dump("Query banned member list successfully",$Group->getList($params)); Utils::dump("Query forbidden member list parameter error",$Group->getList()); } testGroupGag($RongSDK); function testGroupMuteAllMembers($RongSDK){ $Group = $RongSDK->getGroup()->MuteAllMembers(); $params = [ 'id'=> 'watergroup1',// group id ]; Utils::dump("Add the specified group to the full ban list successfully",$Group->add($params)); Utils::dump("Add specified group-wide ban parameter error",$Group->add()); $params = [ 'id'=> 'watergroup1',// group id ]; Utils::dump("Unban all members of the specified group successfully",$Group->remove($params)); Utils::dump("Remove all ban parameters error for the specified group",$Group->remove()); $params = [ ]; Utils::dump("Query the complete list of banned words for the specified group successfully",$Group->getList($params)); } testGroupMuteAllMembers($RongSDK); function testGroupMuteWhiteList($RongSDK){ $Group = $RongSDK->getGroup()->MuteWhiteList(); $params = [ 'id'=> 'watergroup1',// Group ID 'members'=>[// Prohibited personnel list ['id'=> 'group9994'] ], ]; Utils::dump("Successfully added to group blocklist",$Group->add($params)); Utils::dump("Add group blocklist parameter error",$Group->add()); $params = [ 'id'=> 'watergroup1',// Group ID 'members'=>[// Forbidden personnel whitelist ['id'=> 'group9994'] ] ]; Utils::dump("Unblock the whitelist successfully",$Group->remove($params)); Utils::dump("Remove the error of the banned whitelist parameter",$Group->remove()); $params = [ 'id'=> 'watergroup1', 'members'=>[] ]; Utils::dump("Remove the ban whitelist members error",$Group->remove($params)); $params = [ 'id'=> 'watergroup1',// @param group id ]; Utils::dump("Query the forbidden word whitelist member list successfully",$Group->getList($params)); Utils::dump("Query forbidden whitelist member list parameter error @param error",$Group->getList()); } testGroupMuteWhiteList($RongSDK); function testGroupRemark($RongSDK){ $Group = $RongSDK->getGroup()->Remark(); $params = [ 'userId'=> 'ujadk90ha1',// @param personnel id 'groupId'=>'groupId',// Group ID 'remark'=> 'personRemark'// Group annotation ]; Utils::dump("Add group member successfully",$Group->set($params)); Utils::dump("Add group member parameter error",$Group->set()); $params = [ 'userId'=> 'ujadk90ha1',// Staff ID 'groupId'=>'groupId',// Group ID ]; Utils::dump("Remove group member backup success",$Group->del($params)); Utils::dump("Remove group member parameter error",$Group->del()); Utils::dump("Get group member backup success",$Group->get($params)); Utils::dump("Get group member parameter error",$Group->get()); } testGroupRemark($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestUser.php
RongCloud/tests/TestUser.php
<?php /** * User module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define("APPSECRET", ''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY, APPSECRET); /** * testUser * * @param RongCloud $RongSDK * @return void */ function testUser($RongSDK) { $portrait = " http://7xogjk.com1.z0.glb.clouddn.com/IuDkFprSQ1493563384017406982"; $User = $RongSDK->getUser(); $params = [ 'id' => 'ujadk90had', // User ID 'name' => 'test', // Username 'portrait' => $portrait // User avatar ]; Utils::dump("User registration successful", $User->register($params)); Utils::dump("User registration ID error", $User->register()); $params = [ 'id' => 'ujadk90had', 'name' => '', 'portrait' => $portrait ]; Utils::dump("User registration name error", $User->register($params)); $params = [ 'id' => 'ujadk90had', 'name' => Utils::createRand(66), 'portrait' => $portrait ]; Utils::dump("User registration name length error", $User->register($params)); $params = [ 'id' => 'ujadk90had', 'name' => '测试用户', 'portrait' => Utils::createRand(513) ]; Utils::dump("User registration portrait error", $User->register($params)); $params = [ 'id' => 'ujadk90had', 'name' => '新用户', 'portrait' => $portrait ]; Utils::dump("User update successful", $User->update($params)); Utils::dump("User update ID error", $User->update()); $params = [ 'id' => 'ujadk90had', 'name' => '', 'portrait' => $portrait ]; Utils::dump("User update name error", $User->update($params)); $params = [ 'id' => 'ujadk90had', 'name' => Utils::createRand(66), 'portrait' => $portrait ]; Utils::dump("User update name length error", $User->update($params)); $params = [ 'id' => 'ujadk90had', 'name' => '测试用户', 'portrait' => Utils::createRand(513) ]; Utils::dump("User update portrait error", $User->update($params)); $params = [ 'id' => 'ujadk90had', ]; Utils::dump("Successfully retrieved user information", $User->get($params)); $params = [ 'id' => '55vW81Mni', ]; Utils::dump("Query user's group membership success", $User->getGroups($params)); $params = [ 'id' => ['55vW81Mni','kkj9o02'], 'time' => 1623123911000 ]; Utils::dump("Token expired", $User->expire($params)); $params = [ 'id' => '55vW81Mni', ]; Utils::dump("Token invalid, failure time is a required parameter", $User->expire($params)); } testUser($RongSDK); function testUserBlock($RongSDK) { $User = $RongSDK->getUser()->Block(); $params = [ 'id' => 'ujadk90had', // User ID, unique identifier, maximum length of 30 characters 'minute' => 20 // Blocking duration 1 - 1 * 30 * 24 * 60 minutes ]; Utils::dump("User blocked successfully", $User->add($params)); Utils::dump("Add banned user ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', 'minute' => 0 ]; Utils::dump("Add banned user minute error", $User->add($params)); $params = [ 'id' => 'ujadk90ha1d', 'minute' => 1 * 30 * 24 * 60 * 2 ]; Utils::dump("Add a banned user with minute size error", $User->add($params)); $params = [ 'id' => 'ujadk90had', ]; Utils::dump("User unblocked successfully", $User->remove($params)); Utils::dump("Remove blocked user ID error", $User->remove()); Utils::dump("User ban successful", $User->getList()); } testUserBlock($RongSDK); function testUserBlacklist($RongSDK) { $User = $RongSDK->getUser()->Blacklist(); $params = [ 'id' => 'ujadk90ha1d', // User ID 'blacklist' => ['ujadk90ha1d'] // Add blacklist personnel list ]; Utils::dump("User blacklist added successfully", $User->add($params)); Utils::dump("User blacklist ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("User blacklist error", $User->add($params)); $params = [ 'id' => 'ujadk90ha1d', // User ID 'blacklist' => ['ujadk90ha1d'] // Add to blacklist personnel list ]; Utils::dump("User blacklist removed successfully", $User->add($params)); Utils::dump("Remove user blacklist ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("Remove user blacklist error", $User->add($params)); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("User blacklist retrieval successful", $User->getList($params)); Utils::dump("Error in obtaining user blacklist ID", $User->getList()); } testUserBlacklist($RongSDK); function testUserOnlinestatus($RongSDK) { $User = $RongSDK->getUser()->Onlinestatus(); $params = [ 'id' => 'ujadk90ha1d', // User ID ]; Utils::dump("User online status retrieved successfully", $User->check($params)); Utils::dump("User online status parameter error", $User->check()); } testUserOnlinestatus($RongSDK); function testUserMuteGroups($RongSDK) { $Group = $RongSDK->getUser()->MuteGroups(); $params = [ 'members' => [ // Forbidden personnel list ['id' => 'group9994'] ], 'minute' => 500 //Prohibition duration ]; Utils::dump("Group mute added successfully", $Group->add($params)); Utils::dump("Add group ban parameter error", $Group->add()); $params = [ 'members' => [ ['id' => 'group9994'] ], 'minute' => 0 ]; Utils::dump("Add group ban minute error", $Group->add($params)); $params = [ 'members' => [ // Forbidden personnel list ['id' => 'group9994'] ] ]; Utils::dump("Group mute lifted successfully", $Group->remove($params)); Utils::dump("Unblock group mute parameter error", $Group->remove()); $params = [ 'members' => [] ]; Utils::dump("Remove group ban error for members", $Group->remove($params)); $params = []; Utils::dump("Successfully queried the list of banned members in the group", $Group->getList($params)); } testUserMuteGroups($RongSDK); function testUserMuteChatrooms($RongSDK) { $Chatroom = $RongSDK->getUser()->MuteChatrooms(); $params = [ 'members' => [ ['id' => 'seal9901'] // Personnel ID ], 'minute' => 30 // Prohibited duration ]; Utils::dump("Add chat room global ban success", $Chatroom->add($params)); Utils::dump("Add chat room global ban parameter error", $Chatroom->add()); $params = [ 'members' => [ ['id' => 'seal9901'] // Personnel ID ], ]; Utils::dump("Successfully lifted the global ban in the chat room", $Chatroom->remove($params)); Utils::dump("Remove global chat ban error", $Chatroom->remove()); $params = []; Utils::dump("Successfully retrieved the global banned word list for the chat room", $Chatroom->getList($params)); } testUserMuteChatrooms($RongSDK); function testUserTag($RongSDK) { $Chatroom = $RongSDK->getUser()->Tag(); $params = [ 'userId' => 'ujadk90ha1', // User ID 'tags' => ['tag1', 'tag2'] // User label ]; Utils::dump("User tag added successfully", $Chatroom->set($params)); Utils::dump("Error in adding user tag parameter", $Chatroom->set()); $params = [ 'userIds' => ['ujadk90ha1', 'ujadk90ha2'], // User ID 'tags' => ['tag1', 'tag2'] // User label ]; Utils::dump("Batch adding user tags succeeded", $Chatroom->batchset($params)); Utils::dump("Batch add user tag parameter error", $Chatroom->batchset()); $params = [ 'userIds' => ['ujadk90ha1', 'ujadk90ha2'], // User ID ]; Utils::dump("Get user tag success", $Chatroom->get($params)); Utils::dump("Get user tag parameter error", $Chatroom->get()); } testUserTag($RongSDK); function testUserWhitelist($RongSDK) { $User = $RongSDK->getUser()->Whitelist(); $params = [ 'id' => 'ujadk90ha1d', // User ID 'whitelist' => ['ujadk90ha1d'] // Add blacklist personnel list ]; Utils::dump("User whitelist added successfully", $User->add($params)); Utils::dump("User whitelist ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("User whitelist error", $User->add($params)); $params = [ 'id' => 'ujadk90ha1d', // User ID 'whitelist' => ['ujadk90ha1d'] // Add blacklist personnel list ]; Utils::dump("Remove user whitelist successfully", $User->add($params)); Utils::dump("Remove user whitelist ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("Remove user whitelist error", $User->add($params)); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("User whitelist obtained successfully", $User->getList($params)); Utils::dump("User whitelist ID retrieval error", $User->getList()); } testUserWhitelist($RongSDK); function testChatBan($RongSDK) { $ban = $RongSDK->getUser()->Ban(); $params = [ 'id' => ['kkj9o01', 'kkj9o02'], //Banned user Id, supports batch setting, with a maximum of no more than 1000. 'state' => 1, //Forbidden state, 0: Remove forbidden. 1: Add forbidden. 'type' => 'PERSON', //conversation type, currently supports single conversation PERSON ]; Utils::dump("Set user single chat ban", $ban->set($params)); $params = [ 'state' => 1, 'type' => 'PERSON', ]; Utils::dump("Set user single chat ban error", $ban->set($params)); $param = [ 'num' => 101, //Get the number of rows, default is 100, maximum supported is 200. 'offset' => 0, //The starting position for the query, default is 0. 'type' => 'PERSON' // Currently supports single-person conversation type PERSON. ]; Utils::dump("Query single-chat banned user list", $ban->getList($param)); } testChatBan($RongSDK); function testUserRemark($RongSDK) { $remark = $RongSDK->getUser()->Remark(); $params = [ 'userId' => 'kkj9o01', 'remarks'=>json_encode([["id"=>"userid1","remark"=>"remark1"]]) ]; Utils::dump("Set user remarks", $remark->set($params)); $params = [ ]; Utils::dump("Set user backup note userId error", $remark->set($params)); $params = [ 'userId' => 'kkj9o01', 'targetId'=>"friendId" ]; Utils::dump("Delete user remarks", $remark->del($params)); $params = [ ]; Utils::dump("Delete user backup annotation userId error", $remark->del($params)); $params = [ 'userId' => 'kkj9o01', 'size'=>50, 'page'=>1 ]; Utils::dump("Get user annotation list", $remark->get($params)); $params = [ ]; Utils::dump("Get user annotation list userId error", $remark->get($params)); } testUserRemark($RongSDK); function testUserAbandon($RongSDK) { $User = $RongSDK->getUser(); $params = [ 'id' => 'kkj9o01', ]; Utils::dump("deactivate users", $User->abandon($params)); $params = [ ]; Utils::dump("Deactivate user ID error", $User->abandon($params)); $params = [ 'id' => 'kkj9o01', ]; Utils::dump("Deactivate user activation", $User->activate($params)); $params = [ ]; Utils::dump("Error in deactivated user activation ID", $User->activate($params)); $params = [ 'size'=>50, 'page'=>1 ]; Utils::dump("List of unsubscribed users", $User->abandonQuery($params)); } testUserAbandon($RongSDK); function testBlockPushPeriod($RongSDK) { $User = $RongSDK->getUser()->BlockPushPeriod(); $params = [ 'id' => 'ujadk90had', // User ID unique identifier, maximum length 30 characters 'startTime' => "23:59:59", //No interference start time 'period'=>'600', //Do not disturb duration: minutes 'level'=>1, //Do Not Disturb Level 1 only notifies for private chats and @ messages, including @ specified users and @ all messages. Does not receive notifications, even for @ messages. ]; Utils::dump("Add a do-not-disturb period", $User->add($params)); Utils::dump("Add do-not-disturb period ID error", $User->add()); $params = [ 'id' => 'ujadk90ha1d', ]; Utils::dump("Add error-free quiet period startTime", $User->add($params)); $params = [ 'id' => 'ujadk90had', ]; Utils::dump("Successfully removed the do-not-disturb period", $User->remove($params)); Utils::dump("Remove the no-disturb period ID error", $User->remove()); Utils::dump("Quiet hours acquisition succeeded", $User->getList($params)); } testBlockPushPeriod($RongSDK); /** * testProfile * * @param RongCloud $RongSDK * @return void */ function testProfile($RongSDK) { $User = $RongSDK->getUser()->Profile(); $params = [ 'userId' => 'ujadk90ha1', // User ID 'userProfile' => [ 'name' => 'testName', 'email' => 'tester@rongcloud.cn' ], //User basic information 'userExtProfile' => [ 'ext_Profile1' => 'testpro1' ] //User extension information ]; Utils::dump("User profile settings", $User->set($params)); $params = [ 'userId' => ['ujadk90ha1', 'ujadk90ha2'], // User ID ]; Utils::dump("User custody information clearance", $User->clean($params)); $params = [ 'userId' => ['ujadk90ha1', 'ujadk90ha2'], // User ID ]; Utils::dump("Batch query user information", $User->batchQuery($params)); $params = [ 'page' => 1, 'size' => 20, 'order' => 0 ]; Utils::dump("Retrieve the full list of users for the application", $User->query($params)); } testProfile($RongSDK); /** * Paginate to retrieve the full list of application users */ function query() { $RongSDK = new RongCloud(APPKEY, APPSECRET); $params = [ 'page' => 1, 'size' => 20, 'order' => 0 ]; $res = $RongSDK->getUser()->Profile()->query($params); Utils::dump("Get the full list of users by pagination", $res); }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestChatroom.php
RongCloud/tests/TestChatroom.php
<?php /** * Chat room module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET', ''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY, APPSECRET); function testChatroom($RongSDK) { $Chatroom = $RongSDK->getChatroom(); $params = [ ['id' => 'chatroom9992', 'name' => 'RongCloud'] ]; Utils::dump("Chat room created successfully", $Chatroom->create($params)); Utils::dump("Create chat room parameter error", $Chatroom->create()); $params = [ 'id' => 'watergroup1', ]; Utils::dump("Chat room successfully destroyed", $Chatroom->destory($params)); Utils::dump("Destroy chat room parameter error", $Chatroom->destory()); $params = [ 'id' => 'chatroom9992', 'count' => 10, 'order' => 2 ]; Utils::dump("Successfully retrieved chat room information", $Chatroom->get($params)); Utils::dump("Get chat room information parameter error", $Chatroom->get()); $params = [ 'id' => 'chatroom9992',// Chat room id 'members' => [ ['id' => "sea9902"]// @param personnel ID ] ]; Utils::dump("Check if the user has successfully joined the chat room", $Chatroom->isExist($params)); Utils::dump("Check if the user has a parameter error in the chat room", $Chatroom->isExist()); } testChatroom($RongSDK); function testChatroomBan($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Ban(); $params = [ 'members' => [ ['id' => 'seal9901']// Personnel ID ], 'minute' => 30// Forbidden duration ]; Utils::dump("Add global chat room ban success", $Chatroom->add($params)); Utils::dump("Add chat room global ban parameter error", $Chatroom->add()); $params = [ 'members' => [ ['id' => 'seal9901']// personnel id ], ]; Utils::dump("Global chat room ban lifted successfully", $Chatroom->remove($params)); Utils::dump("Unlock the global chat room mute error", $Chatroom->remove()); $params = [ ]; Utils::dump("Get the global banned words list of the chat room successfully", $Chatroom->getList($params)); } testChatroomBan($RongSDK); function testChatroomBlock($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Block(); $params = [ 'id' => 'watergroup1',// Group ID 'members' => [// Forbidden personnel list ['id' => 'group9994'] ], 'minute' => 500 // Forbidden duration ]; Utils::dump("Add block success", $Chatroom->add($params)); Utils::dump("Add ban parameter error", $Chatroom->add()); $params = [ 'id' => 'watergroup1', 'members' => [ ['id' => 'group9994'] ], 'minute' => 0 ]; Utils::dump("Add ban minute error", $Chatroom->add($params)); $params = [ 'id' => 'watergroup1',// Group ID 'members' => [// Banned personnel list ['id' => 'group9994'] ] ]; Utils::dump("Unblock successful", $Chatroom->remove($params)); Utils::dump("Unblock parameter error", $Chatroom->remove()); $params = [ 'id' => 'watergroup1', 'members' => [] ]; Utils::dump("Unblock members error", $Chatroom->remove($params)); $params = [ 'id' => 'watergroup1',// group id ]; Utils::dump("Query the list of banned members successfully", $Chatroom->getList($params)); Utils::dump("Query parameters error for the banned member list", $Chatroom->getList()); } testChatroomBlock($RongSDK); function testChatroomDemotion($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Demotion(); $params = [ 'msgs' => ['RC:TxtMsg03', 'RC:TxtMsg02']// Message type list ]; Utils::dump("Add application in-chat room downgrade message successfully", $Chatroom->add($params)); Utils::dump("@param error in downgrading in-app chat room message parameters", $Chatroom->add()); $params = [ 'msgs' => ['RC:TxtMsg03', 'RC:TxtMsg02']// Message type list ]; Utils::dump("Successfully downgraded the in-app chat room", $Chatroom->remove($params)); Utils::dump("Remove application internal chat room downgrade message parameter error", $Chatroom->remove()); Utils::dump("Get the success message for downgrading the in-app chat room", $Chatroom->getList()); } testChatroomDemotion($RongSDK); function testChatroomDistribute($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Distribute(); $params = [ 'id' => "Txtmsg03"// chatroom id ]; Utils::dump("Stop chat room message distribution success", $Chatroom->stop($params)); Utils::dump("Stop chat room message distribution parameter error", $Chatroom->stop()); $params = [ 'id' => "Txtmsg03"// chatroom id ]; Utils::dump("Restore chat room message distribution success", $Chatroom->resume($params)); Utils::dump("Restore chat room message distribution parameter error", $Chatroom->resume()); } testChatroomDistribute($RongSDK); function testChatroomGag($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Gag(); $params = [ 'id' => 'chatroom001',// Chat room id 'members' => [ ['id' => 'seal9901']// Forbidden personnel id ], 'minute' => 30// Forbidden speech duration ]; Utils::dump("Add chat room member ban success", $Chatroom->add($params)); Utils::dump("Add chat room member ban parameter error", $Chatroom->add()); $params = [ 'id' => 'ujadk90ha',// Chat room id 'members' => [ ['id' => 'seal9901']// Personnel ID ], ]; Utils::dump("Successfully lifted the chat room member's ban", $Chatroom->remove($params)); Utils::dump("Unban chat room member parameter error", $Chatroom->remove()); $params = [ 'id' => 'ujadk90ha',// chatroom id ]; Utils::dump("Get the list of banned words for chat room members successfully", $Chatroom->getList($params)); Utils::dump("Get the chat room member ban list parameter error", $Chatroom->getList()); } testChatroomGag($RongSDK); function testChatroomMuteAllMembers($RongSDK) { $Chatroom = $RongSDK->getChatroom()->MuteAllMembers(); $params = [ 'id' => 'chatroom001',//chatroom id ]; Utils::dump("Add group chat room mute all success", $Chatroom->add($params)); Utils::dump("Error in adding a global mute parameter for the chat room", $Chatroom->add()); $params = [ 'id' => 'ujadk90ha',// Chatroom ID ]; Utils::dump("Unmute all in the chat room successfully", $Chatroom->remove($params)); Utils::dump("Clear the global mute parameter error of the chat room", $Chatroom->remove()); Utils::dump("Check if the entire chat room is successfully muted", $Chatroom->check($params)); Utils::dump("Check the success parameter for the global mute error in the chat room", $Chatroom->check()); Utils::dump("Successfully obtained the complete mute list for the chat room", $Chatroom->getList(1,50)); } testChatroomMuteAllMembers($RongSDK); function testChatroomMuteWhiteList($RongSDK) { $Chatroom = $RongSDK->getChatroom()->MuteWhiteList(); $params = [ 'id' => 'chatroom001',// Chat room ID "members"=>[ ["id"=>"test1"] ] ]; Utils::dump("Successfully added to the chat room's global mute whitelist", $Chatroom->add($params)); Utils::dump("Add chat room global ban whitelist parameter error", $Chatroom->add()); Utils::dump("Remove the entire mute whitelist of the chat room successfully", $Chatroom->remove($params)); Utils::dump("Remove the chat room's global ban whitelist parameter error", $Chatroom->remove()); $params = [ 'id' => 'chatroom001',// chatroom id ]; Utils::dump("Successfully obtained the complete whitelist of chat room bans", $Chatroom->getList($params)); } testChatroomMuteWhiteList($RongSDK); function testChatroomKeepalive($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Keepalive(); $params = [ 'id' => 'chatroom001',// chatroom id ]; Utils::dump("Successfully added the chat room with livestream protection", $Chatroom->add($params)); Utils::dump("Add error for survival chat room parameters", $Chatroom->add()); $params = [ 'id' => 'ujadk90ha',// Chatroom ID /* Chatroom ID */ ]; Utils::dump("Delete chat room successfully", $Chatroom->remove($params)); Utils::dump("Delete the error in the parameter of the active chat room", $Chatroom->remove()); Utils::dump("Get the list of chat rooms successfully", $Chatroom->getList()); } testChatroomKeepalive($RongSDK); function testChatroomWhitelistUser($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Whitelist()->User(); $params = [ "id" => "seal9901",// Chat room ID "members" => [ ["id" => "user1"],// User ID ["id" => "user2"] ] ]; Utils::dump("Add chat room user whitelist successfully", $Chatroom->add($params)); Utils::dump("Add chat room user whitelist parameter error", $Chatroom->add()); $params = [ "id" => "seal9901",// Chat room ID "members" => [ ["id" => "user1"],// User ID ["id" => "user2"] ] ]; Utils::dump("Remove chat room user whitelist successfully", $Chatroom->remove($params)); Utils::dump("Remove chat room user whitelist parameter error", $Chatroom->remove()); $params = [ "id" => "seal9901",// chatroom id ]; Utils::dump("Get the chat room user whitelist successfully", $Chatroom->getList($params)); Utils::dump("Get chat room user whitelist parameter error", $Chatroom->getList()); } testChatroomWhitelistUser($RongSDK); function testChatroomWhitelistMessage($RongSDK) { $Chatroom = $RongSDK->getChatroom()->Whitelist()->Message(); $params = [ 'msgs' => ["RC:TxtMsg"]// Message Type List ]; Utils::dump("Add chat room message whitelist successfully", $Chatroom->add($params)); Utils::dump("Add chat room message whitelist parameter error", $Chatroom->add()); Utils::dump("Get the whitelist of chat room messages successfully", $Chatroom->getList()); $params = [ 'msgs' => ["RC:TxtMsg"]// Message type list ]; Utils::dump("Successfully removed chat room message whitelist", $Chatroom->remove($params)); Utils::dump("Remove chat room message whitelist parameter error", $Chatroom->remove()); } testChatroomWhitelistMessage($RongSDK); function testChatroomEntry($RongSDK) { $Chatroom = $RongSDK->getChatroom(); $params = [ ['id' => 'chatroom001', 'name' => 'RongCloud'] ]; $Chatroom->create($params); $Chatroom = $RongSDK->getChatroom()->Entry(); $params = [ 'id' => 'chatroom001',// Chat room ID 'userId' => 'userId01',// Operation User Id 'key' => 'key001',// Chat room attribute name 'value' => 'value001',// The value corresponding to the chat room attribute ]; Utils::dump("Set chat room property successfully", $Chatroom->set($params)); $params['key'] = 'key002'; $params['value'] = ['value002']; $Chatroom->set($params); $params['key'] = 'key003'; $params['value'] = ['value003']; $Chatroom->set($params); $params['key'] = 'key004'; $params['value'] = ['value004']; $Chatroom->set($params); $params = [ 'id' => 'chatroom001',// Chat room ID 'userId' => 'userId01',// Operation User Id 'key' => 'key005',// Chat room attribute name 'value' => 'value005',// Chat room attribute corresponding value 'autoDelete' => true,// Whether to delete this Key value after the user exits the chat room 'objectName' => 'RC:chrmKVNotiMsg',// Notification content 'content' => '{"type":1,"key":"name","value":"live streaming host","extra":""}',// Chat room attribute corresponding value ]; Utils::dump("Set chat room properties successfully (all parameters)", $Chatroom->set($params)); Utils::dump("Set chat room property parameter error @param error", $Chatroom->set()); $params = [ 'id' => 'chatroom001',// Chat room ID 'userId' => 'userId01',// Operation user ID 'key' => 'key001',// Chat room attribute name ]; Utils::dump("Delete chat room attribute success", $Chatroom->remove($params)); Utils::dump("Delete chat room attribute parameter error", $Chatroom->remove()); $params = [ 'id' => 'chatroom001',// chatroom id ]; Utils::dump("Get chat room properties (all)", $Chatroom->query($params)); $params = [ 'id' => 'chatroom001',// Chat room ID 'keys' => [ ['key' => 'key004'], ['key' => 'key005'] ] ]; Utils::dump("Get chatroom properties (partial)", $Chatroom->query($params)); } testChatroomEntry($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestPush.php
RongCloud/tests/TestPush.php
<?php /** * Push module test case */ require "./../RongCloud.php"; define("APPKEY", ''); define("APPSECRET", ''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY,APPSECRET); function testPush($RongSDK){ $Push = $RongSDK->getPush(); $params = [ 'platform'=> ['ios','android'],// Target operating system 'fromuserid'=>'mka091amn',// Sender User ID 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],// Message content 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']] ]; Utils::dump("Broadcast message succeeded",$Push->broadcast($params)); Utils::dump("Broadcast message parameter error",$Push->broadcast()); $params = [ 'platform'=> ['ios','android'],// Target operating system 'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all. 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']] ]; Utils::dump("Message pushed successfully",$Push->push($params)); Utils::dump("Push message parameter error",$Push->push()); } testPush($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/tests/TestSensitive.php
RongCloud/tests/TestSensitive.php
<?php /** * Test cases for sensitive word module */ require "./../RongCloud.php"; define("APPKEY", ''); define('APPSECRET',''); use RongCloud\RongCloud; use RongCloud\Lib\Utils; $RongSDK = new RongCloud(APPKEY,APPSECRET); function testSensitive($RongSDK){ $Sensitive = $RongSDK->getSensitive(); $params = [ 'replace'=> '***',// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word masking can be empty 'keyword'=>"abc",// Sensitive word 'type'=>0// 0: Sensitive word substitution 1: Sensitive word filtering ]; Utils::dump("Add sensitive word successfully",$Sensitive->add($params)); Utils::dump("Add sensitive keyword error",$Sensitive->add()); $params = [ 'words' => [ [ 'word' => "abc1",// Screen masking ], [ 'word' => "abc2",// Sensitive word 'replaceWord' => '***'// Sensitive word replacement, maximum length does not exceed 32 characters, sensitive word masking can be empty ] ] ]; Utils::dump("Batch addition of sensitive words successful",$Sensitive->batchAdd($params)); $params = [ 'keywords'=>["bbb"] ]; Utils::dump("Delete sensitive words successfully",$Sensitive->remove($params)); $params = [ 'keywords'=>[] ]; Utils::dump("Delete sensitive keywords error",$Sensitive->remove($params)); $params = [ 'type'=>0 ]; Utils::dump("Get sensitive word success",$Sensitive->getList($params)); } testSensitive($RongSDK);
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Request.php
RongCloud/Lib/Request.php
<?php /** * Request to send */ namespace RongCloud\Lib; use RongCloud\RongCloud; class Request { private $appKey = ''; private $appSecret = ''; /** * Server API interface address * Singapore domain: api.sg-light-api.com, api-b.sg-light-api.com * * @var array */ private $serverUrl = ['http://api.rong-api.com/', 'http://api-b.rong-api.com/']; // private $serverUrl = ['http://api.sg-light-api.com/', 'http://api-b.sg-light-api.com/']; // private $serverUrl = 'https://api-rce-rcxtest.rongcloud.net/'; private $smsUrl = 'http://api.sms.ronghub.com/'; private $connectTimeout = 20; private $timeout = 30; public function __construct() { if (RongCloud::$appkey) { $this->appKey = RongCloud::$appkey; } if (RongCloud::$appSecret) { $this->appSecret = RongCloud::$appSecret; } if (RongCloud::$connectTimeout) { $this->connectTimeout = RongCloud::$connectTimeout; } if (RongCloud::$timeout) { $this->timeout = RongCloud::$timeout; } if (RongCloud::$apiUrl) { $this->serverUrl = RongCloud::$apiUrl; } else { RongCloud::$apiUrl = $this->serverUrl; } $this->serverUrl = $this->resetServerUrl(); } /** * Server URL multi-domain switching */ private function resetServerUrl($nextUrl = "") { if (is_array(RongCloud::$apiUrl)) { $urlList = RongCloud::$apiUrl; sort($urlList); RongCloud::$apiUrl = $urlList; } if (is_array(RongCloud::$apiUrl) && count(RongCloud::$apiUrl) == 1) { return RongCloud::$apiUrl[0]; } if (is_string(RongCloud::$apiUrl)) { return RongCloud::$apiUrl; } if (RONGCLOUOD_DOMAIN_CHANGE != true) { return RongCloud::$apiUrl[0]; } ob_start(); $sessionId = "RongCloudServerSDKUrl"; $originalSessionStatus = session_status(); $originalSessionId = session_id(); if ($originalSessionStatus !== PHP_SESSION_ACTIVE) { @session_start(); session_write_close(); } if (!headers_sent()) { @session_id($sessionId); @session_start(); if (!isset($_SESSION['curl'])) { $_SESSION['curl'] = RongCloud::$apiUrl[0]; } if ($nextUrl) { $_SESSION['curl'] = $nextUrl; } $currentUrl = isset($_SESSION['curl']) ? $_SESSION['curl'] : RongCloud::$apiUrl[0]; session_write_close(); if ($originalSessionId) { @session_id($originalSessionId); if ($originalSessionStatus !== PHP_SESSION_ACTIVE) { @session_start(); } } else { if (session_status() === PHP_SESSION_ACTIVE) { session_destroy(); } } } else { $currentUrl = RongCloud::$apiUrl[0]; } ob_end_flush(); return $currentUrl; } /** * Set the next domain as the multi-domain * @param string $url */ private function getNextUrl($url = "") { $urlList = RongCloud::$apiUrl; if (is_array($urlList) && in_array($url, $urlList)) { $currentKey = array_search($url, $urlList); $nextUrl = isset($urlList[$currentKey + 1]) ? $urlList[$currentKey + 1] : $urlList[0]; $this->resetServerUrl($nextUrl); } return true; } /** * Create HTTP header parameters * @param array $data * @return bool */ private function createHttpHeader($request_id) { $nonce = mt_rand(); $timeStamp = time(); $sign = sha1($this->appSecret . $nonce . $timeStamp); return [ 'App-Key:' . $this->appKey, 'Nonce:' . $nonce, 'Timestamp:' . $timeStamp, 'Signature:' . $sign, 'X-Request-ID:' . $request_id ]; } /** * Send request * * @param Interface $action method * @param Request $params parameters * @param string $contentType Interface return data type, default json * @param string $module Interface request module, default im * @param string $httpMethod Interface request method, default POST * @return int|mixed */ public function Request($action, $params, $contentType = 'urlencoded', $module = 'im', $httpMethod = 'POST') { switch ($module) { case 'im': $action = $this->serverUrl . $action; break; case 'sms': $action = $this->smsUrl . $action; break; default: $action = $this->serverUrl . $action; } $guid = $this->create_guid(); $httpHeader = $this->createHttpHeader($guid); $ch = curl_init(); if ($contentType == "urlencoded" || $contentType == "json") { $action .= ".json"; } else { $action .= ".xml"; } if ($httpMethod == 'POST' && $contentType == 'urlencoded') { $httpHeader[] = 'Content-Type:application/x-www-form-urlencoded'; curl_setopt($ch, CURLOPT_POSTFIELDS, $this->build_query($params)); } if ($httpMethod == 'POST' && $contentType == 'json') { $httpHeader[] = 'Content-Type:application/json'; curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); } if ($httpMethod == 'GET' && $contentType == 'urlencoded') { $action .= strpos($action, '?') === false ? '?' : '&'; $action .= $this->build_query($params); } curl_setopt($ch, CURLOPT_URL, $action); curl_setopt($ch, CURLOPT_POST, $httpMethod == 'POST'); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Handle HTTP certificate issues curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_USERAGENT, "rc-php-sdk/3.4.1"); // curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $ret = curl_exec($ch); if (false === $ret) { $ret = curl_errno($ch); $ret = $this->getCurlError($ret); } $httpInfo = curl_getinfo($ch); curl_close($ch); $result = json_decode($ret, true); if (isset($result['code']) && $result['code'] == 1000) { } if ($module == "im") { if (is_null($result)) { $this->getNextUrl($this->serverUrl); } else { if ($httpInfo['http_code'] >= 500 && $httpInfo['http_code'] < 600) { $this->getNextUrl($this->serverUrl); } elseif (in_array($httpInfo['http_code'], [0, 7, 28])) { $this->getNextUrl($this->serverUrl); } } } if (is_null($result)) { return $ret . ',requestId:' . $guid; } else { $result['requestId'] = $guid; return json_encode($result, JSON_UNESCAPED_UNICODE); } } /** * Get parameters from POST (x-www-form-urlencoded)/GET request * * @param Request $params parameters * @return bool|string */ public function getQueryFields($params) { return $this->build_query($params); } /** * Generate parameter body * * @param $formData * @param string $numericPrefix * @param string $argSeparator * @param string $prefixKey * @return bool|string */ private function build_query($formData, $numericPrefix = '', $argSeparator = '&', $prefixKey = '') { $str = ''; foreach ($formData as $key => $val) { if (!is_array($val)) { $str .= $argSeparator; if ($prefixKey === '') { if (is_int($key)) { $str .= $numericPrefix; } $str .= urlencode($key) . '=' . urlencode($val); } else { $str .= urlencode($prefixKey) . '=' . urlencode($val); } } else { if ($prefixKey == '') { $prefixKey .= $key; } if (isset($val[0]) && is_array($val[0])) { $arr = array(); $arr[$key] = $val[0]; $str .= $argSeparator . http_build_query($arr); } else { $str .= $argSeparator . $this->build_query($val, $numericPrefix, $argSeparator, $prefixKey); } $prefixKey = ''; } } return substr($str, strlen($argSeparator)); } private function create_guid() { $charid = strtoupper(md5(uniqid(mt_rand(), true))); $uuid = substr($charid, 0, 8) . substr($charid, 8, 4) . substr($charid, 12, 4) . substr($charid, 16, 4) . substr($charid, 20, 12); return strtolower($uuid); } /** * cURL request error information * @param int $error */ public function getCurlError($error = 1) { $errorCodes = array( 1 => 'CURLE_UNSUPPORTED_PROTOCOL', 2 => 'CURLE_FAILED_INIT', 3 => 'CURLE_URL_MALFORMAT', 4 => 'CURLE_URL_MALFORMAT_USER', 5 => 'CURLE_COULDNT_RESOLVE_PROXY', 6 => 'CURLE_COULDNT_RESOLVE_HOST', 7 => 'CURLE_COULDNT_CONNECT', 8 => 'CURLE_FTP_WEIRD_SERVER_REPLY', 9 => 'CURLE_REMOTE_ACCESS_DENIED', 11 => 'CURLE_FTP_WEIRD_PASS_REPLY', 13 => 'CURLE_FTP_WEIRD_PASV_REPLY', 14 => 'CURLE_FTP_WEIRD_227_FORMAT', 15 => 'CURLE_FTP_CANT_GET_HOST', 17 => 'CURLE_FTP_COULDNT_SET_TYPE', 18 => 'CURLE_PARTIAL_FILE', 19 => 'CURLE_FTP_COULDNT_RETR_FILE', 21 => 'CURLE_QUOTE_ERROR', 22 => 'CURLE_HTTP_RETURNED_ERROR', 23 => 'CURLE_WRITE_ERROR', 25 => 'CURLE_UPLOAD_FAILED', 26 => 'CURLE_READ_ERROR', 27 => 'CURLE_OUT_OF_MEMORY', 28 => 'CURLE_OPERATION_TIMEDOUT', 30 => 'CURLE_FTP_PORT_FAILED', 31 => 'CURLE_FTP_COULDNT_USE_REST', 33 => 'CURLE_RANGE_ERROR', 34 => 'CURLE_HTTP_POST_ERROR', 35 => 'CURLE_SSL_CONNECT_ERROR', 36 => 'CURLE_BAD_DOWNLOAD_RESUME', 37 => 'CURLE_FILE_COULDNT_READ_FILE', 38 => 'CURLE_LDAP_CANNOT_BIND', 39 => 'CURLE_LDAP_SEARCH_FAILED', 41 => 'CURLE_FUNCTION_NOT_FOUND', 42 => 'CURLE_ABORTED_BY_CALLBACK', 43 => 'CURLE_BAD_FUNCTION_ARGUMENT', 45 => 'CURLE_INTERFACE_FAILED', 47 => 'CURLE_TOO_MANY_REDIRECTS', 48 => 'CURLE_UNKNOWN_TELNET_OPTION', 49 => 'CURLE_TELNET_OPTION_SYNTAX', 51 => 'CURLE_PEER_FAILED_VERIFICATION', 52 => 'CURLE_GOT_NOTHING', 53 => 'CURLE_SSL_ENGINE_NOTFOUND', 54 => 'CURLE_SSL_ENGINE_SETFAILED', 55 => 'CURLE_SEND_ERROR', 56 => 'CURLE_RECV_ERROR', 58 => 'CURLE_SSL_CERTPROBLEM', 59 => 'CURLE_SSL_CIPHER', 60 => 'CURLE_SSL_CACERT', 61 => 'CURLE_BAD_CONTENT_ENCODING', 62 => 'CURLE_LDAP_INVALID_URL', 63 => 'CURLE_FILESIZE_EXCEEDED', 64 => 'CURLE_USE_SSL_FAILED', 65 => 'CURLE_SEND_FAIL_REWIND', 66 => 'CURLE_SSL_ENGINE_INITFAILED', 67 => 'CURLE_LOGIN_DENIED', 68 => 'CURLE_TFTP_NOTFOUND', 69 => 'CURLE_TFTP_PERM', 70 => 'CURLE_REMOTE_DISK_FULL', 71 => 'CURLE_TFTP_ILLEGAL', 72 => 'CURLE_TFTP_UNKNOWNID', 73 => 'CURLE_REMOTE_FILE_EXISTS', 74 => 'CURLE_TFTP_NOSUCHUSER', 75 => 'CURLE_CONV_FAILED', 76 => 'CURLE_CONV_REQD', 77 => 'CURLE_SSL_CACERT_BADFILE', 78 => 'CURLE_REMOTE_FILE_NOT_FOUND', 79 => 'CURLE_SSH', 80 => 'CURLE_SSL_SHUTDOWN_FAILED', 81 => 'CURLE_AGAIN', 82 => 'CURLE_SSL_CRL_BADFILE', 83 => 'CURLE_SSL_ISSUER_ERROR', 84 => 'CURLE_FTP_PRET_FAILED', 84 => 'CURLE_FTP_PRET_FAILED', 85 => 'CURLE_RTSP_CSEQ_ERROR', 86 => 'CURLE_RTSP_SESSION_ERROR', 87 => 'CURLE_FTP_BAD_FILE_LIST', 88 => 'CURLE_CHUNK_FAILED' ); if (isset($errorCodes[$error])) { return $errorCodes[$error]; } else { return "CURLE_UNKNOW_ERROR"; } } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/ConversationType.php
RongCloud/Lib/ConversationType.php
<?php /** * conversation type */ namespace RongCloud\Lib; class ConversationType{ static function t(){ return $Conversation = [ 'PRIVATE'=> 1, 'DISCUSSION'=> 2, 'GROUP'=> 3, 'CHATROOM'=>4, 'CUSTOMER_SERVICE'=> 5, 'SYSTEM'=> 6, 'APP_PUBLIC'=> 7, 'PUBLIC'=> 8, 'ULTRAGROUP'=> 10 ]; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Utils.php
RongCloud/Lib/Utils.php
<?php /** * Tool Class */ namespace RongCloud\Lib; class Utils { /** * Whether the digital length matches * @param $params * @return bool */ public function isLength($params) { $val = $params['val']; $min = isset($params['min']) ? $params['min'] : 0; $len = !is_array($val) ? strlen($val) : count($val); $max = isset($params['max']) ? $params['max'] : 0; $isLen = false; if ($len < $min || $len > $max) { $isLen = true; } return $isLen; } /** * Rename * @param $obj * @param array $array * @return mixed */ public function rename($obj, $array = []) { foreach ($array as $key => $v) { if (isset($obj[$key])) { $obj[$v] = isset($obj[$key]) ? $obj[$key] : ""; unset($obj[$key]); } } return $obj; } /** * Template replacement * @param $temp * @param $data * @return mixed */ public function tplEngine($temp, $data) { foreach ($data as $k => $v) { $v = is_array($v) || is_object($v) ? "object" : $v; $temp = str_replace("{{{$k}}}", $v, $temp); } return $temp; } /** * Get error information * @param $params * @return array|mixed */ public function getError($params) { $code = $params['code']; $errorInfo = []; if (is_array($code)) { $errorInfo = $this->rename($code, ['errorMessage' => 'msg']); $code = $errorInfo['code']; } $errors = $params['errors']; $info = isset($params['info']) ? $params['info'] : []; $error = isset($errors[$code]) ? $errors[$code] : []; if (!$error) { $error = $errorInfo; } if (isset($error['msg'])) { $error['msg'] = $code ? $this->tplEngine($error['msg'], $info) : $errorInfo['msg']; } return $error; } /** * Parameter length validation * @param $params * @return array|mixed|null */ public function checkLength($params) { $proto = $params['proto']; $verify = ($params['verify'][$proto]['length']); $val = $params['val']; $errors = $params['response']; $isLen = $this->isLength([ 'max' => $verify['max'], 'min' => $verify['min'], 'val' => $val ]); $error = null; if ($isLen) { $error = $this->getError([ 'code' => $verify['invalid'], 'errors' => $errors, 'info' => [ 'name' => $proto, 'max' => $verify['max'], 'min' => $verify['min'], 'len' => substr($val, 0, $verify['max']) ] ]); } return $error; } /** * Parameter type validation * @param $params * @return array|int|mixed */ public function checkTypeof($params) { $error = 0; $proto = $params['proto']; $verify = ($params['verify'][$proto]['typeof']); $val = $params['val']; $errors = $params['response']; $isFalse = 0; if ($verify['type'] == "array" && !is_array($val)) { $isFalse = 1; } if ($verify['type'] == "number" && !is_numeric($val)) { $isFalse = 1; } if ($isFalse) { $error = $this->getError([ 'code' => $verify['invalid'], 'errors' => $errors, 'info' => [ 'currentType' => gettype($val), 'name' => $proto, 'type' => $verify['type'] ] ]); } return $error; } /** * Parameter validation * @param $params * @return null */ public function check($params) { $error = null; $model = $params['model']; $api = $params['api']; $errors = $api['response']['fail']; if (isset($params['fail']) && !empty($params['fail'])) { $errors = $params['fail']; } $dataModel = $api['params'][$model]; $data = isset($params['data']) ? $params['data'] : []; $verify = $params['verify']; $checkMap = [ 'length' => 'checkLength', 'require' => 'checkRequire', 'typeof' => 'checkTypeof', 'size' => 'checkSize' ]; $isBreak = false; foreach ($dataModel as $proto => $val) { if ($isBreak) { break; } $protoVerify = isset($verify[$proto]) ? $verify[$proto] : ""; if ($protoVerify) { foreach ($protoVerify as $rule => $ruleVal) { $fun = $checkMap[$rule]; $error = $this->$fun([ 'verify' => $verify, 'proto' => $proto, 'val' => isset($data[$proto]) ? $data[$proto] : "", 'response' => $errors ]); if ($error) { // var_dump($errors, $fun, $verify, $data, $proto); $isBreak = true; break; } } } } return $error; } /** * Parameter size validation * @param $params * @return array|mixed|null */ function checkSize($params) { $error = null; $proto = $params['proto']; $verify = $params['verify'][$proto]['size']; $size = $params['val']; if (is_array($params['val'])) { $size = count($params['val']); } if (is_string($params['val'])) { $size = strlen($params['val']); } $errors = $params['response']; $isIllegal = ($size < $verify['min'] || $size > $verify['max']); if ($isIllegal) { $error = $this->getError([ 'code' => $verify['invalid'], 'errors' => $errors, 'info' => [ 'size' => $size ] ]); } return $error; } /** * Required parameter validation * @param $params * @return array|mixed|null */ function checkRequire($params) { $error = null; $proto = $params['proto']; $verify = $params['verify'][$proto]['require']; $errors = $params['response']; $isIllegal = empty($params['val']) ? 1 : 0; if (is_array($params['val'])) { $isIllegal = empty($params['val']) ? 1 : 0; } else { $isIllegal = trim($params['val']) == '' ? 1 : 0; } if ($isIllegal) { $error = $this->getError([ 'code' => $verify['invalid'], 'errors' => $errors, 'info' => [ 'name' => $proto ] ]); } return $error; } /** * JSON data retrieval * @param string $path * @return mixed */ public static function getJson($path = "") { $files = file_get_contents(RONGCLOUOD_ROOT . $path); return json_decode($files, true); } /** * Variable-friendly print output * @param variable $param Variable parameter * @example dump($a,$b,$c,$e,[.1]) Supports multiple variables, uses English comma separation, default mode print_r, view data type passed as .1 * @version php>=5.6 * @return void */ public static function dump() { $param = func_get_args(); echo '<style>.php-print{background:#eee;padding:10px;border-radius:4px;border:1px solid #ccc;line-height:1.5;white-space:pre-wrap;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px;}</style>' . PHP_EOL, '<pre class="php-print">'; if (end($param) === .1) { array_splice($param, -1, 1); foreach ($param as $k => $v) { echo $k > 0 ? '<hr>' : ''; ob_start(); Utils::dump($v); echo preg_replace('/]=>\s+/', '] => <label>', ob_get_clean()); } } else { foreach ($param as $k => $v) { echo $k > 0 ? '<hr>' : '', print_r($v, true); } } echo '</pre>' . PHP_EOL; } /** * Error information reset * * @param array $result Result information * @param array $failList Error information list * @return array */ public function responseError($result = array(), $failList = array(), $bodyParameter = '') { if (!is_array($result)) { $result = json_decode($result, true); } if ($bodyParameter != '') { $result['bodyParameter'] = $bodyParameter; } if (isset($result['code']) && $result['code'] != 200) { unset($result['url']); if ($result['code'] == 1002) { unset($failList[1002]); } $result['code'] = $result; $result['errors'] = $failList; $result = $this->getError($result); return $result; } else { return $result; } } /** * Generate a random string of specified length * @param int $len * @return string */ public static function createRand($len = 6) { $string = 'abcdefghijklmnopqrstuvwxyz0123456789'; $result = ''; $string = str_shuffle($string); for ($i = 0; $i < $len; $i++) { $result .= $string[mt_rand(0, strlen($string) - 1)]; } return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Group/Group.php
RongCloud/Lib/Group/Group.php
<?php /** * Group module * @author hejinyu */ namespace RongCloud\Lib\Group; use RongCloud\Lib\Group\Gag\Gag; use RongCloud\Lib\Group\MuteAllMembers\MuteAllMembers; use RongCloud\Lib\Group\MuteWhiteList\MuteWhiteList; use RongCloud\Lib\Group\Remark\Remark; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Group { /** * Group module path * * @var string */ private $jsonPath = 'Lib/Group/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Validation configuration file * * @var string */ private $verify = ''; /** * Conversation constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'verify.json'); } /** * Synchronize group information * * @param array $Group Synchronized group information parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',//User ID * 'groups'=>[['id'=> 'group9998', 'name'=> 'RongCloud']]//User group information * ]; * @return array */ public function sync(array $Group=[]){ $conf = $this->conf['sync']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $Group, 'verify'=> $this->verify['user'] ]); if($error) return $error; $data = []; // $data['group'] = array_column($Group['groups'], 'name', 'id'); foreach ($Group['groups'] as $v){ $data["group[{$v['id']}]"] = $v['name']; } $data['userId'] = $Group['id']; $result = (new Request())->Request($conf['url'],$data); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Create Group * * @param array $Group Parameters for creating a group * @param * $Group = [ * 'id'=> 'watergroup1',// Group ID * 'name'=> 'watergroup',// Group name * 'members'=>[ // List of group members * ['id'=> 'group9991111113'] * ] * ]; * @return array */ public function create(array $Group=[]){ $conf = $this->conf['create']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $this->verify['group'] ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'name'=> 'groupName', 'members'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Join a group * * @param array $Group Parameters for joining a group * @param * $Group = [ * 'id'=> 'watergroup',// Group ID * 'name'=>"watergroup",// Group name * 'member'=>['id'=> 'group999'],// Group member information * ]; * @return array */ public function joins(array $Group=[]){ $conf = $this->conf['join']; $verify = $this->verify['group']; unset($verify['memberIds'],$verify['name']); $verify = array_merge($verify,$this->verify['member']); $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:""; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'name'=> 'groupName', 'member'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Exit group * * @param array $Group Exit group parameter * @param * $Group = [ * 'id'=> 'watergroup',// Group id * 'member'=>['id'=> 'group999'],// Group member information * ]; * @return array */ public function quit(array $Group=[]){ $conf = $this->conf['quit']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $verify = array_merge($verify,$this->verify['member']); $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:""; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'member'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Disband group * * @param array $Group Disband group parameter * @param * $Group = [ * 'id'=> 'watergroup',//Group ID * 'member'=>['id'=> 'group999'],//Administrator information * ]; * @return array */ public function dismiss(array $Group=[]){ $conf = $this->conf['dismiss']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:""; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'member'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Modify group information * * @param array $Group Modify group information parameter * @param * $Group = [ * 'id'=> 'watergroup',//group id * 'name'=>"watergroup"//group name * ]; * @return array */ public function update(array $Group=[]){ $conf = $this->conf['update']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'],'name'=>$verify['name']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'name'=> 'groupName', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get group information * * @param array $Group Get group information parameter * @param * $Group = [ * 'id'=> 'watergroup',//group id * ]; * @return array */ public function get(array $Group=[]){ $conf = $this->conf['get']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); if($result['code'] == 200) { $result = (new Utils())->rename($result, [ 'users'=> 'members', ]); } return $result; } /** * Create a group gag object * * @return Gag */ public function Gag(){ return new Gag(); } /** * Create a full member mute for the specified group * * @return MuteAllMembers */ public function MuteAllMembers(){ return new MuteAllMembers(); } /** * Create a mute whitelist for all members of the specified group * * @return MuteWhiteList */ public function MuteWhiteList(){ return new MuteWhiteList(); } /** * Group member remark * * @return Remark */ public function Remark(){ return new Remark(); } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Group/Remark/Remark.php
RongCloud/Lib/Group/Remark/Remark.php
<?php /** * Group annotation */ namespace RongCloud\Lib\Group\Remark; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Remark { /** * Group module group backup * * @var string */ private $jsonPath = 'Lib/Group/Remark/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add group remark * * @param array $User * @param * $User = [ * 'userId'=> 'userId',//User ID * 'groupId'=> 'groupId',//Group ID * 'remark'=> 'Remark'//Group remark * ]; * @return array */ public function set(array $Group=[]){ $conf = $this->conf['set']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Delete group remark * * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1',//User ID * 'groupId'=> 'targetUserid'//Group ID * ]; * @return array */ public function del(array $Group=[]){ $conf = $this->conf['del']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get group annotation * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1',//User ID * 'groupId'=> 'groupId'//Group ID * ]; * @return array * @return array */ public function get(array $Group=[]){ $conf = $this->conf['get']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Group/MuteAllMembers/MuteAllMembers.php
RongCloud/Lib/Group/MuteAllMembers/MuteAllMembers.php
<?php /** * Specify the group-wide member ban * @author hejinyu */ namespace RongCloud\Lib\Group\MuteAllMembers; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class MuteAllMembers { /** * Group module path * * @var string */ private $jsonPath = 'Lib/Group/MuteAllMembers/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Validate configuration file * * @var string */ private $verify = ''; /** * Conversation constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add group ban * * @param array $Group Parameters for adding group ban * @param * $Group = [ * 'id'=> 'ujadk90ha',//group id * ]; * @return array */ public function add(array $Group=[]){ $conf = $this->conf['add']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unblock users * * @param array $Group Unblock users parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',// Group ID * 'members'=>[// List of users to unblock * ['id'=> 'ujadk90ha'] * ] * ]; * @return array */ public function remove(array $Group=[]){ $conf = $this->conf['remove']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Query the list of banned members * * @param array $Group Unban parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',//group id * ]; * @return array */ public function getList(array $Group=[]){ $conf = $this->conf['getList']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Group/MuteWhiteList/MuteWhiteList.php
RongCloud/Lib/Group/MuteWhiteList/MuteWhiteList.php
<?php /** * Group blacklist * @author hejinyu */ namespace RongCloud\Lib\Group\MuteWhiteList; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class MuteWhiteList { /** * Group module path * * @var string */ private $jsonPath = 'Lib/Group/MuteWhiteList/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Validation configuration file * * @var string */ private $verify = ''; /** * Conversation constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add group ban whitelist * * @param array $Group Add group ban whitelist parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',// Group ID * 'members'=>[// Ban list * ['id'=> 'ujadk90ha'] * ] * ]; * @return array */ public function add(array $Group=[]){ $conf = $this->conf['add']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $verify = array_merge($verify , ['minute'=>$verify['minute']]); $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unblock users from the mute list * * @param array $Group Parameters for unblocking users from the mute list * @param * $Group = [ * 'id'=> 'ujadk90ha',// Group ID * 'members'=>[// List of users to unblock * ['id'=> 'ujadk90ha'] * ] * ]; * @return array */ public function remove(array $Group=[]){ $conf = $this->conf['remove']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Query the list of members in the banned words whitelist * * @param array $Group Parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',//group id * ]; * @return array */ public function getList(array $Group=[]){ $conf = $this->conf['getList']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); if($result['code'] == 200){ $result = (new Utils())->rename($result,['users'=>'members']); } return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Group/Gag/Gag.php
RongCloud/Lib/Group/Gag/Gag.php
<?php /** * Group Mute * @author hejinyu */ namespace RongCloud\Lib\Group\Gag; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Gag { /** * Group module path * * @var string */ private $jsonPath = 'Lib/Group/Gag/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for verification * * @var string */ private $verify = ''; /** * Conversation constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add group mute * * @param array $Group Add group mute parameters * @param * $Group = [ * 'id'=> 'ujadk90ha',//Group ID * 'members'=>[ //Muted members list * ['id'=> 'ujadk90ha'] * ] * , * 'minute'=>50 // Mute duration in minutes * ]; * @return array */ public function add(array $Group=[]){ $conf = $this->conf['add']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $verify = array_merge($verify , ['minute'=>$this->verify['minute']]); $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unblock * * @param array $Group Unblock parameter * @param * $Group = [ * 'id'=> 'ujadk90ha',// Group id * 'members'=>[// Unblock members list * ['id'=> 'ujadk90ha'] * ] * ]; * @return array */ public function remove(array $Group=[]){ $conf = $this->conf['remove']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id'], 'members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Query the list of banned members * * @param array $Group Parameters for unbanning * @param * $Group = [ * 'id'=> 'ujadk90ha',//group id * ]; * @return array */ public function getList(array $Group=[]){ $conf = $this->conf['getList']; $verify = $this->verify['group']; $verify = ['id'=>$verify['id']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; $Group = (new Utils())->rename($Group, [ 'id'=> 'groupId', ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); if($result['code'] == 200){ $result = (new Utils())->rename($result,['users'=>'members']); foreach ($result['members']?:[] as $k=>&$v){ $v = (new Utils())->rename($v,['userId'=>'id']); } } return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Push/Push.php
RongCloud/Lib/Push/Push.php
<?php /** * Push module * conversation=> hejinyu */ namespace RongCloud\Lib\Push; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Push { /** * Push module path * * @var string */ private $jsonPath = 'Lib/Push/'; /** * Request configuration file * * @var string * */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * Push constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'verify.json'); } /** * Broadcast Message * * @param array $Push Push parameters * @param * $Push = [ * 'platform'=> ['ios','android'],//Target operating systems * 'fromuserid'=>'mka091amn',//Sender user ID * 'audience'=>['is_to_all'=>true],//Push conditions, including: tag, userid, is_to_all. * 'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],//Message content to be sent * 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']]//Push display * ]; * @return array */ public function broadcast(array $Push=[]){ $conf = $this->conf['broadcast']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'broadcast', 'data'=> $Push, 'verify'=> $this->verify['broadcast'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$Push,'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * push * * @param Push $Push parameter * @param * $Push = [ * 'platform'=> ['ios','android'],//Target operating systems * 'audience'=>['is_to_all'=>true],//Push conditions, including: tag, userid, is_to_all. * 'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']]//Push display * ]; * @return array */ public function push(array $Push=[]){ $conf = $this->conf['push']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'broadcast', 'data'=> $Push, 'verify'=> $this->verify['push'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$Push,'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/User.php
RongCloud/Lib/User/User.php
<?php /** * User Module * User=> hejinyu * Date=> 2018/7/23 * Time=> 11=>41 */ namespace RongCloud\Lib\User; use RongCloud\Lib\User\Tag\Tag; use RongCloud\Lib\User\Block\Block; use RongCloud\Lib\User\Blacklist\Blacklist; use RongCloud\Lib\User\Whitelist\Whitelist; use RongCloud\Lib\User\MuteGroups\MuteGroups; use RongCloud\Lib\User\Onlinestatus\Onlinestatus; use RongCloud\Lib\User\MuteChatrooms\MuteChatrooms; use RongCloud\Lib\User\Chat\Ban; use RongCloud\Lib\User\Remark\Remark; use RongCloud\Lib\User\BlockPushPeriod\BlockPushPeriod; use RongCloud\Lib\User\Profile\Profile; use RongCloud\Lib\Utils; use RongCloud\Lib\Request; class User { /** * User module path * * @var string */ private $jsonPath = 'Lib/User/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verification configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . 'verify.json'); } /** * @param array $User User registration * @param * $User = [ * 'id'=> 'ujadk90ha', // User ID * 'name'=> 'Maritn', // User name * 'portrait'=> 'http://7xogjk.com1.z0.glb.clouddn.com/IuDkFprSQ1493563384017406982' // User avatar * ]; * @return array */ public function register(array $User = []) { $conf = $this->conf['register']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', 'portrait' => 'portraitUri' ]); $result = (new Request())->Request($conf['url'], $User); $bodyParameter = (new Request())->getQueryFields($User); $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); return $result; } /** * Token invalidation * * @param array $User User information * @param * $User = [ * 'id'=> ['ujadk90ha1'], // User IDs that need to have their tokens invalidated, supports setting up to 20 IDs. * 'time'=> 1623123911000 // Expiration timestamp accurate to milliseconds, all tokens obtained by the user before this timestamp will be invalidated. Tokens in use by connected users before this timestamp will not be immediately invalidated, but will be unable to reconnect after disconnection. * ]; * @return array */ public function expire(array $User = []) { $conf = $this->conf['expire']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['expire'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId' ]); $result = (new Request())->Request($conf['url'], $User); $bodyParameter = (new Request())->getQueryFields($User); $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); return $result; } /** * @param array $User User information update * @param * $User = [ * 'id'=> 'ujadk90ha', // User ID * 'name'=> 'Maritn', // User name * 'portrait'=> 'http://7xogjk.com1.z0.glb.clouddn.com/IuDkFprSQ1493563384017406982' // User avatar * ]; * @return array */ public function update(array $User = []) { $conf = $this->conf['update']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', 'portrait' => 'portraitUri' ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Query user information * @param * $User = [ * 'id'=> 'ujadk90ha',//User ID * ]; * @return array */ public function get(array $User = []) { $conf = $this->conf['get']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); if ($result['code'] == 200) { $result = (new Utils())->rename($result, [ 'userName' => 'name', 'userPortrait' => 'portrait', ]); } return $result; } /** * @param array $User User deregistration * @param * $User = [ * 'id'=> 'ujadk90ha',//User ID * ]; * @return array */ public function abandon(array $User = []) { $conf = $this->conf['cancel_set']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Query for deactivated users * @param * @return array */ public function abandonQuery(array $params = ["page" => 1, "size" => 50]) { $conf = $this->conf['cancel_query']; $User = (new Utils())->rename($params, [ 'page' => 'pageNo', 'size' => 'pageSize' ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Deactivate user activation * @param * $User = [ * 'id'=> 'ujadk90ha',//User ID * ]; * @return array */ public function activate(array $User = []) { $conf = $this->conf['active']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Reactivate user ID * @param array $User User ID * @param * $User = [ * 'id'=> 'ujadk90ha', // User ID * ]; * @return array */ public function reactivate(array $User = []) { $conf = $this->conf['reactivate']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Query the group where the user is located * @param * $User = [ * 'id'=> 'ujadk90ha',//User ID * ]; * @return array */ public function getGroups(array $User = []) { $conf = $this->conf['getGroups']; $error = (new Utils())->check( [ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['user'] ] ); if ($error) { return $error; } $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } public function query(array $params = ["page" => 1, "pageSize" => 20, "order" => 0]) { $conf = $this->conf['user_query']; $User = (new Utils())->rename($params, [ 'size' => 'pageSize' ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } public function del(array $params) { $conf = $this->conf['user_del']; $User = (new Utils())->rename($params, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Create a block object * * @return Block */ public function Block() { return new Block(); } /** * Create a blacklist object * * @return Blacklist */ public function Blacklist() { return new Blacklist(); } /** * Create an online status object for the user * * @return Onlinestatus */ public function Onlinestatus() { return new Onlinestatus(); } /** * Global group muting * * @return MuteGroups */ public function MuteGroups() { return new MuteGroups(); } /** * Global chatroom mute * * @return MuteChatrooms */ public function MuteChatrooms() { return new MuteChatrooms(); } /** * User tag * * @return Tag */ public function Tag() { return new Tag(); } /** * Create a whitelist object * * @return Whitelist */ public function Whitelist() { return new Whitelist(); } /** * User mute ban * * @return Ban */ public function Ban() { return new Ban(); } /** * User push remark * * @return Remark */ public function Remark() { return new Remark(); } /** * User quiet time period * * @return Remark */ public function BlockPushPeriod() { return new BlockPushPeriod(); } /** * User Profile Hosting * * @return Profile */ public function Profile() { return new Profile(); } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/MuteGroups/MuteGroups.php
RongCloud/Lib/User/MuteGroups/MuteGroups.php
<?php /** * User module global group member ban service */ namespace RongCloud\Lib\User\MuteGroups; use RongCloud\Lib\Request; use RongCloud\Lib\User\User; use RongCloud\Lib\Utils; class MuteGroups { /** * User module global group member mute service * * @var string */ private $jsonPath = 'Lib/User/MuteGroups/'; /** * Request configuration file * * @var string * */ private $conf = ''; /** * Configuration file for verification * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'verify.json'); } /** * Add group ban * * @param array $Group Parameters for adding group ban * @param * $Group = [ * 'members'=>[ // List of banned members * ['id'=> 'ujadk90ha'] * ], * 'minute'=>50 // Duration of ban in minutes * ]; * @return array */ public function add(array $Group=[]){ $conf = $this->conf['add']; $verify = $this->verify['group']; $verify = ['members'=>$verify['members']]; $verify = array_merge($verify , ['minute'=>$this->verify['minute']]); $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unban * * @param array $Group Unban parameter * @param * $Group = [ * 'members'=>[ //Unban member list * ['id'=> 'ujadk90ha'] * ] * ]; * @return array */ public function remove(array $Group=[]){ $conf = $this->conf['remove']; $verify = $this->verify['group']; $verify = ['members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'group', 'data'=> $Group, 'verify'=> $verify ]); if($error) return $error; foreach ($Group['members'] as &$v){ $v = $v['id']; } $Group = (new Utils())->rename($Group, [ 'members'=> 'userId' ]); $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Query the list of banned members * * @param array $Group Query the list of banned members * @param * $Group = [ * ]; * @return array */ public function getList(array $Group=[]){ $conf = $this->conf['getList']; $result = (new Request())->Request($conf['url'],$Group); $result = (new Utils())->responseError($result, $conf['response']['fail']); if($result['code'] == 200){ $result = (new Utils())->rename($result,['users'=>'members']); foreach ($result['members']?:[] as $k=>&$v){ $v = (new Utils())->rename($v,['userId'=>'id']); } } return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Remark/Remark.php
RongCloud/Lib/User/Remark/Remark.php
<?php /** * User backup note */ namespace RongCloud\Lib\User\Remark; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Remark { /** * User Module User Notes * * @var string */ private $jsonPath = 'Lib/User/Remark/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Validate configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add user remark * * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1',//User ID * 'remark'=> [ * ["id"=>'userid',"remark"=>'Remark2'], * ["id"=>'userid2',"remark"=>'Remark2'] * ]//User remark * ]; * @return array */ public function set(array $User=[]){ $conf = $this->conf['set']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Delete user remark * * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1',//User ID * 'targetId'=> 'targetUserid'//User remark * ]; * @return array */ public function del(array $User=[]){ $conf = $this->conf['del']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get user annotation * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1', // User ID * 'size'=> 50 // Default 50 * 'page' => 1 // Default first page * ]; * @return array * @return array */ public function get(array $User=[]){ $conf = $this->conf['get']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['remark'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Onlinestatus/Onlinestatus.php
RongCloud/Lib/User/Onlinestatus/Onlinestatus.php
<?php /** * User module User Online Status */ namespace RongCloud\Lib\User\Onlinestatus; use RongCloud\Lib\Request; use RongCloud\Lib\User\User; use RongCloud\Lib\Utils; class Onlinestatus { /** * User module user status * * @var string */ private $jsonPath = 'Lib/User/Onlinestatus/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Check user online status * * @param array $User Parameters for checking user online status * @param * $User = [ * 'id'=> 'ujadk90ha1',//User ID, unique identifier, maximum length 30 characters * ]; * @return array */ public function check(array $User=[]){ $conf = $this->conf['get']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Block/Block.php
RongCloud/Lib/User/Block/Block.php
<?php /** * Banned user relationship */ namespace RongCloud\Lib\User\Block; use RongCloud\Lib\Request; use RongCloud\Lib\User\User; use RongCloud\Lib\Utils; class Block { /** * User module path to block user * * @var string */ private $jsonPath = 'Lib/User/Block/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add banned user * * @param array $User Banned user parameters * @param * $User = [ * 'id'=> 'ujadk90ha1',// Banned user ID, unique identifier, maximum length 30 characters * 'minute'=> 20 // Ban duration 1 - 1 * 30 * 24 * 60 minutes * ]; * @return array */ public function add(array $User=[]){ $conf = $this->conf['add']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unblock user * * @param array $User Unblock parameters * @param * $user = [ * 'id'=> 'ujadk90ha',//Unblock user ID, unique identifier, maximum length 30 characters * ]; * @return array */ public function remove(array $User=[]){ $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get the list of banned users * * @param array $User Banned user list parameter * @param * $user = [ * ]; * @return array */ public function getList(array $User=[]){ $conf = $this->conf['getList']; $result = (new Request())->Request($conf['url'],$User); // foreach ($result['']) $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Tag/Tag.php
RongCloud/Lib/User/Tag/Tag.php
<?php /** * Banned user relationship */ namespace RongCloud\Lib\User\Tag; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Tag { /** * User module User label * * @var string */ private $jsonPath = 'Lib/User/Tag/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add user tags * * @param array $User * @param * $User = [ * 'userId'=> 'ujadk90ha1',//User ID * 'tags'=> ['Tag1','Tag2']//User tags * ]; * @return array */ public function set(array $User=[]){ $conf = $this->conf['setTag']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['tag'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User,'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Batch add user tags * * @param array $User * @param * $User = [ * 'userIds'=> ['ujadk90ha1','ujadk90ha1'],//User ID list * 'tags'=> ['Tag1','Tag2']//User tags * ]; * @return array */ public function batchset(array $User=[]){ $conf = $this->conf['batchSetTag']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['batchTag'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User,'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get user tags * @param array $User * @param * $User = [ * 'userIds'=> ['ujadk90ha1','ujadk90ha1'],//User ID list * ]; * @return array * @return array */ public function get(array $User=[]){ $conf = $this->conf['getTag']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['getTag'] ]); if($error) return $error; $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Blacklist/Blacklist.php
RongCloud/Lib/User/Blacklist/Blacklist.php
<?php /** * User Relationship Blocklist * User: hejinyu * Date: 2018/7/23 * Time: 11:41 */ namespace RongCloud\Lib\User\Blacklist; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Blacklist { /** * User module blacklist path * * @var string */ private $jsonPath = 'Lib/User/Blacklist/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * @param array $User Add to blacklist * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID * 'blacklist'=> ['kkj9o01'] //List of personnel to be added to the blacklist * ]; * @return array */ public function add(array $User=[]){ $conf = $this->conf['add']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', 'blacklist'=> 'blackUserId' ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Remove blacklist * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID * 'blacklist'=> ['kkj9o01'] //List of personnel to be removed from the blacklist * ]; * @return array */ public function remove(array $User=[]){ $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', 'blacklist'=> 'blackUserId' ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Get the blacklist of a specific user * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID * 'size'=> 1000,//Number of users per page when fetching the blacklist, default is 1000 if not provided, maximum does not exceed 1000 * 'pageToken'=> ''//Pagination token, returned as 'next' from the previous request, no pagination if not provided, default fetches the first 1000 users in reverse chronological order of blacklist addition. * ]; * @return array */ public function getList(array $User=[]){ $conf = $this->conf['getList']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Chat/Ban.php
RongCloud/Lib/User/Chat/Ban.php
<?php /** * User mute list */ namespace RongCloud\Lib\User\Chat; use RongCloud\Lib\Request; use RongCloud\Lib\User\User; use RongCloud\Lib\Utils; class Ban { /** * User module user single chat forbidden path * * @var string */ private $jsonPath = 'Lib/User/Chat/'; /** * Request configuration file * * @var string * Configuration file path */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . 'verify.json'); } /** * Set user single chat ban * * @param array $User Set user single chat ban parameters * @param * $User = [ * 'id' => ['ujadk90ha1'], //Banned user Id, supports batch setting, maximum not exceeding 1000. * 'state' => 1, //Ban status, 0 unban, 1 add ban * 'type' => 'PERSON' //Conversation type, currently supports single chat PERSON * ]; * @return array */ public function set(array $User = []) { $conf = $this->conf['set']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'user', 'data' => $User, 'verify' => $this->verify['set'] ]); if ($error) return $error; $User = (new Utils())->rename($User, [ 'id' => 'userId', ]); $result = (new Request())->Request($conf['url'], $User); $bodyParameter = (new Request())->getQueryFields($User); $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); return $result; } /** * Query the list of banned users * * @param array $param Parameters for querying the list of banned users * @param * $param = [ * 'num' => 100, // Number of rows to fetch, default is 100, maximum supported is 200. * 'offset' => 0, // Starting position for the query, default is 0. * 'type' => 'PERSON' // Conversation type, currently supports single chat PERSON * ]; * @return array */ public function getList(array $param = []) { $conf = $this->conf['getList']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'param', 'data' => $param, 'verify' => $this->verify['getList'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param); $bodyParameter = (new Request())->getQueryFields($param); $result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/BlockPushPeriod/BlockPushPeriod.php
RongCloud/Lib/User/BlockPushPeriod/BlockPushPeriod.php
<?php /** * User non-disturbance time period */ namespace RongCloud\Lib\User\BlockPushPeriod; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class BlockPushPeriod { /** * User quiet hours path * * @var string */ private $jsonPath = 'Lib/User/BlockPushPeriod/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * Add a do-not-disturb time period * * @param array $User Parameters for the banned user * @param * $User = [ * 'id'=> 'ujadk90ha1', // User ID, unique identifier, maximum length 30 characters * 'startTime'=> "23:59:59" // Start time of do-not-disturb * 'period' => 50, // Do-not-disturb duration in minutes, calculated from the start time * 'level' => 1 // 1: Only notify for single chats and @ messages, including messages @ specific users and @ everyone. 5: Do not receive notifications, even for @ messages * ]; * @return array */ public function add(array $User=[]){ $conf = $this->conf['add']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); if(!isset($User['level'])){ $User['level'] = 1; } $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Delete user's do-not-disturb time period * * @param array $User * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID, unique identifier, maximum length 30 characters * ]; * @return array */ public function remove(array $User=[]){ $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get user's do-not-disturb time period * * @param array $User * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID, unique identifier, maximum length 30 characters * ]; * @return array */ public function getList(array $User=[]){ $conf = $this->conf['getList']; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Whitelist/Whitelist.php
RongCloud/Lib/User/Whitelist/Whitelist.php
<?php /** * User relationship allowlist * User: hejinyu * Date: 2018/7/23 * Time: 11:41 */ namespace RongCloud\Lib\User\Whitelist; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Whitelist { /** * User module whitelist path * * @var string */ private $jsonPath = 'Lib/User/Whitelist/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * User constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json'); } /** * @param array $User Add whitelist * @param * $user = [ * 'id'=> 'ujadk90ha',// User ID * 'whitelist'=> ['kkj9o01'] // List of personnel to be added to the whitelist * ]; * @return array */ public function add(array $User=[]){ $conf = $this->conf['add']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', 'whitelist'=> 'whiteUserId' ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Remove whitelist * @param * $user = [ * 'id'=> 'ujadk90ha',// User ID * 'whitelist'=> ['kkj9o01'] // List of personnel to be removed from the whitelist * ]; * @return array */ public function remove(array $User=[]){ $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', 'whitelist'=> 'whiteUserId' ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $User Get the whitelist of a specific user * @param * $user = [ * 'id'=> 'ujadk90ha',//User ID * 'size'=> 1000,//Number of rows per page when fetching the whitelist, defaults to 1000 if not provided, maximum does not exceed 1000 * 'pageToken'=> ''//Pagination information, returns 'next' from the previous request, no pagination if not provided, defaults to fetching the first 1000 users in reverse chronological order of addition to the whitelist. * ]; * @return array */ public function getList(array $User=[]){ $conf = $this->conf['getList']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'user', 'data'=> $User, 'verify'=> $this->verify['user'] ]); if($error) return $error; $User = (new Utils())->rename($User, [ 'id'=> 'userId', ]); $result = (new Request())->Request($conf['url'],$User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/Profile/Profile.php
RongCloud/Lib/User/Profile/Profile.php
<?php /** * User hosting */ namespace RongCloud\Lib\User\Profile; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Profile { /** * User Entrustment * * @var string */ private $jsonPath = 'Lib/User/Profile/'; /** * Request configuration file * * @var string * */ private $conf = ''; /** * Configuration file for validation * * @var string * // */ private $verify = ''; /** * Profile constructor. */ function __construct() { // Initialize request configuration and validate file path $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . 'verify.json'); } /** * User profile settings * * @param array * $params = [ * 'userId' => 'ujadk90ha1', // User ID * 'userProfile' => [], // Basic user information (default maximum of 20 items) * 'userExtProfile' => [] // Extended user information (key length does not exceed 32 characters, key must be prefixed with ext_, value length does not exceed 256 characters, default maximum of 20 items) * ]; * @return array */ public function set(array $params = []) { $conf = $this->conf['set']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'profile', 'data' => $params, 'verify' => $this->verify['set'] ]); if ($error) return $error; if (isset($params['userProfile'])) { if (is_array($params['userProfile'])) { $params['userProfile'] = json_encode($params['userProfile'], JSON_UNESCAPED_UNICODE); } } if (isset($params['userExtProfile'])) { if (is_array($params['userExtProfile'])) { $params['userExtProfile'] = json_encode($params['userExtProfile'], JSON_UNESCAPED_UNICODE); } } $result = (new Request())->Request($conf['url'], $params); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * User custody information clearance * * @param array * $params = [ * 'userId'=> ['ujadk90ha1','ujadk90ha1'], // User ID list, up to 20 users at a time * ]; * @return array */ public function clean(array $params = []) { $conf = $this->conf['clean']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'profile', 'data' => $params, 'verify' => $this->verify['clean'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $params); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Batch query user data * * @param array * $params = [ * 'userId'=> ['ujadk90ha1','ujadk90ha1'],//User ID list, maximum 100 per batch * ]; * @return array */ public function batchQuery(array $params = []) { $conf = $this->conf['batchQuery']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'profile', 'data' => $params, 'verify' => $this->verify['batchQuery'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $params); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get paginated list of all application users * * @param array * $params = [ * 'page' => 1, // Default is 1 * 'size' => 20, // Default is 20, maximum is 100 * 'order' => 0, // Sorting mechanism based on registration time, default is ascending, 0 for ascending, 1 for descending * ]; * @return array */ public function query(array $params = []) { $conf = $this->conf['query']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'profile', 'data' => $params, 'verify' => $this->verify['query'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $params); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/User/MuteChatrooms/MuteChatrooms.php
RongCloud/Lib/User/MuteChatrooms/MuteChatrooms.php
<?php /** * Chatroom member banned words */ namespace RongCloud\Lib\User\MuteChatrooms; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class MuteChatrooms { /** * Chat room member banned path * * @var string */ private $jsonPath = 'Lib/User/MuteChatrooms/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * Gag constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'verify.json'); } /** * Add member mute * * @param array $Chatroom * $Chatroom = [ * 'members'=> [ * ['id'=>'seal9901']//Muted member id * ], * 'minute'=>30//Mute duration * ]; * @return mixed|null */ public function add(array $Chatroom=[]){ $conf = $this->conf['add']; $verify = $this->verify['chatroom'] ; $verify = ['members'=>$verify['members'],'minute'=>$verify['minute']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'chatroom', 'data'=> $Chatroom, 'verify'=> $verify ]); if($error) return $error; foreach ($Chatroom['members'] as &$v){ $v = $v['id']; } $Chatroom = (new Utils())->rename($Chatroom, [ 'members'=>'userId', ]); $result = (new Request())->Request($conf['url'],$Chatroom); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Unban chatroom members * * @param array $Chatroom * $Chatroom = [ * 'members'=> [ * ['id'=>'seal9901']// member id * ] * ]; * @return mixed|null */ public function remove(array $Chatroom=[]){ $conf = $this->conf['remove']; $verify = $this->verify['chatroom'] ; $verify = ['members'=>$verify['members']]; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'chatroom', 'data'=> $Chatroom, 'verify'=> $verify ]); if($error) return $error; foreach ($Chatroom['members'] as &$v){ $v = $v['id']; } $Chatroom = (new Utils())->rename($Chatroom, [ 'members'=>'userId' ]); $result = (new Request())->Request($conf['url'],$Chatroom); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get the list of banned members in a chatroom * * @param array $Chatroom * $Chatroom = [ * * ]; * @return mixed|null */ public function getList(array $Chatroom=[]){ $conf = $this->conf['getList']; $result = (new Request())->Request($conf['url'],$Chatroom); $result = (new Utils())->responseError($result, $conf['response']['fail']); if($result['code'] == 200){ $result = (new Utils())->rename($result,['users'=>'members']); foreach ($result['members'] as $k=>&$v){ $v = (new Utils())->rename($v,['userId'=>'id']); } } return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Sensitive/Sensitive.php
RongCloud/Lib/Sensitive/Sensitive.php
<?php /** * Sensitive Word Management * Date=> 2018/7/23 * Time=> 11=>41 */ namespace RongCloud\Lib\Sensitive; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Sensitive { /** * Sensitive word module path * * @var string */ private $jsonPath = 'Lib/Sensitive/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string */ private $verify = ''; /** * Sensitive constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'verify.json'); } /** * Sensitive word addition * * @param array $Sensitive Sensitive word addition parameter * @param * $Sensitive = [ * 'replace'=> '***',// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word masking can be empty * 'keyword'=>"abc",// Sensitive word * 'type'=>0// 0: Sensitive word replacement 1: Sensitive word masking * ]; * @return array */ public function add(array $Sensitive=[]){ $Sensitive['replace'] = isset($Sensitive['replace'])?$Sensitive['replace']:""; $conf = $this->conf['add']; $verify = $this->verify['rule']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'rule', 'data'=> $Sensitive, 'verify'=> $verify ]); if($error) return $error; $Sensitive = (new Utils())->rename($Sensitive, [ 'keyword'=> 'word', 'replace'=> 'replaceWord' ]); if(!isset($Sensitive['type'])){ $Sensitive['type'] = 1; } if($Sensitive['type'] == 1){ unset($Sensitive['type']); unset($Sensitive['replaceWord']); } $result = (new Request())->Request($conf['url'],$Sensitive); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Batch add sensitive words * * @param array $Sensitive Parameters for adding sensitive words * @param * $Sensitive = [ * [ * 'word'=>'abc',// Sensitive word * 'replaceWord'=>'***'// Replacement for sensitive word, maximum length not exceeding 32 characters, sensitive word masking can be empty * ] * ]; * @return array */ public function batchAdd(array $Sensitive = []) { $conf = $this->conf['batchAdd']; $verify = $this->verify['batchAdd']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'sensitive', 'data' => $Sensitive, 'verify' => $verify ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $Sensitive, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Sensitive word deletion * * @param array $Sensitive Sensitive word deletion parameter * @param * $Sensitive = [ * 'keywords'=>["bbb"]//Sensitive word deletion list * ]; * @return array */ public function remove(array $Sensitive=[]){ $conf = $this->conf['remove']; $verify = $this->verify['sensitive']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'sensitive', 'data'=> $Sensitive, 'verify'=> $verify ]); if($error) return $error; $Sensitive = (new Utils())->rename($Sensitive, [ 'keywords'=> 'words', ]); $result = (new Request())->Request($conf['url'],$Sensitive); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Sensitive word list * * @param array $Sensitive Sensitive word list parameter * @param * $Sensitive = [ * 'type'=> 1,//Sensitive word type, 0: Sensitive word replacement, 1: Sensitive word filtering, empty to get all * ]; * @return array */ public function getList(array $Sensitive=[]){ $Sensitive['type'] = isset($Sensitive['type'])?intval($Sensitive['type']):2; $conf = $this->conf['getList']; $result = (new Request())->Request($conf['url'],$Sensitive); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Message.php
RongCloud/Lib/Message/Message.php
<?php /** * Message Module */ namespace RongCloud\Lib\Message; use RongCloud\Lib\Message\Chatroom\Chatroom; use RongCloud\Lib\Message\Discussion\Discussion; use RongCloud\Lib\Message\Group\Group; use RongCloud\Lib\Message\Ultragroup\Ultragroup; use RongCloud\Lib\Message\History\History; use RongCloud\Lib\Message\Person\Person; use RongCloud\Lib\Message\System\System; use RongCloud\Lib\Message\Broadcast\Broadcast; use RongCloud\Lib\Message\Expansion\Expansion; class Message { /** * Create a chatroom object * * @return Chatroom */ public function Chatroom(){ return new Chatroom(); } /** * Create a chat room object * * @return Discussion */ public function Discussion(){ return new Discussion(); } /** * Create a chat room object * * @return Group */ public function Group(){ return new Group(); } /** * Create a chat room object * * @return History */ public function History(){ return new History(); } /** * Create a chat room object * * @return Person */ public function Person(){ return new Person(); } /** * Create a chat room object * * @return System */ public function System(){ return new System(); } /** * Create a broadcast message object * * @return Broadcast */ public function Broadcast(){ return new Broadcast(); } /** * Create a broadcast message object * * @return Expansion */ public function Expansion(){ return new Expansion(); } /** * Create a supergroup message object * * @return Expansion */ public function Ultragroup(){ return new Ultragroup(); } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Person/Person.php
RongCloud/Lib/Message/Person/Person.php
<?php /** * Two-person message */ namespace RongCloud\Lib\Message\Person; use RongCloud\Lib\ConversationType; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Person { /** * @var string Path for two-person messaging */ private $jsonPath = 'Lib/Message/Person/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for verification * * @var string */ private $verify = ''; /** * Person constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . '../verify.json');; } /** * @param array $Message Two-person message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> 'markoiwm',//Recipient ID * "objectName"=>'RC:TxtMsg',//Message type: Text * 'content'=>['content'=>'Hello, Xiaoming']//Message Body * ]; * @return array */ public function send(array $Message = []) { $conf = $this->conf['send']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toUserId' ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Send different content messages to multiple users * @param * $Message = [ * 'senderId'=> 'kamdnq', // Sender ID * 'objectName'=>'RC:TxtMsg', // Message type: text * 'template'=>['content'=>'{name}, language score {score} points'], // Template content * 'content'=>[ * 'sea9901'=>[ // Recipient ID * 'data'=>['{name}'=>'Xiao Ming','{score}'=>'90'], // Template data * 'push'=>'{name}, your score is out', // Push notification content * ], * 'sea9902'=>[ // Recipient ID * 'data'=>['{name}'=>'Xiao Hong','{score}'=>'95'], // Template data * 'push'=>'{name}, your score is out', // Push notification content * ] * ] * ]; * @return array */ public function sendTemplate(array $Message = []) { $conf = $this->conf['sendTemplate']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', ]); $newMessage = [ 'fromUserId' => $Message['fromUserId'], 'objectName' => $Message['objectName'], "content" => $Message['template'], ]; $Message['content'] = isset($Message['content']) ? json_decode($Message['content'], true) : []; foreach ($Message['content'] as $userId => $v) { $newMessage['toUserId'][] = $userId; $newMessage['values'][] = $v['data']; $newMessage['pushData'][] = isset($v['pushData']) ? $v['pushData'] : ''; $newMessage['pushContent'][] = $v['push']; } $result = (new Request())->Request($conf['url'], $newMessage, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Two-person status message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha', // Sender ID * 'targetId'=> 'markoiwm', // Receiver ID * "objectName"=>'RC:TxtMsg', // Message type: Text * 'content'=>['content'=>'Hello, Xiao Ming'] // Message Body * ]; * @return array */ public function sendStatusMessage(array $Message = []) { $conf = $this->conf['sendStatusMessage']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toUserId' ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Two-person message recall * @param * $Message = [ * 'senderId'=> 'ujadk90ha', // Sender ID * 'targetId'=> 'markoiwm', // Receiver ID * "uId"=>'5GSB-RPM1-KP8H-9JHF', // Message unique identifier * 'sentTime'=>'1519444243981' // Sending time * ]; * @return array */ public function recall(array $Message = []) { $conf = $this->conf['recall']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'uId' => 'messageUID' ]); $Message['conversationType'] = ConversationType::t()['PRIVATE']; $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * getHistoryMsg * * @param array $param = [ * 'userId'=> 'ujadk90ha', * 'targetId'=> 'markoiwm', * "startTime"=> 1759130000000, * 'endTime'=> 1759140981000, * 'includeStart'=> true * ]; * @return array */ public function getHistoryMsg(array $param = []) { $conf = $this->conf['privateHistoryMsg']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'historyMsg', 'data' => $param, 'verify' => $this->verify['historyMsg'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Discussion/Discussion.php
RongCloud/Lib/Message/Discussion/Discussion.php
<?php /** * Discussion group message */ namespace RongCloud\Lib\Message\Discussion; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Discussion { private $jsonPath = 'Lib/Message/Discussion/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string */ private $verify = ''; /** * Discussion constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; } /** * @param array $Message Discussion group message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> ['kkj9o01'],//Discussion group, multiple IDs * "objectName"=>'RC:TxtMsg',//Message type Text * 'content'=>json_encode(['content'=>'Hello, host'])//Message Body * ]; * @return array */ public function send($Message){ $conf = $this->conf['send']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'message', 'data'=> $Message, 'verify'=> $this->verify['message'] ]); if($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId'=> 'fromUserId', 'targetId'=> 'toChatroomId' ]); $result = (new Request())->Request($conf['url'],$Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Discussion group broadcast message * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * "objectName"=>'RC:TxtMsg',//Message type: text * 'content'=>json_encode(['content'=>'Hello, host']) //Message Body * ]; * @return array */ public function broadcast($Message){ $conf = $this->conf['broadcast']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'message', 'data'=> $Message, 'verify'=> $this->verify['message'] ]); if($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId'=> 'fromUserId', ]); $result = (new Request())->Request($conf['url'],$Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Group/Group.php
RongCloud/Lib/Message/Group/Group.php
<?php /** * Group message */ namespace RongCloud\Lib\Message\Group; use RongCloud\Lib\ConversationType; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Group { private $jsonPath = 'Lib/Message/Group/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string */ private $verify = ''; /** * Group constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . '../verify.json');; } /** * @param array $Message Group message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> 'markoiwm',//Group ID * "objectName"=>'RC:TxtMsg',//Message type: Text * 'content'=>['content'=>'Hello, Xiao Ming']//Message Body * ]; * @return array */ public function send(array $Message = []) { $conf = $this->conf['send']; if (isset($Message['content']) && is_array($Message['content'])) { $Message['content'] = json_encode($Message['content']); } $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toGroupId' ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Group message @ * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> 'markoiwm',//Group ID * "objectName"=>'RC:TxtMsg',//Message type Text * 'content'=>[//Message content * 'content'=>'Hello, Xiaoming', * 'mentionedInfo'=>[ * 'type'=>'1',//@ function type, 1 indicates @ all, 2 indicates @ specified users * 'userIds'=>['kladd', 'almmn1'],//List of @ users, required when type is 2, can be empty when type is 1 * 'pushContent'=>'Greeting message'//Custom @ message push content * ] * ]; * @return array */ public function sendMention(array $Message = []) { $conf = $this->conf['send']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message['content'] = isset($Message['content']) ? json_decode($Message['content'], true) : [];; $content = $Message['content']; $mentionedInfo = $content['mentionedInfo']; if ($mentionedInfo) { $Message['content']['mentionedInfo'] = (new Utils())->rename($mentionedInfo, [ 'userIds' => 'userIdList', ]); } $Message['content'] = json_encode($Message['content']); $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toGroupId' ]); $Message['isMentioned'] = 1; $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Group status message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> 'markoiwm',//Group ID * "objectName"=>'RC:TxtMsg',//Message type Text * 'content'=>['content'=>'Hello, Xiaoming']//Message Body * ]; * @return array */ public function sendStatusMessage(array $Message = []) { $conf = $this->conf['sendStatusMessage']; if (isset($Message['content']) && is_array($Message['content'])) { $Message['content'] = json_encode($Message['content']); } $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toGroupId' ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Group message recall * @param * $Message = [ * 'senderId'=> 'ujadk90ha',// Sender ID * 'targetId'=> 'markoiwm',// Group ID * "uId"=>'5GSB-RPM1-KP8H-9JHF',// Unique message identifier * 'sentTime'=>'1519444243981'// Message sending time * ]; * @return array */ public function recall(array $Message = []) { $conf = $this->conf['recall']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'uId' => 'messageUID' ]); $Message['conversationType'] = ConversationType::t()['GROUP']; $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * getHistoryMsg * * @param array $param = [ * 'userId'=> 'ujadk90ha', * 'targetId'=> 'markoiwm', * "startTime"=> 1759130000000, * 'endTime'=> 1759140981000, * 'includeStart'=> true * ]; * @return array */ public function getHistoryMsg(array $param = []) { $conf = $this->conf['groupHistoryMsg']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'historyMsg', 'data' => $param, 'verify' => $this->verify['historyMsg'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Expansion/Expansion.php
RongCloud/Lib/Message/Expansion/Expansion.php
<?php /** * Message Extension */ namespace RongCloud\Lib\Message\Expansion; use RongCloud\Lib\ConversationType; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Expansion { /** * @var string Message Extension */ private $jsonPath = 'Lib/Message/Expansion/'; /** * Request configuration file * * @var string * */ private $conf = ''; /** * Validate configuration file * * @var string */ private $verify = ''; /** * Person constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . '../verify.json');; } /** * Set message extension * * @param array $param Set message extension parameters * @param * $param = [ * 'msgUID' => 'BRGM-DEN2-01E4-BN66', //Message unique identifier ID, which can be obtained by the server through the full message routing function. * 'userId' => 'WNYZbMqpH', //The ID of the user who needs to set the extension for the message. * 'targetId' => 'tjw3zbMrU', //Target ID, which could be a user ID or a group ID depending on the conversationType. * 'conversationType' => '1', //Conversation type, 1 for one-on-one chat and 3 for group chat, only supports single chat and group chat types. * 'extraKeyVal' => ['type'=>'3'], //Custom message extension content, JSON structure, set in Key-Value pairs, e.g., {"type":"3"}, a single message can set up to 300 extension information, with a maximum of 100 settings at a time. * 'isSyncSender' => 0 //In the online state of the terminal user, whether the sender receives this setting status, 0 means not receiving, 1 means receiving, default is 0 not receiving * ]; * @return array */ public function set(array $param = []) { $conf = $this->conf['set']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'expansion', 'data' => $param, 'verify' => $this->verify['expansion'] ]); if ($error) return $error; if (is_array($param['extraKeyVal'])) { $param['extraKeyVal'] = json_encode($param['extraKeyVal'], JSON_UNESCAPED_UNICODE); } $result = (new Request())->Request($conf['url'], $param); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Delete Message Extension * * @param array $param Parameters for deleting message extension * @param * $param = [ * 'msgUID' => 'BRGM-DEN2-01E4-BN66', //Message unique identifier ID, which can be obtained by the server through the full message routing function. * 'userId' => 'WNYZbMqpH', //User ID of the message sender who needs to set the extension. * 'targetId' => 'tjw3zbMrU', //Target ID, which could be a user ID or group ID depending on the conversationType. * 'conversationType' => '1', //Conversation type, where 1 represents a one-on-one chat and 3 represents a group chat. Only single chat and group chat types are supported. * 'extraKey' => ['type'], //Key values of the extension information to be deleted. A maximum of 100 extension information items can be deleted at once. * 'isSyncSender' => 0 //Indicates whether the sender receives this setting status when the terminal user is online. 0 means not receiving, 1 means receiving, and the default is 0 (not receiving). * ]; * @return array */ public function delete(array $param = []) { $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'expansion', 'data' => $param, 'verify' => $this->verify['expansion'] ]); if ($error) return $error; if (is_array($param['extraKey'])) { $param['extraKey'] = json_encode($param['extraKey'], JSON_UNESCAPED_UNICODE); } $result = (new Request())->Request($conf['url'], $param); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * Get extension information * * @param array $param Parameters for obtaining extension information * @param * $param = [ * 'msgUID' => 'ujadk90ha', // Message unique identifier ID, which can be obtained by the server through the full message routing function. * 'pageNo' => 1 // Page number, defaults to returning 300 pieces of extension information. * ]; * @return array */ public function getList(array $param = []) { $conf = $this->conf['getList']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'expansion', 'data' => $param, 'verify' => $this->verify['expansion'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Chatroom/Chatroom.php
RongCloud/Lib/Message/Chatroom/Chatroom.php
<?php /** * Chat room message */ namespace RongCloud\Lib\Message\Chatroom; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; use RongCloud\Lib\ConversationType; class Chatroom { private $jsonPath = 'Lib/Message/Chatroom/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * Chatroom constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . '../verify.json');; } /** * @param array $Message Chat room message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',// Sender ID * 'targetId'=> 'kkj9o01',// Chat room ID * "objectName"=>'RC:TxtMsg',// Message type - text * 'content'=>['content'=>'Hello, host']// Message content * ]; * @return array */ public function send(array $Message = []) { $conf = $this->conf['send']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'targetId' => 'toChatroomId' ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Chatroom broadcast message * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * "objectName"=>'RC:TxtMsg',//Message type: text * 'content'=>['content'=>'Hello, host']//Message content * ]; * @return array */ public function broadcast(array $Message = []) { $conf = $this->conf['broadcast']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', ]); $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Chat room message recall * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender Id * 'targetId'=> 'markoiwm',//Chat room Id * "uId"=>'5GSB-RPM1-KP8H-9JHF',//Unique identifier of the message * 'sentTime'=>'1519444243981'//Message sending time * ]; * @return array */ public function recall(array $Message = []) { $conf = $this->conf['recall']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId' => 'fromUserId', 'uId' => 'messageUID' ]); $Message['conversationType'] = ConversationType::t()['CHATROOM']; $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * getHistoryMsg * * @param array $param = [ * 'userId'=> 'ujadk90ha', * 'targetId'=> 'markoiwm', * "startTime"=> 1759130000000, * 'endTime'=> 1759140981000, * 'includeStart'=> true * ]; * @return array */ public function getHistoryMsg(array $param = []) { $conf = $this->conf['chatroomHistoryMsg']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'historyMsg', 'data' => $param, 'verify' => $this->verify['historyMsg'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Ultragroup/Ultragroup.php
RongCloud/Lib/Message/Ultragroup/Ultragroup.php
<?php /** * Supergroup Message */ namespace RongCloud\Lib\Message\Ultragroup; use RongCloud\Lib\ConversationType; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class Ultragroup { private $jsonPath = 'Lib/Message/Ultragroup/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Configuration file for validation * * @var string * */ private $verify = ''; /** * Group constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath.'api.json'); $this->verify = Utils::getJson($this->jsonPath.'../verify.json');; } /** * @param array $Message Supergroup message sending * @param * $Message = [ * 'senderId'=> 'ujadk90ha',//Sender ID * 'targetId'=> ['markoiwm'],//Supergroup ID, up to three can be sent simultaneously * "objectName"=>'RC:TxtMsg',//Message type, text * 'content'=>['content'=>'Hello, Xiao Ming']//Message Body * ]; * @return array */ public function send(array $Message=[]){ $conf = $this->conf['send']; if(isset($Message['content']) && is_array($Message['content'])){ $Message['content'] = json_encode($Message['content']); } $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'message', 'data'=> $Message, 'verify'=> $this->verify['message'] ]); if($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId'=> 'fromUserId', 'targetId'=> 'toGroupIds' ]); $result = (new Request())->Request($conf['url'],$Message, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Super group message @ * @param * $Message = [ * 'senderId'=> 'ujadk90ha', // Sender ID * 'targetId'=> ["markoiwm"], // Super group ID * "objectName"=>'RC:TxtMsg', // Message type: text * 'content'=>[ // Message content * 'content'=>'Hello, Xiao Ming', * 'mentionedInfo'=>[ * 'type'=>'1', // @ function type, 1 represents @ all, 2 represents @ specified users * 'userIds'=>['kladd', 'almmn1'], // List of @ users, required when type is 2, can be empty when type is 1 * 'pushContent'=>'Greeting message' // Custom @ message push content * ] * ]; * @return array */ public function sendMention(array $Message=[]){ $conf = $this->conf['send']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'message', 'data'=> $Message, 'verify'=> $this->verify['message'] ]); if($error) return $error; $Message['content'] = isset($Message['content'])?json_decode($Message['content'],true):[];; $content = $Message['content']; $mentionedInfo = $content['mentionedInfo']; if($mentionedInfo){ $Message['content']['mentionedInfo'] = (new Utils())->rename($mentionedInfo, [ 'userIds'=> 'userIdList', ]); } $Message['content'] = json_encode($Message['content']); $Message = (new Utils())->rename($Message, [ 'senderId'=> 'fromUserId', 'targetId'=> 'toGroupIds' ]); $Message['isMentioned'] = 1; $result = (new Request())->Request($conf['url'],$Message, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Supergroup message recall * @param * $Message = [ * 'senderId'=> 'ujadk90ha', // Sender Id * 'targetId'=> 'markoiwm', // Supergroup Id * "uId"=>'5GSB-RPM1-KP8H-9JHF', // Unique identifier of the message * 'sentTime'=>'1519444243981' // Timestamp of the message * ]; * @return array */ public function recall(array $Message=[]){ $conf = $this->conf['recall']; $error = (new Utils())->check([ 'api'=> $conf, 'model'=> 'message', 'data'=> $Message, 'verify'=> $this->verify['message'] ]); if($error) return $error; $Message = (new Utils())->rename($Message, [ 'senderId'=> 'fromUserId', 'uId'=> 'messageUID' ]); $Message['conversationType'] = ConversationType::t()['ULTRAGROUP']; $result = (new Request())->Request($conf['url'],$Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * getHistoryMsg * * @param array $param = [ * 'userId'=> 'ujadk90ha', * 'targetId'=> 'markoiwm', * "startTime"=> 1759130000000, * 'endTime'=> 1759140981000, * 'includeStart'=> true * ]; * @return array */ public function getHistoryMsg(array $param = []) { $conf = $this->conf['ultraGroupHistoryMsg']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'historyMsg', 'data' => $param, 'verify' => $this->verify['historyMsg'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $param, 'json'); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false
rongcloud/server-sdk-php
https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/History/History.php
RongCloud/Lib/Message/History/History.php
<?php /** * Historical message */ namespace RongCloud\Lib\Message\History; use RongCloud\Lib\Request; use RongCloud\Lib\Utils; class History { private $jsonPath = 'Lib/Message/History/'; /** * Request configuration file * * @var string */ private $conf = ''; /** * Verify configuration file * * @var string */ private $verify = ''; /** * History constructor. */ function __construct() { $this->conf = Utils::getJson($this->jsonPath . 'api.json'); $this->verify = Utils::getJson($this->jsonPath . 'verify.json');; } /** * @param array $Message History message retrieval * @param * $Message = [ * 'date'=> '2018030613',//Date * ]; * @return array */ public function get(array $Message = []) { $conf = $this->conf['get']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $Message, 'verify' => $this->verify['message'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $Message); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message History message file deletion * @param * $Message = [ * 'date'=> '2018030613',//Date * ]; * @return array */ public function remove(array $User = []) { $conf = $this->conf['remove']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $User, 'verify' => $this->verify['message'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } /** * @param array $Message Message clearance * @param * $Message = [ * 'conversationType'=> '1',//Conversation type, supports single chat, group chat, system message. Single chat is 1, group chat is 3, system notification is 6 * 'fromUserId'=>"fromUserId",//User ID, delete the specified user's historical messages before the msgTimestamp * 'targetId'=>"userId",//Target conversation ID that needs to be cleared * 'msgTimestamp'=>"16888383883222",//Clear all historical messages before this timestamp, accurate to milliseconds, leave empty to clear all historical messages of the conversation. * * ]; * @return array */ public function clean(array $User = []) { $conf = $this->conf['clean']; $error = (new Utils())->check([ 'api' => $conf, 'model' => 'message', 'data' => $User, 'verify' => $this->verify['clean'] ]); if ($error) return $error; $result = (new Request())->Request($conf['url'], $User); $result = (new Utils())->responseError($result, $conf['response']['fail']); return $result; } }
php
MIT
590bd7c0699a341347a180147fc96509393bb9d4
2026-01-05T05:06:12.177745Z
false