@bratislava/ginis-sdk 0.2.0 → 0.3.1

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/ginis.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ import ssl from './src/api/json/ssl'
2
+ import pod from './src/api/json/pod'
3
+ export type GinisConfig = {
4
+ username: string
5
+ password: string
6
+ urls: {
7
+ ude?: string
8
+ ssl?: string
9
+ pod?: string
10
+ }
11
+ debug?: boolean
12
+ }
13
+ export declare const defaultConfig: {}
14
+ type _Ssl = typeof ssl
15
+ /**
16
+ * full SSL service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=SSL&language=cs-CZ&version=390
17
+ */
18
+ export type Ssl = {
19
+ [P in keyof _Ssl]: OmitThisParameter<_Ssl[P]>
20
+ }
21
+ type _Pod = typeof pod
22
+ /**
23
+ * full POD service docs: https://robot.gordic.cz/xrg/Default.html?c=OpenModuleDetail&moduleName=POD&language=cs-CZ&version=390
24
+ */
25
+ export type Pod = {
26
+ [P in keyof _Pod]: OmitThisParameter<_Pod[P]>
27
+ }
28
+ export declare class Ginis {
29
+ config: GinisConfig
30
+ /**
31
+ * Exports functions of the api's with config and url values bound.
32
+ * See documentation of the api for request options.
33
+ * Inputs are typed objects, outputs unformatted xml.
34
+ */
35
+ json: {
36
+ ssl: Ssl
37
+ pod: Pod
38
+ }
39
+ constructor(config: GinisConfig)
40
+ }
41
+ export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bratislava/ginis-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "A small wrapper for most commonly used requests towards the Bratislava GINIS system",
5
5
  "main": "dist/ginis-sdk.js",
6
6
  "types": "dist/ginis-sdk.d.ts",
@@ -11,23 +11,23 @@ export type DetailElPodaniRequest = {
11
11
  }
12
12
 
13
13
  export type DetailElPodaniXrg = {
14
- 'Detail-el-podani': {
15
- 'Datum-prijeti': string
16
- 'Stav-zpracovani': string
17
- 'Duvod-odmitnuti'?: string
18
- 'Stav-podani-kod': string
19
- 'Stav-podani-text'?: string
20
- 'Stav-odpovedi-kod': string
21
- 'Stav-odpovedi-text'?: string
22
- 'Id-dokumentu': string
14
+ DetailElPodani: {
15
+ DatumPrijeti: string
16
+ StavZpracovani: string
17
+ DuvodOdmitnuti?: string
18
+ StavPodaniKod: string
19
+ StavPodaniText?: string
20
+ StavOdpovediKod: string
21
+ StavOdpovediText?: string
22
+ IdDokumentu: string
23
23
  Vec?: string
24
- 'Spis-znacka'?: string
24
+ SpisZnacka?: string
25
25
  Znacka?: string
26
- }
27
- 'Navazany-dokument'?: {
28
- 'Id-dokumentu': string
26
+ }[]
27
+ NavazanyDokument?: {
28
+ IdDokumentu: string
29
29
  Vec?: string
30
- 'Spis-znacka'?: string
30
+ SpisZnacka?: string
31
31
  Znacka?: string
32
32
  }
33
33
  }
@@ -49,7 +49,7 @@ export async function detailElPodani(
49
49
  {
50
50
  GRestHeader: getGRestHeader(
51
51
  this.config,
52
- 'http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-el-podani/request/v_1.0.0.0'
52
+ 'http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0'
53
53
  ),
54
54
  Xrg: { 'Detail-el-podani': bodyObj },
55
55
  },
@@ -20,8 +20,8 @@ describe('Detail-el-podani', () => {
20
20
 
21
21
  test('Basic request', async () => {
22
22
  const data = await ginis.json.pod.detailElPodani({
23
- 'Id-el-podani': '28a3e8de-95a7-4834-962e-f27b6c',
23
+ 'Id-zpravy': '4f700d05-9989-4798-a469-1b05f03c9cb7',
24
24
  })
25
- expect(data['Detail-el-podani']['Datum-prijeti']).toBeTruthy()
25
+ expect(data.DetailElPodani[0]?.IdDokumentu).toBe('MAG0X03RZA55')
26
26
  })
27
27
  })
@@ -4,7 +4,7 @@ import type { GinisConfig } from '../../ginis'
4
4
  import { makeAxiosRequest } from '../../utils/api'
5
5
 
6
6
  /**
7
- * full docs https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=seznam-dokumentu&type=request
7
+ * full docs https://robot.gordic.cz/xrg/Default.html?c=OpenMethodDetail&moduleName=UDE&version=390&methodName=pridat-soubor&type=request
8
8
  */
9
9
  export type pridatSoubor = {
10
10
  'Id-dokumentu'?: string
package/src/utils/api.ts CHANGED
@@ -31,7 +31,13 @@ export const makeAxiosRequest = async <T>(
31
31
  responseAxios = await axios.post<T>(url, body, requestConfig)
32
32
  } catch (error) {
33
33
  if (debug) {
34
- console.error(error)
34
+ let anyError = error as any
35
+ console.error(anyError)
36
+ console.log('########### GINIS ERROR RESPONSE ###########')
37
+ console.log('status: ', anyError?.response?.status)
38
+ console.log('statusText: ', anyError?.response?.statusText)
39
+ console.log('data: ', anyError?.response?.data)
40
+ console.log('########### GINIS RESPONSE END ###########')
35
41
  }
36
42
  throw error
37
43
  }