AuthProviderID.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. /// Enumeration of the available Auth Provider IDs.
  16. public struct AuthProviderID: Equatable {
  17. public let rawValue: String
  18. private init(rawValue: String) {
  19. self.rawValue = rawValue
  20. }
  21. }
  22. public extension AuthProviderID {
  23. static var apple: Self {
  24. Self(rawValue: "apple.com")
  25. }
  26. static var email: Self {
  27. Self(rawValue: "password")
  28. }
  29. static var facebook: Self {
  30. Self(rawValue: "facebook.com")
  31. }
  32. static var gameCenter: Self {
  33. Self(rawValue: "gc.apple.com")
  34. }
  35. static var gitHub: Self {
  36. Self(rawValue: "github.com")
  37. }
  38. static var google: Self {
  39. Self(rawValue: "google.com")
  40. }
  41. static var phone: Self {
  42. Self(rawValue: "phone")
  43. }
  44. static func custom(_ value: String) -> Self {
  45. Self(rawValue: value)
  46. }
  47. }