11# SendGridKit
22
3- ![ Swift] ( http://img.shields.io/badge/swift-5.2 -brightgreen.svg )
3+ ![ Swift] ( http://img.shields.io/badge/swift-5.6 -brightgreen.svg )
44
55SendGridKit is a Swift package used to communicate with the SendGrid API for Server Side Swift Apps.
66
@@ -10,7 +10,7 @@ Add the dependency to Package.swift:
1010~~~~ swift
1111dependencies: [
1212 ...
13- .package (url : " https://github.com/vapor-community/sendgrid-kit.git" , from : " 1 .0.0" )
13+ .package (url : " https://github.com/vapor-community/sendgrid-kit.git" , from : " 2 .0.0" )
1414],
1515targets: [
1616 .target (name : " App" , dependencies : [
@@ -22,7 +22,7 @@ Register the config and the provider.
2222
2323~~~~ swift
2424let httpClient = HTTPClient (... )
25- let sendgridClient = SendGridClient (httpClient : httpClient, apiKey : " YOUR_API_KEY" )
25+ let sendGridClient = SendGridClient (httpClient : httpClient, apiKey : " YOUR_API_KEY" )
2626~~~~
2727
2828## Using the API
@@ -34,7 +34,7 @@ Usage in a route closure would be as followed:
3434import SendGrid
3535
3636let email = SendGridEmail (... )
37- try sendGridClient.send (email, on : eventLoop )
37+ try await sendGridClient.send (email)
3838~~~~
3939
4040## Error handling
@@ -43,7 +43,7 @@ Simply ensure you catch errors thrown like any other throwing function
4343
4444~~~~ swift
4545do {
46- try sendGridClient.send (... )
46+ try await sendGridClient.send (... )
4747}
4848catch let error as SendGridError {
4949 print (error)
0 commit comments