@polar-sh/sdk 0.19.1 → 0.19.2

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 (50) hide show
  1. package/README.md +5 -0
  2. package/docs/sdks/customersessions/README.md +85 -0
  3. package/funcs/customerSessionsCreate.d.ts +16 -0
  4. package/funcs/customerSessionsCreate.d.ts.map +1 -0
  5. package/funcs/customerSessionsCreate.js +100 -0
  6. package/funcs/customerSessionsCreate.js.map +1 -0
  7. package/lib/config.d.ts +2 -2
  8. package/lib/config.js +2 -2
  9. package/models/components/customersession.d.ts +57 -0
  10. package/models/components/customersession.d.ts.map +1 -0
  11. package/models/components/customersession.js +87 -0
  12. package/models/components/customersession.js.map +1 -0
  13. package/models/components/customersessioncreate.d.ts +35 -0
  14. package/models/components/customersessioncreate.d.ts.map +1 -0
  15. package/models/components/customersessioncreate.js +68 -0
  16. package/models/components/customersessioncreate.js.map +1 -0
  17. package/models/components/index.d.ts +2 -0
  18. package/models/components/index.d.ts.map +1 -1
  19. package/models/components/index.js +2 -0
  20. package/models/components/index.js.map +1 -1
  21. package/models/components/oauth2client.js +2 -2
  22. package/models/components/oauth2client.js.map +1 -1
  23. package/models/components/oauth2clientconfiguration.js +2 -2
  24. package/models/components/oauth2clientconfiguration.js.map +1 -1
  25. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  26. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  27. package/models/components/scope.d.ts +3 -0
  28. package/models/components/scope.d.ts.map +1 -1
  29. package/models/components/scope.js +1 -0
  30. package/models/components/scope.js.map +1 -1
  31. package/package.json +1 -1
  32. package/sdk/customersessions.d.ts +12 -0
  33. package/sdk/customersessions.d.ts.map +1 -0
  34. package/sdk/customersessions.js +22 -0
  35. package/sdk/customersessions.js.map +1 -0
  36. package/sdk/sdk.d.ts +3 -0
  37. package/sdk/sdk.d.ts.map +1 -1
  38. package/sdk/sdk.js +5 -0
  39. package/sdk/sdk.js.map +1 -1
  40. package/src/funcs/customerSessionsCreate.ts +132 -0
  41. package/src/lib/config.ts +2 -2
  42. package/src/models/components/customersession.ts +126 -0
  43. package/src/models/components/customersessioncreate.ts +81 -0
  44. package/src/models/components/index.ts +2 -0
  45. package/src/models/components/oauth2client.ts +2 -2
  46. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  47. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  48. package/src/models/components/scope.ts +1 -0
  49. package/src/sdk/customersessions.ts +27 -0
  50. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,81 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Schema for creating a customer session.
13
+ */
14
+ export type CustomerSessionCreate = {
15
+ /**
16
+ * ID of the customer to create a session for.
17
+ */
18
+ customerId: string;
19
+ };
20
+
21
+ /** @internal */
22
+ export const CustomerSessionCreate$inboundSchema: z.ZodType<
23
+ CustomerSessionCreate,
24
+ z.ZodTypeDef,
25
+ unknown
26
+ > = z.object({
27
+ customer_id: z.string(),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ "customer_id": "customerId",
31
+ });
32
+ });
33
+
34
+ /** @internal */
35
+ export type CustomerSessionCreate$Outbound = {
36
+ customer_id: string;
37
+ };
38
+
39
+ /** @internal */
40
+ export const CustomerSessionCreate$outboundSchema: z.ZodType<
41
+ CustomerSessionCreate$Outbound,
42
+ z.ZodTypeDef,
43
+ CustomerSessionCreate
44
+ > = z.object({
45
+ customerId: z.string(),
46
+ }).transform((v) => {
47
+ return remap$(v, {
48
+ customerId: "customer_id",
49
+ });
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace CustomerSessionCreate$ {
57
+ /** @deprecated use `CustomerSessionCreate$inboundSchema` instead. */
58
+ export const inboundSchema = CustomerSessionCreate$inboundSchema;
59
+ /** @deprecated use `CustomerSessionCreate$outboundSchema` instead. */
60
+ export const outboundSchema = CustomerSessionCreate$outboundSchema;
61
+ /** @deprecated use `CustomerSessionCreate$Outbound` instead. */
62
+ export type Outbound = CustomerSessionCreate$Outbound;
63
+ }
64
+
65
+ export function customerSessionCreateToJSON(
66
+ customerSessionCreate: CustomerSessionCreate,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerSessionCreate$outboundSchema.parse(customerSessionCreate),
70
+ );
71
+ }
72
+
73
+ export function customerSessionCreateFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<CustomerSessionCreate, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) => CustomerSessionCreate$inboundSchema.parse(JSON.parse(x)),
79
+ `Failed to parse 'CustomerSessionCreate' from JSON`,
80
+ );
81
+ }
@@ -120,6 +120,8 @@ export * from "./customerordersortproperty.js";
120
120
  export * from "./customerordersubscription.js";
121
121
  export * from "./customerportalcustomer.js";
122
122
  export * from "./customerportaloauthaccount.js";
123
+ export * from "./customersession.js";
124
+ export * from "./customersessioncreate.js";
123
125
  export * from "./customersortproperty.js";
124
126
  export * from "./customersubscription.js";
125
127
  export * from "./customersubscriptionproduct.js";
@@ -128,7 +128,7 @@ export const OAuth2Client$inboundSchema: z.ZodType<
128
128
  grant_types: z.array(GrantTypes$inboundSchema).optional(),
129
129
  response_types: z.array(ResponseTypes$inboundSchema).optional(),
130
130
  scope: z.string().default(
131
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
131
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
132
132
  ),
133
133
  client_name: z.string(),
134
134
  client_uri: z.nullable(z.string()).optional(),
@@ -196,7 +196,7 @@ export const OAuth2Client$outboundSchema: z.ZodType<
196
196
  grantTypes: z.array(GrantTypes$outboundSchema).optional(),
197
197
  responseTypes: z.array(ResponseTypes$outboundSchema).optional(),
198
198
  scope: z.string().default(
199
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
199
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
200
200
  ),
201
201
  clientName: z.string(),
202
202
  clientUri: z.nullable(z.string()).optional(),
@@ -134,7 +134,7 @@ export const OAuth2ClientConfiguration$inboundSchema: z.ZodType<
134
134
  response_types: z.array(OAuth2ClientConfigurationResponseTypes$inboundSchema)
135
135
  .optional(),
136
136
  scope: z.string().default(
137
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
137
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
138
138
  ),
139
139
  client_name: z.string(),
140
140
  client_uri: z.nullable(z.string()).optional(),
@@ -185,7 +185,7 @@ export const OAuth2ClientConfiguration$outboundSchema: z.ZodType<
185
185
  responseTypes: z.array(OAuth2ClientConfigurationResponseTypes$outboundSchema)
186
186
  .optional(),
187
187
  scope: z.string().default(
188
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
188
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
189
189
  ),
190
190
  clientName: z.string(),
191
191
  clientUri: z.nullable(z.string()).optional(),
@@ -138,7 +138,7 @@ export const OAuth2ClientConfigurationUpdate$inboundSchema: z.ZodType<
138
138
  OAuth2ClientConfigurationUpdateResponseTypes$inboundSchema,
139
139
  ).optional(),
140
140
  scope: z.string().default(
141
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
141
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
142
142
  ),
143
143
  client_name: z.string(),
144
144
  client_uri: z.nullable(z.string()).optional(),
@@ -192,7 +192,7 @@ export const OAuth2ClientConfigurationUpdate$outboundSchema: z.ZodType<
192
192
  OAuth2ClientConfigurationUpdateResponseTypes$outboundSchema,
193
193
  ).optional(),
194
194
  scope: z.string().default(
195
- "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
195
+ "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
196
196
  ),
197
197
  clientName: z.string(),
198
198
  clientUri: z.nullable(z.string()).optional(),
@@ -32,6 +32,7 @@ export const Scope = {
32
32
  SubscriptionsWrite: "subscriptions:write",
33
33
  CustomersRead: "customers:read",
34
34
  CustomersWrite: "customers:write",
35
+ CustomerSessionsWrite: "customer_sessions:write",
35
36
  OrdersRead: "orders:read",
36
37
  MetricsRead: "metrics:read",
37
38
  WebhooksRead: "webhooks:read",
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { customerSessionsCreate } from "../funcs/customerSessionsCreate.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as components from "../models/components/index.js";
8
+ import { unwrapAsync } from "../types/fp.js";
9
+
10
+ export class CustomerSessions extends ClientSDK {
11
+ /**
12
+ * Create Customer Session
13
+ *
14
+ * @remarks
15
+ * Create a customer session.
16
+ */
17
+ async create(
18
+ request: components.CustomerSessionCreate,
19
+ options?: RequestOptions,
20
+ ): Promise<components.CustomerSession> {
21
+ return unwrapAsync(customerSessionsCreate(
22
+ this,
23
+ request,
24
+ options,
25
+ ));
26
+ }
27
+ }
package/src/sdk/sdk.ts CHANGED
@@ -9,6 +9,7 @@ import { CheckoutLinks } from "./checkoutlinks.js";
9
9
  import { Checkouts } from "./checkouts.js";
10
10
  import { CustomerPortal } from "./customerportal.js";
11
11
  import { Customers } from "./customers.js";
12
+ import { CustomerSessions } from "./customersessions.js";
12
13
  import { CustomFields } from "./customfields.js";
13
14
  import { Discounts } from "./discounts.js";
14
15
  import { ExternalOrganizations } from "./externalorganizations.js";
@@ -114,4 +115,9 @@ export class Polar extends ClientSDK {
114
115
  get customerPortal(): CustomerPortal {
115
116
  return (this._customerPortal ??= new CustomerPortal(this._options));
116
117
  }
118
+
119
+ private _customerSessions?: CustomerSessions;
120
+ get customerSessions(): CustomerSessions {
121
+ return (this._customerSessions ??= new CustomerSessions(this._options));
122
+ }
117
123
  }