Skip to content

Commit

Permalink
Change package name
Browse files Browse the repository at this point in the history
  • Loading branch information
mikwat committed Dec 22, 2023
1 parent 972c6f8 commit 258ff70
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
import PackageDescription

let package = Package(
name: "MailerLiteApiClient",
name: "MailerLiteAPIClient",
platforms: [
.macOS(.v10_15), .iOS(.v15), .tvOS(.v15)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "MailerLiteApiClient",
targets: ["MailerLiteApiClient"]),
name: "MailerLiteAPIClient",
targets: ["MailerLiteAPIClient"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "MailerLiteApiClient"),
name: "MailerLiteAPIClient"),
.testTarget(
name: "MailerLiteApiClientTests",
dependencies: ["MailerLiteApiClient"]),
name: "MailerLiteAPIClientTests",
dependencies: ["MailerLiteAPIClient"]),
]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A basic Swift SDK for the [MailerLite API](https://developers.mailerlite.com/doc

### Get a list of subscribers
```swift
import MailerLiteApiClient
import MailerLiteAPIClient

let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")

Expand All @@ -25,7 +25,7 @@ mailerLite.send(ListSubscribers()) { result in

### Upsert a subscriber
```swift
import MailerLiteApiClient
import MailerLiteAPIClient

let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")

Expand All @@ -44,7 +44,7 @@ mailerLite.send(UpsertSubscriber(email: "[email protected]", fields: Subscriber.

### Update a subscriber
```swift
import MailerLiteApiClient
import MailerLiteAPIClient

let mailerLite = MailerLiteAPIClient(apiKey: "your-api-key")

Expand Down
64 changes: 64 additions & 0 deletions Tests/MailerLiteApiClientTests/PlaygroundTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// DO NOT COMMIT CHANGES TO THIS FILE

import XCTest
@testable import MailerLiteAPIClient

final class PlaygroundTests: XCTestCase {
let apiKey = """
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI0IiwianRpIjoiZDUxOGRmYTEyZGIwMzNhMDQ2Nzk0ZmU0ZjA5NWU4MDc0YTk2YThkMDE1N2UzZTA2YzlhODM3OGM4MDNmZDA0OTlmZGZkM2UyZjMyM2Y1MzYiLCJpYXQiOjE3MDI5Mjg4NTcuNDk3MDg5LCJuYmYiOjE3MDI5Mjg4NTcuNDk3MDkxLCJleHAiOjQ4NTg2MDI0NTcuNDkyODU5LCJzdWIiOiI3NDAxMjYiLCJzY29wZXMiOltdfQ.a8KnpvjFu4SdMOCs0aFUUunF5_4h1NTehpKzRlVo3-uCXqnS8wBNblohrwEGInbyHj1bzutWAUXUVq7EAfImtAdm3hL4ocV6U08JI_i9ldoeGQDYSWtaC6Y1z5U_j7RhP4KlZ0v8tLgrCDdjuRfZq5LjfmTkLSNf0Ow4Pl4tAhDS0Cmb-VlZCQDgCn9ztyrNQH5ewHI7PgUFns2wdZW6CeYSErW_jFug3KhRuCB-0iHhq_s2EIBiiCKIf19vCruwzBKXKIConnNarSl6_Q2Gu2NkLeo01MMxyW1ID2h0b55LUqDEpaYLlcCYlDsRtt_otwuD0Bw3eDPeAMGbkyDa-wn5-475hNkRo8NdVfWtuiP9J9UnNg072Ezj4hqab5DmWhtAf8Uie6wGmaWJaY1y1X1Sc-okFKbMrtP1Al0u4DXeR0KAswGPTfgySxaMHDJZH50QC5Jhx1xDfl6eb3r2lko1ATgznuHzSOAgQudacxrOXU62jejxIjeroNcyIpOY3BqBineVU_adcgl2PwOk__hPdoFfJsFB2S1NjfkCs9Hr1nw41bTemApPIMTikka9nuJmd4cg6trpJiSyjAaN0SU5gAXDNeDZeuJSPe_FUVTXJpJXfgRmc_SKexy94Vpo2UwqX_NebrpSGv0xYNZqZL3mSmBvGXBXQQZUq42JnEo
"""
var apiClient: MailerLiteAPIClient!
var expectation: XCTestExpectation!

override func setUp() async throws {
apiClient = MailerLiteAPIClient(apiKey: apiKey)
expectation = expectation(description: "Expectation")
}

// func testListSubscribers() async throws {
// let response = await withCheckedContinuation { continuation in
// apiClient.send(ListSubscribers()) { response in
// continuation.resume(returning: response)
// }
// }
//
// do {
// let listResponse = try response.get()
// if let subscribers = listResponse.data {
// print("Found \(subscribers.count) subscribers")
// for subscriber in subscribers {
// print("Subscriber: \(subscriber)")
// }
// } else {
// print("No subscribers found")
// }
//
// print("Links: \(listResponse.links)")
// print("Meta: \(listResponse.meta)")
// } catch {
// print("Error: \(error)")
// }
// }

// func testUpsertSubscribers() {
// apiClient.send(UpsertSubscriber(email: "elegant.joy3337-at-awattslife.com")) { result in
// switch result {
// case .success(let response):
// XCTFail("Success was not expected: \(response)")
// case .failure(let error):
// if let apiError = error as? APIClientError {
// switch apiError {
// case .response(let response):
// print("Error response: \(response)")
// default:
// print("Error: \(error.localizedDescription)")
// }
// } else {
// print("Error: \(error.localizedDescription)")
// }
// }
// self.expectation.fulfill()
// }
// wait(for: [expectation], timeout: 5.0)
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation
import XCTest
@testable import MailerLiteApiClient
@testable import MailerLiteAPIClient

final class ListSubscribersTest: XCTestCase {
var apiClient: MailerLiteAPIClient!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation
import XCTest
@testable import MailerLiteApiClient
@testable import MailerLiteAPIClient

final class UpdateSubscriberTest: XCTestCase {
var apiClient: MailerLiteAPIClient!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation
import XCTest
@testable import MailerLiteApiClient
@testable import MailerLiteAPIClient

final class UpsertSubscriberTest: XCTestCase {
var apiClient: MailerLiteAPIClient!
Expand Down

0 comments on commit 258ff70

Please sign in to comment.