@bratislava/ginis-sdk 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -23
- package/dist/ginis-sdk.js +3 -2
- package/package.json +4 -2
- package/src/api/json/pod/Detail-el-podani.ts +59 -0
- package/src/api/json/pod/__tests__/Detail-el-podani.test.ts +27 -0
- package/src/api/json/pod/index.ts +5 -0
- package/src/api/json/ssl/Detail-dokumentu.ts +140 -0
- package/src/api/json/ssl/Pridat-soubor.ts +54 -0
- package/src/api/json/ssl/__tests__/Detail-dokumentu.test.ts +27 -0
- package/src/api/json/ssl/__tests__/Pridat-soubor.test.ts +37 -0
- package/src/api/json/ssl/__tests__/raw-data.bin +0 -0
- package/src/api/json/ssl/index.ts +7 -0
- package/src/api/{ssl.ts → xml/ssl.ts} +2 -2
- package/src/api/{ude.ts → xml/ude.ts} +2 -2
- package/src/ginis.ts +16 -22
- package/src/index.ts +4 -1
- package/src/utils/api.ts +38 -5
- package/src/utils/errors.ts +7 -0
- package/tsconfig.json +1 -1
- package/webpack.config.js +4 -0
- package/__tests__/ssl.test.ts +0 -30
- package/__tests__/ude.test.ts +0 -27
package/README.md
CHANGED
|
@@ -39,30 +39,35 @@ const ginis = new Ginis({
|
|
|
39
39
|
Use the xml-returning requests:
|
|
40
40
|
|
|
41
41
|
```ts
|
|
42
|
-
// data will contain the unformatted xml as a string, status and statusText from axios response
|
|
43
42
|
// the options object uses same keys as the requests in Ginis docs
|
|
44
43
|
// i.e. https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
|
|
45
|
-
// will throw if the request fails
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
'Id-uredni-desky': 'MAG0AWO0A03L',
|
|
44
|
+
// will throw an Axios error if the request fails
|
|
45
|
+
const data = await ginis.json.ssl.detailDokumentu({
|
|
46
|
+
'Id-dokumentu': 'MAG0X03RYYSN',
|
|
49
47
|
})
|
|
50
48
|
```
|
|
51
49
|
|
|
52
|
-
TODO - waiting for feedback on JSON endpoints, will add more afterwards.
|
|
53
|
-
TODO - "simple" service for most common requests, requiring and returning just the data needed.
|
|
54
|
-
|
|
55
50
|
## Extending the library
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
The `src/api` is structured after the GINIS modules, each method available on the exported API object maps to a single action - for more info on the hierarchy, see our [GINIS docs](https://bratislava.github.io/GINIS).
|
|
52
|
+
The `src/api` is structured after the GINIS modules, each subdirectory a single service, each file a single action - for more info on the hierarchy, see our [GINIS docs](https://bratislava.github.io/GINIS).
|
|
60
53
|
|
|
61
|
-
You can read / reproduce / add new requests in the /src/api/\[service-name\].ts.
|
|
54
|
+
You can read / reproduce / add new requests in the /src/api/\[service-name\]/\[Action-name\].ts. Read through a couple files and you should be set. To get the typescript typing, either copy the structure from official Gordic docs and update the right-hand side by hand (they are usually strings), or make a manual request and use a tool such as quicktype.io.
|
|
62
55
|
|
|
63
56
|
TS docs frequently reference [the official Gordic documentation](https://robot.gordic.cz/xrg/Default.html) (you'll need to create an account to access it). Once you are logged in, you can browse the full docs with request/reponse formats and all the available endpoints (of which we wrap just a subset).
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
## Developing and running tests
|
|
59
|
+
|
|
60
|
+
For each new service / request you should add appropriate tests in the `__tests__` subdirectory of the service directory.
|
|
61
|
+
|
|
62
|
+
You need to have GINIS credentials setup in `.env` file - see `.env.example`. If interacting with the Bratislava deployment, you also need to be connected through VPN or on internal network.
|
|
63
|
+
|
|
64
|
+
Start the test using
|
|
65
|
+
|
|
66
|
+
`yarn test`
|
|
67
|
+
|
|
68
|
+
## XML example
|
|
69
|
+
|
|
70
|
+
We should have services we need available as JSON endpoints, previous xml requests are kept in as documentation.
|
|
66
71
|
|
|
67
72
|
```ts
|
|
68
73
|
// https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
|
|
@@ -111,16 +116,6 @@ export const seznamDokumentu = async (
|
|
|
111
116
|
}
|
|
112
117
|
```
|
|
113
118
|
|
|
114
|
-
## Developing and running tests
|
|
115
|
-
|
|
116
|
-
For each new service / request you should add appropriate tests in the `__tests__` directory.
|
|
117
|
-
|
|
118
|
-
You need to have GINIS credentials setup in `.env` file - see `.env.example`. If interacting with the Bratislava deployment, you also need to be connected through VPN or on internal network.
|
|
119
|
-
|
|
120
|
-
Start the test using
|
|
121
|
-
|
|
122
|
-
`yarn test`
|
|
123
|
-
|
|
124
119
|
## Documentation
|
|
125
120
|
|
|
126
121
|
Explore the [docs](https://bratislava.github.io/json-schema-xsd-tools/).
|