solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName A string to describe the verification service * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'CodeLength' => $options['codeLength'], 'LookupEnabled' => Serialize::booleanToString($options['lookupEnabled']), 'SkipSmsToLandlines' => Serialize::booleanToString($options['skipSmsToLandlines']), 'DtmfInputRequired' => Serialize::booleanToString($options['dtmfInputRequired']), 'TtsName' => $options['ttsName'], 'Psd2Enabled' => Serialize::booleanToString($options['psd2Enabled']), 'DoNotShareWarningEnabled' => Serialize::booleanToString($options['doNotShareWarningEnabled']), 'CustomCodeEnabled' => Serialize::booleanToString($options['customCodeEnabled']), 'Push.IncludeDate' => Serialize::booleanToString($options['pushIncludeDate']), 'Push.ApnCredentialSid' => $options['pushApnCredentialSid'], 'Push.FcmCredentialSid' => $options['pushFcmCredentialSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set *