src/Resources/SnsEndpoint.php
public function createEndpoint($request)
    {
        if (is_array($request)) {
            $name = array_get($request, 'Application', array_get($request, 'PlatformApplicationArn'));
            if (empty($name)) {
                throw new BadRequestException("Create endpoint request contains no 'Application' field.");
            }
            $request['PlatformApplicationArn'] = $this->service->addArnPrefix($name);
            $name = array_get($request, 'Token');
            if (empty($name)) {
                throw new BadRequestException("Create endpoint request contains no 'Token' field.");
            }
        } else {
            throw new BadRequestException("Create endpoint request contains fields.");
        }

        try {
            if (null !== $result = $this->service->getConnection()->createPlatformEndpoint($request)) {
                $arn = array_get($result->toArray(), 'EndpointArn', '');

                return ['Endpoint' => $this->service->stripArnPrefix($arn), 'EndpointArn' => $arn];
            }
        } catch (\Exception $ex) {
            if (null !== $newEx = Sns::translateException($ex)) {
                throw $newEx;
            }

            throw new InternalServerErrorException(
                "Failed to create endpoint for '{$request['PlatformApplicationArn']}'.\n{$ex->getMessage()}",
                $ex->getCode()
            );
        }

        return [];
    }
public function createEndpoint($request)
    {
        if (is_array($request)) {
            $name = array_get($request, 'Application', array_get($request, 'PlatformApplicationArn'));
            if (empty($name)) {
                throw new BadRequestException("Create endpoint request contains no 'Application' field.");
            }
            $request['PlatformApplicationArn'] = $this->service->addArnPrefix($name);
            $name = array_get($request, 'Token');
            if (empty($name)) {
                throw new BadRequestException("Create endpoint request contains no 'Token' field.");
            }
        } else {
            throw new BadRequestException("Create endpoint request contains fields.");
        }

        try {
            if (null !== $result = $this->service->getConnection()->createPlatformEndpoint($request)) {
                $arn = array_get($result->toArray(), 'EndpointArn', '');

                return ['Endpoint' => $this->service->stripArnPrefix($arn), 'EndpointArn' => $arn];
            }
        } catch (\Exception $ex) {
            if (null !== $newEx = Sns::translateException($ex)) {
                throw $newEx;
            }

            throw new InternalServerErrorException(
                "Failed to create endpoint for '{$request['PlatformApplicationArn']}'.\n{$ex->getMessage()}",
                $ex->getCode()
            );
        }

        return [];
    }
@param $request

@return array
@throws \DreamFactory\Core\Exceptions\BadRequestException
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException