notifications client (#949)
This commit is contained in:
@@ -18,6 +18,7 @@ import AdminShippingProfilesResource from "./shipping-profiles"
|
|||||||
import AdminStoresResource from "./store"
|
import AdminStoresResource from "./store"
|
||||||
import AdminShippingOptionsResource from "./shipping-options"
|
import AdminShippingOptionsResource from "./shipping-options"
|
||||||
import AdminRegionsResource from "./regions"
|
import AdminRegionsResource from "./regions"
|
||||||
|
import AdminNotificationsResource from "./notifications"
|
||||||
|
|
||||||
class Admin extends BaseResource {
|
class Admin extends BaseResource {
|
||||||
public auth = new AdminAuthResource(this.client)
|
public auth = new AdminAuthResource(this.client)
|
||||||
@@ -39,6 +40,7 @@ class Admin extends BaseResource {
|
|||||||
public store = new AdminStoresResource(this.client)
|
public store = new AdminStoresResource(this.client)
|
||||||
public shippingOptions = new AdminShippingOptionsResource(this.client)
|
public shippingOptions = new AdminShippingOptionsResource(this.client)
|
||||||
public regions = new AdminRegionsResource(this.client)
|
public regions = new AdminRegionsResource(this.client)
|
||||||
|
public notifications = new AdminNotificationsResource(this.client)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Admin
|
export default Admin
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import {
|
||||||
|
AdminGetNotificationsParams,
|
||||||
|
AdminNotificationsListRes,
|
||||||
|
AdminNotificationsRes,
|
||||||
|
AdminPostNotificationsNotificationResendReq,
|
||||||
|
} from "@medusajs/medusa"
|
||||||
|
import { ResponsePromise } from "../.."
|
||||||
|
import BaseResource from "../base"
|
||||||
|
|
||||||
|
class AdminNotificationsResource extends BaseResource {
|
||||||
|
list(
|
||||||
|
query: AdminGetNotificationsParams
|
||||||
|
): ResponsePromise<AdminNotificationsListRes> {
|
||||||
|
let path = `/admin/notifications`
|
||||||
|
|
||||||
|
if (query) {
|
||||||
|
const queryString = Object.entries(query).map(([key, value]) => {
|
||||||
|
return `${key}=${value}`
|
||||||
|
})
|
||||||
|
|
||||||
|
path = `/admin/notifications?${queryString.join("&")}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.client.request("GET", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
resend(
|
||||||
|
id: string,
|
||||||
|
payload: AdminPostNotificationsNotificationResendReq
|
||||||
|
): ResponsePromise<AdminNotificationsRes> {
|
||||||
|
const path = `/admin/notifications/${id}/resend`
|
||||||
|
return this.client.request("POST", path, payload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AdminNotificationsResource
|
||||||
@@ -53,6 +53,9 @@ export type AdminNotificationsListRes = {
|
|||||||
notifications: Notification[]
|
notifications: Notification[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminNotificationsRes = PaginatedResponse & {
|
export type AdminNotificationsRes = {
|
||||||
notification: Notification
|
notification: Notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from "./list-notifications"
|
||||||
|
export * from "./resend-notification"
|
||||||
|
|||||||
Reference in New Issue
Block a user