diff --git a/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift b/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift index fb38c4b..d86fbcb 100644 --- a/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift +++ b/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift @@ -49,6 +49,7 @@ public extension StructuredData { /// - alternateName: the name the organization is also known by, or `nil` (the default) to omit its property. /// - description: what the organization does, or `nil` (the default) to omit its property. /// - areaServed: the area the organization serves, or `nil` (the default) to omit its property. + /// - email: the address the organization is written to, or `nil` (the default) to omit its property. /// - logo: the absolute URL of the organization's logo, or `nil` (the default) to omit its property. /// - profiles: the absolute URLs of the organization's public profiles, or empty (the default) to omit their property. init( @@ -57,6 +58,7 @@ public extension StructuredData { alternateName: String? = nil, description: String? = nil, areaServed: String? = nil, + email: String? = nil, logo: String? = nil, profiles: [String] = [] ) { @@ -79,6 +81,10 @@ public extension StructuredData { organization.append(.init(.areaServed, value: .string(areaServed))) } + if let email { + organization.append(.init(.email, value: .string(email))) + } + if let logo { organization.append(.init(.logo, value:.string(logo))) } diff --git a/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift b/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift index 2fd7044..6600667 100644 --- a/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift +++ b/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift @@ -75,6 +75,8 @@ public extension StructuredData.Property.Name { static let areaServed: Self = "areaServed" /// What the thing a node describes is or does. static let description: Self = "description" + /// The address the thing a node describes is written to. + static let email: Self = "email" /// The absolute URL of an organization's logo. static let logo: Self = "logo" /// The name of the thing a node describes. diff --git a/Packages/Infrastructure/Tests/Cases/Public/Types/StructuredDataTests.swift b/Packages/Infrastructure/Tests/Cases/Public/Types/StructuredDataTests.swift index 131ead0..74be9d3 100644 --- a/Packages/Infrastructure/Tests/Cases/Public/Types/StructuredDataTests.swift +++ b/Packages/Infrastructure/Tests/Cases/Public/Types/StructuredDataTests.swift @@ -31,17 +31,18 @@ struct StructuredDataTests { } @Test - func `carries the organization's alternate name, description, and area in that order`() { + func `carries the organization's alternate name, description, area, and address in that order`() { let data = StructuredData( name: "A Site", url: "https://site.example/", alternateName: "The Site", description: "What the site is.", - areaServed: "A City" + areaServed: "A City", + email: "hello@site.example" ) #expect(data.payload.contains( - #""name":"A Site","url":"https://site.example/","alternateName":"The Site","description":"What the site is.","areaServed":"A City""# + #""name":"A Site","url":"https://site.example/","alternateName":"The Site","description":"What the site is.","areaServed":"A City","email":"hello@site.example""# )) }