A basic Swift SDK for the MailerLite API.
import MailerLiteAPIClient
let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")
do {
let response = mailerLite.send(ListSubscribers())
// TODO: handle response
let data = response.data {
print("Found \(data.count) subscribers")
}
} catch {
// TODO: handle error
}
import MailerLiteAPIClient
let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")
do {
let response = mailerLite.send(UpsertSubscriber(email: "dummy@example.com", fields: Subscriber.Fields(lastName: "Testerson")))
// TODO: handle response
let data = response.data {
print("Subscriber \(data.email) upserted")
}
} catch {
// TODO: handle error
switch result {
}
import MailerLiteAPIClient
let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")
do {
let response = mailerLite.send(UpdateSubscriber(
id: "31897397363737859",
fields: Subscriber.Fields(
lastName: nil,
name: "Dummy"
),
groups: [
"4243829086487936",
"14133878422767533",
"31985378335392975"
]
)))
// TODO: handle response
let data = response.data {
print("Subscriber \(data.id) updated")
}
} catch {
// TODO: handle error
}
Please help improve this SDK! Contributions welcome.