Commit Graph

3 Commits

Author SHA1 Message Date
Dmitry Shmulevich c7adb917f3
update license to Apache v2.0 (#1406) 2022-01-04 19:53:31 -08:00
Yaron Schneider 3ef025c604
change headers (#679) 2021-02-09 18:57:55 -08:00
Michael Collins b08e920cdd
Apns output binding (#481)
* Create Apple Push Notification Output Binding

I created the apns package and created apns.go to implement the output
binding to send push notifications to Apple devices using the Apple Push
Notification Service.

* Refactor Code

I refactored and cleaned up the source code in apns.go. I made the code
easier to read and understand. I split out the JWT generation into
authorization_builder.go. I split out the create operation code into
create_operation.go and refactored it to follow a pipeline pattern.

I created doc.go and added documentation for how to use the APNS binding
to send push notifications to Apple devices.

* Fix Lint Issuer

I corrected issues reported by golangci-lint in the pull request. I ran
gofumpt against the test cases for the APNs binding. I fixed a naming
error in create_operation.go.

* Address Review Comment

I revised extractKeyID in apns.go to address a readability concern in
the code. I simplified the if/else block to make the logic easier to
understand.

* Add License Header to APNs Binding

I added the standard Microsoft copyright and MIT license header to the
source files for the APNs binding. This was requested from the PR
review.

* Revise APNS.extractTeamID for Readability

Per a PR comment, I revised the APNS.extractTeamID function to make the
function more readable.

* Revise APNS Create Operation

I revised the APNS create operation based on discussions in the PR
(#481). I deleted create_operation.go and merged the code back into the
main APNS type to simplify the code.

* Fix Linter Errors

I fixed linter errors reported in apns.go.

* Fix Code Review Comments

I switched from using encoding/json for JSON encoding and decoding to
using jsoniter.

I updated authorization_builder.go to define the expiration period as a
constant and provided a comment describing the need for and use of the
expiration period.

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
Co-authored-by: Mark Chmarny <mchmarny@users.noreply.github.com>
Co-authored-by: Young Bu Park <youngp@microsoft.com>
2020-10-09 10:26:44 -07:00