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 the Amazon SNS product page. 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
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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 Amazon Web Services 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 Amazon Web Services 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
Subscribeaction. 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 theAuthenticateOnUnsubscribeflag 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
PlatformPrincipalandPlatformCredentialattributes when using theCreatePlatformApplicationaction. -
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.
CreatePlatformEndpointrequires thePlatformApplicationArnthat is returned fromCreatePlatformApplication. You can use the returnedEndpointArnto send a message to a mobile app or by theSubscribeaction for subscription to a topic. TheCreatePlatformEndpointaction 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. -
createSMSSandboxPhoneNumber(
{required String phoneNumber, LanguageCodeString? languageCode}) → Future< void> - Adds a destination phone number to an Amazon Web Services account in the SMS sandbox and sends a one-time password (OTP) to that phone number.
-
createTopic(
{required String name, Map< String, String> ? attributes, String? dataProtectionPolicy, 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 Creating an Amazon SNS topic in the Amazon SNS Developer Guide. 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.
-
deleteSMSSandboxPhoneNumber(
{required String phoneNumber}) → Future< void> - Deletes an Amazon Web Services account's verified or pending phone number from the SMS sandbox.
-
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.
-
getDataProtectionPolicy(
{required String resourceArn}) → Future< GetDataProtectionPolicyResponse> -
Retrieves the specified inline
DataProtectionPolicydocument that is stored in the specified Amazon SNS topic. -
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 Amazon Web Services account.
-
getSMSSandboxAccountStatus(
) → Future< GetSMSSandboxAccountStatusResult> - Retrieves the SMS sandbox status for the calling Amazon Web Services account in the target Amazon Web Services Region.
-
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
ListEndpointsByPlatformApplicationare 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 callListEndpointsByPlatformApplicationagain 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. -
listOriginationNumbers(
{int? maxResults, String? nextToken}) → Future< ListOriginationNumbersResult> - Lists the calling Amazon Web Services account's dedicated origination numbers and their metadata. For more information about origination numbers, see Origination numbers in the Amazon SNS Developer Guide.
-
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
ListPlatformApplicationsare 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 callListPlatformApplicationsusing the NextToken string received from the previous call. When there are no more records to return,NextTokenwill be null. For more information, see Using Amazon SNS Mobile Push Notifications. -
listSMSSandboxPhoneNumbers(
{int? maxResults, String? nextToken}) → Future< ListSMSSandboxPhoneNumbersResult> - Lists the calling Amazon Web Services account's current verified and pending destination phone numbers in the SMS sandbox.
-
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
NextTokenis also returned. Use theNextTokenparameter in a newListSubscriptionscall 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
NextTokenis also returned. Use theNextTokenparameter in a newListSubscriptionsByTopiccall 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
NextTokenis also returned. Use theNextTokenparameter in a newListTopicscall 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). -
publishBatch(
{required List< PublishBatchRequestEntry> publishBatchRequestEntries, required String topicArn}) → Future<PublishBatchResponse> -
Publishes up to 10 messages to the specified topic in a single batch. This
is a batch version of the
PublishAPI. If you try to send more than 10 messages in a single batch request, you will receive aTooManyEntriesInBatchRequestexception. -
putDataProtectionPolicy(
{required String dataProtectionPolicy, required String resourceArn}) → Future< void> - Adds or updates an inline policy document that is stored in the specified Amazon SNS topic.
-
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
Amazon Web Services account, the endpoint owner must run the
ConfirmSubscriptionaction 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 Amazon Web Services signature is required. If the
Unsubscribecall 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 theUnsubscriberequest 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.
-
verifySMSSandboxPhoneNumber(
{required String oneTimePassword, required String phoneNumber}) → Future< void> - Verifies a destination phone number with a one-time password (OTP) for the calling Amazon Web Services account.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited