Skip to content

Commit 2e9bb9f

Browse files
committed
Add support for optional address, name and url of location
We still keep Location as lat+long, since that's required and guaranteed to exist. The others are optional values in the payload.
1 parent 9fed6b8 commit 2e9bb9f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/WhatsApp/Content.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ public record Location(double Latitude, double Longitude);
7070
/// Content contains a location.
7171
/// </summary>
7272
/// <param name="Location">The location provided as content.</param>
73-
public record LocationContent(Location Location) : Content
73+
/// <param name="Address">Optional address of the shared location.</param>
74+
/// <param name="Name">Optional name of the shared location.</param>
75+
/// <param name="Url">Optional URL of the shared location.</param>
76+
public record LocationContent(Location Location, string? Address, string? Name, string? Url) : Content
7477
{
7578
/// <inheritdoc/>
7679
public override ContentType Type => ContentType.Location;

src/WhatsApp/ContentMessage.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ .type as $type |
5353
}
5454
elif $type == "location" then {
5555
"$type": $type,
56-
location: .location,
56+
location: {
57+
latitude: .location.latitude,
58+
longitude: .location.longitude
59+
},
60+
address: .location.address,
61+
name: .location.name,
62+
url: .location.url
5763
}
5864
elif $type == "image" or $type == "video" or $type == "audio" then {
5965
"$type": $type,

0 commit comments

Comments
 (0)