@tripian/core 1.0.0 → 2.0.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.
@@ -1,21 +1,21 @@
1
- import { AxiosError } from 'axios';
2
- import Model from '@tripian/model';
3
- /**
4
- * All successfully (axios response status code) resolved promises firstly handles by this function. easy.log calling.
5
- * If dataKey exist and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
6
- * @param {AxiosResponse} httpResponse axios response object
7
- * @param {string} dataKey
8
- * @returns {any} httpResponse.data axios httpResponse.data
9
- */
10
- declare const handleHttpResponseSuccess: <T>(httpResponse: Model.SuccessResponse<T>, dataKey: string, params?: any) => Model.DataPayload<T>;
11
- /**
12
- * All failed (axios response status code) promises firstly handles by this function.
13
- * setting tripian.data.hasError to true
14
- * easy.log calling.
15
- * If dataKey exist (and dataKey !== 'trip') and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
16
- * @param {AxiosError} errorResponse is axios error response object
17
- * @param {string} dataKey
18
- * @returns {AxiosError} errorResponse is axios error response object
19
- */
20
- declare const handleHttpResponseError: (errorResponse: AxiosError<Model.ErrorResponse>, dataKey: string, params?: any) => never;
21
- export { handleHttpResponseSuccess, handleHttpResponseError };
1
+ import { AxiosError } from 'axios';
2
+ import Model from '@tripian/model';
3
+ /**
4
+ * All successfully (axios response status code) resolved promises firstly handles by this function. easy.log calling.
5
+ * If dataKey exist and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
6
+ * @param {AxiosResponse} httpResponse axios response object
7
+ * @param {string} dataKey
8
+ * @returns {any} httpResponse.data axios httpResponse.data
9
+ */
10
+ declare const handleHttpResponseSuccess: <T>(httpResponse: Model.SuccessResponse<T>, dataKey: string, params?: any) => Model.DataPayload<T>;
11
+ /**
12
+ * All failed (axios response status code) promises firstly handles by this function.
13
+ * setting tripian.data.hasError to true
14
+ * easy.log calling.
15
+ * If dataKey exist (and dataKey !== 'trip') and httpResponse.data.success is true, httpResponse.data.data is saving to tripian.data[dataKey]
16
+ * @param {AxiosError} errorResponse is axios error response object
17
+ * @param {string} dataKey
18
+ * @returns {AxiosError} errorResponse is axios error response object
19
+ */
20
+ declare const handleHttpResponseError: (errorResponse: AxiosError<Model.ErrorResponse>, dataKey: string, params?: any) => never;
21
+ export { handleHttpResponseSuccess, handleHttpResponseError };
package/index.d.ts CHANGED
@@ -1,40 +1,40 @@
1
- import Model, { Providers } from '@tripian/model';
2
- import random from './Random';
3
- import data from './data/data';
4
- import API from './api/API';
5
- import ProvidersYelpAPI from './providers/yelp/API';
6
- import ProvidersGlxAPI from './providers/glx/API';
7
- import ProvidersGygAPI from './providers/gyg/API';
8
- /**
9
- * Env
10
- */
11
- declare const ENV: {
12
- DEV: {
13
- url: string;
14
- xApiKey: string;
15
- };
16
- TEST: {
17
- url: string;
18
- xApiKey: string;
19
- };
20
- PROD: {
21
- url: string;
22
- xApiKey: string;
23
- };
24
- };
25
- declare let api: API;
26
- /**
27
- * This function initilize for web sdk.
28
- */
29
- declare const init: (url: string, xApiKey: string, token?: Model.Token | undefined, useCahce?: boolean) => void;
30
- interface IProviders {
31
- yelp?: ProvidersYelpAPI;
32
- glx?: ProvidersGlxAPI;
33
- gyg?: ProvidersGygAPI;
34
- yelpInit: (sandbox?: boolean) => void;
35
- glxInit: () => Promise<Providers.Glx.Token>;
36
- gygInit: () => void;
37
- }
38
- declare const providers: IProviders;
39
- declare const ver: string;
40
- export { ver, random, data, api, init, ENV, providers };
1
+ import Model, { Providers } from '@tripian/model';
2
+ import random from './Random';
3
+ import data from './data/data';
4
+ import API from './api/API';
5
+ import ProvidersYelpAPI from './providers/yelp/API';
6
+ import ProvidersGlxAPI from './providers/glx/API';
7
+ import ProvidersGygAPI from './providers/gyg/API';
8
+ /**
9
+ * Env
10
+ */
11
+ declare const ENV: {
12
+ DEV: {
13
+ url: string;
14
+ xApiKey: string;
15
+ };
16
+ TEST: {
17
+ url: string;
18
+ xApiKey: string;
19
+ };
20
+ PROD: {
21
+ url: string;
22
+ xApiKey: string;
23
+ };
24
+ };
25
+ declare let api: API;
26
+ /**
27
+ * This function initilize for web sdk.
28
+ */
29
+ declare const init: (url: string, xApiKey: string, token?: Model.Token | undefined, useCahce?: boolean) => void;
30
+ interface IProviders {
31
+ yelp?: ProvidersYelpAPI;
32
+ glx?: ProvidersGlxAPI;
33
+ gyg?: ProvidersGygAPI;
34
+ yelpInit: (sandbox?: boolean) => void;
35
+ glxInit: () => Promise<Providers.Glx.Token>;
36
+ gygInit: () => void;
37
+ }
38
+ declare const providers: IProviders;
39
+ declare const ver: string;
40
+ export { ver, random, data, api, init, ENV, providers };
package/index.html CHANGED
@@ -1,115 +1,115 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Tripian Web Core Test</title>
7
- <!-- <script src="https://unpkg.com/@tripian/core@latest/tcore.umd.js"></script> -->
8
- <script src="tcore.umd.js"></script>
9
- </head>
10
- <body></body>
11
- <script>
12
- const url = tcore.ENV.DEV.url; // 'https://fgzpwfdoy1.execute-api.eu-west-1.amazonaws.com/api'
13
- const xApiKey = tcore.ENV.DEV.xApiKey; // 'oPkgR28N5W1xmZs705Lhf72HnZjj4q2p6KySXuyb'
14
-
15
- // const url = tcore.ENV.PROD.url; // 'https://0gke6jmyse.execute-api.eu-west-1.amazonaws.com/api'
16
- // const xApiKey = tcore.ENV.PROD.xApiKey; // '7cq5PBc7Qd2dKkbkTP7Gj3uecDODPtof8CZ3pLNZ'
17
-
18
- // (url: string, xApiKey: string, token?: Model.Token, useCahce: boolean = true)
19
- tcore.init(url, xApiKey, undefined, true);
20
-
21
- // Cities
22
- // tcore.api.citiesAll().then((cities) => console.log('cities', cities));
23
-
24
- // Register
25
- // tcore.api
26
- // .register({
27
- // email: '35@35.com',
28
- // first_name: 'Otuz',
29
- // last_name: 'Beş',
30
- // password: 'Tripian*123',
31
- // profile: {
32
- // age: 18,
33
- // answers: [],
34
- // },
35
- // })
36
- // .then(() => {
37
- // Login
38
- tcore.api.login({ email: '35@35.com', password: 'Tripian*123' }).then(() => {
39
- // User Trips
40
- tcore.api.tripRefs().then((tripRefs) => {
41
- console.log('tripRefs', tripRefs);
42
- // User Trips is not empty
43
- if (tripRefs.length > 0) {
44
- // First Trip Data
45
- tcore.api.trip(tripRefs[0].trip_hash).then((trip) => {
46
- console.log('trip', trip);
47
- // Trip City Top 10 Pois
48
- tcore.api.topTen(tripRefs[0].city.id).then((topTenArray) => {
49
- if (topTenArray.length > 0) console.log('topTen', topTenArray[0].top_ten_poi);
50
- });
51
- });
52
- }
53
- });
54
- });
55
- // });
56
-
57
- /* Yelp Test
58
- tcore.providers.yelpInit(undefined, false);
59
- tcore.providers.yelp.bussiness('gR9DTbKCvezQlqvD7_FzPw').then((bussiness) => {
60
- console.log('html yelp bussiness', bussiness);
61
- tcore.providers.yelp.openings('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2).then((openings) => {
62
- console.log('html yelp openings', openings);
63
- tcore.providers.yelp.hold('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2, 'unique_mi_unique').then((hold) => {
64
- console.log('html yelp hold', hold);
65
- tcore.providers.yelp
66
- .reservation(
67
- 'rC5mIHMNF5C1Jtpb2obSkA',
68
- '2020-06-15',
69
- '12:00',
70
- 2,
71
- 'unique_mi_unique',
72
- hold.hold_id,
73
- 'Cenan',
74
- 'Yunusoglu',
75
- 'cenan@tripian.com',
76
- '+1-555-66-777',
77
- )
78
- .then((reservation) => {
79
- console.log('html yelp reservation', reservation);
80
- });
81
- });
82
- });
83
- });
84
- */
85
-
86
- // tcore.init(tcore.ENV.PROD.url, tcore.ENV.PROD.xApiKey);
87
- // tcore.api.login({ email: 'umut@tripian.com', password: 'tripiaN123' }).then(() => {
88
- // tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
89
- // tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
90
- // console.log('trip');
91
- // console.log(tcore.data.trip.plans[0].steps);
92
-
93
- // tcore.api.stepAdd({ plan_id: plan_id, poi_id: add_poi }).then(() => {
94
- // console.log('stepAdd');
95
- // console.log(tcore.data.trip.plans[0].steps);
96
-
97
- // newStepId = tcore.data.trip.plans[0].steps[tcore.data.trip.plans[0].steps.length - 1].id;
98
-
99
- // tcore.api.stepReplace(newStepId, { poi_id: update_poi }).then(() => {
100
- // console.log('stepReplace');
101
- // console.log(tcore.data.trip.plans[0].steps);
102
-
103
- // tcore.api.stepDelete(newStepId).then(() => {
104
- // console.log('stepDelete');
105
- // console.log(tcore.data.trip.plans[0].steps);
106
-
107
- // console.log('son');
108
- // });
109
- // });
110
- // });
111
- // });
112
- // });
113
- // });
114
- </script>
115
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Tripian Web Core Test</title>
7
+ <!-- <script src="https://unpkg.com/@tripian/core@latest/tcore.umd.js"></script> -->
8
+ <script src="tcore.umd.js"></script>
9
+ </head>
10
+ <body></body>
11
+ <script>
12
+ const url = tcore.ENV.DEV.url; // 'https://fgzpwfdoy1.execute-api.eu-west-1.amazonaws.com/api'
13
+ const xApiKey = tcore.ENV.DEV.xApiKey; // 'oPkgR28N5W1xmZs705Lhf72HnZjj4q2p6KySXuyb'
14
+
15
+ // const url = tcore.ENV.PROD.url; // 'https://0gke6jmyse.execute-api.eu-west-1.amazonaws.com/api'
16
+ // const xApiKey = tcore.ENV.PROD.xApiKey; // '7cq5PBc7Qd2dKkbkTP7Gj3uecDODPtof8CZ3pLNZ'
17
+
18
+ // (url: string, xApiKey: string, token?: Model.Token, useCahce: boolean = true)
19
+ tcore.init(url, xApiKey, undefined, true);
20
+
21
+ // Cities
22
+ // tcore.api.citiesAll().then((cities) => console.log('cities', cities));
23
+
24
+ // Register
25
+ // tcore.api
26
+ // .register({
27
+ // email: '35@35.com',
28
+ // first_name: 'Otuz',
29
+ // last_name: 'Beş',
30
+ // password: 'Tripian*123',
31
+ // profile: {
32
+ // age: 18,
33
+ // answers: [],
34
+ // },
35
+ // })
36
+ // .then(() => {
37
+ // Login
38
+ tcore.api.login({ email: '35@35.com', password: 'Tripian*123' }).then(() => {
39
+ // User Trips
40
+ tcore.api.tripRefs().then((tripRefs) => {
41
+ console.log('tripRefs', tripRefs);
42
+ // User Trips is not empty
43
+ if (tripRefs.length > 0) {
44
+ // First Trip Data
45
+ tcore.api.trip(tripRefs[0].trip_hash).then((trip) => {
46
+ console.log('trip', trip);
47
+ // Trip City Top 10 Pois
48
+ tcore.api.topTen(tripRefs[0].city.id).then((topTenArray) => {
49
+ if (topTenArray.length > 0) console.log('topTen', topTenArray[0].top_ten_poi);
50
+ });
51
+ });
52
+ }
53
+ });
54
+ });
55
+ // });
56
+
57
+ /* Yelp Test
58
+ tcore.providers.yelpInit(undefined, false);
59
+ tcore.providers.yelp.bussiness('gR9DTbKCvezQlqvD7_FzPw').then((bussiness) => {
60
+ console.log('html yelp bussiness', bussiness);
61
+ tcore.providers.yelp.openings('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2).then((openings) => {
62
+ console.log('html yelp openings', openings);
63
+ tcore.providers.yelp.hold('rC5mIHMNF5C1Jtpb2obSkA', '2020-06-15', '12:00', 2, 'unique_mi_unique').then((hold) => {
64
+ console.log('html yelp hold', hold);
65
+ tcore.providers.yelp
66
+ .reservation(
67
+ 'rC5mIHMNF5C1Jtpb2obSkA',
68
+ '2020-06-15',
69
+ '12:00',
70
+ 2,
71
+ 'unique_mi_unique',
72
+ hold.hold_id,
73
+ 'Cenan',
74
+ 'Yunusoglu',
75
+ 'cenan@tripian.com',
76
+ '+1-555-66-777',
77
+ )
78
+ .then((reservation) => {
79
+ console.log('html yelp reservation', reservation);
80
+ });
81
+ });
82
+ });
83
+ });
84
+ */
85
+
86
+ // tcore.init(tcore.ENV.PROD.url, tcore.ENV.PROD.xApiKey);
87
+ // tcore.api.login({ email: 'umut@tripian.com', password: 'tripiaN123' }).then(() => {
88
+ // tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
89
+ // tcore.api.trip('f106b4e6dd8148778dd70f552965f686').then(() => {
90
+ // console.log('trip');
91
+ // console.log(tcore.data.trip.plans[0].steps);
92
+
93
+ // tcore.api.stepAdd({ plan_id: plan_id, poi_id: add_poi }).then(() => {
94
+ // console.log('stepAdd');
95
+ // console.log(tcore.data.trip.plans[0].steps);
96
+
97
+ // newStepId = tcore.data.trip.plans[0].steps[tcore.data.trip.plans[0].steps.length - 1].id;
98
+
99
+ // tcore.api.stepReplace(newStepId, { poi_id: update_poi }).then(() => {
100
+ // console.log('stepReplace');
101
+ // console.log(tcore.data.trip.plans[0].steps);
102
+
103
+ // tcore.api.stepDelete(newStepId).then(() => {
104
+ // console.log('stepDelete');
105
+ // console.log(tcore.data.trip.plans[0].steps);
106
+
107
+ // console.log('son');
108
+ // });
109
+ // });
110
+ // });
111
+ // });
112
+ // });
113
+ // });
114
+ </script>
115
+ </html>
package/package.json CHANGED
@@ -1,66 +1,35 @@
1
- {
2
- "name": "@tripian/core",
3
- "version": "1.00.000",
4
- "description": "Tripian Inc Web SDK",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "scripts": {
8
- "npm": "npm publish --access public"
9
- },
10
- "dependencies": {
11
- "@tripian/model": "1.00.000",
12
- "adyen-encryption": "^0.1.1",
13
- "axios": "^0.19.1",
14
- "moment": "^2.29.0"
15
- },
16
- "devDependencies": {
17
- "@babel/cli": "^7.7.7",
18
- "@babel/core": "^7.7.7",
19
- "@babel/preset-env": "^7.7.7",
20
- "@babel/preset-typescript": "^7.10.4",
21
- "@tripian/eslint-config-tripian": "^1.1.0",
22
- "@types/jest": "^26.0.13",
23
- "@types/node": "^13.1.7",
24
- "@types/npm": "^2.0.31",
25
- "@typescript-eslint/eslint-plugin": "^2.16.0",
26
- "babel-jest": "^24.9.0",
27
- "babel-loader": "^8.0.6",
28
- "eslint": "^6.8.0",
29
- "eslint-config-airbnb": "^18.0.1",
30
- "eslint-config-airbnb-typescript": "^6.3.1",
31
- "eslint-config-prettier": "^6.9.0",
32
- "eslint-plugin-import": "^2.20.0",
33
- "eslint-plugin-jest": "^23.6.0",
34
- "eslint-plugin-jsx-a11y": "^6.2.3",
35
- "eslint-plugin-prettier": "^3.1.2",
36
- "eslint-plugin-react": "^7.17.0",
37
- "eslint-plugin-react-hooks": "^2.3.0",
38
- "jest": "^24.9.0",
39
- "prettier": "^1.19.1",
40
- "ts-loader": "^6.2.1",
41
- "typedoc": "^0.19.1",
42
- "typedoc-plugin-external-module-name": "^4.0.3",
43
- "typescript": "^4.0.2",
44
- "webpack": "^4.41.5",
45
- "webpack-cli": "^3.3.10"
46
- },
47
- "keywords": [
48
- "tripian",
49
- "core",
50
- "web sdk"
51
- ],
52
- "repository": {
53
- "type": "git",
54
- "url": "git+https://github.com/Tripian-inc/ui-tripian-core.git"
55
- },
56
- "author": "Penguen Umut",
57
- "license": "MIT",
58
- "bugs": {
59
- "url": "https://github.com/Tripian-inc/ui-tripian-core/issues"
60
- },
61
- "homepage": "https://tripian-inc.github.io/ui-tripian-core/globals.html",
62
- "eslintConfig": {
63
- "extends": "@tripian/eslint-config-tripian"
64
- },
65
- "prettier": "@tripian/eslint-config-tripian/prettier.js"
66
- }
1
+ {
2
+ "name": "@tripian/core",
3
+ "version": "2.00.000",
4
+ "description": "Tripian Inc Web SDK",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "npm": "npm publish --access public"
9
+ },
10
+ "dependencies": {
11
+ "@tripian/model": "2.00.000",
12
+ "adyen-encryption": "^0.1.1",
13
+ "axios": "^0.19.1",
14
+ "moment": "^2.29.0"
15
+ },
16
+ "keywords": [
17
+ "tripian",
18
+ "core",
19
+ "web sdk"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Tripian-inc/ui-tripian-core.git"
24
+ },
25
+ "author": "Penguen Umut",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/Tripian-inc/ui-tripian-core/issues"
29
+ },
30
+ "homepage": "https://tripian-inc.github.io/ui-tripian-core/globals.html",
31
+ "eslintConfig": {
32
+ "extends": "@tripian/eslint-config-tripian"
33
+ },
34
+ "prettier": "@tripian/eslint-config-tripian/prettier.js"
35
+ }
@@ -1,15 +1,15 @@
1
- import { Providers } from '@tripian/model';
2
- declare class API {
3
- private axios;
4
- private baseURL;
5
- private tripianTravelerXApiKey;
6
- private tripianFakeDeviceId;
7
- private sandbox;
8
- private token?;
9
- constructor(sandbox?: boolean);
10
- login: () => Promise<Providers.Glx.Token>;
11
- checkLogin: () => Promise<boolean>;
12
- booking: (id: string) => Promise<Providers.Glx.Booking>;
13
- catalog: (cityName: string, demo?: boolean) => Promise<Providers.Glx.Catalog>;
14
- }
15
- export default API;
1
+ import { Providers } from '@tripian/model';
2
+ declare class API {
3
+ private axios;
4
+ private baseURL;
5
+ private tripianTravelerXApiKey;
6
+ private tripianFakeDeviceId;
7
+ private sandbox;
8
+ private token?;
9
+ constructor(sandbox?: boolean);
10
+ login: () => Promise<Providers.Glx.Token>;
11
+ checkLogin: () => Promise<boolean>;
12
+ booking: (id: string) => Promise<Providers.Glx.Booking>;
13
+ catalog: (cityName: string, demo?: boolean) => Promise<Providers.Glx.Catalog>;
14
+ }
15
+ export default API;
@@ -1,3 +1,3 @@
1
- declare const montrealCatalogExcludeItemIds: string[];
2
- declare const catalogGroupsApprovedTitles: string[];
3
- export { montrealCatalogExcludeItemIds, catalogGroupsApprovedTitles };
1
+ declare const montrealCatalogExcludeItemIds: string[];
2
+ declare const catalogGroupsApprovedTitles: string[];
3
+ export { montrealCatalogExcludeItemIds, catalogGroupsApprovedTitles };
@@ -1,8 +1,8 @@
1
- import { AxiosError } from 'axios';
2
- interface GlxErrorResponse {
3
- errorCode: number;
4
- errorMessage: string;
5
- traceId: string;
6
- }
7
- declare const handleHttpResponseErrorForGlx: (errorResponse: AxiosError<GlxErrorResponse>, dataKey: string, params?: any) => never;
8
- export { handleHttpResponseErrorForGlx };
1
+ import { AxiosError } from 'axios';
2
+ interface GlxErrorResponse {
3
+ errorCode: number;
4
+ errorMessage: string;
5
+ traceId: string;
6
+ }
7
+ declare const handleHttpResponseErrorForGlx: (errorResponse: AxiosError<GlxErrorResponse>, dataKey: string, params?: any) => never;
8
+ export { handleHttpResponseErrorForGlx };
@@ -1,24 +1,24 @@
1
- import Model, { Providers } from '@tripian/model';
2
- declare class API {
3
- private axios;
4
- private tripianProxyURL;
5
- private baseURL;
6
- private baseURL_TEST;
7
- private access_token;
8
- constructor(test?: boolean);
9
- categories: (limit?: number, language?: string, currency?: string) => Promise<Providers.Gyg.Category[]>;
10
- category: (categoryId: number, language?: string, currency?: string) => Promise<Providers.Gyg.Category>;
11
- tours: (cityName: string, cityCoordinate?: Model.Coordinate | undefined, radius?: number, categoryIds?: number[] | undefined, unique?: boolean, limit?: number, preformatted?: string, language?: string, currency?: string) => Promise<Providers.Gyg.CatalogGroup[]>;
12
- tour: (tourId: number, language?: string, currency?: string, preformatted?: string) => Promise<Providers.Gyg.Tour>;
13
- tourAvailabilities: (tourId: number, startDate: string, endDate?: string | undefined, language?: string, currency?: string) => Promise<Providers.Gyg.TourAvailability[]>;
14
- options: (tourId: number, language?: string, currency?: string) => Promise<Providers.Gyg.TourOption[]>;
15
- optionAvailabilities: (optionId: number, startDate: string, endDate?: string | undefined, language?: string, currency?: string) => Promise<Providers.Gyg.TourAvailability[]>;
16
- optionPricings: (optionId: number, language?: string, currency?: string) => Promise<Providers.Gyg.TourOptionPricing>;
17
- bookingAdd: (tourBookingRequest: Providers.Gyg.TourBookingRequest) => Promise<Providers.Gyg.TourBooking>;
18
- booking: (bookingHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBookingInfo[]>;
19
- bookingDelete: (bookingHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBooking[]>;
20
- cartAdd: (tourBookingCartRequest: Providers.Gyg.TourBookingCartRequest) => Promise<Providers.Gyg.TourBookingCart>;
21
- cart: (shoppingCartHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBookingCart>;
22
- paymentConfiguration: (language?: string, currency?: string, country?: string) => Promise<Providers.Gyg.PaymentConfiguration[]>;
23
- }
24
- export default API;
1
+ import Model, { Providers } from '@tripian/model';
2
+ declare class API {
3
+ private axios;
4
+ private tripianProxyURL;
5
+ private baseURL;
6
+ private baseURL_TEST;
7
+ private access_token;
8
+ constructor(test?: boolean);
9
+ categories: (limit?: number, language?: string, currency?: string) => Promise<Providers.Gyg.Category[]>;
10
+ category: (categoryId: number, language?: string, currency?: string) => Promise<Providers.Gyg.Category>;
11
+ tours: (cityName: string, cityCoordinate?: Model.Coordinate | undefined, radius?: number, categoryIds?: number[] | undefined, unique?: boolean, limit?: number, preformatted?: string, language?: string, currency?: string) => Promise<Providers.Gyg.CatalogGroup[]>;
12
+ tour: (tourId: number, language?: string, currency?: string, preformatted?: string) => Promise<Providers.Gyg.Tour>;
13
+ tourAvailabilities: (tourId: number, startDate: string, endDate?: string | undefined, language?: string, currency?: string) => Promise<Providers.Gyg.TourAvailability[]>;
14
+ options: (tourId: number, language?: string, currency?: string) => Promise<Providers.Gyg.TourOption[]>;
15
+ optionAvailabilities: (optionId: number, startDate: string, endDate?: string | undefined, language?: string, currency?: string) => Promise<Providers.Gyg.TourAvailability[]>;
16
+ optionPricings: (optionId: number, language?: string, currency?: string) => Promise<Providers.Gyg.TourOptionPricing>;
17
+ bookingAdd: (tourBookingRequest: Providers.Gyg.TourBookingRequest) => Promise<Providers.Gyg.TourBooking>;
18
+ booking: (bookingHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBookingInfo[]>;
19
+ bookingDelete: (bookingHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBooking[]>;
20
+ cartAdd: (tourBookingCartRequest: Providers.Gyg.TourBookingCartRequest) => Promise<Providers.Gyg.TourBookingCart>;
21
+ cart: (shoppingCartHash: string, language?: string, currency?: string) => Promise<Providers.Gyg.TourBookingCart>;
22
+ paymentConfiguration: (language?: string, currency?: string, country?: string) => Promise<Providers.Gyg.PaymentConfiguration[]>;
23
+ }
24
+ export default API;
@@ -1,3 +1,3 @@
1
- import { Providers } from '@tripian/model';
2
- declare const allCategories: Providers.Gyg.Category[];
3
- export default allCategories;
1
+ import { Providers } from '@tripian/model';
2
+ declare const allCategories: Providers.Gyg.Category[];
3
+ export default allCategories;
@@ -1,6 +1,6 @@
1
- declare const uniqueTour = false;
2
- declare const titleCategoryIds: {
3
- title: string;
4
- categoryIds: number[];
5
- }[];
6
- export { uniqueTour, titleCategoryIds };
1
+ declare const uniqueTour = false;
2
+ declare const titleCategoryIds: {
3
+ title: string;
4
+ categoryIds: number[];
5
+ }[];
6
+ export { uniqueTour, titleCategoryIds };
@@ -1,16 +1,16 @@
1
- import { AxiosError } from 'axios';
2
- interface GygErrorResponse {
3
- apiVersion: string;
4
- date: string;
5
- descriptor: string;
6
- errors: {
7
- errorCode: number;
8
- errorMessage: string;
9
- }[];
10
- helpURL: string;
11
- method: string;
12
- query: string;
13
- status: string;
14
- }
15
- declare const handleHttpResponseErrorForGyg: (errorResponse: AxiosError<GygErrorResponse>, dataKey: string, params?: any) => never;
16
- export { handleHttpResponseErrorForGyg };
1
+ import { AxiosError } from 'axios';
2
+ interface GygErrorResponse {
3
+ apiVersion: string;
4
+ date: string;
5
+ descriptor: string;
6
+ errors: {
7
+ errorCode: number;
8
+ errorMessage: string;
9
+ }[];
10
+ helpURL: string;
11
+ method: string;
12
+ query: string;
13
+ status: string;
14
+ }
15
+ declare const handleHttpResponseErrorForGyg: (errorResponse: AxiosError<GygErrorResponse>, dataKey: string, params?: any) => never;
16
+ export { handleHttpResponseErrorForGyg };
@@ -1,3 +1,3 @@
1
- import { Providers } from '@tripian/model';
2
- declare const mockTour: Providers.Gyg.Tour;
3
- export default mockTour;
1
+ import { Providers } from '@tripian/model';
2
+ declare const mockTour: Providers.Gyg.Tour;
3
+ export default mockTour;