tonightpass 0.0.26 → 0.0.28

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,133 +0,0 @@
1
- import { sdk } from "./builder";
2
- import {
3
- CreateOrganizationDto,
4
- CreateOrganizationEventDto,
5
- CreateOrganizationEventTicketDto,
6
- UpdateOrganizationDto,
7
- UpdateOrganizationEventTicketDto,
8
- } from "../rest";
9
- import { isBrowser } from "../utils";
10
-
11
- export const organizations = sdk((client) => ({
12
- getAll: async () => client.get("/organizations"),
13
- get: async (slug: string) => client.get("/organizations/:slug", { slug }),
14
- create: async (data: CreateOrganizationDto) =>
15
- client.post("/organizations", data),
16
- update: async (slug: string, data: UpdateOrganizationDto) =>
17
- client.put("/organizations/:slug", data, { slug }),
18
- delete: async (slug: string) =>
19
- client.delete("/organizations/:slug", null, { slug }),
20
- members: {
21
- getAll: async () => client.get("/organizations/members"),
22
- delete: async (id: string) =>
23
- client.delete("/organizations/members/:id", null, { id }),
24
- },
25
- events: {
26
- getAll: async (organizationSlug: string) =>
27
- client.get("/organizations/:organizationSlug/events", {
28
- organizationSlug,
29
- }),
30
- get: async (organizationSlug: string, eventSlug: string) =>
31
- client.get("/organizations/:organizationSlug/events/:eventSlug", {
32
- organizationSlug,
33
- eventSlug,
34
- }),
35
- create: async (
36
- organizationSlug: string,
37
- data: CreateOrganizationEventDto,
38
- ) =>
39
- client.post("/organizations/:organizationSlug/events", data, {
40
- organizationSlug,
41
- }),
42
- update: async (
43
- organizationSlug: string,
44
- eventSlug: string,
45
- data: CreateOrganizationEventDto,
46
- ) =>
47
- client.put("/organizations/:organizationSlug/events/:eventSlug", data, {
48
- organizationSlug,
49
- eventSlug,
50
- }),
51
- delete: async (organizationSlug: string, eventSlug: string) =>
52
- client.delete(
53
- "/organizations/:organizationSlug/events/:eventSlug",
54
- null,
55
- {
56
- organizationSlug,
57
- eventSlug,
58
- },
59
- ),
60
- tickets: {
61
- getAll: async (slug: string, eventSlug: string) =>
62
- client.get("/organizations/:slug/events/:eventSlug/tickets", {
63
- slug,
64
- eventSlug,
65
- }),
66
- get: async (slug: string, eventSlug: string, ticketId: string) =>
67
- client.get("/organizations/:slug/events/:eventSlug/tickets/:ticketId", {
68
- slug,
69
- eventSlug,
70
- ticketId,
71
- }),
72
- create: async (
73
- slug: string,
74
- eventSlug: string,
75
- data: CreateOrganizationEventTicketDto,
76
- ) =>
77
- client.post("/organizations/:slug/events/:eventSlug/tickets", data, {
78
- slug,
79
- eventSlug,
80
- }),
81
- update: async (
82
- slug: string,
83
- eventSlug: string,
84
- ticketId: string,
85
- data: UpdateOrganizationEventTicketDto,
86
- ) =>
87
- client.put(
88
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
89
- data,
90
- {
91
- slug,
92
- eventSlug,
93
- ticketId,
94
- },
95
- ),
96
- delete: async (slug: string, eventSlug: string, ticketId: string) =>
97
- client.delete(
98
- "/organizations/:slug/events/:eventSlug/tickets/:ticketId",
99
- null,
100
- {
101
- slug,
102
- eventSlug,
103
- ticketId,
104
- },
105
- ),
106
- },
107
- },
108
- billing: {
109
- account: async (slug: string) =>
110
- client.get("/organizations/:slug/billing/account", { slug }),
111
- link: (slug: string) => {
112
- if (isBrowser) {
113
- window.location.href = client.url("/organizations/:slug/billing/link", {
114
- slug,
115
- });
116
- } else {
117
- throw new Error("Billing link is only available in the browser");
118
- }
119
- },
120
- dashboard: (slug: string) => {
121
- if (isBrowser) {
122
- window.location.href = client.url(
123
- "/organizations/:slug/billing/dashboard",
124
- {
125
- slug,
126
- },
127
- );
128
- } else {
129
- throw new Error("Billing dashboard is only available in the browser");
130
- }
131
- },
132
- },
133
- }));