Skip to content

Commit

Permalink
feat: Get root collections
Browse files Browse the repository at this point in the history
  • Loading branch information
morrislaptop committed Jun 8, 2018
1 parent b2344a4 commit e10c2b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public function set($uri, $value)
return JSON::decode((string) $response->getBody(), true);
}

public function post($uri, $value)
{
$response = $this->request('POST', $uri, ['json' => $value]);

return JSON::decode((string) $response->getBody(), true);
}

public function push($uri, $value): string
{
$response = $this->request('POST', $uri, ['json' => $value]);
Expand Down
11 changes: 11 additions & 0 deletions src/Firestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ public function getCollection(string $path = ''): Collection
throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
}
}

/**
* Returns the root collections.
*/
public function getRootCollections()
{
$uri = $this->uri->withPath($this->uri->getPath() . ':listCollectionIds');
$value = $this->client->post($uri, null);

return $value;
}
}

0 comments on commit e10c2b7

Please sign in to comment.