Skip to content

Commit e8d3013

Browse files
committed
✨ Add teams service
1 parent 58b0f15 commit e8d3013

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Docs/Services.md

-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ At the moment these service are supported
1212

1313
These are probably the most used services
1414

15-
- Discord
1615
- Facetime
1716
- GoToMeeting
18-
- Microsoft Teams
1917
- Phone
2018

2119
## Resources

Sources/Model/Service.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import ArgumentParser
22
import Foundation
33

44
enum Service: String, Codable, ExpressibleByArgument {
5-
case ical, meet, zoom
5+
case ical, meet, zoom, teams
66

77
private static let servicePatterns: [Service: String] = [
88
Service.meet: #"https:\/\/meet\.google\.com/[a-z]{3}-[a-z]{4}-[a-z]{3}"#,
99
Service.zoom: #"https://(?:[a-zA-Z0-9-.]+)?zoom\.(?:us|com|com\.cn|de)\/(?:my|[a-z]{1,2}|webinar)\/[-a-zA-Z0-9()@:%_\+.~#?&=\/]*"#,
10+
Service.teams: #"https:\/\/teams\.microsoft\.com\/l\/meetup-join\/[a-zA-Z0-9_%\/=\-\+\.?]+"#,
1011
]
1112

1213
private static func findMatch(in text: String, using pattern: String) -> String? {

Tests/ServiceTests.swift

+8
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ import Testing
2525

2626
#expect(output == expected)
2727
}
28+
29+
@Test func testTeamsNotes() {
30+
let input = "https://teams.microsoft.com/l/meetup-join/19%3ameeting_MzI2YmRlNTgtMTU0MC00NmNhLWIzMmQtODg0ZGVmMGEwOTc3%40thread.v2/0?context=%7b%22Tid%22%3a%22c2ad6337-37a8-446a-ba48-18f44ea87c3d%22%2c%22Oid%22%3a%2230e7d7d2-057e-4d2f-8fa5-0475c962dded%22%7d"
31+
let output = Service.fromNotes(notes: input)
32+
let expected: [Service: String] = [Service.teams: input]
33+
34+
#expect(output == expected)
35+
}
2836
}

0 commit comments

Comments
 (0)