@passly-nl/data 1.3.3 → 1.3.5

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.
Files changed (34) hide show
  1. package/dist/index.d.mts +50 -31
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +74 -45
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +6 -12
  6. package/src/adapter/OrderAdapter.ts +1 -0
  7. package/src/dto/aiUsage/AiUsagePeriodDto.ts +4 -4
  8. package/src/dto/order/OrderDto.ts +12 -2
  9. package/src/dto/statistics/InsightsResponseDto.ts +4 -4
  10. package/src/service/AdminMerchantsService.ts +5 -6
  11. package/src/service/MerchantBuyerService.ts +4 -5
  12. package/src/service/MerchantBuyersService.ts +5 -6
  13. package/src/service/MerchantContractService.ts +4 -5
  14. package/src/service/MerchantDiscountCodesService.ts +4 -12
  15. package/src/service/MerchantEmailTemplatesService.ts +5 -6
  16. package/src/service/MerchantEventAppTeamsService.ts +4 -5
  17. package/src/service/MerchantEventEmailTemplatesService.ts +5 -6
  18. package/src/service/MerchantEventProductsService.ts +4 -5
  19. package/src/service/MerchantEventShopsService.ts +4 -5
  20. package/src/service/MerchantEventStockPoolsService.ts +4 -5
  21. package/src/service/MerchantEventTicketTemplatesService.ts +4 -7
  22. package/src/service/MerchantEventTimeSlotsService.ts +14 -1
  23. package/src/service/MerchantEventsService.ts +17 -5
  24. package/src/service/MerchantFinanceInvoicesService.ts +5 -6
  25. package/src/service/MerchantOrdersService.ts +5 -15
  26. package/src/service/MerchantShopsService.ts +5 -6
  27. package/src/service/MerchantTicketsService.ts +5 -15
  28. package/src/service/MerchantUsersService.ts +4 -6
  29. package/src/service/PublicShopService.ts +1 -1
  30. package/src/types/index.ts +1 -0
  31. package/src/types/list.ts +12 -0
  32. package/src/types/order.ts +5 -0
  33. package/src/util/buildListQuery.ts +48 -0
  34. package/src/util/index.ts +1 -0
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.3.3",
4
+ "version": "1.3.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/basmilius",
@@ -50,22 +50,16 @@
50
50
  "./*": "./*"
51
51
  },
52
52
  "devDependencies": {
53
- "@basmilius/http-client": "^3.35.0",
54
- "@flux-ui/types": "^3.0.0-next.70",
55
- "@fortawesome/fontawesome-common-types": "^7.2.0",
53
+ "@basmilius/http-client": "^3.37.0",
54
+ "@flux-ui/types": "^3.0.0-next.72",
56
55
  "@types/luxon": "^3.7.1",
57
- "@typescript/native-preview": "^7.0.0-dev.20260524.1",
56
+ "@typescript/native-preview": "^7.0.0-dev.20260527.1",
58
57
  "luxon": "^3.7.2",
59
58
  "tsdown": "^0.22.0"
60
59
  },
61
60
  "peerDependencies": {
62
- "@basmilius/http-client": "^3.35.0",
63
- "@flux-ui/types": "^3.0.0-next.70",
64
- "@fortawesome/fontawesome-common-types": "^7.2.0",
61
+ "@basmilius/http-client": "^3.37.0",
62
+ "@flux-ui/types": "^3.0.0-next.72",
65
63
  "luxon": "^3.7.2"
66
- },
67
- "overrides": {
68
- "@disabled-basmilius/http-client": "link:@basmilius/http-client",
69
- "@disabled-flux-ui/types": "link:@flux-ui/types"
70
64
  }
71
65
  }
@@ -17,6 +17,7 @@ export class OrderAdapter {
17
17
  optional(data.payment_provider, OrderAdapter.parseOrderPaymentProvider),
18
18
  optional(data.platform_cost, PaymentAdapter.parseCost)!,
19
19
  optional(data.refunded_total, PaymentAdapter.parseCost)!,
20
+ data.refund_status,
20
21
  optional(data.sub_total, PaymentAdapter.parseCost)!,
21
22
  optional(data.total, PaymentAdapter.parseCost)!,
22
23
  data.url,
@@ -52,11 +52,11 @@ export class AiUsagePeriodDto {
52
52
  this.#lastEventOn = value;
53
53
  }
54
54
 
55
- get features(): AiUsageFeatureStatusDto[] {
55
+ get features(): AiUsageFeatureStatusDto[] | null {
56
56
  return this.#features;
57
57
  }
58
58
 
59
- set features(value: AiUsageFeatureStatusDto[]) {
59
+ set features(value: AiUsageFeatureStatusDto[] | null) {
60
60
  this.#features = value;
61
61
  }
62
62
 
@@ -66,9 +66,9 @@ export class AiUsagePeriodDto {
66
66
  #limitTokens: number | null;
67
67
  #percentage: number;
68
68
  #lastEventOn: DateTime | null;
69
- #features: AiUsageFeatureStatusDto[];
69
+ #features: AiUsageFeatureStatusDto[] | null;
70
70
 
71
- constructor(periodStart: DateTime | null, periodEnd: DateTime | null, tokensUsed: number, limitTokens: number | null, percentage: number, lastEventOn: DateTime | null, features: AiUsageFeatureStatusDto[]) {
71
+ constructor(periodStart: DateTime | null, periodEnd: DateTime | null, tokensUsed: number, limitTokens: number | null, percentage: number, lastEventOn: DateTime | null, features: AiUsageFeatureStatusDto[] | null) {
72
72
  this.#periodStart = periodStart;
73
73
  this.#periodEnd = periodEnd;
74
74
  this.#tokensUsed = tokensUsed;
@@ -1,7 +1,7 @@
1
1
  import { dto } from '@basmilius/http-client';
2
2
  import type { DateTime } from 'luxon';
3
3
  import type { BuyerDto, CostDto, EventDto, MarketingAttributionDto, OrderLineDto, OrderPaymentProviderDto, PublicShopDto, TransactionDto } from '#data/dto';
4
- import type { OrderOrigin, OrderType } from '#data/types';
4
+ import type { OrderOrigin, OrderRefundStatus, OrderType } from '#data/types';
5
5
 
6
6
  @dto
7
7
  export class OrderDto {
@@ -85,6 +85,14 @@ export class OrderDto {
85
85
  this.#refundedTotal = value;
86
86
  }
87
87
 
88
+ get refundStatus(): OrderRefundStatus {
89
+ return this.#refundStatus;
90
+ }
91
+
92
+ set refundStatus(value: OrderRefundStatus) {
93
+ this.#refundStatus = value;
94
+ }
95
+
88
96
  get subTotal(): CostDto {
89
97
  return this.#subTotal;
90
98
  }
@@ -167,6 +175,7 @@ export class OrderDto {
167
175
  #paymentProvider: OrderPaymentProviderDto | null;
168
176
  #platformCost: CostDto;
169
177
  #refundedTotal: CostDto;
178
+ #refundStatus: OrderRefundStatus;
170
179
  #subTotal: CostDto;
171
180
  #total: CostDto;
172
181
  #url: string;
@@ -177,7 +186,7 @@ export class OrderDto {
177
186
  #transaction: TransactionDto | null;
178
187
  #attribution: MarketingAttributionDto | null;
179
188
 
180
- constructor(id: string, code: string, origin: OrderOrigin, type: OrderType, createdOn: DateTime, discountAmount: CostDto | null, discountCodeApplied: string | null, paymentProvider: OrderPaymentProviderDto | null, platformCost: CostDto, refundedTotal: CostDto, subTotal: CostDto, total: CostDto, url: string, buyer: BuyerDto | null, event: EventDto | null, lines: OrderLineDto[] | null, shop: PublicShopDto | null, transaction: TransactionDto | null, attribution: MarketingAttributionDto | null) {
189
+ constructor(id: string, code: string, origin: OrderOrigin, type: OrderType, createdOn: DateTime, discountAmount: CostDto | null, discountCodeApplied: string | null, paymentProvider: OrderPaymentProviderDto | null, platformCost: CostDto, refundedTotal: CostDto, refundStatus: OrderRefundStatus, subTotal: CostDto, total: CostDto, url: string, buyer: BuyerDto | null, event: EventDto | null, lines: OrderLineDto[] | null, shop: PublicShopDto | null, transaction: TransactionDto | null, attribution: MarketingAttributionDto | null) {
181
190
  this.#id = id;
182
191
  this.#code = code;
183
192
  this.#origin = origin;
@@ -188,6 +197,7 @@ export class OrderDto {
188
197
  this.#paymentProvider = paymentProvider;
189
198
  this.#platformCost = platformCost;
190
199
  this.#refundedTotal = refundedTotal;
200
+ this.#refundStatus = refundStatus;
191
201
  this.#subTotal = subTotal;
192
202
  this.#total = total;
193
203
  this.#url = url;
@@ -20,11 +20,11 @@ export class InsightsResponseDto {
20
20
  this.#language = value;
21
21
  }
22
22
 
23
- get cards(): InsightDto[] {
23
+ get cards(): InsightDto[] | null {
24
24
  return this.#cards;
25
25
  }
26
26
 
27
- set cards(value: InsightDto[]) {
27
+ set cards(value: InsightDto[] | null) {
28
28
  this.#cards = value;
29
29
  }
30
30
 
@@ -38,10 +38,10 @@ export class InsightsResponseDto {
38
38
 
39
39
  #insightsEnabled: boolean;
40
40
  #language: InsightLanguage;
41
- #cards: InsightDto[];
41
+ #cards: InsightDto[] | null;
42
42
  #lastGeneratedOn: string | null;
43
43
 
44
- constructor(insightsEnabled: boolean, language: InsightLanguage, cards: InsightDto[], lastGeneratedOn: string | null) {
44
+ constructor(insightsEnabled: boolean, language: InsightLanguage, cards: InsightDto[] | null, lastGeneratedOn: string | null) {
45
45
  this.#insightsEnabled = insightsEnabled;
46
46
  this.#language = language;
47
47
  this.#cards = cards;
@@ -1,16 +1,15 @@
1
- import { type BaseResponse, BaseService, type Paginated, QueryString } from '@basmilius/http-client';
1
+ import { type BaseResponse, BaseService, type Paginated } from '@basmilius/http-client';
2
2
  import { MerchantAdapter } from '#data/adapter';
3
3
  import { MerchantDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class AdminMerchantsService extends BaseService {
6
- async get(offset: number, limit: number): Promise<BaseResponse<Paginated<MerchantDto>>> {
8
+ async get(params: ListParams): Promise<BaseResponse<Paginated<MerchantDto>>> {
7
9
  return await this
8
10
  .request('/admin/merchants')
9
11
  .method('get')
10
- .queryString(QueryString.builder()
11
- .append('language', 'nl')
12
- .append('offset', offset)
13
- .append('limit', limit))
12
+ .queryString(buildListQuery(params))
14
13
  .bearerToken()
15
14
  .runPaginatedAdapter(MerchantAdapter.parseMerchant);
16
15
  }
@@ -1,6 +1,8 @@
1
1
  import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
2
  import { BuyerAdapter, OrderAdapter } from '#data/adapter';
3
3
  import type { BuyerDto, OrderDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantBuyerService extends BaseService {
6
8
  async get(merchantId: string, buyerId: string): Promise<BaseResponse<BuyerDto>> {
@@ -23,15 +25,12 @@ export class MerchantBuyerService extends BaseService {
23
25
  .runAdapter(OrderAdapter.parseOrder);
24
26
  }
25
27
 
26
- async getOrders(merchantId: string, buyerId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<OrderDto>>> {
28
+ async getOrders(merchantId: string, buyerId: string, params: ListParams): Promise<BaseResponse<Paginated<OrderDto>>> {
27
29
  return await this
28
30
  .request(`/merchants/${merchantId}/buyers/${buyerId}/orders`)
29
31
  .method('get')
30
32
  .bearerToken()
31
- .queryString(QueryString.builder()
32
- .append('language', 'nl')
33
- .append('offset', offset)
34
- .append('limit', limit))
33
+ .queryString(buildListQuery(params))
35
34
  .runPaginatedAdapter(OrderAdapter.parseOrder);
36
35
  }
37
36
  }
@@ -1,16 +1,15 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { BuyerAdapter } from '#data/adapter';
3
3
  import type { BuyerDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantBuyersService extends BaseService {
6
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<BuyerDto>>> {
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<BuyerDto>>> {
7
9
  return await this
8
10
  .request(`/merchants/${merchantId}/buyers`)
9
11
  .method('get')
10
- .queryString(QueryString.builder()
11
- .append('language', 'nl')
12
- .append('offset', offset)
13
- .append('limit', limit))
12
+ .queryString(buildListQuery(params))
14
13
  .bearerToken()
15
14
  .runPaginatedAdapter(BuyerAdapter.parseBuyer);
16
15
  }
@@ -1,18 +1,17 @@
1
1
  import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
2
  import { MerchantAdapter } from '#data/adapter';
3
3
  import type { ContractDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
  import type { DateTime } from 'luxon';
5
7
 
6
8
  export class MerchantContractService extends BaseService {
7
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<ContractDto>>> {
9
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<ContractDto>>> {
8
10
  return await this
9
11
  .request(`/merchants/${merchantId}/contracts`)
10
12
  .method('get')
11
13
  .bearerToken()
12
- .queryString(QueryString.builder()
13
- .append('language', 'nl')
14
- .append('offset', offset)
15
- .append('limit', limit))
14
+ .queryString(buildListQuery(params))
16
15
  .runPaginatedAdapter(MerchantAdapter.parseContract);
17
16
  }
18
17
 
@@ -2,24 +2,16 @@ import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/ht
2
2
  import type { DateTime } from 'luxon';
3
3
  import { DiscountCodeAdapter } from '#data/adapter';
4
4
  import type { DiscountCodeDto } from '#data/dto';
5
- import type { DiscountCodeType } from '#data/types';
5
+ import type { DiscountCodeType, ListParams } from '#data/types';
6
+ import { buildListQuery } from '#data/util';
6
7
 
7
8
  export class MerchantDiscountCodesService extends BaseService {
8
- async get(merchantId: string, offset: number, limit: number, eventId: string | null = null): Promise<BaseResponse<Paginated<DiscountCodeDto>>> {
9
- const qs = QueryString.builder()
10
- .append('language', 'nl')
11
- .append('offset', offset)
12
- .append('limit', limit);
13
-
14
- if (eventId !== null) {
15
- qs.append('event_id', eventId);
16
- }
17
-
9
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<DiscountCodeDto>>> {
18
10
  return await this
19
11
  .request(`/merchants/${merchantId}/discount-codes`)
20
12
  .method('get')
21
13
  .bearerToken()
22
- .queryString(qs)
14
+ .queryString(buildListQuery(params))
23
15
  .runPaginatedAdapter(DiscountCodeAdapter.parseDiscountCode);
24
16
  }
25
17
 
@@ -1,17 +1,16 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { EmailTemplateAdapter } from '#data/adapter';
3
3
  import type { EmailTemplateDto } from '#data/dto';
4
- import type { EmailTemplateLanguage, EmailTemplateType } from '#data/types';
4
+ import type { EmailTemplateLanguage, EmailTemplateType, ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
5
6
 
6
7
  export class MerchantEmailTemplatesService extends BaseService {
7
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<EmailTemplateDto>>> {
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<EmailTemplateDto>>> {
8
9
  return await this
9
10
  .request(`/merchants/${merchantId}/email-templates`)
10
11
  .method('get')
11
12
  .bearerToken()
12
- .queryString(QueryString.builder()
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .runPaginatedAdapter(EmailTemplateAdapter.parseEmailTemplate);
16
15
  }
17
16
 
@@ -1,17 +1,16 @@
1
1
  import { type BaseResponse, BaseService, type Paginated, QueryString } from '@basmilius/http-client';
2
2
  import { EventAdapter } from '#data/adapter';
3
3
  import type { AppTeamDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantEventAppTeamsService extends BaseService {
6
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<AppTeamDto>>> {
8
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<AppTeamDto>>> {
7
9
  return await this
8
10
  .request(`/merchants/${merchantId}/events/${eventId}/app-teams`)
9
11
  .method('get')
10
12
  .bearerToken()
11
- .queryString(QueryString.builder()
12
- .append('language', 'nl')
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .runPaginatedAdapter(EventAdapter.parseAppTeam);
16
15
  }
17
16
 
@@ -1,17 +1,16 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { EmailTemplateAdapter } from '#data/adapter';
3
3
  import type { EmailTemplateDto } from '#data/dto';
4
- import type { EmailTemplateLanguage, EmailTemplateType } from '#data/types';
4
+ import type { EmailTemplateLanguage, EmailTemplateType, ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
5
6
 
6
7
  export class MerchantEventEmailTemplatesService extends BaseService {
7
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<EmailTemplateDto>>> {
8
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<EmailTemplateDto>>> {
8
9
  return await this
9
10
  .request(`/merchants/${merchantId}/events/${eventId}/email-templates`)
10
11
  .method('get')
11
12
  .bearerToken()
12
- .queryString(QueryString.builder()
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .runPaginatedAdapter(EmailTemplateAdapter.parseEmailTemplate);
16
15
  }
17
16
 
@@ -3,17 +3,16 @@ import type { FluxFormSelectEntry } from '@flux-ui/types';
3
3
  import type { DateTime } from 'luxon';
4
4
  import { FluxAdapter, ProductAdapter } from '#data/adapter';
5
5
  import type { ProductDto } from '#data/dto';
6
+ import type { ListParams } from '#data/types';
7
+ import { buildListQuery } from '#data/util';
6
8
 
7
9
  export class MerchantEventProductsService extends BaseService {
8
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<ProductDto>>> {
10
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<ProductDto>>> {
9
11
  return await this
10
12
  .request(`/merchants/${merchantId}/events/${eventId}/products`)
11
13
  .method('get')
12
14
  .bearerToken()
13
- .queryString(QueryString.builder()
14
- .append('language', 'nl')
15
- .append('offset', offset)
16
- .append('limit', limit))
15
+ .queryString(buildListQuery(params))
17
16
  .runPaginatedAdapter(ProductAdapter.parseProduct);
18
17
  }
19
18
 
@@ -2,16 +2,15 @@ import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/ht
2
2
  import type { DateTime } from 'luxon';
3
3
  import { CommonAdapter, EventAdapter } from '#data/adapter';
4
4
  import type { ShopDto, StatusResponseDto } from '#data/dto';
5
+ import type { ListParams } from '#data/types';
6
+ import { buildListQuery } from '#data/util';
5
7
 
6
8
  export class MerchantEventShopsService extends BaseService {
7
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<ShopDto>>> {
9
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<ShopDto>>> {
8
10
  return await this
9
11
  .request(`/merchants/${merchantId}/events/${eventId}/shops`)
10
12
  .method('get')
11
- .queryString(QueryString.builder()
12
- .append('language', 'nl')
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .bearerToken()
16
15
  .runPaginatedAdapter(EventAdapter.parseShop);
17
16
  }
@@ -2,16 +2,15 @@ import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/ht
2
2
  import type { FluxFormSelectEntry } from '@flux-ui/types';
3
3
  import { EventAdapter, FluxAdapter } from '#data/adapter';
4
4
  import type { StockOverviewDto, StockPoolDto } from '#data/dto';
5
+ import type { ListParams } from '#data/types';
6
+ import { buildListQuery } from '#data/util';
5
7
 
6
8
  export class MerchantEventStockPoolsService extends BaseService {
7
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<StockPoolDto>>> {
9
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<StockPoolDto>>> {
8
10
  return await this
9
11
  .request(`/merchants/${merchantId}/events/${eventId}/stock-pools`)
10
12
  .method('get')
11
- .queryString(QueryString.builder()
12
- .append('language', 'nl')
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .bearerToken()
16
15
  .runPaginatedAdapter(EventAdapter.parseStockPool);
17
16
  }
@@ -2,18 +2,15 @@ import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/ht
2
2
  import type { FluxFormSelectEntry } from '@flux-ui/types';
3
3
  import { EventAdapter, FluxAdapter } from '#data/adapter';
4
4
  import type { TicketTemplateDto } from '#data/dto';
5
- import type { TicketTemplateType } from '#data/types';
6
- import { jsonBlob } from '#data/util';
5
+ import type { ListParams, TicketTemplateType } from '#data/types';
6
+ import { buildListQuery, jsonBlob } from '#data/util';
7
7
 
8
8
  export class MerchantEventTicketTemplatesService extends BaseService {
9
- async get(merchantId: string, eventId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<TicketTemplateDto>>> {
9
+ async get(merchantId: string, eventId: string, params: ListParams): Promise<BaseResponse<Paginated<TicketTemplateDto>>> {
10
10
  return await this
11
11
  .request(`/merchants/${merchantId}/events/${eventId}/ticket-templates`)
12
12
  .method('get')
13
- .queryString(QueryString.builder()
14
- .append('language', 'nl')
15
- .append('offset', offset)
16
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
17
14
  .bearerToken()
18
15
  .runPaginatedAdapter(EventAdapter.parseTicketTemplate);
19
16
  }
@@ -1,6 +1,7 @@
1
1
  import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
+ import type { FluxFormSelectEntry } from '@flux-ui/types';
2
3
  import type { DateTime } from 'luxon';
3
- import { EventAdapter } from '#data/adapter';
4
+ import { EventAdapter, FluxAdapter } from '#data/adapter';
4
5
  import type { TimeSlotDto } from '#data/dto';
5
6
 
6
7
  export class MerchantEventTimeSlotsService extends BaseService {
@@ -16,6 +17,18 @@ export class MerchantEventTimeSlotsService extends BaseService {
16
17
  .runPaginatedAdapter(EventAdapter.parseTimeSlot);
17
18
  }
18
19
 
20
+ async getSelectOptions(merchantId: string, eventId: string, searchQuery: string | null = null, ids: string[] | null = null): Promise<BaseResponse<FluxFormSelectEntry[]>> {
21
+ return await this
22
+ .request(`/merchants/${merchantId}/events/${eventId}/time-slots/select-options`)
23
+ .method('get')
24
+ .queryString(QueryString.builder()
25
+ .append('language', 'nl')
26
+ .appendArray('ids[]', ids)
27
+ .append('searchQuery', searchQuery))
28
+ .bearerToken()
29
+ .runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
30
+ }
31
+
19
32
  async create(merchantId: string, eventId: string, fromTime: DateTime, toTime: DateTime, label: string | null = null): Promise<BaseResponse<TimeSlotDto>> {
20
33
  return await this
21
34
  .request(`/merchants/${merchantId}/events/${eventId}/time-slots`)
@@ -1,19 +1,31 @@
1
1
  import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
+ import type { FluxFormSelectEntry } from '@flux-ui/types';
2
3
  import type { DateTime } from 'luxon';
3
- import { EventAdapter } from '#data/adapter';
4
+ import { EventAdapter, FluxAdapter } from '#data/adapter';
4
5
  import type { EventDto } from '#data/dto';
6
+ import type { ListParams } from '#data/types';
7
+ import { buildListQuery } from '#data/util';
5
8
 
6
9
  export class MerchantEventsService extends BaseService {
7
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<EventDto>>> {
10
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<EventDto>>> {
8
11
  return await this
9
12
  .request(`/merchants/${merchantId}/events`)
10
13
  .method('get')
11
14
  .bearerToken()
15
+ .queryString(buildListQuery(params))
16
+ .runPaginatedAdapter(EventAdapter.parseEvent);
17
+ }
18
+
19
+ async getSelectOptions(merchantId: string, searchQuery: string | null = null, ids: string[] | null = null): Promise<BaseResponse<FluxFormSelectEntry[]>> {
20
+ return await this
21
+ .request(`/merchants/${merchantId}/events/select-options`)
22
+ .method('get')
12
23
  .queryString(QueryString.builder()
13
24
  .append('language', 'nl')
14
- .append('offset', offset)
15
- .append('limit', limit))
16
- .runPaginatedAdapter(EventAdapter.parseEvent);
25
+ .appendArray('ids[]', ids)
26
+ .append('searchQuery', searchQuery))
27
+ .bearerToken()
28
+ .runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
17
29
  }
18
30
 
19
31
  async post(merchantId: string, name: string, description: string, startsOn: DateTime, endsOn: DateTime, minimumAge: number): Promise<BaseResponse<EventDto>> {
@@ -1,17 +1,16 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { FinanceAdapter } from '#data/adapter';
3
3
  import type { InvoiceDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantFinanceInvoicesService extends BaseService {
6
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<InvoiceDto>>> {
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<InvoiceDto>>> {
7
9
  return await this
8
10
  .request(`/merchants/${merchantId}/finance/invoices`)
9
11
  .method('get')
10
12
  .bearerToken()
11
- .queryString(QueryString.builder()
12
- .append('language', 'nl')
13
- .append('offset', offset)
14
- .append('limit', limit))
13
+ .queryString(buildListQuery(params))
15
14
  .runPaginatedAdapter(FinanceAdapter.parseInvoice);
16
15
  }
17
16
  }
@@ -1,25 +1,15 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { OrderAdapter } from '#data/adapter';
3
3
  import type { OrderDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantOrdersService extends BaseService {
6
- async get(merchantId: string, offset: number, limit: number, filter?: Record<string, string | number | boolean>): Promise<BaseResponse<Paginated<OrderDto>>> {
7
- const query = QueryString
8
- .builder()
9
- .append('language', 'nl')
10
- .append('offset', offset)
11
- .append('limit', limit);
12
-
13
- if (filter) {
14
- Object
15
- .entries(filter)
16
- .forEach(([key, value]) => query.append(key, value));
17
- }
18
-
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<OrderDto>>> {
19
9
  return await this
20
10
  .request(`/merchants/${merchantId}/orders`)
21
11
  .method('get')
22
- .queryString(query)
12
+ .queryString(buildListQuery(params))
23
13
  .bearerToken()
24
14
  .runPaginatedAdapter(OrderAdapter.parseOrder);
25
15
  }
@@ -1,16 +1,15 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { EventAdapter } from '#data/adapter';
3
3
  import type { ShopDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantShopsService extends BaseService {
6
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<ShopDto>>> {
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<ShopDto>>> {
7
9
  return await this
8
10
  .request(`/merchants/${merchantId}/shops`)
9
11
  .method('get')
10
- .queryString(QueryString.builder()
11
- .append('language', 'nl')
12
- .append('offset', offset)
13
- .append('limit', limit))
12
+ .queryString(buildListQuery(params))
14
13
  .bearerToken()
15
14
  .runPaginatedAdapter(EventAdapter.parseShop);
16
15
  }
@@ -1,25 +1,15 @@
1
- import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
1
+ import { BaseResponse, BaseService, Paginated } from '@basmilius/http-client';
2
2
  import { TicketAdapter } from '#data/adapter';
3
3
  import type { TicketDto } from '#data/dto';
4
+ import type { ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
4
6
 
5
7
  export class MerchantTicketsService extends BaseService {
6
- async get(merchantId: string, offset: number, limit: number, filter?: Record<string, string | number | boolean>): Promise<BaseResponse<Paginated<TicketDto>>> {
7
- const query = QueryString
8
- .builder()
9
- .append('language', 'nl')
10
- .append('offset', offset)
11
- .append('limit', limit);
12
-
13
- if (filter) {
14
- Object
15
- .entries(filter)
16
- .forEach(([key, value]) => query.append(key, value));
17
- }
18
-
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<TicketDto>>> {
19
9
  return await this
20
10
  .request(`/merchants/${merchantId}/tickets`)
21
11
  .method('get')
22
- .queryString(query)
12
+ .queryString(buildListQuery(params))
23
13
  .bearerToken()
24
14
  .runPaginatedAdapter(TicketAdapter.parseTicket);
25
15
  }
@@ -1,17 +1,15 @@
1
1
  import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
2
2
  import { MerchantAdapter } from '#data/adapter';
3
3
  import type { InvitationDto, MerchantUserDto } from '#data/dto';
4
- import type { Claim } from '#data/types';
4
+ import type { Claim, ListParams } from '#data/types';
5
+ import { buildListQuery } from '#data/util';
5
6
 
6
7
  export class MerchantUsersService extends BaseService {
7
- async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<MerchantUserDto>>> {
8
+ async get(merchantId: string, params: ListParams): Promise<BaseResponse<Paginated<MerchantUserDto>>> {
8
9
  return await this
9
10
  .request(`/merchants/${merchantId}/users`)
10
11
  .method('get')
11
- .queryString(QueryString.builder()
12
- .append('language', 'nl')
13
- .append('offset', offset)
14
- .append('limit', limit))
12
+ .queryString(buildListQuery(params))
15
13
  .bearerToken()
16
14
  .runPaginatedAdapter(MerchantAdapter.parseMerchantUser);
17
15
  }