Skip to content

Commit

Permalink
Fix build errors (#19)
Browse files Browse the repository at this point in the history
* Fix build errors
  • Loading branch information
fpseverino authored Sep 7, 2024
1 parent 5804515 commit c7dda56
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
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

0 comments on commit c7dda56

Please sign in to comment.