Skip to content

Commit 0a33f65

Browse files
committed
Make everything Sendable
1 parent 5e0a02c commit 0a33f65

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

Sources/IndiePitcherSwift/dtos.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import Foundation
99

1010
/// The format of the email body
11-
public enum EmailBodyFormat: String, Codable {
11+
public enum EmailBodyFormat: String, Codable, Sendable {
1212
/// The body format is a markdown text
1313
case markdown
1414
/// The body format is html text
1515
case html
1616
}
1717

1818
/// Represents a custom contact property.
19-
public enum CustomContactPropertyValue: Codable, Equatable {
19+
public enum CustomContactPropertyValue: Codable, Equatable, Sendable {
2020
/// A string property
2121
case string(String)
2222
/// A number property
@@ -78,7 +78,7 @@ public enum CustomContactPropertyValue: Codable, Equatable {
7878
}
7979

8080
/// A contact in the mailing list
81-
public struct Contact: Codable {
81+
public struct Contact: Codable, Sendable {
8282
public init(email: String, userId: String? = nil, avatarUrl: String? = nil, name: String? = nil, hardBouncedAt: Date? = nil, subscribedToLists: [String], customProperties: [String : CustomContactPropertyValue], languageCode: String? = nil) {
8383
self.email = email
8484
self.userId = userId
@@ -109,7 +109,7 @@ public struct Contact: Codable {
109109
}
110110

111111
/// The payload to create a new contact
112-
public struct CreateContact: Codable {
112+
public struct CreateContact: Codable, Sendable {
113113

114114
/// Initializer
115115
/// - Parameters:
@@ -155,7 +155,7 @@ public struct CreateContact: Codable {
155155
}
156156

157157
/// The payload to create multiple contacts using a single API call
158-
public struct CreateMultipleContacts: Codable {
158+
public struct CreateMultipleContacts: Codable, Sendable {
159159

160160
/// Initializer
161161
/// - Parameter contacts: The list of contacts to create
@@ -168,7 +168,7 @@ public struct CreateMultipleContacts: Codable {
168168
}
169169

170170
/// The payload to update a contact in the mailing list. The email is required to identify the contact.
171-
public struct UpdateContact: Codable {
171+
public struct UpdateContact: Codable, Sendable {
172172

173173
/// Initializer
174174
/// - Parameters:
@@ -210,7 +210,7 @@ public struct UpdateContact: Codable {
210210
}
211211

212212
/// Payload of send transactional email request.
213-
public struct SendEmail: Codable {
213+
public struct SendEmail: Codable, Sendable {
214214

215215
/// Initializer
216216
/// - Parameters:
@@ -239,7 +239,7 @@ public struct SendEmail: Codable {
239239
}
240240

241241
/// Send an email to one of more registered contacts.
242-
public struct SendEmailToContact: Codable {
242+
public struct SendEmailToContact: Codable, Sendable {
243243

244244
/// Initializer
245245
/// - Parameters:
@@ -287,7 +287,7 @@ public struct SendEmailToContact: Codable {
287287
public var delayUntilDate: Date?
288288
}
289289

290-
public struct SendEmailToMailingList: Codable {
290+
public struct SendEmailToMailingList: Codable, Sendable {
291291

292292
/// Initializer
293293
/// - Parameters:
@@ -326,7 +326,7 @@ public struct SendEmailToMailingList: Codable {
326326
}
327327

328328
/// Represents a mailing list contacts can subscribe to, such as `Monthly newsletter` or `Onboarding`.
329-
public struct MailingList: Codable {
329+
public struct MailingList: Codable, Sendable {
330330

331331
public init(name: String, title: String, numSubscribers: Int) {
332332
self.name = name
@@ -345,7 +345,7 @@ public struct MailingList: Codable {
345345
}
346346

347347
/// A portal session that allows a contact to manage their email list subscriptions when redirected to returned `url`. A session is valid for 30 minutes.
348-
public struct MailingListPortalSession: Codable {
348+
public struct MailingListPortalSession: Codable, Sendable {
349349
public init(url: URL, expiresAt: Date, returnURL: URL) {
350350
self.url = url
351351
self.expiresAt = expiresAt

Sources/IndiePitcherSwift/errors.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public struct IndiePitcherRequestError: Error, Equatable {
1+
public struct IndiePitcherRequestError: Error, Equatable, Sendable {
22
var statusCode: UInt
33
var reason: String
44

Sources/IndiePitcherSwift/responses.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99

1010
/// Represents a response returning data.
11-
public struct DataResponse<T: Codable>: Codable {
11+
public struct DataResponse<T: Codable & Sendable>: Codable, Sendable {
1212

1313
public init(data: T) {
1414
self.success = true
@@ -34,15 +34,15 @@ public struct EmptyResposne: Codable {
3434
}
3535

3636
/// Represents a response returning paginated data.
37-
public struct PagedDataResponse<T: Codable>: Codable {
37+
public struct PagedDataResponse<T: Codable & Sendable>: Codable, Sendable {
3838
public init(data: [T], metadata: PagedDataResponse<T>.PageMetadata) {
3939
self.success = true
4040
self.data = data
4141
self.metadata = metadata
4242
}
4343

4444
/// Paging metadata
45-
public struct PageMetadata: Codable {
45+
public struct PageMetadata: Codable, Sendable {
4646
public init(page: Int, per: Int, total: Int) {
4747
self.page = page
4848
self.per = per
@@ -67,7 +67,7 @@ public struct PagedDataResponse<T: Codable>: Codable {
6767
public var metadata: PageMetadata
6868
}
6969

70-
struct ErrorResponse: Codable {
70+
struct ErrorResponse: Codable, Sendable {
7171
var reason: String
7272
var error: Bool
7373
}

0 commit comments

Comments
 (0)