Use atproto actions with ease in iOS shortcuts
at main 2.5 kB view raw
1// 2// UserSessionModel.swift 3// shortcut 4// 5// Created by Bailey Townsend on 6/25/25. 6// 7 8import ATProtoKit 9import Foundation 10import SwiftData 11 12@Model 13class UserSessionModel { 14 15 @Attribute(.unique) public var id: UUID 16 17 /// The user's handle within the AT Protocol. 18 public var handle: String 19 20 /// The decentralized identifier (DID), serving as a persistent and long-term account 21 /// identifier according to the W3C standard. 22 public var sessionDID: String 23 24 /// The user's email address. Optional. 25 public var email: String? 26 27 /// Indicates whether the user's email address has been confirmed. Optional. 28 public var isEmailConfirmed: Bool? 29 30 /// Indicates whether Two-Factor Authentication (via email) is enabled. Optional. 31 public var isEmailAuthenticationFactorEnabled: Bool? 32 33 /// The DID document associated with the user, which contains AT Protocol-specific 34 /// information. Optional. 35 // public var didDocument: DIDDocument? 36 37 /// Indicates whether the user account is active. Optional. 38 public var isActive: Bool? 39 40 /// Indicates the possible reason for why the user account is inactive. Optional. 41 public var status: UserAccountStatus? 42 43 /// The user account's endpoint used for sending authentication requests. 44 public var serviceEndpoint: URL 45 46 /// The URL of the Personal Data Server (PDS) associated with the user. Optional. 47 /// 48 /// - Note: This is not included when initalizing `UserSession`. Instead, it's added 49 /// after the successful initalizing. 50 public var pdsURL: String? 51 52 /// The URL of the user's profile picture. Optional since it is not part of the user session response. 53 public var profilePicture: URL? 54 55 public init( 56 sessionId: UUID, handle: String, sessionDID: String, email: String? = nil, 57 isEmailConfirmed: Bool? = nil, 58 isEmailAuthenticationFactorEnabled: Bool? = nil, 59 isActive: Bool? = nil, status: UserAccountStatus? = nil, 60 serviceEndpoint: URL, pdsURL: String? = nil 61 ) { 62 self.id = sessionId 63 self.handle = handle 64 self.sessionDID = sessionDID 65 self.email = email 66 self.isEmailConfirmed = isEmailConfirmed 67 self.isEmailAuthenticationFactorEnabled = isEmailAuthenticationFactorEnabled 68 // self.didDocument = didDocument 69 self.isActive = isActive 70 self.status = status 71 self.serviceEndpoint = serviceEndpoint 72 self.pdsURL = pdsURL 73 } 74}