Skip to content

Commit 526ea82

Browse files
committed
Add .all property to Expansions
1 parent 89308a3 commit 526ea82

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Sources/TwitterAPIKit/APIv2/ExpansionsV2.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ public enum TwitterTweetExpansionsV2: TwitterExpansionsParameterV2, Hashable {
3535
case .other(let string): return string
3636
}
3737
}
38+
39+
public static let all: Set<Self> = [
40+
.attachmentsPollIDs,
41+
.attachmentsMediaKeys,
42+
.authorID,
43+
.entitiesMentionsUsername,
44+
.geoPlaceID,
45+
.inReplyToUserID,
46+
.referencedTweetsID,
47+
.referencedTweetsIDAuthorID,
48+
]
3849
}
3950

4051
public enum TwitterUserExpansionsV2: TwitterExpansionsParameterV2, Hashable {
@@ -47,6 +58,10 @@ public enum TwitterUserExpansionsV2: TwitterExpansionsParameterV2, Hashable {
4758
case .other(let string): return string
4859
}
4960
}
61+
62+
public static let all: Set<Self> = [
63+
.pinnedTweetID
64+
]
5065
}
5166

5267
public enum TwitterListExpansionsV2: TwitterExpansionsParameterV2, Hashable {
@@ -59,6 +74,10 @@ public enum TwitterListExpansionsV2: TwitterExpansionsParameterV2, Hashable {
5974
case .other(let string): return string
6075
}
6176
}
77+
78+
public static let all: Set<Self> = [
79+
.ownerID
80+
]
6281
}
6382

6483
public enum TwitterSpaceExpansionsV2: TwitterExpansionsParameterV2, Hashable {
@@ -78,4 +97,11 @@ public enum TwitterSpaceExpansionsV2: TwitterExpansionsParameterV2, Hashable {
7897
case .other(let string): return string
7998
}
8099
}
100+
101+
public static let all: Set<Self> = [
102+
.invitedUserIDs,
103+
.speakerIDs,
104+
.creatorID,
105+
.hostIDs,
106+
]
81107
}

Tests/TwitterAPIKitTests/APIv2/ExpansionsV2Tests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class ExpansionsV2Tests: XCTestCase {
3030
)
3131
}
3232

33+
func testTwitterTweetExpansionsV2All() throws {
34+
XCTAssertEqual(TwitterTweetExpansionsV2.all.count, 8)
35+
}
36+
3337
func testTwitterUserExpansionsV2() throws {
3438

3539
let allCases: [TwitterUserExpansionsV2] = [
@@ -44,6 +48,10 @@ class ExpansionsV2Tests: XCTestCase {
4448
)
4549
}
4650

51+
func testTwitterUserExpansionsV2All() throws {
52+
XCTAssertEqual(TwitterUserExpansionsV2.all.count, 1)
53+
}
54+
4755
func testTwitterListExpansionsV2() throws {
4856
let allCases: [TwitterListExpansionsV2] = [
4957
.ownerID,
@@ -57,6 +65,10 @@ class ExpansionsV2Tests: XCTestCase {
5765
)
5866
}
5967

68+
func testTwitterListExpansionsV2All() throws {
69+
XCTAssertEqual(TwitterListExpansionsV2.all.count, 1)
70+
}
71+
6072
func testTwitterSpaceExpansionsV2() throws {
6173
let allCases: [TwitterSpaceExpansionsV2] = [
6274
.invitedUserIDs,
@@ -71,6 +83,8 @@ class ExpansionsV2Tests: XCTestCase {
7183
allCases.commaSeparatedString,
7284
"creator_id,host_ids,invited_user_ids,speaker_ids,~~~"
7385
)
86+
87+
XCTAssertEqual(TwitterSpaceExpansionsV2.all.count, 4)
7488
}
7589

7690
}

0 commit comments

Comments
 (0)