api-swift / Sources / IrdAPI / Generated / DNS.swift
5,398 words
   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
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
// Generated by scripts/gen-api.py from spec/openapi.json — do not edit.

import Foundation

// MARK: - Types

/// Shared by 2 operations.
public struct RecordSpec: Codable, Sendable, Hashable {
    public var name: String
    public var type: String
    public var `class`: String
    public var ttl: Int?
    public var data: [String: JSONValue]

    public init(name: String, type: String, `class`: String, ttl: Int? = nil, data: [String: JSONValue]) {
        self.name = name
        self.type = type
        self.`class` = `class`
        self.ttl = ttl
        self.data = data
    }

    enum CodingKeys: String, CodingKey {
        case name
        case type
        case `class`
        case ttl
        case data
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(name, forKey: .name)
        try container.encode(type, forKey: .type)
        try container.encode(`class`, forKey: .`class`)
        try container.encode(ttl, forKey: .ttl)
        try container.encode(data, forKey: .data)
    }
}

/// Used by POST /domains/registrations/{id}/dns.
public struct EnableHostingBody: Codable, Sendable, Hashable {
    public var records: [RecordSpec]?
    public var defaultTtl: Int?
    public var applyRegistryNs: Bool?
    public var totpCode: String?

    public init(records: [RecordSpec]? = nil, defaultTtl: Int? = nil, applyRegistryNs: Bool? = nil, totpCode: String? = nil) {
        self.records = records
        self.defaultTtl = defaultTtl
        self.applyRegistryNs = applyRegistryNs
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case records
        case defaultTtl = "default_ttl"
        case applyRegistryNs = "apply_registry_ns"
        case totpCode = "totp_code"
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum HostedNameserversMode: RawRepresentable, Codable, Sendable, Hashable {
    case shared
    case labels
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [HostedNameserversMode] = [.shared, .labels]

    public init(rawValue: String) {
        switch rawValue {
        case "shared": self = .shared
        case "labels": self = .labels
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .shared: return "shared"
        case .labels: return "labels"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Used by POST /domains/registrations/{id}/dns.
public struct CreatedZone: Codable, Sendable, Hashable {
    public var origin: String
    public var node: String
    public var defaultTtl: Int
    public var nameservers: [String]
    public var createdAt: String

    public init(origin: String, node: String, defaultTtl: Int, nameservers: [String], createdAt: String) {
        self.origin = origin
        self.node = node
        self.defaultTtl = defaultTtl
        self.nameservers = nameservers
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case node
        case defaultTtl = "default_ttl"
        case nameservers
        case createdAt = "created_at"
    }
}

/// Used by POST /domains/registrations/{id}/dns.
public struct EnableHostingResponse: Codable, Sendable, Hashable {
    public var origin: String
    public var nameservers: [String]
    public var nameserversMode: HostedNameserversMode
    public var nameserversReady: Bool
    public var zones: [CreatedZone]
    public var registryAction: [String: JSONValue]?
    public var registryError: String?

    public init(origin: String, nameservers: [String], nameserversMode: HostedNameserversMode, nameserversReady: Bool, zones: [CreatedZone], registryAction: [String: JSONValue]? = nil, registryError: String? = nil) {
        self.origin = origin
        self.nameservers = nameservers
        self.nameserversMode = nameserversMode
        self.nameserversReady = nameserversReady
        self.zones = zones
        self.registryAction = registryAction
        self.registryError = registryError
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case nameservers
        case nameserversMode = "nameservers_mode"
        case nameserversReady = "nameservers_ready"
        case zones
        case registryAction = "registry_action"
        case registryError = "registry_error"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(origin, forKey: .origin)
        try container.encode(nameservers, forKey: .nameservers)
        try container.encode(nameserversMode, forKey: .nameserversMode)
        try container.encode(nameserversReady, forKey: .nameserversReady)
        try container.encode(zones, forKey: .zones)
        try container.encode(registryAction, forKey: .registryAction)
        try container.encodeIfPresent(registryError, forKey: .registryError)
    }
}

/// Used by DELETE /domains/registrations/{id}/dns.
public struct DisableHostingResponse: Codable, Sendable, Hashable {
    public var decommissioned: Bool
    public var snapshotId: String
    public var zonesDeleted: Int

    public init(decommissioned: Bool, snapshotId: String, zonesDeleted: Int) {
        self.decommissioned = decommissioned
        self.snapshotId = snapshotId
        self.zonesDeleted = zonesDeleted
    }

    enum CodingKeys: String, CodingKey {
        case decommissioned
        case snapshotId = "snapshot_id"
        case zonesDeleted = "zones_deleted"
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum DnssecState: RawRepresentable, Codable, Sendable, Hashable {
    case pendingNodes
    case awaitingDs
    case dsPublished
    case removingDs
    case unsigningHold
    case disabled
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [DnssecState] = [.pendingNodes, .awaitingDs, .dsPublished, .removingDs, .unsigningHold, .disabled]

    public init(rawValue: String) {
        switch rawValue {
        case "pending-nodes": self = .pendingNodes
        case "awaiting-ds": self = .awaitingDs
        case "ds-published": self = .dsPublished
        case "removing-ds": self = .removingDs
        case "unsigning-hold": self = .unsigningHold
        case "disabled": self = .disabled
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pendingNodes: return "pending-nodes"
        case .awaitingDs: return "awaiting-ds"
        case .dsPublished: return "ds-published"
        case .removingDs: return "removing-ds"
        case .unsigningHold: return "unsigning-hold"
        case .disabled: return "disabled"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 3 operations.
public struct Dnssec: Codable, Sendable, Hashable {
    public var state: DnssecState
    public var ds: DsRecord?
    public var notBefore: String?

    public init(state: DnssecState, ds: DsRecord? = nil, notBefore: String? = nil) {
        self.state = state
        self.ds = ds
        self.notBefore = notBefore
    }

    enum CodingKeys: String, CodingKey {
        case state
        case ds
        case notBefore = "not_before"
    }
}

/// Shared by 3 operations.
public struct DnssecResponse: Codable, Sendable, Hashable {
    public var dnssec: Dnssec

    public init(dnssec: Dnssec) {
        self.dnssec = dnssec
    }

    enum CodingKeys: String, CodingKey {
        case dnssec
    }
}

/// Used by GET /domains/registrations/{id}/dns/nameservers.
public struct HostedNameserversResponse: Codable, Sendable, Hashable {
    public var origin: String
    public var mode: HostedNameserversMode
    public var nameservers: [String]
    public var nameserversReady: Bool
    public var availableModes: [HostedNameserversMode]

    public init(origin: String, mode: HostedNameserversMode, nameservers: [String], nameserversReady: Bool, availableModes: [HostedNameserversMode]) {
        self.origin = origin
        self.mode = mode
        self.nameservers = nameservers
        self.nameserversReady = nameserversReady
        self.availableModes = availableModes
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case mode
        case nameservers
        case nameserversReady = "nameservers_ready"
        case availableModes = "available_modes"
    }
}

/// Used by POST /domains/registrations/{id}/dns/nameservers.
public struct SetHostedNameserversBody: Codable, Sendable, Hashable {
    public var mode: HostedNameserversMode
    public var totpCode: String?

    public init(mode: HostedNameserversMode, totpCode: String? = nil) {
        self.mode = mode
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case mode
        case totpCode = "totp_code"
    }
}

/// Used by POST /domains/registrations/{id}/dns/nameservers.
public struct SetHostedNameserversResponse: Codable, Sendable, Hashable {
    public var origin: String
    public var mode: HostedNameserversMode
    public var nameservers: [String]
    public var nameserversReady: Bool
    public var availableModes: [HostedNameserversMode]
    public var registryAction: [String: JSONValue]?
    public var registryError: String?

    public init(origin: String, mode: HostedNameserversMode, nameservers: [String], nameserversReady: Bool, availableModes: [HostedNameserversMode], registryAction: [String: JSONValue]? = nil, registryError: String? = nil) {
        self.origin = origin
        self.mode = mode
        self.nameservers = nameservers
        self.nameserversReady = nameserversReady
        self.availableModes = availableModes
        self.registryAction = registryAction
        self.registryError = registryError
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case mode
        case nameservers
        case nameserversReady = "nameservers_ready"
        case availableModes = "available_modes"
        case registryAction = "registry_action"
        case registryError = "registry_error"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(origin, forKey: .origin)
        try container.encode(mode, forKey: .mode)
        try container.encode(nameservers, forKey: .nameservers)
        try container.encode(nameserversReady, forKey: .nameserversReady)
        try container.encode(availableModes, forKey: .availableModes)
        try container.encode(registryAction, forKey: .registryAction)
        try container.encodeIfPresent(registryError, forKey: .registryError)
    }
}

/// Used by GET /dns/domains.
public struct ZoneSummary: Codable, Sendable, Hashable {
    public var origin: String
    public var nodes: [String]
    public var defaultTtl: Int
    /// Present (true) on a domain another account shared with this one through a dns grant: records are editable, changes are billed per the share's payer setting (the owner by default).
    public var delegated: Bool?

    public init(origin: String, nodes: [String], defaultTtl: Int, delegated: Bool? = nil) {
        self.origin = origin
        self.nodes = nodes
        self.defaultTtl = defaultTtl
        self.delegated = delegated
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case nodes
        case defaultTtl = "default_ttl"
        case delegated
    }
}

/// Used by GET /dns/domains.
public struct ListZonesResponse: Codable, Sendable, Hashable {
    public var domains: [ZoneSummary]

    public init(domains: [ZoneSummary]) {
        self.domains = domains
    }

    enum CodingKeys: String, CodingKey {
        case domains
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum ZoneRecordManagedBy: RawRepresentable, Codable, Sendable, Hashable {
    case tunnel
    case app
    case vps
    case platform
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [ZoneRecordManagedBy] = [.tunnel, .app, .vps, .platform]

    public init(rawValue: String) {
        switch rawValue {
        case "tunnel": self = .tunnel
        case "app": self = .app
        case "vps": self = .vps
        case "platform": self = .platform
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .tunnel: return "tunnel"
        case .app: return "app"
        case .vps: return "vps"
        case .platform: return "platform"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Used by GET /dns/domains/{domain}.
public struct ZoneRecord: Codable, Sendable, Hashable {
    public var name: String
    public var type: String
    public var `class`: String
    public var ttl: Int?
    public var data: [String: JSONValue]
    public var managedBy: ZoneRecordManagedBy?
    public var tunnelId: String?
    public var deploymentId: String?
    public var connectionId: String?
    public var instanceId: String?
    public var purpose: String?

    public init(name: String, type: String, `class`: String, ttl: Int? = nil, data: [String: JSONValue], managedBy: ZoneRecordManagedBy? = nil, tunnelId: String? = nil, deploymentId: String? = nil, connectionId: String? = nil, instanceId: String? = nil, purpose: String? = nil) {
        self.name = name
        self.type = type
        self.`class` = `class`
        self.ttl = ttl
        self.data = data
        self.managedBy = managedBy
        self.tunnelId = tunnelId
        self.deploymentId = deploymentId
        self.connectionId = connectionId
        self.instanceId = instanceId
        self.purpose = purpose
    }

    enum CodingKeys: String, CodingKey {
        case name
        case type
        case `class`
        case ttl
        case data
        case managedBy = "managed_by"
        case tunnelId = "tunnel_id"
        case deploymentId = "deployment_id"
        case connectionId = "connection_id"
        case instanceId = "instance_id"
        case purpose
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(name, forKey: .name)
        try container.encode(type, forKey: .type)
        try container.encode(`class`, forKey: .`class`)
        try container.encode(ttl, forKey: .ttl)
        try container.encode(data, forKey: .data)
        try container.encodeIfPresent(managedBy, forKey: .managedBy)
        try container.encodeIfPresent(tunnelId, forKey: .tunnelId)
        try container.encodeIfPresent(deploymentId, forKey: .deploymentId)
        try container.encodeIfPresent(connectionId, forKey: .connectionId)
        try container.encodeIfPresent(instanceId, forKey: .instanceId)
        try container.encodeIfPresent(purpose, forKey: .purpose)
    }
}

/// Used by GET /dns/domains/{domain}.
public struct Zone: Codable, Sendable, Hashable {
    public var origin: String
    public var nameservers: [String]
    public var nameserversMode: HostedNameserversMode
    public var nodes: [String]
    public var defaultTtl: Int
    public var records: [ZoneRecord]

    public init(origin: String, nameservers: [String], nameserversMode: HostedNameserversMode, nodes: [String], defaultTtl: Int, records: [ZoneRecord]) {
        self.origin = origin
        self.nameservers = nameservers
        self.nameserversMode = nameserversMode
        self.nodes = nodes
        self.defaultTtl = defaultTtl
        self.records = records
    }

    enum CodingKeys: String, CodingKey {
        case origin
        case nameservers
        case nameserversMode = "nameservers_mode"
        case nodes
        case defaultTtl = "default_ttl"
        case records
    }
}

/// Used by PUT /dns/domains/{domain}/records.
public struct SetRecordBody: Codable, Sendable, Hashable {
    public var record: RecordSpec?
    public var records: [RecordSpec]?
    public var totpCode: String?

    public init(record: RecordSpec? = nil, records: [RecordSpec]? = nil, totpCode: String? = nil) {
        self.record = record
        self.records = records
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case record
        case records
        case totpCode = "totp_code"
    }
}

/// Used by PUT /dns/domains/{domain}/records.
public struct SetRecordResponse: Codable, Sendable, Hashable {
    public var records: [RecordSpec]
    public var record: RecordSpec

    public init(records: [RecordSpec], record: RecordSpec) {
        self.records = records
        self.record = record
    }

    enum CodingKeys: String, CodingKey {
        case records
        case record
    }
}

/// Used by DELETE /dns/domains/{domain}/records.
public struct DeleteRecordBody: Codable, Sendable, Hashable {
    public var name: String
    public var type: String?
    public var `class`: String?
    public var totpCode: String?

    public init(name: String, type: String? = nil, `class`: String? = nil, totpCode: String? = nil) {
        self.name = name
        self.type = type
        self.`class` = `class`
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case name
        case type
        case `class`
        case totpCode = "totp_code"
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum ClaimState: RawRepresentable, Codable, Sendable, Hashable {
    case pending
    case verified
    case active
    case lapsed
    case revoked
    case expired
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [ClaimState] = [.pending, .verified, .active, .lapsed, .revoked, .expired]

    public init(rawValue: String) {
        switch rawValue {
        case "pending": self = .pending
        case "verified": self = .verified
        case "active": self = .active
        case "lapsed": self = .lapsed
        case "revoked": self = .revoked
        case "expired": self = .expired
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pending: return "pending"
        case .verified: return "verified"
        case .active: return "active"
        case .lapsed: return "lapsed"
        case .revoked: return "revoked"
        case .expired: return "expired"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 7 operations.
public struct ClaimDelegation: Codable, Sendable, Hashable {
    public var ok: Bool
    public var partial: Bool
    public var names: [String]
    public var checkedAt: String?
    public var deadlineAt: String?
    public var lostAt: String?
    public var dsPresent: Bool

    public init(ok: Bool, partial: Bool, names: [String], checkedAt: String? = nil, deadlineAt: String? = nil, lostAt: String? = nil, dsPresent: Bool) {
        self.ok = ok
        self.partial = partial
        self.names = names
        self.checkedAt = checkedAt
        self.deadlineAt = deadlineAt
        self.lostAt = lostAt
        self.dsPresent = dsPresent
    }

    enum CodingKeys: String, CodingKey {
        case ok
        case partial
        case names
        case checkedAt = "checked_at"
        case deadlineAt = "deadline_at"
        case lostAt = "lost_at"
        case dsPresent = "ds_present"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(ok, forKey: .ok)
        try container.encode(partial, forKey: .partial)
        try container.encode(names, forKey: .names)
        try container.encode(checkedAt, forKey: .checkedAt)
        try container.encode(deadlineAt, forKey: .deadlineAt)
        try container.encode(lostAt, forKey: .lostAt)
        try container.encode(dsPresent, forKey: .dsPresent)
    }
}

/// Shared by 7 operations.
public struct ClaimRegistry: Codable, Sendable, Hashable {
    public var expiresAt: String?
    public var status: [String: JSONValue]?
    public var checkedAt: String?

    public init(expiresAt: String? = nil, status: [String: JSONValue]? = nil, checkedAt: String? = nil) {
        self.expiresAt = expiresAt
        self.status = status
        self.checkedAt = checkedAt
    }

    enum CodingKeys: String, CodingKey {
        case expiresAt = "expires_at"
        case status
        case checkedAt = "checked_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(expiresAt, forKey: .expiresAt)
        try container.encode(status, forKey: .status)
        try container.encode(checkedAt, forKey: .checkedAt)
    }
}

/// Shared by 7 operations.
public struct ClaimSeed: Codable, Sendable, Hashable {
    /// The `GET /domains/dns-snapshot` copy the zone is seeded from at activation.
    public var snapshotId: String
    /// When the copy was read from the domain's previous nameservers.
    public var takenAt: String?
    /// The nameservers the copy was read from.
    public var nameservers: [String]
    public var meta: [String: JSONValue]?
    public var recordCount: Int
    /// The records exactly as they will seed the zone (the apex SOA/NS of the old host dropped — ird synthesizes its own).
    public var records: [[String: JSONValue]]

    public init(snapshotId: String, takenAt: String? = nil, nameservers: [String], meta: [String: JSONValue]? = nil, recordCount: Int, records: [[String: JSONValue]]) {
        self.snapshotId = snapshotId
        self.takenAt = takenAt
        self.nameservers = nameservers
        self.meta = meta
        self.recordCount = recordCount
        self.records = records
    }

    enum CodingKeys: String, CodingKey {
        case snapshotId = "snapshot_id"
        case takenAt = "taken_at"
        case nameservers
        case meta
        case recordCount = "record_count"
        case records
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(snapshotId, forKey: .snapshotId)
        try container.encode(takenAt, forKey: .takenAt)
        try container.encode(nameservers, forKey: .nameservers)
        try container.encodeIfPresent(meta, forKey: .meta)
        try container.encode(recordCount, forKey: .recordCount)
        try container.encode(records, forKey: .records)
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum ClaimCheckReason: RawRepresentable, Codable, Sendable, Hashable {
    case parentUnreachable
    case notDelegated
    case partial
    case delegatedToIrd
    case elsewhere
    case expired
    case activationRefused
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [ClaimCheckReason] = [.parentUnreachable, .notDelegated, .partial, .delegatedToIrd, .elsewhere, .expired, .activationRefused]

    public init(rawValue: String) {
        switch rawValue {
        case "parent-unreachable": self = .parentUnreachable
        case "not-delegated": self = .notDelegated
        case "partial": self = .partial
        case "delegated-to-ird": self = .delegatedToIrd
        case "elsewhere": self = .elsewhere
        case "expired": self = .expired
        case "activation-refused": self = .activationRefused
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .parentUnreachable: return "parent-unreachable"
        case .notDelegated: return "not-delegated"
        case .partial: return "partial"
        case .delegatedToIrd: return "delegated-to-ird"
        case .elsewhere: return "elsewhere"
        case .expired: return "expired"
        case .activationRefused: return "activation-refused"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 7 operations.
public struct ClaimCheck: Codable, Sendable, Hashable {
    /// True when the parent zone delegates the domain to exactly the claim's nameservers.
    public var ok: Bool
    public var reason: ClaimCheckReason?
    /// The nameservers the parent zone lists for the domain (lower-case, no trailing dot).
    public var names: [String]?
    /// How many nameservers the parent lists.
    public var nameserverCount: Int?
    /// The claim's nameservers the parent does not list yet — what is still to set at the registrar.
    public var missing: [String]?
    /// A DS record sits at the parent. Claimed zones are unsigned: remove it at the registrar or validating resolvers refuse the domain.
    public var dsPresent: Bool?
    /// With reason `activation-refused`: why the service could not provision the zone although the parent already delegates to ird.
    public var message: String?
    public var error: String?

    public init(ok: Bool, reason: ClaimCheckReason? = nil, names: [String]? = nil, nameserverCount: Int? = nil, missing: [String]? = nil, dsPresent: Bool? = nil, message: String? = nil, error: String? = nil) {
        self.ok = ok
        self.reason = reason
        self.names = names
        self.nameserverCount = nameserverCount
        self.missing = missing
        self.dsPresent = dsPresent
        self.message = message
        self.error = error
    }

    enum CodingKeys: String, CodingKey {
        case ok
        case reason
        case names
        case nameserverCount = "nameserver_count"
        case missing
        case dsPresent = "ds_present"
        case message
        case error
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum ClaimEndReason: RawRepresentable, Codable, Sendable, Hashable {
    case released
    case superseded
    case registered
    case admin
    case notVerified
    case notDelegated
    case delegationLost
    case graceExpired
    case registryGone
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [ClaimEndReason] = [.released, .superseded, .registered, .admin, .notVerified, .notDelegated, .delegationLost, .graceExpired, .registryGone]

    public init(rawValue: String) {
        switch rawValue {
        case "released": self = .released
        case "superseded": self = .superseded
        case "registered": self = .registered
        case "admin": self = .admin
        case "not-verified": self = .notVerified
        case "not-delegated": self = .notDelegated
        case "delegation-lost": self = .delegationLost
        case "grace-expired": self = .graceExpired
        case "registry-gone": self = .registryGone
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .released: return "released"
        case .superseded: return "superseded"
        case .registered: return "registered"
        case .admin: return "admin"
        case .notVerified: return "not-verified"
        case .notDelegated: return "not-delegated"
        case .delegationLost: return "delegation-lost"
        case .graceExpired: return "grace-expired"
        case .registryGone: return "registry-gone"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 7 operations.
public struct Claim: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    /// The domain in DNS (punycode) form.
    public var domain: String
    /// The domain in display (Unicode) form — equal to `domain` unless it is an IDN.
    public var domainUnicode: String
    public var state: ClaimState
    /// While pending: when the claim's window closes — the parent zone must delegate the domain to the claim's nameservers before it, or the claim lapses. Null once verified.
    public var expiresAt: String?
    /// The nameservers to set for the domain at its registrar (per-claim private names on ird's nameserver domain) — given from the start, and the claim's proof: it activates once the parent zone lists exactly these.
    public var nameservers: [String]
    public var delegation: ClaimDelegation
    public var registry: ClaimRegistry
    public var sensitive: Bool
    /// The attached copy of the domain's current records (see `PUT /dns/claims/{id}/seed`), or null — the zone then starts empty.
    public var seedSnapshotId: String?
    /// The attached copy in full (single-claim responses only).
    public var seed: ClaimSeed?
    /// The last delegation read while pending — the customer's verify or the monitor's free recheck every few minutes — in the verify `check` shape; null before the first read or once a health check replaced it.
    public var lastCheck: ClaimCheck?
    public var verifiedAt: String?
    public var activatedAt: String?
    public var endedAt: String?
    public var endReason: ClaimEndReason?
    public var createdAt: String

    public init(id: String, domain: String, domainUnicode: String, state: ClaimState, expiresAt: String? = nil, nameservers: [String], delegation: ClaimDelegation, registry: ClaimRegistry, sensitive: Bool, seedSnapshotId: String? = nil, seed: ClaimSeed? = nil, lastCheck: ClaimCheck? = nil, verifiedAt: String? = nil, activatedAt: String? = nil, endedAt: String? = nil, endReason: ClaimEndReason? = nil, createdAt: String) {
        self.id = id
        self.domain = domain
        self.domainUnicode = domainUnicode
        self.state = state
        self.expiresAt = expiresAt
        self.nameservers = nameservers
        self.delegation = delegation
        self.registry = registry
        self.sensitive = sensitive
        self.seedSnapshotId = seedSnapshotId
        self.seed = seed
        self.lastCheck = lastCheck
        self.verifiedAt = verifiedAt
        self.activatedAt = activatedAt
        self.endedAt = endedAt
        self.endReason = endReason
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case domain
        case domainUnicode = "domain_unicode"
        case state
        case expiresAt = "expires_at"
        case nameservers
        case delegation
        case registry
        case sensitive
        case seedSnapshotId = "seed_snapshot_id"
        case seed
        case lastCheck = "last_check"
        case verifiedAt = "verified_at"
        case activatedAt = "activated_at"
        case endedAt = "ended_at"
        case endReason = "end_reason"
        case createdAt = "created_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(domain, forKey: .domain)
        try container.encode(domainUnicode, forKey: .domainUnicode)
        try container.encode(state, forKey: .state)
        try container.encode(expiresAt, forKey: .expiresAt)
        try container.encode(nameservers, forKey: .nameservers)
        try container.encode(delegation, forKey: .delegation)
        try container.encode(registry, forKey: .registry)
        try container.encode(sensitive, forKey: .sensitive)
        try container.encode(seedSnapshotId, forKey: .seedSnapshotId)
        try container.encodeIfPresent(seed, forKey: .seed)
        try container.encode(lastCheck, forKey: .lastCheck)
        try container.encode(verifiedAt, forKey: .verifiedAt)
        try container.encode(activatedAt, forKey: .activatedAt)
        try container.encode(endedAt, forKey: .endedAt)
        try container.encode(endReason, forKey: .endReason)
        try container.encode(createdAt, forKey: .createdAt)
    }
}

/// Used by GET /dns/claims.
public struct ListClaimsResponse: Codable, Sendable, Hashable {
    public var claims: [Claim]

    public init(claims: [Claim]) {
        self.claims = claims
    }

    enum CodingKeys: String, CodingKey {
        case claims
    }
}

/// Shared by 5 operations.
public struct ClaimResponse: Codable, Sendable, Hashable {
    public var claim: Claim

    public init(claim: Claim) {
        self.claim = claim
    }

    enum CodingKeys: String, CodingKey {
        case claim
    }
}

/// Used by PUT /dns/claims/{id}/seed.
public struct SeedClaimBody: Codable, Sendable, Hashable {
    public var snapshotId: String

    public init(snapshotId: String) {
        self.snapshotId = snapshotId
    }

    enum CodingKeys: String, CodingKey {
        case snapshotId = "snapshot_id"
    }
}

/// Used by POST /dns/claims/{id}/verify.
public struct VerifyClaimResponse: Codable, Sendable, Hashable {
    public var claim: Claim
    public var check: ClaimCheck

    public init(claim: Claim, check: ClaimCheck) {
        self.claim = claim
        self.check = check
    }

    enum CodingKeys: String, CodingKey {
        case claim
        case check
    }
}

/// Query parameters of `listClaims`; unset fields are omitted.
public struct ListClaimsQuery: Sendable, Hashable {
    public var state: String?
    /// Rows to return, 1..500 (default 50).
    public var limit: Int?

    public init(state: String? = nil, limit: Int? = nil) {
        self.state = state
        self.limit = limit
    }

    /// The items in spec order.
    public var queryItems: [QueryItem] {
        var items: [QueryItem] = []
        if let value = state { items.append(QueryItem("state", value)) }
        if let value = limit { items.append(QueryItem("limit", String(value))) }
        return items
    }
}

// MARK: - Operations

extension IrdOperation {
    public static let dns_enableHosting = IrdOperation(method: .post, pathTemplate: "/domains/registrations/{id}/dns", module: "dns", name: "enableHosting", security: .keyOrJwt)
    public static let dns_disableHosting = IrdOperation(method: .delete, pathTemplate: "/domains/registrations/{id}/dns", module: "dns", name: "disableHosting", security: .keyOrJwt)
    public static let dns_getDnssec = IrdOperation(method: .get, pathTemplate: "/domains/registrations/{id}/dns/dnssec", module: "dns", name: "getDnssec", security: .keyOrJwt)
    public static let dns_enableDnssec = IrdOperation(method: .post, pathTemplate: "/domains/registrations/{id}/dns/dnssec", module: "dns", name: "enableDnssec", security: .keyOrJwt)
    public static let dns_disableDnssec = IrdOperation(method: .delete, pathTemplate: "/domains/registrations/{id}/dns/dnssec", module: "dns", name: "disableDnssec", security: .keyOrJwt)
    public static let dns_hostedNameservers = IrdOperation(method: .get, pathTemplate: "/domains/registrations/{id}/dns/nameservers", module: "dns", name: "hostedNameservers", security: .keyOrJwt)
    public static let dns_setHostedNameservers = IrdOperation(method: .post, pathTemplate: "/domains/registrations/{id}/dns/nameservers", module: "dns", name: "setHostedNameservers", security: .keyOrJwt)
    public static let dns_listZones = IrdOperation(method: .get, pathTemplate: "/dns/domains", module: "dns", name: "listZones", security: .keyOrJwt)
    public static let dns_getZone = IrdOperation(method: .get, pathTemplate: "/dns/domains/{domain}", module: "dns", name: "getZone", security: .keyOrJwt)
    public static let dns_setRecord = IrdOperation(method: .put, pathTemplate: "/dns/domains/{domain}/records", module: "dns", name: "setRecord", security: .keyOrJwt)
    public static let dns_deleteRecord = IrdOperation(method: .delete, pathTemplate: "/dns/domains/{domain}/records", module: "dns", name: "deleteRecord", security: .keyOrJwt)
    public static let dns_listClaims = IrdOperation(method: .get, pathTemplate: "/dns/claims", module: "dns", name: "listClaims", security: .keyOrJwt)
    public static let dns_createClaim = IrdOperation(method: .post, pathTemplate: "/dns/claims", module: "dns", name: "createClaim", security: .keyOrJwt)
    public static let dns_getClaim = IrdOperation(method: .get, pathTemplate: "/dns/claims/{id}", module: "dns", name: "getClaim", security: .keyOrJwt)
    public static let dns_releaseClaim = IrdOperation(method: .delete, pathTemplate: "/dns/claims/{id}", module: "dns", name: "releaseClaim", security: .keyOrJwt)
    public static let dns_seedClaim = IrdOperation(method: .put, pathTemplate: "/dns/claims/{id}/seed", module: "dns", name: "seedClaim", security: .keyOrJwt)
    public static let dns_unseedClaim = IrdOperation(method: .delete, pathTemplate: "/dns/claims/{id}/seed", module: "dns", name: "unseedClaim", security: .keyOrJwt)
    public static let dns_verifyClaim = IrdOperation(method: .post, pathTemplate: "/dns/claims/{id}/verify", module: "dns", name: "verifyClaim", security: .keyOrJwt)

    static let dnsOperations: [IrdOperation] = [.dns_enableHosting, .dns_disableHosting, .dns_getDnssec, .dns_enableDnssec, .dns_disableDnssec, .dns_hostedNameservers, .dns_setHostedNameservers, .dns_listZones, .dns_getZone, .dns_setRecord, .dns_deleteRecord, .dns_listClaims, .dns_createClaim, .dns_getClaim, .dns_releaseClaim, .dns_seedClaim, .dns_unseedClaim, .dns_verifyClaim]
}

/// The `dns` operations (18).
public struct DNSAPI: Sendable {
    let client: IrdClient

    /// Put a domain on ird nameservers
    /// Provisions the domain's DNS zone on the ird nameservers, optionally seeded with `records`, and — unless `apply_registry_ns` is false — enqueues the registrar nameserver change pointing the registry at the zone's NS set (that action is charg…
    /// `POST /domains/registrations/{id}/dns` — 202
    public func enableHosting(id: String, body: EnableHostingBody? = nil) async throws -> EnableHostingResponse {
        try await client.request(.dns_enableHosting, params: ["id": id], body: body)
    }

    /// Take a domain off ird DNS
    /// Removes the domain's hosted zone from the ird nameservers.
    /// `DELETE /domains/registrations/{id}/dns` — 200
    public func disableHosting(id: String, body: TotpCodeBody? = nil) async throws -> DisableHostingResponse {
        try await client.request(.dns_disableHosting, params: ["id": id], body: body)
    }

    /// DNSSEC state of the hosted zone
    /// The managed key's lifecycle stage and its DS tuple.
    /// `GET /domains/registrations/{id}/dns/dnssec` — 200
    public func getDnssec(id: String) async throws -> DnssecResponse {
        try await client.request(.dns_getDnssec, params: ["id": id])
    }

    /// Enable DNSSEC on the hosted zone
    /// One click: ird generates the keys, signs the zone on every nameserver, verifies each serves the keys, holds, and only then publishes the DS record at the registry (as a managed DS row). Charged per change; poll the state via GET.
    /// `POST /domains/registrations/{id}/dns/dnssec` — 202
    public func enableDnssec(id: String, body: TotpCodeBody? = nil) async throws -> DnssecResponse {
        try await client.request(.dns_enableDnssec, params: ["id": id], body: body)
    }

    /// Disable DNSSEC on the hosted zone
    /// The safe order, server-side: the DS record is withdrawn from the registry first, then a hold covers the parent DS TTL, and only then does the zone stop signing — the domain stays resolvable throughout.
    /// `DELETE /domains/registrations/{id}/dns/dnssec` — 202
    public func disableDnssec(id: String, body: TotpCodeBody? = nil) async throws -> DnssecResponse {
        try await client.request(.dns_disableDnssec, params: ["id": id], body: body)
    }

    /// Which nameservers the hosted zone uses
    /// The nameserver set the domain's hosted zone is published under: `shared` — ird's public nameservers, the same for every zone — or `labels` — the zone's own private nameservers `<label>.nN.<ns domain>`, unique to this domain and account.
    /// `GET /domains/registrations/{id}/dns/nameservers` — 200
    public func hostedNameservers(id: String) async throws -> HostedNameserversResponse {
        try await client.request(.dns_hostedNameservers, params: ["id": id])
    }

    /// Move the hosted zone to its private nameservers
    /// `mode: labels` moves the domain's hosted zone from ird's shared public nameservers onto its own private nameservers `<label>.nN.<ns domain>` (.ro domains only — 409 for others and for ird's infrastructure domains).
    /// `POST /domains/registrations/{id}/dns/nameservers` — 200, 202
    public func setHostedNameservers(id: String, body: SetHostedNameserversBody) async throws -> SetHostedNameserversResponse {
        try await client.request(.dns_setHostedNameservers, params: ["id": id], body: body)
    }

    /// Your hosted DNS domains
    /// The domains whose DNS is hosted on ird nameservers, each with the nodes serving it. Requires an API key or account JWT.
    /// `GET /dns/domains` — 200
    public func listZones() async throws -> ListZonesResponse {
        try await client.request(.dns_listZones)
    }

    /// A hosted domain's zone
    /// The domain's logical zone: published nameservers, the nodes serving it, and every record.
    /// `GET /dns/domains/{domain}` — 200
    public func getZone(domain: String) async throws -> Zone {
        try await client.request(.dns_getZone, params: ["domain": domain])
    }

    /// Set a DNS record or RRset
    /// Replaces the RRset at (name, type, class) across every node copy of the zone in a single signed change — DNS updates a whole RRset, never one value inside it.
    /// `PUT /dns/domains/{domain}/records` — 200
    public func setRecord(domain: String, body: SetRecordBody? = nil) async throws -> SetRecordResponse {
        try await client.request(.dns_setRecord, params: ["domain": domain], body: body)
    }

    /// Delete a DNS record
    /// Deletes the record(s) matching `name` (narrowed by `type` and `class` when given) across every node copy of the zone in a single signed change.
    /// `DELETE /dns/domains/{domain}/records` — 200
    public func deleteRecord(domain: String, body: DeleteRecordBody) async throws -> DeletedResponse {
        try await client.request(.dns_deleteRecord, params: ["domain": domain], body: body)
    }

    /// Your bring-your-own domain claims
    /// Domains you hold at another registrar and host (or are about to host) on ird DNS: every live claim plus the ones that ended in the last 30 days, newest first.
    /// `GET /dns/claims` — 200
    public func listClaims(query: ListClaimsQuery = ListClaimsQuery()) async throws -> ListClaimsResponse {
        try await client.request(.dns_listClaims, query: query.queryItems)
    }

    /// Claim a domain you hold elsewhere
    /// Opens a claim on a registrable domain (`example.com`, not a subdomain) registered at another registrar so ird can be its DNS.
    /// `POST /dns/claims` — 201
    public func createClaim(body: DomainNameResponse) async throws -> ClaimResponse {
        try await client.request(.dns_createClaim, body: body)
    }

    /// A claim
    /// One of your claims with the nameservers to set at the registrar, its window (while pending), the latest delegation read and registry facts. Another account's claim answers 404. Charged `dns.manage` per request.
    /// `GET /dns/claims/{id}` — 200
    public func getClaim(id: String) async throws -> ClaimResponse {
        try await client.request(.dns_getClaim, params: ["id": id])
    }

    /// Release a claim
    /// Ends the claim (state `revoked`, reason `released`) and takes the hosted zone out of service — a snapshot of its records is kept. Point the domain's nameservers elsewhere first or it goes dark. Free.
    /// `DELETE /dns/claims/{id}` — 200
    public func releaseClaim(id: String) async throws -> ClaimResponse {
        try await client.request(.dns_releaseClaim, params: ["id": id])
    }

    /// Attach a copy of the domain's current records to a pending claim
    /// Copy the domain's current DNS into the zone ird creates at activation, instead of starting empty: take the copy with `GET /domains/dns-snapshot?domain=` **while the domain still resolves at its previous host** (before switching the nameserv…
    /// `PUT /dns/claims/{id}/seed` — 200
    public func seedClaim(id: String, body: SeedClaimBody) async throws -> ClaimResponse {
        try await client.request(.dns_seedClaim, params: ["id": id], body: body)
    }

    /// Drop the attached copy
    /// The zone then starts empty at activation. Charged `dns.manage` per request (unlike releasing the claim).
    /// `DELETE /dns/claims/{id}/seed` — 200
    public func unseedClaim(id: String) async throws -> ClaimResponse {
        try await client.request(.dns_unseedClaim, params: ["id": id])
    }

    /// Check a claim's nameservers now
    /// Reads the domain's delegation at its parent zone now — the parent zone's own servers are asked for a non-recursive referral, never a resolver — and compares it with the claim's `nameservers`.
    /// `POST /dns/claims/{id}/verify` — 200
    public func verifyClaim(id: String) async throws -> VerifyClaimResponse {
        try await client.request(.dns_verifyClaim, params: ["id": id])
    }
}

extension IrdClient {
    public var dns: DNSAPI { DNSAPI(client: self) }
}

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/api-swift.git