-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mobile push notification and Oauth flow
- Loading branch information
Showing
7 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../cryptohopper/android/sdk/API/Authentication/AuthWithCode/HopperAPIAuthWithCodeRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cryptohopper.android.sdk.API.Authentication.AuthWithCode | ||
|
||
import HopperAPIAuthenticationResponse | ||
import HopperAPIRequest | ||
import cryptohopper.android.sdk.API.Hopper.General.CreateHopper.HopperAPICreateHopperResponse | ||
import cryptohopper.android.sdk.SharedModels.ConfigModels.HopperAPIHttpMethod | ||
|
||
class HopperAPIAuthWithCodeRequest: HopperAPIRequest<HopperAPIAuthenticationResponse> { | ||
|
||
constructor(code: String, userAgent: String) { | ||
this.httpMethod = HopperAPIHttpMethod.POST | ||
this.needsAuthentication = false | ||
this.setIsAuthenticationRequest(true) | ||
this.changeUrlPath("/oauth2/token") | ||
addBodyItem( "grant_type", "authorization_code") | ||
addBodyItem( "client_id", HopperAPIConfigurationManager.shared.config.clientId!!) | ||
addBodyItem( "code", code) | ||
addBodyItem( "scope", "read,user,notifications,trade,manage") | ||
addHeader("User-Agent",userAgent) | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...dk/API/User/General/GetMobileNotifications/HopperAPIUpdateGetMobileNotificationRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cryptohopper.android.sdk.API.User.General.GetMobileNotifications | ||
|
||
import HopperAPIRequest | ||
import cryptohopper.android.sdk.SharedModels.ConfigModels.HopperAPIHttpMethod | ||
|
||
class HopperAPIUpdateGetMobileNotificationRequest: HopperAPIRequest<HopperAPIUpdateGetMobileNotificationResponse> { | ||
|
||
constructor(data : String) { | ||
this.httpMethod = HopperAPIHttpMethod.GET | ||
this.needsAuthentication = true | ||
this.changeUrlPath("/user/mobilepushnotifications") | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
...k/API/User/General/GetMobileNotifications/HopperAPIUpdateGetMobileNotificationResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cryptohopper.android.sdk.API.User.General.GetMobileNotifications | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class HopperAPIUpdateGetMobileNotificationResponse ( | ||
@SerializedName("data") val notifications: Map<String,String>? | ||
) | ||
|
23 changes: 23 additions & 0 deletions
23
...k/API/User/General/UpdateMobilePushNotification/HopperAPIUpdatePushNotificationRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package cryptohopper.android.sdk.API.User.General.UpdateMobilePushNotification | ||
|
||
import HopperAPIRequest | ||
import HopperCommonMessageResponse | ||
import cryptohopper.android.sdk.SharedModels.ConfigModels.HopperAPIHttpMethod | ||
|
||
internal class HopperAPIUpdatePushNotificationRequest: HopperAPIRequest<HopperCommonMessageResponse> { | ||
|
||
constructor( | ||
permissions : Map<String,String> | ||
) { | ||
this.httpMethod = HopperAPIHttpMethod.POST | ||
this.needsAuthentication = true | ||
this.changeUrlPath("/user/mobilepushnotifications") | ||
|
||
var arr = mutableMapOf<String,Any>() | ||
for ((k, v) in permissions) { | ||
arr[k] = v | ||
} | ||
addBodyItem("settings",arr) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters