-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContactRepresentable.swift
More file actions
42 lines (37 loc) · 1013 Bytes
/
ContactRepresentable.swift
File metadata and controls
42 lines (37 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// ContactRepresentable.swift
// feather-openapi
//
// Created by Tibor Bödecs on 2026. 01. 21.
//
import OpenAPIKit30
/// Describes an OpenAPI contact.
public protocol ContactRepresentable:
OpenAPIContactRepresentable,
VendorExtensionsProperty
{
/// Contact name.
var name: String? { get }
/// Contact URL.
var url: LocationRepresentable? { get }
/// Contact email.
var email: String? { get }
}
extension ContactRepresentable {
/// Default name is `nil`.
public var name: String? { nil }
/// Default URL is `nil`.
public var url: LocationRepresentable? { nil }
/// Default email is `nil`.
public var email: String? { nil }
/// Builds an OpenAPI contact object.
/// - Returns: The OpenAPI contact.
public func openAPIContact() -> OpenAPI.Document.Info.Contact {
.init(
name: name,
url: url?.openAPILocation(),
email: email,
vendorExtensions: vendorExtensions
)
}
}