src/Resources/SnsEndpoint.php
public function listResources($fields = null)
    {
        $resources = [];
        if (empty($this->parentResource)) {
            $applications = [];
            try {
                $out = [];
                $token = null;
                do {
                    $result = $this->service->getConnection()->listPlatformApplications(
                        [
                            'NextToken' => $token
                        ]
                    );
                    $topics = $result['PlatformApplications'];
                    $token = $result['NextToken'];

                    if (!empty($topics)) {
                        $out = array_merge($out, $topics);
                    }
                } while ($token);

                foreach ($out as $app) {
                    $applications[] = array_get($app, 'PlatformApplicationArn');
                }
            } catch (\Exception $ex) {
                if (null !== $newEx = Sns::translateException($ex)) {
                    throw $newEx;
                }

                throw new InternalServerErrorException("Failed to retrieve applications.\n{$ex->getMessage()}",
                    $ex->getCode());
            }
        } else {
            $applications = [$this->parentResource];
        }

        foreach ($applications as $application) {
            $result = $this->getEndpointsAsArray($application);
            foreach ($result as $end) {
                switch ($fields) {
                    case false:
                    case Sns::FORMAT_SIMPLE:
                        $resources[] = $this->service->stripArnPrefix(array_get($end, 'EndpointArn'));
                        break;
                    case Sns::FORMAT_ARN:
                        $resources[] = array_get($end, 'EndpointArn');
                        break;
                    case true:
                    case Sns::FORMAT_FULL:
                    default:
                        $end['Endpoint'] = $this->service->stripArnPrefix(array_get($end, 'EndpointArn'));
                        $resources[] = $end;
                        break;
                }
            }
        }

        return $resources;
    }
public function listResources($fields = null)
    {
        $resources = [];
        if (empty($this->parentResource)) {
            $applications = [];
            try {
                $out = [];
                $token = null;
                do {
                    $result = $this->service->getConnection()->listPlatformApplications(
                        [
                            'NextToken' => $token
                        ]
                    );
                    $topics = $result['PlatformApplications'];
                    $token = $result['NextToken'];

                    if (!empty($topics)) {
                        $out = array_merge($out, $topics);
                    }
                } while ($token);

                foreach ($out as $app) {
                    $applications[] = array_get($app, 'PlatformApplicationArn');
                }
            } catch (\Exception $ex) {
                if (null !== $newEx = Sns::translateException($ex)) {
                    throw $newEx;
                }

                throw new InternalServerErrorException("Failed to retrieve applications.\n{$ex->getMessage()}",
                    $ex->getCode());
            }
        } else {
            $applications = [$this->parentResource];
        }

        foreach ($applications as $application) {
            $result = $this->getEndpointsAsArray($application);
            foreach ($result as $end) {
                switch ($fields) {
                    case false:
                    case Sns::FORMAT_SIMPLE:
                        $resources[] = $this->service->stripArnPrefix(array_get($end, 'EndpointArn'));
                        break;
                    case Sns::FORMAT_ARN:
                        $resources[] = array_get($end, 'EndpointArn');
                        break;
                    case true:
                    case Sns::FORMAT_FULL:
                    default:
                        $end['Endpoint'] = $this->service->stripArnPrefix(array_get($end, 'EndpointArn'));
                        $resources[] = $end;
                        break;
                }
            }
        }

        return $resources;
    }
@param mixed $fields Use boolean, comma-delimited string, or array of properties

@return ServiceResponseInterface
@throws BadRequestException|InternalServerErrorException|NotFoundException