Skip to content

Commit

Permalink
Updated typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed May 3, 2018
1 parent 38e53fa commit e6134af
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 96 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Change Log

---

## [4.0.1](https://github.com/AndrewBarba/apns2/releases/tag/4.0.1)

1. Updated Typescript definitions for v4.0

## [4.0.0](https://github.com/AndrewBarba/apns2/releases/tag/4.0.0)

1. Remove support for Node versions less than v8.10
Expand Down
71 changes: 71 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { EventEmitter } from "events"

export class APNS extends EventEmitter {
constructor(options: APNSOptions)
send(notification: Notification): Promise<Notification>
send(notifications: Notification[]): Promise<Notification[]>
}

export class Notification {
constructor(deviceToken: string, options?: NotificationOptions)
static readonly priority: NotificationPriority
readonly deviceToken: string
readonly priority: number
readonly expiration: number
readonly topic: string
readonly collapseId: string
}

export class BasicNotification extends Notification {
constructor(deviceToken: string, message: string, options?: NotificationOptions)
}

export class SilentNotification extends Notification {
constructor(deviceToken: string, options?: NotificationOptions)
}

export const Errors: {
badCertificate: string
badCertificateEnvironment: string
badCollapseId: string
badDeviceToken: string
badExpirationDate: string
badMessageId: string
badPath: string
badPriority: string
badTopic: string
deviceTokenNotForTopic: string
duplicateHeaders: string
error: string
expiredProviderToken: string
forbidden: string
idleTimeout: string
internalServerError: string
invalidProviderToken: string
invalidSigningKey: string
methodNotAllowed: string
missingDeviceToken: string
missingTopic: string
payloadEmpty: string
payloadTooLarge: string
serviceUnavailable: string
shutdown: string
tooManyRequests: string
topicDisallowed: string
unknownError: string
unregistered: string
}

declare interface APNSOptions {
team: string
keyId: string
signingKey: string
defaultTopic?: string
host?: string
port?: number
}

declare interface NotificationPriority {
immediate: number
throttled: number
}
95 changes: 0 additions & 95 deletions lib/apns.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apns2",
"version": "4.0.0",
"version": "4.0.1",
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.",
"author": "Andrew Barba <[email protected]>",
"main": "lib/apns.js",
Expand Down

0 comments on commit e6134af

Please sign in to comment.