@passly-nl/data 1.0.0-rc.5 → 1.0.0-rc.7
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/dist/index.d.mts +26 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -5
- package/src/adapter/ShortlinkAdapter.ts +17 -0
- package/src/adapter/index.ts +1 -0
- package/src/dto/index.ts +1 -0
- package/src/dto/shortlink/ShortlinkDto.ts +69 -0
- package/src/dto/shortlink/index.ts +1 -0
- package/src/service/MerchantEventShopService.ts +26 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passly-nl/data",
|
|
3
3
|
"description": "API implementation for Passly.",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/basmilius",
|
|
@@ -50,15 +50,19 @@
|
|
|
50
50
|
"./*": "./*"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@basmilius/http-client": "^3.
|
|
53
|
+
"@basmilius/http-client": "^3.10.0",
|
|
54
54
|
"@flux-ui/types": "^3.0.0-next.28",
|
|
55
55
|
"@fortawesome/fontawesome-common-types": "^7.2.0",
|
|
56
|
-
"apexcharts": "^5.
|
|
56
|
+
"apexcharts": "^5.10.0",
|
|
57
57
|
"luxon": "^3.7.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/luxon": "^3.7.1",
|
|
61
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
62
|
-
"tsdown": "^0.21.0-beta.
|
|
61
|
+
"@typescript/native-preview": "^7.0.0-dev.20260303.1",
|
|
62
|
+
"tsdown": "^0.21.0-beta.3"
|
|
63
|
+
},
|
|
64
|
+
"overrides": {
|
|
65
|
+
"@disabled-basmilius/http-client": "link:@basmilius/http-client",
|
|
66
|
+
"@disabled-flux-ui/types": "link:@flux-ui/types"
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { adapter, type ForeignData } from '@basmilius/http-client';
|
|
2
|
+
import { DateTimeAdapter } from '#data/adapter';
|
|
3
|
+
import { ShortlinkDto } from '#data/dto';
|
|
4
|
+
|
|
5
|
+
@adapter
|
|
6
|
+
export class ShortlinkAdapter {
|
|
7
|
+
static parse(data: ForeignData): ShortlinkDto {
|
|
8
|
+
return new ShortlinkDto(
|
|
9
|
+
data.id,
|
|
10
|
+
data.identifier,
|
|
11
|
+
data.hits,
|
|
12
|
+
data.link,
|
|
13
|
+
data.target,
|
|
14
|
+
DateTimeAdapter.parseDateTime(data.createdOn)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/adapter/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './ProductAdapter';
|
|
|
15
15
|
export * from './PublicPayAdapter';
|
|
16
16
|
export * from './PublicShopAdapter';
|
|
17
17
|
export * from './ReservationAdapter';
|
|
18
|
+
export * from './ShortlinkAdapter';
|
|
18
19
|
export * from './StatisticsAdapter';
|
|
19
20
|
export * from './StatisticsBuyersAdapter';
|
|
20
21
|
export * from './StatisticsEventsAdapter';
|
package/src/dto/index.ts
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { dto } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
3
|
+
|
|
4
|
+
@dto
|
|
5
|
+
export class ShortlinkDto {
|
|
6
|
+
get id(): string {
|
|
7
|
+
return this.#id;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
set id(value: string) {
|
|
11
|
+
this.#id = value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get identifier(): string {
|
|
15
|
+
return this.#identifier;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
set identifier(value: string) {
|
|
19
|
+
this.#identifier = value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get hits(): number {
|
|
23
|
+
return this.#hits;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
set hits(value: number) {
|
|
27
|
+
this.#hits = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get link(): string {
|
|
31
|
+
return this.#link;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
set link(value: string) {
|
|
35
|
+
this.#link = value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get target(): string {
|
|
39
|
+
return this.#target;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set target(value: string) {
|
|
43
|
+
this.#target = value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get createdOn(): DateTime {
|
|
47
|
+
return this.#createdOn;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set createdOn(value: DateTime) {
|
|
51
|
+
this.#createdOn = value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#id: string;
|
|
55
|
+
#identifier: string;
|
|
56
|
+
#hits: number;
|
|
57
|
+
#link: string;
|
|
58
|
+
#target: string;
|
|
59
|
+
#createdOn: DateTime;
|
|
60
|
+
|
|
61
|
+
constructor(id: string, identifier: string, hits: number, link: string, target: string, createdOn: DateTime) {
|
|
62
|
+
this.#id = id;
|
|
63
|
+
this.#identifier = identifier;
|
|
64
|
+
this.#hits = hits;
|
|
65
|
+
this.#link = link;
|
|
66
|
+
this.#target = target;
|
|
67
|
+
this.#createdOn = createdOn;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ShortlinkDto';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
-
import { EventAdapter } from '#data/adapter';
|
|
3
|
-
import type { ShopDesignDto, ShopDto, ShopElementDto } from '#data/dto';
|
|
2
|
+
import { EventAdapter, ShortlinkAdapter } from '#data/adapter';
|
|
3
|
+
import type { ShopDesignDto, ShopDto, ShopElementDto, ShortlinkDto } from '#data/dto';
|
|
4
4
|
|
|
5
5
|
export class MerchantEventShopService extends BaseService {
|
|
6
6
|
async get(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<ShopDto>> {
|
|
@@ -23,6 +23,16 @@ export class MerchantEventShopService extends BaseService {
|
|
|
23
23
|
.runArrayAdapter(EventAdapter.parseShopElement);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
async getShortlink(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<ShortlinkDto>> {
|
|
27
|
+
return await this
|
|
28
|
+
.request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/shortlink`)
|
|
29
|
+
.method('get')
|
|
30
|
+
.queryString(QueryString.builder()
|
|
31
|
+
.append('language', 'nl'))
|
|
32
|
+
.bearerToken()
|
|
33
|
+
.runAdapter(ShortlinkAdapter.parse);
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
async patch(merchantId: string, eventId: string, shop: ShopDto): Promise<BaseResponse<ShopDto>> {
|
|
27
37
|
return await this
|
|
28
38
|
.request(`/merchants/${merchantId}/events/${eventId}/shops/${shop.id}`)
|
|
@@ -44,6 +54,8 @@ export class MerchantEventShopService extends BaseService {
|
|
|
44
54
|
return await this
|
|
45
55
|
.request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/design`)
|
|
46
56
|
.method('patch')
|
|
57
|
+
.queryString(QueryString.builder()
|
|
58
|
+
.append('language', 'nl'))
|
|
47
59
|
.bearerToken()
|
|
48
60
|
.body({
|
|
49
61
|
background_color: design.backgroundColor,
|
|
@@ -57,10 +69,22 @@ export class MerchantEventShopService extends BaseService {
|
|
|
57
69
|
return await this
|
|
58
70
|
.request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/elements`)
|
|
59
71
|
.method('patch')
|
|
72
|
+
.queryString(QueryString.builder()
|
|
73
|
+
.append('language', 'nl'))
|
|
60
74
|
.bearerToken()
|
|
61
75
|
.body({
|
|
62
76
|
elements
|
|
63
77
|
})
|
|
64
78
|
.runArrayAdapter(EventAdapter.parseShopElement);
|
|
65
79
|
}
|
|
80
|
+
|
|
81
|
+
async postShortlink(merchantId: string, eventId: string, shopId: string): Promise<BaseResponse<ShortlinkDto>> {
|
|
82
|
+
return await this
|
|
83
|
+
.request(`/merchants/${merchantId}/events/${eventId}/shops/${shopId}/shortlink`)
|
|
84
|
+
.method('post')
|
|
85
|
+
.queryString(QueryString.builder()
|
|
86
|
+
.append('language', 'nl'))
|
|
87
|
+
.bearerToken()
|
|
88
|
+
.runAdapter(ShortlinkAdapter.parse);
|
|
89
|
+
}
|
|
66
90
|
}
|