Skip to content

Commit

Permalink
Merge pull request #34 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 0.2.1
  • Loading branch information
adrianq authored Apr 3, 2020
2 parents 85a316b + bd2c4f0 commit e20d72e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ yarn publish [--tag beta] [--patch | --minor | --major]
### Create API instance

```
const api = new D2Api({
const api = new D2ApiDefault({
baseUrl: "https://play.dhis2.org/2.30",
auth: { username: "admin", password: "district" },
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "d2-api",
"description": "Typed wrapper over DHIS2 API",
"version": "0.2.0",
"version": "0.2.1",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"repository": {
Expand Down
12 changes: 12 additions & 0 deletions src/api/dataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ import { D2Api } from "./d2-api";
export default class DataStore {
constructor(public d2Api: D2Api, public namespace: string) {}

getKeys(): D2ApiResponse<string[]> {
const { d2Api, namespace } = this;

return d2Api
.request<string[]>({
method: "GET",
url: `/dataStore/${namespace}`,
validateStatus: validate404,
})
.map(response => (response.status === 404 ? [] : response.data));
}

get<T>(key: string): D2ApiResponse<T | undefined> {
const { d2Api, namespace } = this;

Expand Down

0 comments on commit e20d72e

Please sign in to comment.