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 build errors #19

Merged
merged 2 commits into from
Sep 7, 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Andrewangeta @fpseverino
3 changes: 2 additions & 1 deletion Sources/SendGridKit/SendGridClient.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Foundation
@preconcurrency import Foundation
import NIO
import AsyncHTTPClient
import NIOHTTP1
import NIOFoundationCompat

public struct SendGridClient: Sendable {
let apiURL = "https://api.sendgrid.com/v3/mail/send"
Expand Down
21 changes: 18 additions & 3 deletions Tests/SendGridKitTests/SendGridTestsKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,27 @@ class SendGridKitTests: XCTestCase {

func testSendEmail() async throws {
// TODO: Replace to address with the email address you'd like to recieve your test email
let emailAddress = EmailAddress(email: "TO-ADDRESS", name: "Test User")
let emailAddress = EmailAddress("TO-ADDRESS")
// TODO: Replace from address with the email address associated with your verified Sender Identity
let fromEmailAddress = EmailAddress(email: "FROM-ADDRESS", name: "Test")

let personalization = Personalization(to: [emailAddress], subject: "Test Email")
let emailContent = EmailContent(type: "text/plain", value: "This email was sent using SendGridKit!")
let email = SendGridEmail(personalizations: [personalization], from: fromEmailAddress, content: [emailContent])

let attachment = EmailAttachment(
content: "Hello, World!".data(using: .utf8)!.base64EncodedString(),
type: "text/plain",
filename: "hello.txt",
disposition: "attachment"
)

let emailContent = EmailContent("This email was sent using SendGridKit!")

let email = SendGridEmail(
personalizations: [personalization],
from: fromEmailAddress,
content: [emailContent],
attachments: [attachment]
)

do {
try await client.send(email: email)
Expand Down
Loading