@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 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 { data, status, statusText } = await ginis.xml.ude.seznamDokumentu({
47
- Stav: 'vyveseno',
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
- TODO - waiting for feedback on JSON endpoints, will add more afterwards.
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. Each function exported form these files should contain the full (templated) headers and body definition, as well as a link to the Gordic docs, all of which can be used to construct and customize your requests. The `bodyObj` also follows the (key names should match the ones from Gordic).
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
- Example:
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/).