-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(guild): guildMemberListUpdate and UpdateGuildSubscriptions gatew…
…ay payload For retrieving the member list of a guild and subscribing to other updates.
- Loading branch information
1 parent
cdd577e
commit 50fb7f3
Showing
6 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// DiscordRange.swift | ||
// | ||
// | ||
// Created by Vincent Kwok on 14/3/24. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct DiscordRange: Codable { | ||
public let start: Int | ||
public let end: Int | ||
|
||
public var closedRange: ClosedRange<Int> { start...end } | ||
|
||
public init(start: Int, end: Int) { | ||
self.start = start | ||
self.end = end | ||
} | ||
|
||
public init(from decoder: any Decoder) throws { | ||
var container = try decoder.unkeyedContainer() | ||
self.start = try container.decode(Int.self) | ||
self.end = try container.decode(Int.self) | ||
guard container.isAtEnd else { | ||
throw DecodingError.dataCorrupted(.init(codingPath: [], debugDescription: "Unexpected elements at end of range")) | ||
} | ||
} | ||
|
||
public func encode(to encoder: any Encoder) throws { | ||
var container = encoder.unkeyedContainer() | ||
try container.encode(start) | ||
try container.encode(end) | ||
} | ||
} |