Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in Response signatures #65

Merged
merged 1 commit into from
Feb 12, 2024
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
2 changes: 1 addition & 1 deletion src/main/kotlin/api/SubscribersApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ interface SubscribersApi {
suspend fun markSubscriberMessageFeedAs(
@Path("subscriberId") subscriberId: String,
@Body request: MarkSubscriberFeedAsRequest
): Response<ResponseWrapper<SubscriberNotificationResponse>>
): Response<ResponseWrapper<List<SubscriberNotificationResponse>>>

@POST("$ENDPOINT/{subscriberId}/messages/{messageId}/actions/{type}")
suspend fun markMessageActionAsSeen(
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/ApiKeys.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class ApiKeys(
var key: String? = null,
var _userId: String? = null
@SerializedName("_userId")
var userId: String? = null
)
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/Channel.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Channel(
val credentials: ChannelCredentials? = null,
val providerId: String? = null,
val _integrationId: String? = null
@SerializedName("_integrationId")
val integrationId: String? = null
)
26 changes: 18 additions & 8 deletions src/main/kotlin/dto/ExecutionDetails.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class ExecutionDetails(
val _id: String? = null,
val _jobId: String? = null,
val _organizationId: String? = null,
val _environmentId: String? = null,
val _notificationId: String? = null,
val _subscriberId: String? = null,
val _notificationTemplateId: String? = null,
val _messageId: String? = null,
@SerializedName("_id")
val id: String? = null,
@SerializedName("_jobId")
val jobId: String? = null,
@SerializedName("_organizationId")
val organizationId: String? = null,
@SerializedName("_environmentId")
val environmentId: String? = null,
@SerializedName("_notificationId")
val notificationId: String? = null,
@SerializedName("_subscriberId")
val subscriberId: String? = null,
@SerializedName("_notificationTemplateId")
val notificationTemplateId: String? = null,
@SerializedName("_messageId")
val messageId: String? = null,
val transactionId: String? = null,
val providerId: Any? = null,
val status: String? = null,
Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/dto/Job.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Job(
var _id: String? = null,
@SerializedName("_id")
var id: String? = null,
var digest: Any? = null,
var status: String? = null,
var payload: Any? = null,
var step: Step? = null,
var _notificationId: String? = null,
@SerializedName("_notificationId")
var notificationId: String? = null,
var type: String? = null,
var createdAt: String? = null,
var updatedAt: String? = null,
Expand Down
17 changes: 12 additions & 5 deletions src/main/kotlin/dto/Notification.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Notification(
val _id: String? = null,
val _templateId: String? = null,
val _environmentId: String? = null,
val _organizationId: String? = null,
val _subscriberId: String? = null,
@SerializedName("_id")
val id: String? = null,
@SerializedName("_templateId")
val templateId: String? = null,
@SerializedName("_environmentId")
val environmentId: String? = null,
@SerializedName("_organizationId")
val organizationId: String? = null,
@SerializedName("_subscriberId")
val subscriberId: String? = null,
val transactionId: String? = null,
val channels: List<String>? = null,
val to: Subscriber? = null,
Expand Down
17 changes: 12 additions & 5 deletions src/main/kotlin/dto/NotificationGroup.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class NotificationGroup(
val _id: String? = null,
@SerializedName("_id")
val id: String? = null,
val name: String? = null,
val _organizationId: String? = null,
val _environmentId: String? = null,
val _parentId: String? = null,
@SerializedName("_organizationId")
val organizationId: String? = null,
@SerializedName("_environmentId")
val environmentId: String? = null,
@SerializedName("_parentId")
val parentId: String? = null,
val createdAt: String? = null,
val updatedAt: String? = null,
val __v: String? = null
@SerializedName("__v")
val version: String? = null
)
11 changes: 8 additions & 3 deletions src/main/kotlin/dto/Step.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Step(
val _id: String? = null,
val _templateId: String? = null,
@SerializedName("_id")
val id: String? = null,
@SerializedName("_templateId")
val templateId: String? = null,
val uuid: String? = null,
val name: String? = null,
val active: Boolean? = null,
val shouldStopOnFail: Boolean? = null,
val template: Any? = null,
val filters: List<Filters>? = null,
val _parentId: String? = null,
@SerializedName("_parentId")
val parentId: String? = null,
val metadata: Metadata? = null,
val replyCallback: Any? = null
)
3 changes: 3 additions & 0 deletions src/main/kotlin/dto/Subscriber.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

open class Subscriber(
@SerializedName("_id")
var id: String? = null,
var subscriberId: String? = null,
var firstName: String? = null,
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/Template.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Template(
var _id: String? = null,
@SerializedName("_id")
var id: String? = null,
var name: String? = null,
var critical: Boolean? = null,
var triggers: List<Trigger>? = null
Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/dto/Tenant.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Tenant(
private var _environmentId: String? = null,
private var _id: String? = null,
@SerializedName("_environmentId")
private var environmentId: String? = null,
@SerializedName("_id")
private var id: String? = null,
private var createdAt: String? = null,
private var data: Any? = null,
private var identifier: String? = null,
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/Token.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Token(
var _id: String? = null,
@SerializedName("_id")
var id: String? = null,
var providerId: String? = null,
var provider: String? = null,
var accessToken: String? = null,
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/Trigger.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Trigger(
val type: String? = null,
val _id: String? = null,
@SerializedName("_id")
val id: String? = null,
val identifier: String? = null,
val variables: List<Variables>? = null,
val subscriberVariables: List<Variables>? = null,
Expand Down
7 changes: 5 additions & 2 deletions src/main/kotlin/dto/User.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName
import java.math.BigDecimal

data class User(
var _id: String? = null,
@SerializedName("_id")
var id: String? = null,
var firstName: String? = null,
var lastName: String? = null,
var email: String? = null,
Expand All @@ -12,6 +14,7 @@ data class User(
var token: List<Token>,
var createdAt: String? = null,
var updatedAt: String? = null,
var __v: BigDecimal? = null
@SerializedName("__v")
var version: BigDecimal? = null

)
5 changes: 4 additions & 1 deletion src/main/kotlin/dto/Variables.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package co.novu.dto

import com.google.gson.annotations.SerializedName

data class Variables(
var name: String? = null,
var _id: String? = null
@SerializedName("_id")
var id: String? = null
)
22 changes: 15 additions & 7 deletions src/main/kotlin/dto/blueprints/Blueprint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@ package co.novu.dto.blueprints
import co.novu.dto.NotificationGroup
import co.novu.dto.PreferenceSettings
import co.novu.dto.Trigger
import com.google.gson.annotations.SerializedName

data class Blueprint(
private var _id: String? = null,
@SerializedName("_id")
private var id: String? = null,
private var name: String? = null,
private var description: String? = null,
private var active: Boolean? = null,
private var draft: Boolean? = null,
private var critical: Boolean? = null,
private var isBlueprint: Boolean? = null,
private var _notificationGroupId: String? = null,
@SerializedName("_notificationGroupId")
private var notificationGroupId: String? = null,
private var blueprintId: String? = null,
private var tags: List<String>? = null,
private var triggers: List<Trigger>? = null,
private var steps: List<Step>? = null,
private var preferenceSettings: PreferenceSettings? = null,
private var _environmentId: String? = null,
private var _organizationId: String? = null,
private var _creatorId: String? = null,
private var _parentId: String? = null,
@SerializedName("_environmentId")
private var environmentId: String? = null,
@SerializedName("_organizationId")
private var organizationId: String? = null,
@SerializedName("_creatorId")
private var creatorId: String? = null,
@SerializedName("_parentId")
private var parentId: String? = null,
private var deleted: Boolean? = null,
private var createdAt: String? = null,
private var updatedAt: String? = null,
private var __v: Long? = null,
@SerializedName("__v")
private var version: Long? = null,
private var notificationGroup: NotificationGroup? = null
)
6 changes: 0 additions & 6 deletions src/main/kotlin/dto/blueprints/Filters.kt

This file was deleted.

11 changes: 8 additions & 3 deletions src/main/kotlin/dto/blueprints/Step.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package co.novu.dto.blueprints

import com.google.gson.annotations.SerializedName

data class Step(
val _id: String? = null,
val _templateId: String? = null,
@SerializedName("_id")
val id: String? = null,
@SerializedName("_templateId")
val templateId: String? = null,
val uuid: String? = null,
val name: String? = null,
val active: Boolean? = null,
val shouldStopOnFail: Boolean? = null,
val template: Any? = null,
val filters: Any? = null,
val _parentId: String? = null,
@SerializedName("_parentId")
val parentId: String? = null,
val metadata: Any? = null,
val replyCallback: Any? = null
)
19 changes: 0 additions & 19 deletions src/main/kotlin/dto/blueprints/Template.kt

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/kotlin/dto/blueprints/Variables.kt

This file was deleted.

22 changes: 14 additions & 8 deletions src/main/kotlin/dto/request/BaseEventRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ abstract class BaseEventRequest {
// Optional fields
private var overrides: Map<String, Any>? = null
private var transactionId: String? = null
private var actor: String? = null
private var tenant: String? = null

protected fun init(
_name: String,
_payload: Map<String, Any>,
_overrides: Map<String, Any>? = null,
_transactionId: String? = null
name: String,
payload: Map<String, Any>,
overrides: Map<String, Any>? = null,
transactionId: String? = null,
actor: String? = null,
tenant: String? = null
): BaseEventRequest {
return this.apply {
this.name = _name
this.payload = _payload
this.overrides = _overrides
this.transactionId = _transactionId
this.name = name
this.payload = payload
this.overrides = overrides
this.transactionId = transactionId
this.actor = actor
this.tenant = tenant
}
}
}
Loading
Loading