Skip to content

Commit

Permalink
Add Rest API with UserPool Integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Feb 12, 2020
1 parent ad94773 commit 1c210ee
Show file tree
Hide file tree
Showing 14 changed files with 658 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Amplify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
210922522359634C00CEC295 /* AnalyticsPropertyValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2109224B2359634C00CEC295 /* AnalyticsPropertyValue.swift */; };
210922572359693900CEC295 /* BasicAnalyticsEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 210922562359693800CEC295 /* BasicAnalyticsEvent.swift */; };
2109225A23596BCD00CEC295 /* AnalyticsCategoryClientBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2109225923596BCD00CEC295 /* AnalyticsCategoryClientBehavior.swift */; };
210A8C2623F4999E003F4D91 /* AWSMobileClientError+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 210A8C2523F4999E003F4D91 /* AWSMobileClientError+Extension.swift */; };
210DBC122332B3C0009B9E51 /* StorageDownloadFileOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 210DBC112332B3C0009B9E51 /* StorageDownloadFileOperation.swift */; };
210DBC142332B3C6009B9E51 /* StorageGetURLOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 210DBC132332B3C6009B9E51 /* StorageGetURLOperation.swift */; };
210DBC162332B3CB009B9E51 /* StorageDownloadDataOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 210DBC152332B3CB009B9E51 /* StorageDownloadDataOperation.swift */; };
Expand Down Expand Up @@ -525,6 +526,7 @@
2109224B2359634C00CEC295 /* AnalyticsPropertyValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnalyticsPropertyValue.swift; sourceTree = "<group>"; };
210922562359693800CEC295 /* BasicAnalyticsEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicAnalyticsEvent.swift; sourceTree = "<group>"; };
2109225923596BCD00CEC295 /* AnalyticsCategoryClientBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsCategoryClientBehavior.swift; sourceTree = "<group>"; };
210A8C2523F4999E003F4D91 /* AWSMobileClientError+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AWSMobileClientError+Extension.swift"; sourceTree = "<group>"; };
210DBC112332B3C0009B9E51 /* StorageDownloadFileOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageDownloadFileOperation.swift; sourceTree = "<group>"; };
210DBC132332B3C6009B9E51 /* StorageGetURLOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageGetURLOperation.swift; sourceTree = "<group>"; };
210DBC152332B3CB009B9E51 /* StorageDownloadDataOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageDownloadDataOperation.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1960,6 +1962,7 @@
21420A81237222A700FA140C /* AWSAuthServiceBehavior.swift */,
21420A8C237222A900FA140C /* AWSMobileClientAdapter.swift */,
21420A8E237222A900FA140C /* AWSMobileClientBehavior.swift */,
210A8C2523F4999E003F4D91 /* AWSMobileClientError+Extension.swift */,
21420A7A237222A700FA140C /* Configuration */,
21420A83237222A800FA140C /* Provider */,
);
Expand Down Expand Up @@ -3433,6 +3436,7 @@
2129BE4423948951006363A1 /* MutationSyncMetadata.swift in Sources */,
2129BE1E2394806B006363A1 /* QueryPredicate+GraphQL.swift in Sources */,
21420A8F237222A900FA140C /* AWSIAMConfiguration.swift in Sources */,
210A8C2623F4999E003F4D91 /* AWSMobileClientError+Extension.swift in Sources */,
2129BE1723948065006363A1 /* GraphQLRequest+Model.swift in Sources */,
219A888523EB897700BBC5F2 /* GraphQLRequest+AnyModelWithSync.swift in Sources */,
219A88F123F3379900BBC5F2 /* GraphQLDocumentInput.swift in Sources */,
Expand Down
12 changes: 12 additions & 0 deletions Amplify/Categories/Storage/Error/AuthError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Foundation

public enum AuthError {
case identity(ErrorName, ErrorDescription, RecoverySuggestion, Error? = nil)
case notAuthenticated(ErrorDescription, RecoverySuggestion, Error? = nil)
case notAuthorized(ErrorDescription, RecoverySuggestion, Error? = nil)
case unknown(ErrorDescription, Error? = nil)
}

Expand All @@ -17,6 +19,10 @@ extension AuthError: AmplifyError {
switch self {
case .identity(let errorName, let errorDescription, _, _):
return "Could not get IdentityId due to [\(errorName)] with message: \(errorDescription)"
case .notAuthenticated(let errorDescription, _, _):
return "The user is not authenticated: \(errorDescription)"
case .notAuthorized(let errorDescription, _, _):
return "The user is not authorized: \(errorDescription)"
case .unknown(let errorDescription, _):
return "Unexpected error occurred with message: \(errorDescription)"
}
Expand All @@ -26,6 +32,10 @@ extension AuthError: AmplifyError {
switch self {
case .identity(_, _, let recoverySuggestion, _):
return recoverySuggestion
case .notAuthenticated(_, let recoverySuggestion, _):
return recoverySuggestion
case .notAuthorized(_, let recoverySuggestion, _):
return recoverySuggestion
case .unknown:
return AmplifyErrorMessages.shouldNotHappenReportBugToAWS()
}
Expand All @@ -34,6 +44,8 @@ extension AuthError: AmplifyError {
public var underlyingError: Error? {
switch self {
case .identity(_, _, _, let underlyingError),
.notAuthenticated(_, _, let underlyingError),
.notAuthorized(_, _, let underlyingError),
.unknown(_, let underlyingError):
return underlyingError
}
Expand Down
Loading

0 comments on commit 1c210ee

Please sign in to comment.