SNS class
Amazon Simple Notification Service (Amazon SNS) is a web service that enables you to build distributed web-enabled applications. Applications can use Amazon SNS to easily push real-time notification messages to interested subscribers over multiple delivery protocols. For more information about this product see https://aws.amazon.com/sns. For detailed information about Amazon SNS features and their associated API calls, see the Amazon SNS Developer Guide.
Constructors
- SNS({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})
Properties
Methods
-
addPermission(
{required List< String> awsAccountId, required List<String> actionName, required String label, required String topicArn}) → Future<void> - Adds a statement to a topic's access control policy, granting access for the specified AWS accounts to the specified actions.
-
checkIfPhoneNumberIsOptedOut(
{required String phoneNumber}) → Future< CheckIfPhoneNumberIsOptedOutResponse> - Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your account. You cannot send SMS messages to a number that is opted out.
-
close(
) → void - Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
-
confirmSubscription(
{required String token, required String topicArn, String? authenticateOnUnsubscribe}) → Future< ConfirmSubscriptionResponse> -
Verifies an endpoint owner's intent to receive messages by validating the
token sent to the endpoint by an earlier
Subscribe
action. If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN). This call requires an AWS signature only when theAuthenticateOnUnsubscribe
flag is set to "true". -
createPlatformApplication(
{required Map< String, String> attributes, required String name, required String platform}) → Future<CreatePlatformApplicationResponse> -
Creates a platform application object for one of the supported push
notification services, such as APNS and GCM (Firebase Cloud Messaging), to
which devices and mobile apps may register. You must specify
PlatformPrincipal
andPlatformCredential
attributes when using theCreatePlatformApplication
action. -
createPlatformEndpoint(
{required String platformApplicationArn, required String token, Map< String, String> ? attributes, String? customUserData}) → Future<CreateEndpointResponse> -
Creates an endpoint for a device and mobile app on one of the supported
push notification services, such as GCM (Firebase Cloud Messaging) and
APNS.
CreatePlatformEndpoint
requires thePlatformApplicationArn
that is returned fromCreatePlatformApplication
. You can use the returnedEndpointArn
to send a message to a mobile app or by theSubscribe
action for subscription to a topic. TheCreatePlatformEndpoint
action is idempotent, so if the requester already owns an endpoint with the same device token and attributes, that endpoint's ARN is returned without creating a new endpoint. For more information, see Using Amazon SNS Mobile Push Notifications. -
createTopic(
{required String name, Map< String, String> ? attributes, List<Tag> ? tags}) → Future<CreateTopicResponse> - Creates a topic to which notifications can be published. Users can create at most 100,000 standard topics (at most 1,000 FIFO topics). For more information, see https://aws.amazon.com/sns. This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.
-
deleteEndpoint(
{required String endpointArn}) → Future< void> - Deletes the endpoint for a device and mobile app from Amazon SNS. This action is idempotent. For more information, see Using Amazon SNS Mobile Push Notifications.
-
deletePlatformApplication(
{required String platformApplicationArn}) → Future< void> - Deletes a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push Notifications.
-
deleteTopic(
{required String topicArn}) → Future< void> - Deletes a topic and all its subscriptions. Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.
-
getEndpointAttributes(
{required String endpointArn}) → Future< GetEndpointAttributesResponse> - Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push Notifications.
-
getPlatformApplicationAttributes(
{required String platformApplicationArn}) → Future< GetPlatformApplicationAttributesResponse> - Retrieves the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push Notifications.
-
getSMSAttributes(
{List< String> ? attributes}) → Future<GetSMSAttributesResponse> - Returns the settings for sending SMS messages from your account.
-
getSubscriptionAttributes(
{required String subscriptionArn}) → Future< GetSubscriptionAttributesResponse> - Returns all of the properties of a subscription.
-
getTopicAttributes(
{required String topicArn}) → Future< GetTopicAttributesResponse> - Returns all of the properties of a topic. Topic properties returned might differ based on the authorization of the user.
-
listEndpointsByPlatformApplication(
{required String platformApplicationArn, String? nextToken}) → Future< ListEndpointsByPlatformApplicationResponse> -
Lists the endpoints and endpoint attributes for devices in a supported
push notification service, such as GCM (Firebase Cloud Messaging) and
APNS. The results for
ListEndpointsByPlatformApplication
are paginated and return a limited list of endpoints, up to 100. If additional records are available after the first page results, then a NextToken string will be returned. To receive the next page, you callListEndpointsByPlatformApplication
again using the NextToken string received from the previous call. When there are no more records to return, NextToken will be null. For more information, see Using Amazon SNS Mobile Push Notifications. -
listPhoneNumbersOptedOut(
{String? nextToken}) → Future< ListPhoneNumbersOptedOutResponse> - Returns a list of phone numbers that are opted out, meaning you cannot send SMS messages to them.
-
listPlatformApplications(
{String? nextToken}) → Future< ListPlatformApplicationsResponse> -
Lists the platform application objects for the supported push notification
services, such as APNS and GCM (Firebase Cloud Messaging). The results for
ListPlatformApplications
are paginated and return a limited list of applications, up to 100. If additional records are available after the first page results, then a NextToken string will be returned. To receive the next page, you callListPlatformApplications
using the NextToken string received from the previous call. When there are no more records to return,NextToken
will be null. For more information, see Using Amazon SNS Mobile Push Notifications. -
listSubscriptions(
{String? nextToken}) → Future< ListSubscriptionsResponse> -
Returns a list of the requester's subscriptions. Each call returns a
limited list of subscriptions, up to 100. If there are more subscriptions,
a
NextToken
is also returned. Use theNextToken
parameter in a newListSubscriptions
call to get further results. -
listSubscriptionsByTopic(
{required String topicArn, String? nextToken}) → Future< ListSubscriptionsByTopicResponse> -
Returns a list of the subscriptions to a specific topic. Each call returns
a limited list of subscriptions, up to 100. If there are more
subscriptions, a
NextToken
is also returned. Use theNextToken
parameter in a newListSubscriptionsByTopic
call to get further results. -
listTagsForResource(
{required String resourceArn}) → Future< ListTagsForResourceResponse> - List all tags added to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon Simple Notification Service Developer Guide.
-
listTopics(
{String? nextToken}) → Future< ListTopicsResponse> -
Returns a list of the requester's topics. Each call returns a limited list
of topics, up to 100. If there are more topics, a
NextToken
is also returned. Use theNextToken
parameter in a newListTopics
call to get further results. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
optInPhoneNumber(
{required String phoneNumber}) → Future< void> - Use this request to opt in a phone number that is opted out, which enables you to resume sending SMS messages to the number.
-
publish(
{required String message, Map< String, MessageAttributeValue> ? messageAttributes, String? messageDeduplicationId, String? messageGroupId, String? messageStructure, String? phoneNumber, String? subject, String? targetArn, String? topicArn}) → Future<PublishResponse> -
Sends a message to an Amazon SNS topic, a text message (SMS message)
directly to a phone number, or a message to a mobile platform endpoint
(when you specify the
TargetArn
). -
removePermission(
{required String label, required String topicArn}) → Future< void> - Removes a statement from a topic's access control policy.
-
setEndpointAttributes(
{required Map< String, String> attributes, required String endpointArn}) → Future<void> - Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS. For more information, see Using Amazon SNS Mobile Push Notifications.
-
setPlatformApplicationAttributes(
{required Map< String, String> attributes, required String platformApplicationArn}) → Future<void> - Sets the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging). For more information, see Using Amazon SNS Mobile Push Notifications. For information on configuring attributes for message delivery status, see Using Amazon SNS Application Attributes for Message Delivery Status.
-
setSMSAttributes(
{required Map< String, String> attributes}) → Future<void> - Use this request to set the default settings for sending SMS messages and receiving daily SMS usage reports.
-
setSubscriptionAttributes(
{required String attributeName, required String subscriptionArn, String? attributeValue}) → Future< void> - Allows a subscription owner to set an attribute of the subscription to a new value.
-
setTopicAttributes(
{required String attributeName, required String topicArn, String? attributeValue}) → Future< void> - Allows a topic owner to set an attribute of the topic to a new value.
-
subscribe(
{required String protocol, required String topicArn, Map< String, String> ? attributes, String? endpoint, bool? returnSubscriptionArn}) → Future<SubscribeResponse> -
Subscribes an endpoint to an Amazon SNS topic. If the endpoint type is
HTTP/S or email, or if the endpoint and the topic are not in the same AWS
account, the endpoint owner must run the
ConfirmSubscription
action to confirm the subscription. -
tagResource(
{required String resourceArn, required List< Tag> tags}) → Future<void> - Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.
-
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribe(
{required String subscriptionArn}) → Future< void> -
Deletes a subscription. If the subscription requires authentication for
deletion, only the owner of the subscription or the topic's owner can
unsubscribe, and an AWS signature is required. If the
Unsubscribe
call does not require authentication and the requester is not the subscription owner, a final cancellation message is delivered to the endpoint, so that the endpoint owner can easily resubscribe to the topic if theUnsubscribe
request was unintended. -
untagResource(
{required String resourceArn, required List< String> tagKeys}) → Future<void> - Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited