Skip to content

Commit 2b8bc75

Browse files
committed
Support URL properties
ref. discord/discord-api-docs#7674
1 parent 070d5e9 commit 2b8bc75

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwordRPC/Types/RichPresence.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,42 @@ import Foundation
1111
public struct RichPresence: Encodable {
1212
public var assets = Assets()
1313
public var details = ""
14+
public var statusDisplayType: StatusDisplayType = .app
15+
public var detailsURL: URL?
1416
public var instance = true
1517
public var party = Party()
1618
public var secrets: Secrets?
1719
public var state = ""
20+
public var stateURL: URL?
1821
public var timestamps = Timestamps()
1922
public var buttons: [Button]?
2023
public var type: ActivityType?
24+
25+
enum CodingKeys: String, CodingKey {
26+
case assets
27+
case details
28+
case statusDisplayType = "status_display_type"
29+
case detailsURL = "details_url"
30+
case instance
31+
case party
32+
case secrets
33+
case state
34+
case stateURL = "state_url"
35+
case timestamps
36+
case buttons
37+
case type
38+
}
2139

2240
public init() {}
2341
}
2442

2543
public extension RichPresence {
44+
enum StatusDisplayType: Int, Encodable {
45+
case app = 0
46+
case state = 1
47+
case details = 2
48+
}
49+
2650
struct Timestamps: Encodable {
2751
public var end: Date?
2852
public var start: Date?
@@ -43,14 +67,18 @@ public extension RichPresence {
4367
struct Assets: Encodable {
4468
public var largeImage: String?
4569
public var largeText: String?
70+
public var largeURL: URL?
4671
public var smallImage: String?
4772
public var smallText: String?
73+
public var smallURL: URL?
4874

4975
enum CodingKeys: String, CodingKey {
5076
case largeImage = "large_image"
5177
case largeText = "large_text"
78+
case largeURL = "large_url"
5279
case smallImage = "small_image"
5380
case smallText = "small_text"
81+
case smallURL = "small_url"
5482
}
5583
}
5684

0 commit comments

Comments
 (0)