import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.notification.list()
.then(({ notifications, count, limit, offset }) => {
console.log(notifications)
}){
"limit": 123,
"offset": 123,
"count": 123,
"notifications": [
{
"id": "<string>",
"to": "<string>",
"channel": "email",
"template": "<string>",
"provider_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"data": {},
"trigger_type": "order.created",
"resource_id": "<string>",
"resource_type": "order",
"receiver_id": "<string>",
"original_notification_id": "<string>",
"external_id": "<string>"
}
],
"estimate_count": 123
}Retrieve a list of notifications. The notifications can be filtered by fields such as id. The notifications can also be sorted or paginated.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.notification.list()
.then(({ notifications, count, limit, offset }) => {
console.log(notifications)
}){
"limit": 123,
"offset": 123,
"count": 123,
"notifications": [
{
"id": "<string>",
"to": "<string>",
"channel": "email",
"template": "<string>",
"provider_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"data": {},
"trigger_type": "order.created",
"resource_id": "<string>",
"resource_type": "order",
"receiver_id": "<string>",
"original_notification_id": "<string>",
"external_id": "<string>"
}
],
"estimate_count": 123
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Search term to apply on the notification's searchable properties.
Filter by a notification ID.
Filter by a notification channel.
"email"
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Whether to include deleted records in the result.
OK
The paginated list of notifications.
The maximum number of items returned.
The number of items skipped before retrieving the returned items.
The total count of items.
The list of notifications.
Show child attributes
The notification's ID.
Where to send the notification to. For example, if channel is email, this can be an email number.
Through which channel is the notification sent through.
"email"
The ID of the template in a third-party service used as the notification's shape.
The ID of the provider used to send the notification.
The date the notification was created.
Data payload to send with the notification.
What triggered this notification.
"order.created"
The ID of the associated resource. For example, if the notification was triggered because an order was created, this would be the ID of the order.
The type of the resource that triggered the notification.
"order"
The ID of the user or customer that's receiving this notification.
The ID of the original notification, if this notification is resent.
The ID of the notification in an external or third-party system.
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.