import Foundation
import ServiceStack
public class ViewsAndExplorers : Codable
{
public var nodes:[ViewExplorerNode] = []
required public init(){}
}
public class ViewExplorerNode : Node
{
public var viewId:String?
public var explorerId:String?
public var childNodes:[ViewExplorerNode] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case viewId
case explorerId
case childNodes
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
viewId = try container.decodeIfPresent(String.self, forKey: .viewId)
explorerId = try container.decodeIfPresent(String.self, forKey: .explorerId)
childNodes = try container.decodeIfPresent([ViewExplorerNode].self, forKey: .childNodes) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if viewId != nil { try container.encode(viewId, forKey: .viewId) }
if explorerId != nil { try container.encode(explorerId, forKey: .explorerId) }
if childNodes.count > 0 { try container.encode(childNodes, forKey: .childNodes) }
}
}
public class Node : Codable
{
public var entityName:String?
public var id:String?
public var parentID:String?
public var title:String?
public var count:Int?
public var imageKey:String?
public var expanded:Bool?
public var selected:Bool?
public var displayPath:String?
public var childNodes:[Node] = []
public var registrationPathElement:String?
public var queryPathElement:String?
public var path:String?
public var isHierarchy:Bool?
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/ViewsAndExplorers HTTP/1.1
Host: digiofficeapigateway.deltares.nl
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Nodes:
[
{
ViewId: 00000000-0000-0000-0000-000000000000,
ExplorerId: 00000000-0000-0000-0000-000000000000,
ChildNodes:
[
{
ViewId: 00000000-0000-0000-0000-000000000000,
ExplorerId: 00000000-0000-0000-0000-000000000000,
ChildNodes:
[
{
ViewId: 00000000-0000-0000-0000-000000000000,
ExplorerId: 00000000-0000-0000-0000-000000000000,
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
ChildNodes:
[
{
EntityName: String,
ID: String,
ParentID: String,
Title: String,
Count: 0,
ImageKey: String,
Expanded: False,
Selected: False,
DisplayPath: String,
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
],
RegistrationPathElement: String,
QueryPathElement: String,
Path: String,
IsHierarchy: False
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Nodes: [ { ViewId: 00000000-0000-0000-0000-000000000000, ExplorerId: 00000000-0000-0000-0000-000000000000, ChildNodes: [ { ViewId: 00000000-0000-0000-0000-000000000000, ExplorerId: 00000000-0000-0000-0000-000000000000, ChildNodes: [ { ViewId: 00000000-0000-0000-0000-000000000000, ExplorerId: 00000000-0000-0000-0000-000000000000, EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, ChildNodes: [ { EntityName: String, ID: String, ParentID: String, Title: String, Count: 0, ImageKey: String, Expanded: False, Selected: False, DisplayPath: String, RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ], RegistrationPathElement: String, QueryPathElement: String, Path: String, IsHierarchy: False } ] }