@rewritetoday/types 1.0.2 → 1.0.3

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,7 +1,7 @@
1
1
  import type { Snowflake } from './resources/globals';
2
2
  import type { APIMessage, MessageStatus, MessageType } from './resources/message';
3
3
  import type { APIOTPMessage } from './resources/otp';
4
- import type { WebhookEventType } from './resources/webhooks';
4
+ import { WebhookEventType } from './resources/webhooks';
5
5
  export interface WebhookBase<Type extends WebhookEventType, Data extends object> {
6
6
  /** Event name. See {@link WebhookEventType}. */
7
7
  type: Type;
@@ -88,3 +88,43 @@ export type WebhookMessageCanceledEvent = WebhookBase<WebhookEventType.MessageCa
88
88
  })>>;
89
89
  /** https://docs.rewritetoday.com/en/webhooks */
90
90
  export type WebhookEvent = WebhookSMSOTPEvent | WebhookMessageSentEvent | WebhookMessageBatchEvent | WebhookMessageQueuedEvent | WebhookMessageDeliveredEvent | WebhookMessageScheduledEvent | WebhookMessageFailedEvent | WebhookMessageCanceledEvent;
91
+ /**
92
+ * Checks whether the event is a {@link WebhookEventType.SMSOTP} or not
93
+ * @param event The event data received from Rewrite
94
+ */
95
+ export declare function isWebhookSMSOTPEvent(event: WebhookEvent): event is WebhookSMSOTPEvent;
96
+ /**
97
+ * Checks whether the event is a {@link WebhookEventType.MessageSent} or not
98
+ * @param event The event data received from Rewrite
99
+ */
100
+ export declare function isWebhookMessageSentEvent(event: WebhookEvent): event is WebhookMessageSentEvent;
101
+ /**
102
+ * Checks whether the event is a {@link WebhookEventType.MessageBatch} or not
103
+ * @param event The event data received from Rewrite
104
+ */
105
+ export declare function isWebhookMessageBatchEvent(event: WebhookEvent): event is WebhookMessageBatchEvent;
106
+ /**
107
+ * Checks whether the event is a {@link WebhookEventType.MessageQueued} or not
108
+ * @param event The event data received from Rewrite
109
+ */
110
+ export declare function isWebhookMessageQueuedEvent(event: WebhookEvent): event is WebhookMessageQueuedEvent;
111
+ /**
112
+ * Checks whether the event is a {@link WebhookEventType.MessageDelivered} or not
113
+ * @param event The event data received from Rewrite
114
+ */
115
+ export declare function isWebhookMessageDeliveredEvent(event: WebhookEvent): event is WebhookMessageDeliveredEvent;
116
+ /**
117
+ * Checks whether the event is a {@link WebhookEventType.MessageScheduled} or not
118
+ * @param event The event data received from Rewrite
119
+ */
120
+ export declare function isWebhookMessageScheduledEvent(event: WebhookEvent): event is WebhookMessageScheduledEvent;
121
+ /**
122
+ * Checks whether the event is a {@link WebhookEventType.MessageFailed} or not
123
+ * @param event The event data received from Rewrite
124
+ */
125
+ export declare function isWebhookMessageFailedEvent(event: WebhookEvent): event is WebhookMessageFailedEvent;
126
+ /**
127
+ * Checks whether the event is a {@link WebhookEventType.MessageCanceled} or not
128
+ * @param event The event data received from Rewrite
129
+ */
130
+ export declare function isWebhookMessageCanceledEvent(event: WebhookEvent): event is WebhookMessageCanceledEvent;
@@ -1 +1,57 @@
1
- export {};
1
+ import { WebhookEventType } from './resources/webhooks';
2
+ /**
3
+ * Checks whether the event is a {@link WebhookEventType.SMSOTP} or not
4
+ * @param event The event data received from Rewrite
5
+ */
6
+ export function isWebhookSMSOTPEvent(event) {
7
+ return event.type === WebhookEventType.SMSOTP;
8
+ }
9
+ /**
10
+ * Checks whether the event is a {@link WebhookEventType.MessageSent} or not
11
+ * @param event The event data received from Rewrite
12
+ */
13
+ export function isWebhookMessageSentEvent(event) {
14
+ return event.type === WebhookEventType.MessageSent;
15
+ }
16
+ /**
17
+ * Checks whether the event is a {@link WebhookEventType.MessageBatch} or not
18
+ * @param event The event data received from Rewrite
19
+ */
20
+ export function isWebhookMessageBatchEvent(event) {
21
+ return event.type === WebhookEventType.MessageBatch;
22
+ }
23
+ /**
24
+ * Checks whether the event is a {@link WebhookEventType.MessageQueued} or not
25
+ * @param event The event data received from Rewrite
26
+ */
27
+ export function isWebhookMessageQueuedEvent(event) {
28
+ return event.type === WebhookEventType.MessageQueued;
29
+ }
30
+ /**
31
+ * Checks whether the event is a {@link WebhookEventType.MessageDelivered} or not
32
+ * @param event The event data received from Rewrite
33
+ */
34
+ export function isWebhookMessageDeliveredEvent(event) {
35
+ return event.type === WebhookEventType.MessageDelivered;
36
+ }
37
+ /**
38
+ * Checks whether the event is a {@link WebhookEventType.MessageScheduled} or not
39
+ * @param event The event data received from Rewrite
40
+ */
41
+ export function isWebhookMessageScheduledEvent(event) {
42
+ return event.type === WebhookEventType.MessageScheduled;
43
+ }
44
+ /**
45
+ * Checks whether the event is a {@link WebhookEventType.MessageFailed} or not
46
+ * @param event The event data received from Rewrite
47
+ */
48
+ export function isWebhookMessageFailedEvent(event) {
49
+ return event.type === WebhookEventType.MessageFailed;
50
+ }
51
+ /**
52
+ * Checks whether the event is a {@link WebhookEventType.MessageCanceled} or not
53
+ * @param event The event data received from Rewrite
54
+ */
55
+ export function isWebhookMessageCanceledEvent(event) {
56
+ return event.type === WebhookEventType.MessageCanceled;
57
+ }
package/dist/version.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Current version of [@rewritetoday/types](https://www.npmjs.com/package/@rewritetoday/types).
3
3
  */
4
- export declare const version: "1.0.2";
4
+ export declare const version: "1.0.3";
5
5
  /**
6
6
  * Current Rewrite API version.
7
7
  */
package/dist/version.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Current version of [@rewritetoday/types](https://www.npmjs.com/package/@rewritetoday/types).
4
4
  */
5
- export const version = '1.0.2';
5
+ export const version = '1.0.3';
6
6
  /**
7
7
  * Current Rewrite API version.
8
8
  */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.2",
2
+ "version": "1.0.3",
3
3
  "name": "@rewritetoday/types",
4
4
  "description": "Official Rewrite API typings that are always up to date",
5
5
  "type": "module",