Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 388d340

Browse files
feat: meta type to subscriber, subscription filter type (#916)
1 parent 406054e commit 388d340

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed

src/types/subscription-subscribers.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ import {
88
CrudQueryableResource
99
} from './core'
1010

11+
interface SubscriptionSubscriberMeta {
12+
owner: string,
13+
timestamps: {
14+
canceled_at: string | null,
15+
created_at: string,
16+
updated_at: string
17+
}
18+
}
19+
1120
/**
1221
* Core Subscription Subscriber Base Interface
1322
* For custom flows, extend this interface
@@ -20,8 +29,8 @@ export interface SubscriptionSubscriberBase {
2029
name: string
2130
email: string
2231
}
32+
meta: SubscriptionSubscriberMeta
2333
}
24-
2534
export interface SubscriptionSubscriber extends Identifiable, SubscriptionSubscriberBase {
2635

2736
}

src/types/subscriptions.d.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,42 @@ import {
1717
export interface SubscriptionBase {
1818
type: "subscription",
1919
attributes: {
20-
account_id: string,
20+
external_ref?: string,
21+
account_id: string
2122
offering: {
2223
id: string
23-
type: "subscription-offering",
24+
type: "subscription_offering"
2425
attributes: {
25-
name: string,
26-
description: string,
27-
updated_at: string,
26+
external_ref?: string
27+
name: string
28+
description: string
29+
updated_at: string
2830
created_at: string
29-
},
30-
relationships: {
31-
plans: {
32-
links: {
33-
related: string,
34-
self: string
35-
},
36-
data: {
37-
type: "offering-plan",
38-
id: string
39-
}
40-
}
31+
canceled_at: string | null
4132
},
4233
meta: {
43-
owner: string
34+
owner: string,
35+
timestamps: {
36+
updated_at: string
37+
created_at: string
38+
canceled_at: string | null
39+
}
4440
}
4541
},
4642
plan_id: string,
4743
currency: string,
48-
updated_at: string,
44+
updated_at: string
4945
created_at: string
5046
},
5147
meta: {
52-
owner: string
48+
owner: string,
49+
status: 'active' | 'inactive'
50+
canceled: boolean
51+
timestamps: {
52+
updated_at: string
53+
created_at: string
54+
canceled_at: string | null
55+
}
5356
}
5457
}
5558

@@ -93,6 +96,12 @@ export interface SubscriptionInvoice extends Identifiable {
9396
}
9497
}
9598

99+
export interface SubscriptionFilter {
100+
eq?: {
101+
account_id?: string
102+
}
103+
}
104+
96105

97106
export interface Subscription extends Identifiable, SubscriptionBase {
98107

@@ -107,10 +116,10 @@ export interface SubscriptionsEndpoint
107116
Subscription,
108117
SubscriptionCreate,
109118
never,
110-
never,
119+
SubscriptionFilter,
111120
never,
112121
never
113-
>, "Filter" | "Limit" | "Offset" | "Sort" | "With" | "Attributes" | "Update" | "Link" > {
122+
>, "Limit" | "Offset" | "Sort" | "With" | "Attributes" | "Update" | "Link" > {
114123
endpoint: 'subscriptions'
115124

116125
GetInvoices(id: string): Promise<Resource<SubscriptionInvoice[]>>

0 commit comments

Comments
 (0)