Module apns

Main module for apns4erl API.

Copyright © Inaka <hello@inaka.net>

Description

Main module for apns4erl API. Use this one from your own applications.

Copyright 2017 Erlang Solutions Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Data Types

device_id()

device_id() = binary()

feedback()

feedback() = apns_feedback:feedback()

headers()

headers() = #{apns_id => binary(), apns_expiration => binary(), apns_priority => binary(), apns_topic => binary(), apns_collapse_id => binary(), apns_push_type => binary(), apns_auth_token => binary()}

json()

json() = #{binary() => binary() | json()}

response()

response() = {integer(), [term()], [term()] | no_body} | timeout

token()

token() = binary()

Function Index

close_connection/1Closes the connection with APNs service.
connect/1Connects to APNs service.
connect/2Connects to APNs service with Provider Certificate or Token.
default_headers/0Get the default headers from environment variables.
generate_token/2
get_feedback/0
get_feedback/1
push_notification/3Push notification to APNs.
push_notification/4Push notification to certificate APNs Connection.
push_notification_token/4Push notification to APNs with authentication token.
push_notification_token/5Push notification to authentication token APNs Connection.
start/0Used when starting the application on the shell.
stop/0Stops the Application.
wait_for_connection_up/1Wait for the APNs connection to be up.

Function Details

close_connection/1

close_connection(ConnectionId::apns_connection:name() | pid()) -> ok

Closes the connection with APNs service.

connect/1

connect(Connection::apns_connection:connection()) -> {ok, pid()}

Connects to APNs service

connect/2

connect(Type::apns_connection:type(), ConnectionName::apns_connection:name()) -> {ok, pid()}

Connects to APNs service with Provider Certificate or Token

default_headers/0

default_headers() -> apns:headers()

Get the default headers from environment variables.

generate_token/2

generate_token(TeamId::binary(), KeyId::binary()) -> token()

get_feedback/0

get_feedback() -> [feedback()] | {error, term()} | timeout

get_feedback/1

get_feedback(Config::apns_feedback:feedback_config()) -> [feedback()] | {error, term()} | timeout

push_notification/3

push_notification(ConnectionId::apns_connection:name() | pid(), DeviceId::device_id(), JSONMap::json()) -> response() | {error, not_connection_owner}

Push notification to APNs. It will use the headers provided on the environment variables.

push_notification/4

push_notification(ConnectionId::apns_connection:name() | pid(), DeviceId::device_id(), JSONMap::json(), Headers::headers()) -> response() | {error, not_connection_owner}

Push notification to certificate APNs Connection.

push_notification_token/4

push_notification_token(ConnectionId::apns_connection:name() | pid(), Token::token(), DeviceId::device_id(), JSONMap::json()) -> response() | {error, not_connection_owner}

Push notification to APNs with authentication token. It will use the headers provided on the environment variables.

push_notification_token/5

push_notification_token(ConnectionId::apns_connection:name() | pid(), Token::token(), DeviceId::device_id(), JSONMap::json(), Headers::headers()) -> response() | {error, not_connection_owner}

Push notification to authentication token APNs Connection.

start/0

start() -> ok

Used when starting the application on the shell.

stop/0

stop() -> ok

Stops the Application

wait_for_connection_up/1

wait_for_connection_up(Server::pid()) -> ok

Wait for the APNs connection to be up.


Generated by EDoc