Protocols
The following protocols are available globally.
-
API Category Plugin
See moreDeclaration
Swift
public protocol APICategoryPlugin : APICategoryAuthProviderFactoryBehavior, APICategoryGraphQLBehavior, APICategoryInterceptorBehavior, APICategoryRESTBehavior, APICategoryReachabilityBehavior, Plugin
-
Declaration
Swift
public protocol AmplifyAuthTokenProvider
-
Amplify OIDC Auth Provider
Declaration
Swift
public protocol AmplifyOIDCAuthProvider : AmplifyAuthTokenProvider
-
Amplify Function Auth Provider
Declaration
Swift
public protocol AmplifyFunctionAuthProvider : AmplifyAuthTokenProvider
-
API Category Auth provider Factory Behavior
See moreDeclaration
Swift
public protocol APICategoryAuthProviderFactoryBehavior
-
Behavior of the API category related to GraphQL operations
See moreDeclaration
Swift
public protocol APICategoryGraphQLBehavior : AnyObject
-
A URLRequestInterceptor accepts a request and returns a request. It is invoked during the “prepare” phase of an API operation.
A URLRequestInterceptor may use the request as a data source for some other operation (e.g., metrics or logging), or use it as the source for preparing a new request that will be used to fulfill the operation. For example, a URLRequestInterceptor may add custom headers to the request for authorization.
URLRequestInterceptors are invoked in the order in which they are added to the plugin.
See moreDeclaration
Swift
public protocol APICategoryInterceptorBehavior
-
Behavior of the API category related to REST operations
See moreDeclaration
Swift
public protocol APICategoryRESTBehavior
-
API Reachability Behavior
See moreDeclaration
Swift
public protocol APICategoryReachabilityBehavior
-
A URLRequestInterceptor accepts a request and returns a request. It is invoked during the “prepare” phase of an API operation.
A URLRequestInterceptor may use the request as a data source for some other operation (e.g., metrics or logging), or use it as the source for preparing a new request that will be used to fulfill the operation. For example, a URLRequestInterceptor may add custom headers to the request for authorization.
URLRequestInterceptors are invoked in the order in which they are added to the plugin.
See moreDeclaration
Swift
public protocol URLRequestInterceptor
-
All HTTP operations have the same underlying Operation type
See moreDeclaration
Swift
public protocol RESTOperation : AmplifyOperation<RESTOperationRequest, Data, APIError>
-
Empty protocol for plugins to define specific
AuthorizationMode
types for the request.Declaration
Swift
public protocol AuthorizationMode
-
Behavior of the Analytics category that clients will use
See moreDeclaration
Swift
public protocol AnalyticsCategoryBehavior
-
Analytics category plugin
See moreDeclaration
Swift
public protocol AnalyticsCategoryPlugin : AnalyticsCategoryBehavior, Plugin
-
Analytics properties can store values of common types
Declaration
Swift
public protocol AnalyticsPropertyValue
-
Analytics event
See moreDeclaration
Swift
public protocol AnalyticsEvent
-
Behavior of the Auth category that clients will use
See moreDeclaration
Swift
public protocol AuthCategoryBehavior : AuthCategoryDeviceBehavior, AuthCategoryUserBehavior
-
Declaration
Swift
public protocol AuthCategoryDeviceBehavior : AnyObject
-
Declaration
Swift
public protocol AuthCategoryPlugin : AuthCategoryBehavior, Plugin
-
Declaration
Swift
public protocol AuthCategoryUserBehavior : AnyObject
-
Device used by the user to sign in
See moreDeclaration
Swift
public protocol AuthDevice
-
Defines the auth session behavior
See moreDeclaration
Swift
public protocol AuthSession
-
Defines the protocol for an auth user
See moreDeclaration
Swift
public protocol AuthUser
-
Declaration
Swift
public protocol AuthSignOutResult
-
Declaration
Swift
public protocol DataStoreBaseBehavior
-
Declaration
Swift
public protocol DataStoreSubscribeBehavior
-
Declaration
Swift
public protocol DataStoreCategoryPlugin : DataStoreBaseBehavior, DataStoreSubscribeBehavior, Plugin
-
This protocol represents a statement that will be executed in a specific storage implementations. Concrete types of this protocol may include SQL insert statements, queries or GraphQL mutations.
See moreDeclaration
Swift
public protocol DataStoreStatement
-
Protocol that defines a contract between the consumer and the DataStore plugin. All models have to be registered and have an associated
See moreversion
.Declaration
Swift
public protocol AmplifyModelRegistration
-
A
Embeddable
type can be used in aModel
as an embedded type. All types embedded in aModel
as anembedded(type:)
orembeddedCollection(of:)
must comform to theEmbeddable
protocol except for Swift’s Basic types embedded as a collection. A collection of String can be embedded in theModel
asembeddedCollection(of: String.self)
without needing to conform to Embeddable.Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol Embeddable : Decodable, Encodable
-
All persistent models should conform to the Model protocol.
See moreDeclaration
Swift
public protocol Model : Decodable, Encodable
-
Protocol that represents a
Codable
Enum that can be persisted and easily integrate with remote APIs since it must have a rawString
value.That means only enums without associated values can be used as model properties.
- Example:
public enum PostStatus: String, EnumPersistable { case draft case published }
Warning
Although this haspublic
access, it is intended for internal use and should not be used directly by host applications. The behavior of this may change without warning.Declaration
Swift
public protocol EnumPersistable : Decodable, Encodable
-
ModelListDecoder
provides decoding and list functionality.Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol ModelListDecoder
-
Empty protocol used as a marker to detect when the type is a
List
Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol ModelListMarker
-
Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol ModelListProvider
-
Protocol used as a marker to detect when the type is a
LazyReference
. Used to retrieve either thereference
or theidentifiers
of the Model directly, without having load a not loaded LazyReference. This is useful when translating the model object over to the payload required for the underlying storage, such as storing the values in DataStore’s local database or AppSync GraphQL request payload.Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol _LazyReferenceValue
-
Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol ModelProvider
-
ModelProviderDecoder
provides decoding and lazy reference functionality.Warning
Although this haspublic
access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to thesepublic
types should be backward compatible, otherwise it will be a breaking change.Declaration
Swift
public protocol ModelProviderDecoder
-
Types that conform to the
Persistable
protocol represent values that can be persisted in a database.Core Types that conform to this protocol:
Bool
Double
Int
String
Temporal.Date
Temporal.DateTime
Temporal.Time
Warning
Although this haspublic
access, it is intended for internal use and should not be used directly by host applications. The behavior of this may change without warning.Declaration
Swift
public protocol Persistable : Encodable
-
Establishes how
Model
fields should be converted to and from different targets (e.g. SQL and GraphQL).Warning
Although this haspublic
access, it is intended for internal use and should not be used directly by host applications. The behavior of this may change without warning.Declaration
Swift
public protocol ModelValueConverter
-
A type that holds internal data in json format
Internally a
JSONValueHolder
will have the data stored as a json map. Properties of the type can be retrieved using the functionjsonValue(for:)
passing in the key of the property.Example:
See morestruct DynamicModel: JSONValueHolder { let values: [String: Any] public func jsonValue(for key: String) -> Any?? { return values[key] } }
Declaration
Swift
public protocol JSONValueHolder
-
AnyModelIdentifierFormat
Declaration
Swift
public protocol AnyModelIdentifierFormat
-
Defines requirements for a model to be identifiable with a unique identifier that can be either a single field or a combination of fields
See moreDeclaration
Swift
public protocol ModelIdentifiable
-
Defines a
See moreModelIdentifier
requirements.Declaration
Swift
public protocol ModelIdentifierProtocol
-
This is a specialized protocol to indicate the property is a container of other properties, i.e. a
struct
representing anotherModel
.See also
ModelPath
Declaration
Swift
public protocol PropertyContainerPath : PropertyPath
-
Supports addition and subtraction of
See moreTemporal.Date
andTemporal.DateTime
withDateUnit
Declaration
Swift
public protocol DateUnitOperable
-
Defines a common format for a
See moreTemporalSpec
unit used in operations. It is a tuple ofCalendar.Component
, such as.year
, and an integer value. Those two are later used in date operations such “4 hours from now” and “2 months ago”.Declaration
Swift
@available(*, deprecated, message: "This protocol will be removed in the future.") public protocol TemporalUnit
-
Supports addition and subtraction of
See moreTemporal.Time
andTemporal.DateTime
withTimeUnit
Declaration
Swift
public protocol TimeUnitOperable
-
Declaration
Swift
public protocol Evaluable
-
The
ModelKey
protocol is used to decorate Swift standard’sCodingKey
enum with query functions and operators that are used to build query conditions.let post = Post.keys Amplify.DataStore.query(Post.self, where: { post.title.contains("[Amplify]") .and(post.content.ne(nil)) })
Using Operators:
The operators on a
ModelKey
reference are defined so queries can also be written with Swift operators as well:let post = Post.keys Amplify.DataStore.query(Post.self, where: { post.title ~= "[Amplify]" && post.content != nil })
Declaration
Swift
public protocol ModelKey : QueryFieldOperation, CaseIterable, CodingKey
-
QueryFieldOperation
provides functions that creates predicates based on a field name. These functions are matchers that get executed at a later point by specific implementations of theModel
filtering logic (e.g. SQL or GraphQL queries).Seealso
QueryField
Seealso
ModelKey
Declaration
Swift
public protocol QueryFieldOperation
-
Protocol that indicates concrete types conforming to it can be used a predicate member.
Declaration
Swift
public protocol QueryPredicate : Evaluable, Encodable
-
Behavior of the Geo category that clients will use
See moreDeclaration
Swift
public protocol GeoCategoryBehavior
-
Geo category plugin
See moreDeclaration
Swift
public protocol GeoCategoryPlugin : GeoCategoryBehavior, Plugin
-
Behavior of the Hub category that clients will use
See moreDeclaration
Swift
public protocol HubCategoryBehavior
-
Declaration
Swift
public protocol HubCategoryPlugin : HubCategoryBehavior, Plugin
-
Declaration
Swift
public protocol HubPayloadEventNameable
-
Defines a
See morelog
convenience property, and provides a default implementation that returns a Logger for a category name ofString(describing: self)
Declaration
Swift
public protocol DefaultLogger
-
Declaration
Swift
public protocol LoggingCategoryClientBehavior
-
Declaration
Swift
public protocol Logger
-
The behavior that all LoggingPlugins provide
See moreDeclaration
Swift
public protocol LoggingCategoryPlugin : LoggingCategoryClientBehavior, Plugin
-
Defines the behaviour of a Notifications subcategory
Declaration
Swift
public protocol NotificationsSubcategoryBehaviour
-
Defines the behaviour of the Push Notifications category that clients will use
See moreDeclaration
Swift
public protocol PushNotificationsCategoryBehaviour : NotificationsSubcategoryBehaviour
-
Defines a plugin that implements the behaviour of the Push Notifications category
See moreDeclaration
Swift
public protocol PushNotificationsCategoryPlugin : Plugin, PushNotificationsCategoryBehaviour
-
protocol describing identified text in an image
See moreDeclaration
Swift
public protocol IdentifiedText
-
Behavior of the Predictions category that clients will use
See moreDeclaration
Swift
public protocol PredictionsCategoryBehavior
-
Declaration
Swift
public protocol PredictionsCategoryPlugin : Plugin, PredictionsCategoryBehavior
-
- Tag: StorageDownloadDataOperation
Declaration
Swift
public protocol StorageDownloadDataOperation: AmplifyInProcessReportingOperation< StorageDownloadDataRequest, Progress, Data, StorageError >
-
This operation encapsulates work to download an object from cloud storage to local storage.
Event descriptions
- InProcess:
Progress
- representing the progress of the download. This event will be emitted as controlled by the underlying NSURLSession behavior, but could be multiple times per second. Apps should not rely on Progress to be 1.0 to determine a completed operation - Completed:
Void
- Receipt of a.completed
event indicates the download is complete and the file has been successfully stored to the local URL supplied in the originalStorageDownloadFileRequest
Error:
StorageError
- Emitted if the download encounters an error.Tag: StorageDownloadFileOperation
Declaration
Swift
public protocol StorageDownloadFileOperation: AmplifyInProcessReportingOperation< StorageDownloadFileRequest, Progress, Void, StorageError >
- InProcess:
-
- Tag: StorageGetURLOperation
Declaration
Swift
public protocol StorageGetURLOperation : AmplifyOperation<StorageGetURLRequest, URL, StorageError>
-
- Tag: StorageListOperation
Declaration
Swift
public protocol StorageListOperation : AmplifyOperation<StorageListRequest, StorageListResult, StorageError>
-
- Tag: StorageRemoveOperation
Declaration
Swift
public protocol StorageRemoveOperation : AmplifyOperation<StorageRemoveRequest, String, StorageError>
-
- Tag: StorageUploadDataOperation
Declaration
Swift
public protocol StorageUploadDataOperation: AmplifyInProcessReportingOperation< StorageUploadDataRequest, Progress, String, StorageError >
-
- Tag: StorageUploadFileOperation
Declaration
Swift
public protocol StorageUploadFileOperation: AmplifyInProcessReportingOperation< StorageUploadFileRequest, Progress, String, StorageError >
-
Declaration
Swift
public protocol StorageBucket
-
Behavior of the Storage category used though
Amplify.Storage.*
. Plugin implementations conform to this protocol indirectly though the StorageCategoryPlugin protocol.- Tag: StorageCategoryBehavior
Declaration
Swift
public protocol StorageCategoryBehavior
-
- Tag: StorageCategoryPlugin
Declaration
Swift
public protocol StorageCategoryPlugin : Plugin, StorageCategoryBehavior
-
Declaration
Swift
public protocol StoragePath
-
An Amplify Category stores certain global states, holds references to plugins for the category, and routes method requests to those plugins appropriately.
- Tag: Category
Declaration
Swift
public protocol Category : AnyObject, CategoryTypeable, DefaultLogger
-
The Amplify category with which the conforming type is associated. Categories, Plugins, ClientBehaviors, etc must all share the same CategoryType
- Tag: CategoryTypeable
Declaration
Swift
public protocol CategoryTypeable
-
A CategoryConfiguration must contain a plugins field used to configure plugins for that category
- Tag: CategoryConfiguration
Declaration
Swift
public protocol CategoryConfiguration : Decodable, Encodable
-
Contains specific data for a User
See moreDeclaration
Swift
public protocol UserProfile
-
Properties of a
UserProfile
can store values of different common types. This protocol is an encapsulation of said types.Currently supported types are
String
,Int
,Double
,Bool
andArray<String>
.If the underlying service does not support one of these, it is expected that the plugin will cast it to another supported type. For example, casting a
Bool
to aString
.Declaration
Swift
public protocol UserProfilePropertyValue
-
Note that although this protocol is public, the
See morereset
method is intended only for internal use, and should not be invoked by host applications.Declaration
Swift
public protocol Resettable
-
CategoryPlugins implement the behavior defined by the category. The
See morePlugin
protocol defines behavior common to all plugins, but each category will also define client API behavior and optionally, plugin API behavior to describe the contract to which the plugin must conform.Declaration
Swift
public protocol Plugin : CategoryTypeable, Resettable
-
The conforming type can be initialized with a
Plugin
. Allows for construction of concrete, type-erasing wrappers to store heterogenous collections of Plugins in a category.Throws
PluginError.mismatchedPlugin if the instance is associated with the wrong categoryDeclaration
Swift
public protocol PluginInitializable
-
Amplify’s philosophy is to expose friendly error messages to the customer that assist with debugging. Therefore, failable APIs are declared to return error results with Amplify errors, which require recovery suggestions and error messages.
- Tag: AmplifyError
Declaration
Swift
public protocol AmplifyError : CustomDebugStringConvertible, Error
-
Describes the parameters that are passed during the creation of an AmplifyOperation
See moreDeclaration
Swift
public protocol AmplifyOperationRequest
-
Simple task that represents a unit of work and its result.
See Also: AmplifyInProcessReportingTask
- Tag: AmplifyTask
Declaration
Swift
public protocol AmplifyTask
-
Simple task that represents a unit of work and its result and is able to report its progress.
See Also: AmplifyTask
- Tag: AmplifyInProcessReportingTask
Declaration
Swift
public protocol AmplifyInProcessReportingTask
-
Task that supports hub with execution of a single unit of work. .
See Also: AmplifyTask
- Tag: AmplifyTaskExecution
Declaration
Swift
public protocol AmplifyTaskExecution
-
Declaration
Swift
public protocol BufferingSequence
-
The conforming type supports cancelling an in-process operation. The exact semantics of “canceling” are not defined in the protocol. Specifically, there is no guarantee that a
See morecancel
results in immediate cessation of activity.Declaration
Swift
public protocol Cancellable
-
Declaration
Swift
public protocol InternalTaskAsyncSequence : AnyObject
-
Declaration
Swift
public protocol InternalTaskAsyncThrowingSequence : AnyObject
-
Declaration
Swift
public protocol InternalTaskChannel
-
Declaration
Swift
public protocol InternalTaskThrowingChannel
-
Declaration
Swift
public protocol InternalTaskInProcess
-
Declaration
Swift
public protocol InternalTaskIdentifiable
-
Declaration
Swift
public protocol InternalTaskHubResult
-
Declaration
Swift
public protocol InternalTaskHubInProcess
-
Declaration
Swift
public protocol InternalTaskValue
-
Declaration
Swift
public protocol InternalTaskResult
-
Declaration
Swift
public protocol InternalTaskRunner : AnyObject, Cancellable
-
Declaration
Swift
public protocol InternalTaskController
-
Declaration
Swift
public protocol RequestIdentifier
-
The conforming type supports pausing and resuming of an in-process operation. The exact semantics of “pausing” and “resuming” are not defined in the protocol. Specifically, there is no guarantee that a
See morepause
results in an immediate suspention of activity, and no guarantee thatresume
will result in an immediate resumption of activity.Declaration
Swift
public protocol Resumable
-
Implement this protocol to support versioning in your plugin
See moreDeclaration
Swift
public protocol AmplifyVersionable
-
A protocol describing the behaviors of a Developer Menu
See more -
A protocol which provides a UI context over which views can be presented
See more -
Implement this protocol to get notified of the trigger events recognized by a
See moreTriggerRecognizer
-
A protocol to be implemented for recognizing user interaction events which notifies a
See moreTriggerDelegate
if it has one