/** * @param Google_Service_Datastore_Key|Google_Service_Datastore_Key[] $key_or_keys * @param array $options * @return AllocateIds\Results */ public function allocateKeys($key_or_keys, $options = []) { if (!is_array($key_or_keys)) { $key_or_keys = [$key_or_keys]; } $request = new Google_Service_Datastore_AllocateIdsRequest(); $request->setKeys($key_or_keys); $response = $this->datastoreService->datasets->allocateIds($this->datasetId, $request, $options); return new AllocateIds\Results($response); }
/** * Fetches a unique key from Datastore */ public function createUniqueKeyRequest() { // retrieve a unique ID from datastore $path = new \Google_Service_Datastore_KeyPathElement(); $path->setKind(self::KIND); $key = new \Google_Service_Datastore_Key(); $key->setPath([$path]); $idRequest = new \Google_Service_Datastore_AllocateIdsRequest(); $idRequest->setKeys([$key]); return $idRequest; }