Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,4 +583,20 @@ export function registerRecoveryModule(
})
}

/**
* Delete email subscription for a single category
* @param query
*/
export function unsubscribeSingle(query: operations['unsubscribe_single']['parameters']['query']) {
return deleteEndpoint(baseUrl, '/v1/subscriptions', { query })
}

/**
* Delete email subscription for all categories
* @param query
*/
export function unsubscribeAll(query: operations['unsubscribe_all']['parameters']['query']) {
return deleteEndpoint(baseUrl, '/v1/subscriptions/all', { query })
}

/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
48 changes: 47 additions & 1 deletion src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface Responses {

interface Endpoint {
parameters: {
path: Record<string, Primitive>
path: Record<string, Primitive> | null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new endpoints don't contain any path parameters so we have to extend this type.

} | null
}

Expand Down Expand Up @@ -409,6 +409,25 @@ export interface paths extends PathRegistry {
}
}
}
'/v1/subscriptions': {
delete: operations['unsubscribe_single']
parameters: {
path: null
query: {
category: string
token: string
}
}
}
'/v1/subscriptions/all': {
delete: operations['unsubscribe_all']
parameters: {
path: null
query: {
token: string
}
}
}
}

export interface operations {
Expand Down Expand Up @@ -1059,6 +1078,33 @@ export interface operations {
body: RegisterRecoveryModuleRequestBody
}

responses: {
200: {
schema: void
}
}
}
unsubscribe_single: {
parameters: {
query: {
category: string
token: string
}
}

responses: {
200: {
schema: void
}
}
}
unsubscribe_all: {
parameters: {
query: {
token: string
}
}

responses: {
200: {
schema: void
Expand Down