File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/commonMain/kotlin/dev/zxilly/notify/sdk Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,19 @@ class Client private constructor(
102102 (resp.body() as Response <Boolean >).body
103103 }
104104
105+ suspend fun unregister (deviceID : String ) = wrap {
106+ if (! isUUID(deviceID)) {
107+ throw Error (" Device ID is not a valid UUID" )
108+ }
109+
110+ val resp = client.delete(" $endpoint /$userID /token/$deviceID " )
111+ if (! resp.ok()) {
112+ val err: ErrorResponse = resp.body()
113+ throw Exception (" Error code ${err.code} : ${err.body} " )
114+ }
115+ (resp.body() as Response <Boolean >).body
116+ }
117+
105118 suspend fun <T > fetchMessage (postProcessor : List <MessageItem >.() -> List <T >) = wrap {
106119 val resp = client.get(" $endpoint /$userID /record" )
107120 if (! resp.ok()) {
You can’t perform that action at this time.
0 commit comments