SPB Git

Repository Public

DatabaseModels.swift 27.1 KB 679 lines swift

1// SP Notes Core2// File: Sources/SPNotesAPI/DatabaseModels.swift3// Description: Models of the database routes (`/api/databases/**`) and of the database kinds of the entity feed4//              (API-NEXT §3.1): database, property, view, row, typed cell values, filters, query, templates.5//6// Author: Simon-Pierre Boucher7// Contact: contact@spboucher.ai8import Foundation910// MARK: - Vocabulary1112/// The property types of a database (`DatabaseProperty.type`). A newer server may send others: keep the string.13public enum DatabasePropertyType {14    public static let title = "title"15    public static let text = "text"16    public static let number = "number"17    public static let date = "date"18    public static let checkbox = "checkbox"19    public static let status = "status"20    public static let select = "select"21    public static let multiSelect = "multi_select"22    public static let url = "url"23    public static let file = "file"24    public static let relation = "relation"25    public static let rollup = "rollup"26    public static let formula = "formula"27    public static let createdTime = "created_time"28    public static let lastEditedTime = "last_edited_time"29    public static let ai = "ai"30    public static let all = [title, text, number, date, checkbox, status, select, multiSelect, url, file, relation, rollup, formula, createdTime, lastEditedTime, ai]31    /// Computed by the server on read: never stored in `values`, never accepted in a write.32    public static let computed: Set<String> = [rollup, formula, createdTime, lastEditedTime]33    /// Not editable by hand (`computed` + `ai`, which is written by the AI run).34    public static let readOnly: Set<String> = computed.union([ai])35}3637/// The view types of a database (`DatabaseView.type`).38public enum DatabaseViewType {39    public static let table = "table"40    public static let board = "board"41    public static let calendar = "calendar"42    public static let gallery = "gallery"43    public static let timeline = "timeline"44    public static let list = "list"45    public static let all = [table, board, calendar, gallery, timeline, list]46}4748/// The aggregates of a rollup property (`config.aggregate`).49public enum DatabaseAggregate {50    public static let count = "count"51    public static let countValues = "count_values"52    public static let sum = "sum"53    public static let avg = "avg"54    public static let min = "min"55    public static let max = "max"56    public static let unique = "unique"57    public static let show = "show"58}5960/// The operators of a filter rule.61public enum DatabaseFilterOp {62    public static let eq = "eq"63    public static let neq = "neq"64    public static let contains = "contains"65    public static let notContains = "not_contains"66    public static let startsWith = "starts_with"67    public static let endsWith = "ends_with"68    public static let empty = "empty"69    public static let notEmpty = "not_empty"70    public static let gt = "gt"71    public static let gte = "gte"72    public static let lt = "lt"73    public static let lte = "lte"74    public static let before = "before"75    public static let after = "after"76    public static let on = "on"77}7879// MARK: - Database8081/// A database: the `database` row of the entity feed, an item of `GET /api/databases` (`rowCount`), and the full82/// object of `GET /api/databases/<id>` (`properties`, `views`). `id` is the database id; every route also accepts83/// the host page id (`pageId`) in its place.84public struct DatabaseInfo: Codable, Sendable, Equatable, Identifiable {85    public var id: String86    /// The host page (type `database`). Trashing / purging that page is how a database is deleted.87    public var pageId: String88    public var name: String89    public var description: String?90    public var icon: String?91    public var isTemplate: Bool?92    public var templateOf: String?93    /// Only in the full object.94    public var properties: [DatabaseProperty]?95    /// Only in the full object.96    public var views: [DatabaseView]?97    /// Only in the list: live rows.98    public var rowCount: Int?99    /// Feed row only.100    public var createdAt: Date?101    /// Feed row and list.102    public var updatedAt: Date?103    /// Feed row only. Observed: stays `null` while the host page is in the trash; a purge sends a `database` tombstone.104    public var deletedAt: Date?105    /// Feed row only.106    public var rev: Int64?107108    /// The title property (every database has exactly one).109    public var titleProperty: DatabaseProperty? { properties?.first { $0.type == DatabasePropertyType.title } }110    public var defaultView: DatabaseView? { views?.first { $0.isDefault == true } ?? views?.first }111}112113/// Body of `PATCH /api/databases/<id>`. Only what is set is sent.114public struct DatabaseChanges: Encodable, Sendable, Equatable {115    public var name: String?116    public var description: PatchValue<String>?117    public var icon: PatchValue<String>?118    public var isTemplate: Bool?119120    public init(name: String? = nil, description: PatchValue<String>? = nil, icon: PatchValue<String>? = nil, isTemplate: Bool? = nil) {121        self.name = name122        self.description = description123        self.icon = icon124        self.isTemplate = isTemplate125    }126127    enum CodingKeys: String, CodingKey { case name, description, icon, isTemplate }128129    public func encode(to encoder: Encoder) throws {130        var c = encoder.container(keyedBy: CodingKeys.self)131        try c.encodeIfPresent(name, forKey: .name)132        try c.encodePatch(description, forKey: .description)133        try c.encodePatch(icon, forKey: .icon)134        try c.encodeIfPresent(isTemplate, forKey: .isTemplate)135    }136}137138/// Body of `POST /api/databases/<id>/duplicate`.139public struct DatabaseDuplicateOptions: Encodable, Sendable, Equatable {140    public var withRows: Bool?141    public var title: String?142    public var asTemplate: Bool?143    public var parentId: PatchValue<String>?144145    public init(withRows: Bool? = nil, title: String? = nil, asTemplate: Bool? = nil, parentId: PatchValue<String>? = nil) {146        self.withRows = withRows147        self.title = title148        self.asTemplate = asTemplate149        self.parentId = parentId150    }151152    enum CodingKeys: String, CodingKey { case withRows, title, asTemplate, parentId }153154    public func encode(to encoder: Encoder) throws {155        var c = encoder.container(keyedBy: CodingKeys.self)156        try c.encodeIfPresent(withRows, forKey: .withRows)157        try c.encodeIfPresent(title, forKey: .title)158        try c.encodeIfPresent(asTemplate, forKey: .asTemplate)159        try c.encodePatch(parentId, forKey: .parentId)160    }161}162163// MARK: - Properties164165/// An option of a `select`, `multi_select` or `status` property. Cell values hold option ids.166public struct DatabaseSelectOption: Codable, Sendable, Equatable, Identifiable {167    public var id: String168    public var name: String169    /// `gray blue green yellow orange red purple pink teal`.170    public var color: String?171    /// `status` only: `todo`, `in_progress`, `done`.172    public var group: String?173174    public init(id: String, name: String, color: String? = nil, group: String? = nil) {175        self.id = id176        self.name = name177        self.color = color178        self.group = group179    }180}181182/// The known keys of `DatabaseProperty.config` (free-form JSON on the wire: unknown keys are kept in `config`).183public struct DatabasePropertyConfig: Codable, Sendable, Equatable {184    /// select / multi_select / status.185    public var options: [DatabaseSelectOption]?186    /// number: `number`, `integer`, `percent`, `currency`.187    public var format: String?188    /// date.189    public var includeTime: Bool?190    /// relation.191    public var targetDatabaseId: String?192    /// relation, on the mirror property that `twoWay` creates in the target database: the property it mirrors.193    public var syncedPropertyId: String?194    public var twoWay: Bool?195    public var single: Bool?196    /// rollup.197    public var relationPropertyId: String?198    public var targetPropertyId: String?199    /// rollup: see `DatabaseAggregate`.200    public var aggregate: String?201    /// formula.202    public var expression: String?203    /// ai.204    public var prompt: String?205206    public init(options: [DatabaseSelectOption]? = nil, format: String? = nil, includeTime: Bool? = nil, targetDatabaseId: String? = nil,207                syncedPropertyId: String? = nil, twoWay: Bool? = nil, single: Bool? = nil, relationPropertyId: String? = nil,208                targetPropertyId: String? = nil, aggregate: String? = nil, expression: String? = nil, prompt: String? = nil) {209        self.options = options210        self.format = format211        self.includeTime = includeTime212        self.targetDatabaseId = targetDatabaseId213        self.syncedPropertyId = syncedPropertyId214        self.twoWay = twoWay215        self.single = single216        self.relationPropertyId = relationPropertyId217        self.targetPropertyId = targetPropertyId218        self.aggregate = aggregate219        self.expression = expression220        self.prompt = prompt221    }222223    /// The configuration as the raw JSON object the routes take.224    public var raw: RawJSON { (try? RawJSON(encoding: self)) ?? .emptyObject }225}226227/// A property (column): the `database_property` row of the feed and the object of the property routes.228public struct DatabaseProperty: Codable, Sendable, Equatable, Identifiable {229    public var id: String230    public var databaseId: String231    public var name: String232    /// See `DatabasePropertyType`.233    public var type: String234    /// Free-form JSON object (see `DatabasePropertyConfig` for the known keys).235    public var config: RawJSON236    public var position: Double?237    public var width: Int?238    public var createdAt: Date?239    public var rev: Int64?240241    /// The known keys of `config`, decoded.242    public var typedConfig: DatabasePropertyConfig { (try? config.decode(DatabasePropertyConfig.self)) ?? DatabasePropertyConfig() }243    public var options: [DatabaseSelectOption] { typedConfig.options ?? [] }244    public var isComputed: Bool { DatabasePropertyType.computed.contains(type) }245    public var isReadOnly: Bool { DatabasePropertyType.readOnly.contains(type) }246}247248/// Body of `POST /api/databases/<id>/properties`. With a client `id` the call is idempotent (the stored property is249/// returned, untouched). A second `title` property is refused (`400`).250public struct DatabasePropertyDraft: Encodable, Sendable, Equatable {251    public var id: String?252    public var name: String253    public var type: String254    public var config: RawJSON?255    /// 40…2000.256    public var width: Int?257    public var position: Double?258259    public init(id: String? = nil, name: String, type: String, config: RawJSON? = nil, width: Int? = nil, position: Double? = nil) {260        self.id = id261        self.name = name262        self.type = type263        self.config = config264        self.width = width265        self.position = position266    }267268    public init(id: String? = nil, name: String, type: String, config: DatabasePropertyConfig, width: Int? = nil, position: Double? = nil) {269        self.init(id: id, name: name, type: type, config: config.raw, width: width, position: position)270    }271}272273/// Changes of `PATCH /api/databases/<id>/properties` for one property. Changing `type` converts the stored values274/// (best effort); the title property cannot change type. `config` REPLACES the stored configuration.275public struct DatabasePropertyChanges: Encodable, Sendable, Equatable {276    public var name: String?277    public var type: String?278    public var config: RawJSON?279    public var width: PatchValue<Int>?280    public var position: Double?281282    public init(name: String? = nil, type: String? = nil, config: RawJSON? = nil, width: PatchValue<Int>? = nil, position: Double? = nil) {283        self.name = name284        self.type = type285        self.config = config286        self.width = width287        self.position = position288    }289290    enum CodingKeys: String, CodingKey { case id, name, type, config, width, position }291292    public func encode(to encoder: Encoder) throws {293        var c = encoder.container(keyedBy: CodingKeys.self)294        try c.encodeIfPresent(name, forKey: .name)295        try c.encodeIfPresent(type, forKey: .type)296        try c.encodeIfPresent(config, forKey: .config)297        try c.encodePatch(width, forKey: .width)298        try c.encodeIfPresent(position, forKey: .position)299    }300}301302// MARK: - Views303304/// A sort of a view or a query.305public struct DatabaseSort: Codable, Sendable, Equatable {306    /// Property id.307    public var property: String308    /// `asc` or `desc`.309    public var dir: String310311    public init(property: String, descending: Bool = false) {312        self.property = property313        self.dir = descending ? "desc" : "asc"314    }315316    public var isDescending: Bool { dir == "desc" }317}318319/// A filter: a rule on one property, or a group `{ and?: [...], or?: [...] }` (groups nest). The top level of a320/// view or a query is always a group.321public indirect enum DatabaseFilter: Codable, Sendable, Equatable {322    /// `property` = property id (or name); `op` = see `DatabaseFilterOp`; `value` = raw JSON (absent for `empty` / `not_empty`).323    case rule(property: String, op: String, value: RawJSON?)324    case group(and: [DatabaseFilter]?, or: [DatabaseFilter]?)325326    /// Every node must match.327    public static func all(_ nodes: [DatabaseFilter]) -> DatabaseFilter { .group(and: nodes, or: nil) }328    /// At least one node must match.329    public static func any(_ nodes: [DatabaseFilter]) -> DatabaseFilter { .group(and: nil, or: nodes) }330    /// A rule with an encodable value (`"text"`, `12`, `true`, `["optionId"]`…).331    public static func rule<V: Encodable>(_ property: String, _ op: String, _ value: V) -> DatabaseFilter {332        .rule(property: property, op: op, value: try? RawJSON(encoding: value))333    }334335    enum CodingKeys: String, CodingKey { case property, op, value, and, or }336337    public init(from decoder: Decoder) throws {338        let c = try decoder.container(keyedBy: CodingKeys.self)339        if c.contains(.property) {340            self = .rule(property: try c.decode(String.self, forKey: .property), op: try c.decodeIfPresent(String.self, forKey: .op) ?? DatabaseFilterOp.eq, value: c.rawIfPresent(.value))341        } else {342            self = .group(and: try c.decodeIfPresent([DatabaseFilter].self, forKey: .and), or: try c.decodeIfPresent([DatabaseFilter].self, forKey: .or))343        }344    }345346    public func encode(to encoder: Encoder) throws {347        var c = encoder.container(keyedBy: CodingKeys.self)348        switch self {349        case .rule(let property, let op, let value):350            try c.encode(property, forKey: .property)351            try c.encode(op, forKey: .op)352            try c.encodeIfPresent(value, forKey: .value)353        case .group(let and, let or):354            try c.encodeIfPresent(and, forKey: .and)355            try c.encodeIfPresent(or, forKey: .or)356        }357    }358}359360/// The known keys of `DatabaseView.config` (free-form JSON on the wire).361public struct DatabaseViewConfig: Codable, Sendable, Equatable {362    public var filter: DatabaseFilter?363    public var sorts: [DatabaseSort]?364    /// Property id (board).365    public var groupBy: String?366    /// Hidden property ids.367    public var hidden: [String]?368    /// Property ids, in display order.369    public var order: [String]?370    public var widths: [String: Double]?371    /// calendar.372    public var dateProperty: String?373    /// timeline.374    public var startProperty: String?375    public var endProperty: String?376    /// gallery.377    public var coverProperty: String?378    /// timeline: `week` or `month`.379    public var scale: String?380381    public init(filter: DatabaseFilter? = nil, sorts: [DatabaseSort]? = nil, groupBy: String? = nil, hidden: [String]? = nil, order: [String]? = nil,382                widths: [String: Double]? = nil, dateProperty: String? = nil, startProperty: String? = nil, endProperty: String? = nil,383                coverProperty: String? = nil, scale: String? = nil) {384        self.filter = filter385        self.sorts = sorts386        self.groupBy = groupBy387        self.hidden = hidden388        self.order = order389        self.widths = widths390        self.dateProperty = dateProperty391        self.startProperty = startProperty392        self.endProperty = endProperty393        self.coverProperty = coverProperty394        self.scale = scale395    }396397    public var raw: RawJSON { (try? RawJSON(encoding: self)) ?? .emptyObject }398}399400/// A view: the `database_view` row of the feed and the object of the view routes.401public struct DatabaseView: Codable, Sendable, Equatable, Identifiable {402    public var id: String403    public var databaseId: String404    public var name: String405    /// See `DatabaseViewType`.406    public var type: String407    /// Free-form JSON object (see `DatabaseViewConfig`).408    public var config: RawJSON409    public var position: Double?410    public var isDefault: Bool?411    public var createdAt: Date?412    public var rev: Int64?413414    public var typedConfig: DatabaseViewConfig { (try? config.decode(DatabaseViewConfig.self)) ?? DatabaseViewConfig() }415}416417/// Body of `POST /api/databases/<id>/views`. With a client `id` the call is idempotent.418public struct DatabaseViewDraft: Encodable, Sendable, Equatable {419    public var id: String?420    public var name: String421    public var type: String422    public var config: RawJSON?423424    public init(id: String? = nil, name: String, type: String, config: RawJSON? = nil) {425        self.id = id426        self.name = name427        self.type = type428        self.config = config429    }430431    public init(id: String? = nil, name: String, type: String, config: DatabaseViewConfig) {432        self.init(id: id, name: name, type: type, config: config.raw)433    }434}435436/// Changes of `PATCH /api/databases/<id>/views` for one view. `config` REPLACES the stored configuration.437public struct DatabaseViewChanges: Encodable, Sendable, Equatable {438    public var name: String?439    public var type: String?440    public var config: RawJSON?441    public var position: Double?442    public var isDefault: Bool?443444    public init(name: String? = nil, type: String? = nil, config: RawJSON? = nil, position: Double? = nil, isDefault: Bool? = nil) {445        self.name = name446        self.type = type447        self.config = config448        self.position = position449        self.isDefault = isDefault450    }451}452453// MARK: - Rows454455/// A row reference: the value of a relation cell, and an item of `GET /api/databases/<id>/rows` (relation pickers).456public struct DatabaseRelationRef: Codable, Sendable, Equatable, Identifiable {457    public var rowId: String458    /// The page of the row.459    public var pageId: String460    public var title: String461    public var icon: String?462463    public var id: String { rowId }464}465466/// One cell of a row, read from `DatabaseRow.values`.467public enum DatabaseCellValue: Sendable, Equatable {468    case null469    case bool(Bool)470    case number(Double)471    /// text, url, date (`YYYY-MM-DD` or ISO), a select / status option id, a created / edited time, a formula string.472    case text(String)473    /// multi_select option ids, or the strings of a `show` / `unique` rollup.474    case list([String])475    /// A relation, hydrated by the row routes (the feed never carries relations).476    case relations([DatabaseRelationRef])477    /// A formula or rollup that cannot be computed: `{ "error": "…" }`.478    case error(String)479    /// An AI cell being generated: `{ "pending": true, "at": … }`.480    case pending(at: Date?)481    /// Anything else (file references, values of a newer server).482    case other(RawJSON)483484    init(_ value: JSONValue) {485        switch value {486        case .null: self = .null487        case .bool(let b): self = .bool(b)488        case .int(let i): self = .number(Double(i))489        case .double(let d): self = .number(d)490        case .string(let s): self = .text(s)491        case .array(let items):492            if items.allSatisfy({ $0.stringValue != nil }) {493                self = .list(items.compactMap(\.stringValue))494            } else if let refs = try? value.raw().decode([DatabaseRelationRef].self) {495                self = .relations(refs)496            } else {497                self = .other(value.raw())498            }499        case .object(let object):500            if let message = object["error"]?.stringValue {501                self = .error(message)502            } else if object["pending"]?.boolValue == true {503                self = .pending(at: object["at"]?.stringValue.flatMap(APIDate.parse))504            } else {505                self = .other(value.raw())506            }507        }508    }509510    public var string: String? { if case .text(let s) = self { return s }; return nil }511    public var double: Double? { if case .number(let n) = self { return n }; return nil }512    public var boolean: Bool? { if case .bool(let b) = self { return b }; return nil }513    public var strings: [String]? { if case .list(let l) = self { return l }; return nil }514    public var references: [DatabaseRelationRef]? { if case .relations(let r) = self { return r }; return nil }515    public var errorMessage: String? { if case .error(let e) = self { return e }; return nil }516}517518/// A row. Two shapes share this type:519/// - the row routes (create, update, list `full`, query): `title`, `icon` and **hydrated** `values` — the title, the520///   relations (`[DatabaseRelationRef]`), rollups, formulas and created / edited times are computed by the server;521/// - the `database_row` row of the entity feed: `databaseId`, `deletedAt`, `rev` and **stored** `values` only.522public struct DatabaseRow: Codable, Sendable, Equatable, Identifiable {523    public var id: String524    /// The page of the row (a page of `pages`, child of the host page).525    public var pageId: String526    /// Feed row only.527    public var databaseId: String?528    /// Row routes only (the feed carries the title in `values` under the title property id, and in the page).529    public var title: String?530    /// Row routes only.531    public var icon: String?532    /// JSON object keyed by property id.533    public var values: RawJSON534    public var position: Double?535    public var createdAt: Date?536    public var updatedAt: Date?537    /// Feed row only: deleting a row is a soft delete (its page goes to the trash).538    public var deletedAt: Date?539    /// Feed row only.540    public var rev: Int64?541542    /// The cells, keyed by property id.543    public var cells: [String: DatabaseCellValue] {544        guard case .object(let object)? = try? JSONValue(parsing: values.data) else { return [:] }545        return object.mapValues(DatabaseCellValue.init)546    }547548    /// One cell (`nil` when the row has no value for the property).549    public func cell(_ propertyID: String) -> DatabaseCellValue? {550        values.member(propertyID).map(DatabaseCellValue.init)551    }552}553554/// One row of `POST /api/databases/<id>/rows`. `id` (row) and `pageId` (the row's page) are client-chosen UUIDs: the555/// same `id` again returns the stored row untouched; `409 row_deleted` when that row was deleted; `409 id_taken` when556/// the id belongs to another database or the page id is in use. Unknown keys are refused by the server.557public struct DatabaseRowDraft: Encodable, Sendable, Equatable {558    public var id: String?559    public var pageId: String?560    public var title: String?561    /// JSON object keyed by property id **or property name**. Relations take row ids; computed properties are ignored.562    public var values: RawJSON?563    public var position: Double?564    /// The document of the row's page.565    public var content: RawJSON?566    public var icon: String?567568    public init(id: String? = nil, pageId: String? = nil, title: String? = nil, values: RawJSON? = nil, position: Double? = nil, content: RawJSON? = nil, icon: String? = nil) {569        self.id = id570        self.pageId = pageId571        self.title = title572        self.values = values573        self.position = position574        self.content = content575        self.icon = icon576    }577}578579/// One entry of a bulk `PATCH /api/databases/<id>/rows`.580public struct DatabaseRowUpdate: Encodable, Sendable, Equatable {581    public var id: String582    /// Merged into the stored values; `null`, `""` or `[]` removes a value; the title property renames the page.583    public var values: RawJSON584585    public init(id: String, values: RawJSON) {586        self.id = id587        self.values = values588    }589}590591/// `DELETE /api/databases/<id>/rows`. Observed: `deleted` counts the ids that belong to the database, rows that592/// were already deleted included.593public struct DatabaseRowsDeleted: Codable, Sendable, Equatable {594    public var ok: Bool595    public var deleted: Int?596}597598/// `POST /api/databases/<id>/rows/restore`: `restored` counts the rows that really came back.599public struct DatabaseRowsRestored: Codable, Sendable, Equatable {600    public var ok: Bool601    public var restored: Int?602}603604// MARK: - Query605606/// Body of `POST /api/databases/<id>/query`. Explicit `filter` / `sorts` override those of `viewId`.607public struct DatabaseQuery: Encodable, Sendable, Equatable {608    public var viewId: String?609    /// `.value(group)` to filter, `.null` to ignore the filter of the view, `nil` to use it.610    public var filter: PatchValue<DatabaseFilter>?611    public var sorts: [DatabaseSort]?612    /// Matches the row titles (≤ 200 characters).613    public var search: String?614    /// 1…1000 (server default 200).615    public var limit: Int?616    public var offset: Int?617618    public init(viewId: String? = nil, filter: PatchValue<DatabaseFilter>? = nil, sorts: [DatabaseSort]? = nil, search: String? = nil, limit: Int? = nil, offset: Int? = nil) {619        self.viewId = viewId620        self.filter = filter621        self.sorts = sorts622        self.search = search623        self.limit = limit624        self.offset = offset625    }626627    enum CodingKeys: String, CodingKey { case viewId, filter, sorts, search, limit, offset }628629    public func encode(to encoder: Encoder) throws {630        var c = encoder.container(keyedBy: CodingKeys.self)631        try c.encodeIfPresent(viewId, forKey: .viewId)632        try c.encodePatch(filter, forKey: .filter)633        try c.encodeIfPresent(sorts, forKey: .sorts)634        try c.encodeIfPresent(search, forKey: .search)635        try c.encodeIfPresent(limit, forKey: .limit)636        try c.encodeIfPresent(offset, forKey: .offset)637    }638}639640/// Answer of the query routes: one page of hydrated rows and the total before paging.641public struct DatabaseQueryResult: Codable, Sendable, Equatable {642    public var rows: [DatabaseRow]643    public var total: Int644    public var limit: Int?645    public var offset: Int?646647    /// More rows exist after this page.648    public var hasMore: Bool { (offset ?? 0) + rows.count < total }649}650651// MARK: - Templates and CSV652653/// An item of `GET /api/databases/templates`.654public struct DatabaseTemplate: Codable, Sendable, Equatable, Identifiable {655    /// `research-papers`, `tasks`, `reading-list`…656    public var id: String657    public var name: String658    public var icon: String?659    public var description: String?660    /// Names of the properties the template creates (title first).661    public var properties: [String]?662}663664/// Answer of `POST /api/databases/<id>/apply-template`.665public struct DatabaseTemplateApplied: Codable, Sendable, Equatable {666    /// The template id.667    public var applied: String668    /// Number of properties of the template now present.669    public var properties: Int?670}671672/// Answer of `POST /api/databases/<id>/import` (CSV).673public struct DatabaseCSVImportResult: Codable, Sendable, Equatable {674    /// Rows created.675    public var created: Int676    /// Names of the properties created for unknown columns (as `text`).677    public var properties: [String]?678}679
Files main
Menu

Theme