krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
v3.1.4: Hutch/Models/Meta.swift · raw
1import Foundation
2
3// MARK: - User Profile (full)
4
5/// Extended user profile from meta.sr.ht with all fields from the `me` query.
6struct UserProfile: Codable, Sendable {
7 let username: String
8 let canonicalName: String
9 let email: String
10 let url: String?
11 let location: String?
12 let bio: String?
13 let avatar: String?
14 let userType: String?
15 let sshKeys: SSHKeyPage
16 let pgpKeys: PGPKeyPage
17 let paymentStatus: String?
18 let subscription: Subscription?
19}
20
21// MARK: - SSH Key
22
23struct SSHKey: Codable, Sendable, Identifiable {
24 let id: Int
25 let fingerprint: String
26 let comment: String?
27 let created: Date
28 let lastUsed: Date?
29}
30
31struct SSHKeyPage: Codable, Sendable {
32 let results: [SSHKey]
33 let cursor: String?
34}
35
36// MARK: - PGP Key
37
38struct PGPKey: Codable, Sendable, Identifiable {
39 let id: Int
40 let fingerprint: String
41 let created: Date
42}
43
44struct PGPKeyPage: Codable, Sendable {
45 let results: [PGPKey]
46 let cursor: String?
47}
48
49// MARK: - Subscription
50
51struct Subscription: Codable, Sendable {
52 let status: String?
53 let autorenew: Bool?
54 let interval: String?
55}
56
57// MARK: - Personal Access Token
58
59struct PersonalAccessToken: Codable, Sendable, Identifiable {
60 let id: Int
61 let issued: Date
62 let expires: Date?
63 let comment: String?
64 let grants: String?
65}