@marteye/studiojs 1.0.0 → 1.1.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.
@@ -0,0 +1,56 @@
1
+ import { HttpClient } from "../net/http";
2
+ import { Sale } from "../types";
3
+ type SalesListResponse = {
4
+ start: string;
5
+ end: string;
6
+ sales: Sale[];
7
+ };
8
+ export default function create(httpClient: HttpClient): {
9
+ get: (marketId: string, saleId: string) => Promise<Sale>;
10
+ list: (marketId: string, opts: {
11
+ start?: string;
12
+ end?: string;
13
+ }) => Promise<SalesListResponse>;
14
+ update: (marketId: string, saleId: string, data: {
15
+ name?: string;
16
+ recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null;
17
+ defaultProductCode?: string;
18
+ attributeDefaults?: Record<string, any>;
19
+ martEyeId?: string | null;
20
+ marteyeSettings?: {
21
+ description?: string;
22
+ image?: string;
23
+ logo?: string;
24
+ type: "LIVE" | "TIMED";
25
+ location?: string | null;
26
+ descriptionLines?: string[];
27
+ descriptionLink?: string;
28
+ deposit?: number;
29
+ hidePrices?: boolean;
30
+ hideReplay?: boolean;
31
+ labels?: string[];
32
+ tags?: string[];
33
+ details?: Array<{
34
+ markdownBase64: string;
35
+ title: string;
36
+ }>;
37
+ cover?: string;
38
+ primaryColour?: string;
39
+ secondaryColour?: string;
40
+ foregroundColour?: string;
41
+ extensionTime?: number;
42
+ incrementLadder?: Array<{
43
+ max: number;
44
+ increment: number;
45
+ }>;
46
+ hideNav?: boolean;
47
+ signInOverrideLink?: string;
48
+ published?: boolean;
49
+ pin?: boolean;
50
+ cascade?: boolean;
51
+ reportEmail?: string;
52
+ } | null;
53
+ }) => Promise<Sale>;
54
+ };
55
+ export type Sales = ReturnType<typeof create>;
56
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import { HttpClient } from "../net/http";
3
+ export default function create(_: HttpClient): {
4
+ /***
5
+ * This is used to construct the webhook event from the request body
6
+ * @param body the request body
7
+ * @param signature the signature of the request taken from the header
8
+ * @param endpointSecret the pre-shared secret
9
+ * @returns the webhook event
10
+ */
11
+ constructEvent: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
12
+ };
13
+ export type Webhooks = ReturnType<typeof create>;
@@ -0,0 +1,115 @@
1
+ /// <reference types="node" />
2
+ import { HttpClient } from "./net/http";
3
+ export default function resources(httpClient: HttpClient): {
4
+ markets: {
5
+ get: (marketId: string) => Promise<import("./types").Market>;
6
+ };
7
+ sales: {
8
+ get: (marketId: string, saleId: string) => Promise<import("./types").Sale>;
9
+ list: (marketId: string, opts: {
10
+ start?: string | undefined;
11
+ end?: string | undefined;
12
+ }) => Promise<{
13
+ start: string;
14
+ end: string;
15
+ sales: import("./types").Sale[];
16
+ }>;
17
+ update: (marketId: string, saleId: string, data: {
18
+ name?: string | undefined;
19
+ recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null | undefined;
20
+ defaultProductCode?: string | undefined;
21
+ attributeDefaults?: Record<string, any> | undefined;
22
+ martEyeId?: string | null | undefined;
23
+ marteyeSettings?: {
24
+ description?: string | undefined;
25
+ image?: string | undefined;
26
+ logo?: string | undefined;
27
+ type: "LIVE" | "TIMED";
28
+ location?: string | null | undefined;
29
+ descriptionLines?: string[] | undefined;
30
+ descriptionLink?: string | undefined;
31
+ deposit?: number | undefined;
32
+ hidePrices?: boolean | undefined;
33
+ hideReplay?: boolean | undefined;
34
+ labels?: string[] | undefined;
35
+ tags?: string[] | undefined;
36
+ details?: {
37
+ markdownBase64: string;
38
+ title: string;
39
+ }[] | undefined;
40
+ cover?: string | undefined;
41
+ primaryColour?: string | undefined;
42
+ secondaryColour?: string | undefined;
43
+ foregroundColour?: string | undefined;
44
+ extensionTime?: number | undefined;
45
+ incrementLadder?: {
46
+ max: number;
47
+ increment: number;
48
+ }[] | undefined;
49
+ hideNav?: boolean | undefined;
50
+ signInOverrideLink?: string | undefined;
51
+ published?: boolean | undefined;
52
+ pin?: boolean | undefined;
53
+ cascade?: boolean | undefined;
54
+ reportEmail?: string | undefined;
55
+ } | null | undefined;
56
+ }) => Promise<import("./types").Sale>;
57
+ };
58
+ lots: {
59
+ get: (marketId: string, saleId: string, lotId: string) => Promise<import("./types").Lot>;
60
+ list: (marketId: string, saleId: string) => Promise<import("./types").Lot[]>;
61
+ create: (marketId: string, saleId: string, data: {
62
+ index?: number | undefined;
63
+ lotNumber?: string | undefined;
64
+ group?: string | undefined;
65
+ productCode?: string | undefined;
66
+ sellerCustomerId?: string | undefined;
67
+ attributes?: Record<string, any> | undefined;
68
+ metadata?: Record<string, any> | undefined;
69
+ buyerCustomerId?: string | undefined;
70
+ unitPriceInCents?: number | undefined;
71
+ startedAt?: string | undefined;
72
+ endedAt?: string | undefined;
73
+ previousLotNumber?: string | undefined;
74
+ }) => Promise<import("./types").Lot>;
75
+ update: (marketId: string, saleId: string, lotId: string, data: {
76
+ productCode?: string | undefined;
77
+ attributes?: Record<string, any> | undefined;
78
+ sellerCasual?: string | null | undefined;
79
+ sellerCustomerId?: string | null | undefined;
80
+ lotNumber?: string | null | undefined;
81
+ remarks?: string | undefined;
82
+ notes?: string | undefined;
83
+ unitOfSale?: "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG" | undefined;
84
+ unitPriceInCents?: number | undefined;
85
+ buyerCasual?: string | null | undefined;
86
+ buyerCustomerId?: string | null | undefined;
87
+ startedAt?: string | null | undefined;
88
+ endedAt?: string | null | undefined;
89
+ saleStatus?: "Sold" | "Unsold" | "Rerun" | "Resold" | null | undefined;
90
+ metadata?: Record<string, any> | undefined;
91
+ }) => Promise<import("./types").Lot>;
92
+ delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
93
+ };
94
+ lotitems: {
95
+ create: (marketId: string, saleId: string, lotId: string, data: {
96
+ attributes?: Record<string, any> | undefined;
97
+ notes?: {
98
+ text: string;
99
+ }[] | undefined;
100
+ metadata?: Record<string, any> | undefined;
101
+ }) => Promise<import("./types").LotItem>;
102
+ update: (marketId: string, saleId: string, lotId: string, itemId: string, data: {
103
+ attributes?: Record<string, any> | undefined;
104
+ index?: number | undefined;
105
+ metadata?: Record<string, any> | undefined;
106
+ }) => Promise<import("./types").LotItem>;
107
+ delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
108
+ };
109
+ webhooks: {
110
+ constructEvent: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
111
+ };
112
+ actions: {
113
+ constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
114
+ };
115
+ };
@@ -0,0 +1,115 @@
1
+ /// <reference types="node" />
2
+ export declare function Studio(apiKey: string, baseUrl?: string, defaultTimeout?: number, debug?: boolean): {
3
+ isDebugMode: boolean;
4
+ markets: {
5
+ get: (marketId: string) => Promise<import("./types").Market>;
6
+ };
7
+ sales: {
8
+ get: (marketId: string, saleId: string) => Promise<import("./types").Sale>;
9
+ list: (marketId: string, opts: {
10
+ start?: string | undefined;
11
+ end?: string | undefined;
12
+ }) => Promise<{
13
+ start: string;
14
+ end: string;
15
+ sales: import("./types").Sale[];
16
+ }>;
17
+ update: (marketId: string, saleId: string, data: {
18
+ name?: string | undefined;
19
+ recurring?: "Weekly" | "Bi-weekly" | "Monthly" | null | undefined;
20
+ defaultProductCode?: string | undefined;
21
+ attributeDefaults?: Record<string, any> | undefined;
22
+ martEyeId?: string | null | undefined;
23
+ marteyeSettings?: {
24
+ description?: string | undefined;
25
+ image?: string | undefined;
26
+ logo?: string | undefined;
27
+ type: "LIVE" | "TIMED";
28
+ location?: string | null | undefined;
29
+ descriptionLines?: string[] | undefined;
30
+ descriptionLink?: string | undefined;
31
+ deposit?: number | undefined;
32
+ hidePrices?: boolean | undefined;
33
+ hideReplay?: boolean | undefined;
34
+ labels?: string[] | undefined;
35
+ tags?: string[] | undefined;
36
+ details?: {
37
+ markdownBase64: string;
38
+ title: string;
39
+ }[] | undefined;
40
+ cover?: string | undefined;
41
+ primaryColour?: string | undefined;
42
+ secondaryColour?: string | undefined;
43
+ foregroundColour?: string | undefined;
44
+ extensionTime?: number | undefined;
45
+ incrementLadder?: {
46
+ max: number;
47
+ increment: number;
48
+ }[] | undefined;
49
+ hideNav?: boolean | undefined;
50
+ signInOverrideLink?: string | undefined;
51
+ published?: boolean | undefined;
52
+ pin?: boolean | undefined;
53
+ cascade?: boolean | undefined;
54
+ reportEmail?: string | undefined;
55
+ } | null | undefined;
56
+ }) => Promise<import("./types").Sale>;
57
+ };
58
+ lots: {
59
+ get: (marketId: string, saleId: string, lotId: string) => Promise<import("./types").Lot>;
60
+ list: (marketId: string, saleId: string) => Promise<import("./types").Lot[]>;
61
+ create: (marketId: string, saleId: string, data: {
62
+ index?: number | undefined;
63
+ lotNumber?: string | undefined;
64
+ group?: string | undefined;
65
+ productCode?: string | undefined;
66
+ sellerCustomerId?: string | undefined;
67
+ attributes?: Record<string, any> | undefined;
68
+ metadata?: Record<string, any> | undefined;
69
+ buyerCustomerId?: string | undefined;
70
+ unitPriceInCents?: number | undefined;
71
+ startedAt?: string | undefined;
72
+ endedAt?: string | undefined;
73
+ previousLotNumber?: string | undefined;
74
+ }) => Promise<import("./types").Lot>;
75
+ update: (marketId: string, saleId: string, lotId: string, data: {
76
+ productCode?: string | undefined;
77
+ attributes?: Record<string, any> | undefined;
78
+ sellerCasual?: string | null | undefined;
79
+ sellerCustomerId?: string | null | undefined;
80
+ lotNumber?: string | null | undefined;
81
+ remarks?: string | undefined;
82
+ notes?: string | undefined;
83
+ unitOfSale?: "Per KG" | "Per Item" | "Per Lot" | "Per 1000KG" | undefined;
84
+ unitPriceInCents?: number | undefined;
85
+ buyerCasual?: string | null | undefined;
86
+ buyerCustomerId?: string | null | undefined;
87
+ startedAt?: string | null | undefined;
88
+ endedAt?: string | null | undefined;
89
+ saleStatus?: "Sold" | "Unsold" | "Rerun" | "Resold" | null | undefined;
90
+ metadata?: Record<string, any> | undefined;
91
+ }) => Promise<import("./types").Lot>;
92
+ delete: (marketId: string, saleId: string, lotId: string) => Promise<unknown>;
93
+ };
94
+ lotitems: {
95
+ create: (marketId: string, saleId: string, lotId: string, data: {
96
+ attributes?: Record<string, any> | undefined;
97
+ notes?: {
98
+ text: string;
99
+ }[] | undefined;
100
+ metadata?: Record<string, any> | undefined;
101
+ }) => Promise<import("./types").LotItem>;
102
+ update: (marketId: string, saleId: string, lotId: string, itemId: string, data: {
103
+ attributes?: Record<string, any> | undefined;
104
+ index?: number | undefined;
105
+ metadata?: Record<string, any> | undefined;
106
+ }) => Promise<import("./types").LotItem>;
107
+ delete: (marketId: string, saleId: string, lotId: string, itemId: string) => Promise<unknown>;
108
+ };
109
+ webhooks: {
110
+ constructEvent: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
111
+ };
112
+ actions: {
113
+ constructAction: (bodyAsBuffer: Buffer, signature: string, endpointSecret: string) => Promise<any>;
114
+ };
115
+ };