Skip to content

Commit d60aa7f

Browse files
authored
chore(auth): Updated code documentation comments (#1265)
1 parent 8057925 commit d60aa7f

31 files changed

+166
-2
lines changed

Amplify/Categories/Auth/Error/AuthError.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import Foundation
99

10+
/// Amplify error raised in the Auth category.
1011
public enum AuthError {
1112

1213
/// Caused by issue in the way auth category is configured

Amplify/Categories/Auth/Models/AuthCodeDeliveryDetails.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Foundation
99

1010
public typealias AdditionalInfo = [String: String]
1111

12+
/// Details on where the code has been delivered
1213
public struct AuthCodeDeliveryDetails {
1314

1415
/// Destination to which the code was delivered.

Amplify/Categories/Auth/Models/AuthDevice.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77

88
import Foundation
99

10+
/// Device used by the user to sign in
1011
public protocol AuthDevice {
1112

13+
/// Device id
1214
var id: String { get }
1315

16+
/// Device name
1417
var name: String { get }
1518
}

Amplify/Categories/Auth/Models/AuthProvider.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,33 @@
77

88
import Foundation
99

10+
/// Supported auth providers that help in federated sign in
11+
///
12+
/// You can use these auth providers to directly sign in to one of the user's social provider and then
13+
/// federate them to the auth plugin's underlying service. For example in the api
14+
/// `Amplify.Auth.signInWithWebUI(for:presentationAnchor:)` you can pass in a provider
15+
/// in the `for:` parameter which will directly show a authentication view for the passed in auth provider.
1016
public enum AuthProvider {
1117

18+
/// Auth provider that uses Login with Amazon
1219
case amazon
1320

21+
/// Auth provider that uses Sign in with Apple
1422
case apple
1523

24+
/// Auth provider that uses Facebook Login
1625
case facebook
1726

27+
/// Auth provider that uses Google Sign-In
1828
case google
1929

30+
/// Auth provider that uses OpenID Connect Protocol
2031
case oidc
2132

33+
/// Auth provider that uses Security Assertion Markup Language standard
2234
case saml
2335

36+
/// Custom auth provider that is not in this list, the associated string value will be the identifier used by
37+
/// the plugin service.
2438
case custom(String)
2539
}

Amplify/Categories/Auth/Models/AuthSession.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88
import Foundation
99

10+
/// Defines the auth session behavior
1011
public protocol AuthSession {
1112

13+
/// Indicates whether a user is signed in or not
14+
///
15+
/// `true` if a user is authenticated. `isSignedIn` remains `true` till we call `Amplify.Auth.signOut`.
16+
/// Please note that this value remains `true` even when the session is expired. Refer the underlying plugin
17+
/// documentation regarding how to handle session expiry.
1218
var isSignedIn: Bool { get }
1319
}

Amplify/Categories/Auth/Models/AuthUpdateAttributeStep.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
/// Step for Auth.updateUserAttribute api call
89
public enum AuthUpdateAttributeStep {
910

11+
/// Next step is to confirm the attribute with confirmation code.
12+
///
13+
/// Invoke Auth.confirm(userAttribute: ...) to confirm the attribute that was updated.
14+
/// `AuthCodeDeliveryDetails` provides the details to which the confirmation
15+
/// code was send and `AdditionalInfo` will provide more details if present.
1016
case confirmAttributeWithCode(AuthCodeDeliveryDetails, AdditionalInfo?)
1117

18+
/// Update Attribute step is `done` when the update attribute flow is complete.
1219
case done
1320
}

Amplify/Categories/Auth/Models/AuthUser.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
/// Defines the protocol for an auth user
89
public protocol AuthUser {
910

11+
/// User name of the auth user
1012
var username: String { get }
1113

14+
/// Unique id of the auth user
1215
var userId: String { get }
1316

1417
}

Amplify/Categories/Auth/Models/AuthUserAttribute.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,54 @@ public struct AuthUserAttribute {
1515
}
1616
}
1717

18+
/// Represents the keys used for different user attributes.
19+
///
1820
public enum AuthUserAttributeKey {
1921
// Attribute ref - https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html
22+
23+
/// Attribute key for user's address
2024
case address
25+
26+
/// Attribute key for user's birthdate
2127
case birthDate
28+
29+
/// Attribute key for user's email
2230
case email
31+
32+
/// Attribute key for user's family name
2333
case familyName
34+
35+
/// Attribute key for user's gender
2436
case gender
37+
38+
/// Attribute key for user's given name
2539
case givenName
40+
41+
/// Attribute key for user's locale
2642
case locale
43+
44+
/// Attribute key for user's middle name
2745
case middleName
46+
47+
/// Attribute key for user's name
2848
case name
49+
50+
/// Attribute key for user's nickname
2951
case nickname
52+
53+
/// Attribute key for user's phone number
3054
case phoneNumber
55+
56+
/// Attribute key for user's picture
3157
case picture
58+
59+
/// Attribute key for user's preferred user name
3260
case preferredUsername
61+
62+
/// Attribute key for providing custom attributes
3363
case custom(String)
64+
65+
/// Attribute key for representing any other keys not mentioned here
3466
case unknown(String)
3567
}
3668

Amplify/Categories/Auth/Models/DeliveryDestination.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77

88
public typealias Destination = String
99

10+
/// Destination to where an item (e.g., confirmation code) was delivered
1011
public enum DeliveryDestination {
1112

13+
/// Email destination with optional associated value containing the email info
1214
case email(Destination?)
1315

16+
/// Phone destination with optional associated value containing the phone number info
1417
case phone(Destination?)
1518

19+
/// SMS destination with optional associated value containing the number info
1620
case sms(Destination?)
1721

22+
/// Unknown destination with optional associated value destination detail
1823
case unknown(Destination?)
1924
}

Amplify/Categories/Auth/Request/AuthAttributeResendConfirmationCodeRequest.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77

88
import Foundation
99

10-
// swiftlint:disable:next type_name
10+
// swiftlint:disable type_name
11+
12+
/// Request for resending confirmation code that was generated for update attribute
1113
public struct AuthAttributeResendConfirmationCodeRequest: AmplifyOperationRequest {
1214

15+
/// Attribute key for which the confirmation code was sent
1316
public let attributeKey: AuthUserAttributeKey
1417

18+
/// Extra request options defined in `AuthAttributeResendConfirmationCodeRequest.Options`
1519
public var options: Options
1620

1721
public init(attributeKey: AuthUserAttributeKey,

0 commit comments

Comments
 (0)