Creates a new text batch.

The text batch will be created as described in the given
object.

@param Api\MtBatchTextSmsCreate $batch the batch description

@return Api\MtBatchTextSmsResult the creation result
195628
public function createTextBatch(Api\MtBatchTextSmsCreate $batch)
    {
        $json = Serialize::textBatch($batch);
        $result = $this->_post($this->_url('/batches'), $json);
        return Deserialize::batchResponse($result);
    }
1041585
def create_or_reference_batch(self):
        
        client = self.aq_parent
        batch_headers = self.get_batch_header_values()
        if not batch_headers:
            return False
        # if the Batch's Title is specified and exists, no further
        # action is required. We will just set the Batch field to
        # use the existing object.
        batch_title = batch_headers.get('title', False)
        if batch_title:
            existing_batch = [x for x in client.objectValues('Batch')
                              if x.title == batch_title]
            if existing_batch:
                self.setBatch(existing_batch[0])
                return existing_batch[0]
        # If the batch title is specified but does not exist,
        # we will attempt to create the bach now.
        if 'title' in batch_headers:
            if 'id' in batch_headers:
                del (batch_headers['id'])
            if '' in batch_headers:
                del (batch_headers[''])
            batch = _createObjectByType('Batch', client, tmpID())
            batch.processForm()
            batch.edit(**batch_headers)
            self.setBatch(batch)
98619
public function setText( $text ) {
    $this->textOriginal = $text;
    $this->text = preg_replace("/([^\w ]*)/iu", "", $text);
    return $this;
  }
519264
private function createDateFromText($text)
    {
        try {
            $date = new \DateTime($text);
        } catch (\Exception $e) {
            $date = new \DateTime(self::DEFAULT_TO_DATE);
        }

        return $date->format('Y-m-d');
    }
288448
public static function binaryBatchUpdate(Api\MtBatchBinarySmsUpdate $batch)
    {
        $fields = Serialize::_batchUpdateHelper($batch);

        $fields['type'] = 'mt_binary';

        if (null != $batch->getBody()) {
            $fields['body'] = base64_encode($batch->getBody());
        }

        if (null != $batch->getUdh()) {
            $fields['udh'] = bin2hex($batch->getUdh());
        }

        return Serialize::_toJson($fields);
    }
580043
public function add(Batch ...$batches)
    {
        foreach ($batches as $batch) {
            if (!$this->has($batch)) {
                $this->batches[] = $batch;
            }
        }

        return $this;
    }
412408
public function emitBatch($batch){
        $buildThrift = (new AgentClient())->buildThrift($batch);
        if(isset($buildThrift['len']) && $buildThrift['len'] && $this->isOpen()) {
            $len = $buildThrift['len'];
            $enitThrift = $buildThrift['thriftStr'];
            $res = socket_sendto($this->socket, $enitThrift, $len, 0, $this->host, $this->post);
            if($res === false) {
                throw new \Exception("emit failse");
            }

            return true;
        }else{
            return false;
        }
    }
190305
public function reprompt(string $text)
    {
        $outputSpeech = OutputSpeech::createByText($text);
        $reprompt     = new Reprompt($outputSpeech);

        $this->responseBody->reprompt = $reprompt;

        return $this->response;
    }
85874
protected function batchFactory()
    {
        return new WriteBatch(
            $this->connection,
            $this->valueMapper,
            $this->databaseFromName($this->name)
        );
    }
238397
public function addText($text) {
      if (is_string($text))
          $text = new BaMLText($text);
      if (!($text instanceof BaMLText)) 
          throw new \CatapultApiException("You can only add type BaMLAttribute or array..");
      
      $this->text = $this->text . $text;
    }
815824
public function setText($text)
    {
        $this->text = $text;
        $this->encodeManager->setData($text);

        return $this;
    }
251276
public function replaceBinaryBatch(
        $batchId, Api\MtBatchBinarySmsCreate $batch
    ) {
        $json = Serialize::binaryBatch($batch);
        $result = $this->_put($this->_batchUrl($batchId), $json);
        return Deserialize::batchResponse($result);
    }
904519
public function text(string $text, string $source = 'auto', string $target = 'auto')
    {
        if (!('auto' === $source && 'auto' === $target)) {
            $this->checkTextTarget($source, $target);
        }

        return Request::exec(self::TEXT, compact('text', 'source', 'target'));
    }
463794
static function CreateWithText($path, $text)
    {
        $dir = Path::Directory($path);
        if (!Folder::Exists($dir))
            Folder::Create($dir);
        
        file_put_contents($path, $text);
    }
640180
public function make(string $text): string
    {
        $map = $this->getMap();
        $transliterated = str_replace(array_keys($map), array_values($map), $text);

        if (true === config('transliterate.remove_accents', false)) {
            $transliterator = IntlTransliterator::create('Any-Latin; Latin-ASCII');
            $transliterated = $transliterator->transliterate($transliterated);
        }

        return self::applyTransformers($transliterated);
    }
530928
public static function binaryBatch(Api\MtBatchBinarySmsCreate $batch)
    {
        $fields = Serialize::_createBatchHelper($batch);

        $fields['type'] = 'mt_binary';
        $fields['body'] = base64_encode($batch->getBody());
        $fields['udh'] = bin2hex($batch->getUdh());

        return Serialize::_toJson($fields);
    }
396854
public function replaceTextBatch(
        $batchId, Api\MtBatchTextSmsCreate $batch
    ) {
        $json = Serialize::textBatch($batch);
        $result = $this->_put($this->_batchUrl($batchId), $json);
        return Deserialize::batchResponse($result);
    }