Serializes the given text batch into JSON.

@param Api\MtBatchTextSmsCreate $batch the batch to serialize

@return string JSON formatted string
176111
public static function textBatch(Api\MtBatchTextSmsCreate $batch)
    {
        $fields = Serialize::_createBatchHelper($batch);

        $fields['type'] = 'mt_text';
        $fields['body'] = $batch->getBody();

        if (!empty($batch->getParameters())) {
            $fields['parameters'] = $batch->getParameters();
        }

        return Serialize::_toJson($fields);
    }
404755
public function replaceBatchTags($batchId, array $tags)
    {
        $json = Serialize::tags($tags);
        $result = $this->_put($this->_batchUrl($batchId, '/tags'), $json);
        return Deserialize::tags($result);
    }
89070
def _addFlushBatch(self):
        

        if len(self._add_batch) > 0:
            language_batches = {}
            # Create command JSONs for each of language endpoints
            for lang in self.endpoints:
                # Append documents with languages without endpoint to default endpoint
                document_jsons = ["\"add\":" + json.dumps(data) for data in self._add_batch
                                  if data['doc'].get("language", self.default_endpoint) == lang or (lang == self.default_endpoint and not self.endpoints.has_key(data['doc'].get("language", None)))]
                command_json = "{" + ",".join(document_jsons) + "}"
                language_batches[lang] = command_json
            # Solr requires for documents to be sent in { "add" : { "doc" : {...} }, "add": { "doc" : { ... }, ... }
            # format which isn't possible with python dictionaries
            for lang in language_batches:
                self._send_solr_command(self.endpoints[lang], language_batches[lang])
                self._add_batch = []
48345
def batch(request, request_options = {})
      client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)
    end
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');
    }
602208
public function format($text, $context, $user = null, $extraData = [])
    {
        $data = $this->getTemplateData($context, $user, $extraData);

        // render
        $viewer = new SSViewer_FromString($text);
        try {
            $string = $viewer->process($data);
        } catch (Exception $e) {
            $string = $text;
        }

        return $string;
    }
1031284
public static function send($client, $batchParts)
    {
        /** @var AbstractHttpRequest $request */
        $request         = new $client->requestClass($client);
        $request->client = $client;

        return $request->sendBatch($batchParts);
    }
740800
public JSONObject updateBatch(String company, HashMap<String, String> params) throws JSONException {
        return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
    }
1250433
protected function sendTextMsgToJsonString(WxSendTextMsg $msg)
    {
        $formatStr = '{
                        "touser":"%s",
                        "msgtype":"%s",
                        "text":
                        {
                             "content":"%s"
                        }
                    }';
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getMsgType(),
                                        $msg->getContent()
                        );


        return $result;
    }
822143
protected function batchCanConvert(Batch $batch)
    {
        return ($this->schema->hasConverter($batch->getAttribute()) && !$batch->isTypeRemoveAll());
    }
964160
public function getBatchArray()
    {
        $batchEntry = [];

        foreach ($this->batches as $batch) {
            $batchEntry[] = $batch->toArray();
        }

        return $batchEntry;
    }
576214
public static function json($mData, $bPretty = FALSE) {
		$iArg = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
		if ($bPretty) {
			$iArg = $iArg | JSON_PRETTY_PRINT;
		}
		return json_encode($mData, $iArg);
	}
1060145
public function batch(Google_Service_AndroidPublisher_InappproductsBatchRequest $postBody, $optParams = array())
  {
    $params = array('postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('batch', array($params), "Google_Service_AndroidPublisher_InappproductsBatchResponse");
  }
741806
public function createBinaryBatch(Api\MtBatchBinarySmsCreate $batch)
    {
        $json = Serialize::binaryBatch($batch);
        $result = $this->_post($this->_url('/batches'), $json);
        return Deserialize::batchResponse($result);
    }
515407
public function getBatch($attributes = [])
    {
        $this->parseBatchAttributes($attributes);

        try {
            $result = $this->getHttp()->get('batch', ['urls' => $this->batchUrls]);
            $this->batchUrls = [];

            return $result;
        } catch (Exception $e) {
            throw $e;
        }
    }
513255
public function asText($text)
    {
        $stream = StreamFactory::string($text);
        return new Response($stream, self::OK, ['Content-Type' => 'text/plain']);
    }
1206405
def send_batch
      batch = @batch.map(&:first) # get the requests
      response = send_batch_request(batch)

      begin
        responses = JSON.parse(response)
      rescue
        raise Jimson::ClientError::InvalidJSON.new(json)
      end

      process_batch_response(responses)
      responses = @batch

      @batch = []

      responses
    end