@naturali/sdk 0.228.0 → 0.229.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2032,6 +2032,175 @@ var Chains = class {
2032
2032
  });
2033
2033
  }
2034
2034
  };
2035
+ var Collections = class {
2036
+ /**
2037
+ * List collections
2038
+ *
2039
+ * Returns the collections in scope, oldest first.
2040
+ */
2041
+ static listCollections(options) {
2042
+ return (options.client ?? client).get({
2043
+ url: "/v1/projects/{project_id}/collections",
2044
+ ...options
2045
+ });
2046
+ }
2047
+ /**
2048
+ * Create a collection
2049
+ *
2050
+ * Creates a collection. `name` is unique per project; a second collection of the same name is `409 NAME_CONFLICT`. A `schema` is compiled here, so one JSON Schema cannot parse is refused rather than stored.
2051
+ */
2052
+ static createCollection(options) {
2053
+ return (options.client ?? client).post({
2054
+ url: "/v1/projects/{project_id}/collections",
2055
+ ...options,
2056
+ headers: {
2057
+ "Content-Type": "application/json",
2058
+ ...options.headers
2059
+ }
2060
+ });
2061
+ }
2062
+ /**
2063
+ * Delete a collection
2064
+ *
2065
+ * Deletes the collection and every item in it.
2066
+ */
2067
+ static deleteCollection(options) {
2068
+ return (options.client ?? client).delete({
2069
+ url: "/v1/projects/{project_id}/collections/{collection_id}",
2070
+ ...options
2071
+ });
2072
+ }
2073
+ /**
2074
+ * Get a collection
2075
+ *
2076
+ * Returns one collection.
2077
+ */
2078
+ static getCollection(options) {
2079
+ return (options.client ?? client).get({
2080
+ url: "/v1/projects/{project_id}/collections/{collection_id}",
2081
+ ...options
2082
+ });
2083
+ }
2084
+ /**
2085
+ * Update a collection
2086
+ *
2087
+ * Renames the collection or replaces its `schema`. A new schema governs the next write of each item; items already stored are not re-judged.
2088
+ */
2089
+ static updateCollection(options) {
2090
+ return (options.client ?? client).patch({
2091
+ url: "/v1/projects/{project_id}/collections/{collection_id}",
2092
+ ...options,
2093
+ headers: {
2094
+ "Content-Type": "application/json",
2095
+ ...options.headers
2096
+ }
2097
+ });
2098
+ }
2099
+ /**
2100
+ * List items
2101
+ *
2102
+ * Returns the collection's items in key order, narrowed by `data` and `tags`. The listing is bounded by `limit` (at most 100) and a statement timeout; a query past it is `422 QUERY_TIMEOUT`.
2103
+ */
2104
+ static listCollectionItems(options) {
2105
+ return (options.client ?? client).get({
2106
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items",
2107
+ ...options
2108
+ });
2109
+ }
2110
+ /**
2111
+ * Delete an item
2112
+ *
2113
+ * Deletes the item at `key`.
2114
+ */
2115
+ static deleteCollectionItem(options) {
2116
+ return (options.client ?? client).delete({
2117
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}",
2118
+ ...options
2119
+ });
2120
+ }
2121
+ /**
2122
+ * Get an item
2123
+ *
2124
+ * Returns the item at `key`.
2125
+ */
2126
+ static getCollectionItem(options) {
2127
+ return (options.client ?? client).get({
2128
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}",
2129
+ ...options
2130
+ });
2131
+ }
2132
+ /**
2133
+ * Update an item
2134
+ *
2135
+ * Merges `data` into the item's as a JSON Merge Patch (RFC 7386): an object merges key by key, `null` removes a key, any other value replaces it. The merged `data` is judged as a put's is.
2136
+ */
2137
+ static updateCollectionItem(options) {
2138
+ return (options.client ?? client).patch({
2139
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}",
2140
+ ...options,
2141
+ headers: {
2142
+ "Content-Type": "application/json",
2143
+ ...options.headers
2144
+ }
2145
+ });
2146
+ }
2147
+ /**
2148
+ * Create or replace an item
2149
+ *
2150
+ * Writes `data` at `key`: `201` when the key was free, `200` when it replaced an item. `tags` replace the bag when sent and leave it alone when omitted. `data` is at most 64 KB as JSON and must satisfy the collection's `schema`. A precondition (`If-Match` or `expected_version`) names a version of an existing item, so it is `404` for a free key.
2151
+ */
2152
+ static putCollectionItem(options) {
2153
+ return (options.client ?? client).put({
2154
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}",
2155
+ ...options,
2156
+ headers: {
2157
+ "Content-Type": "application/json",
2158
+ ...options.headers
2159
+ }
2160
+ });
2161
+ }
2162
+ /**
2163
+ * Get item tags
2164
+ *
2165
+ * Returns the item's tags.
2166
+ */
2167
+ static getCollectionItemTags(options) {
2168
+ return (options.client ?? client).get({
2169
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}/tags",
2170
+ ...options
2171
+ });
2172
+ }
2173
+ /**
2174
+ * Merge item tags
2175
+ *
2176
+ * Merges the given tags into the item's; a key not sent is kept. Bumps the item's `version`.
2177
+ */
2178
+ static mergeCollectionItemTags(options) {
2179
+ return (options.client ?? client).patch({
2180
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}/tags",
2181
+ ...options,
2182
+ headers: {
2183
+ "Content-Type": "application/json",
2184
+ ...options.headers
2185
+ }
2186
+ });
2187
+ }
2188
+ /**
2189
+ * Replace item tags
2190
+ *
2191
+ * Replaces every tag on the item. Bumps the item's `version`.
2192
+ */
2193
+ static replaceCollectionItemTags(options) {
2194
+ return (options.client ?? client).put({
2195
+ url: "/v1/projects/{project_id}/collections/{collection_id}/items/{key}/tags",
2196
+ ...options,
2197
+ headers: {
2198
+ "Content-Type": "application/json",
2199
+ ...options.headers
2200
+ }
2201
+ });
2202
+ }
2203
+ };
2035
2204
  var Conversations = class {
2036
2205
  /**
2037
2206
  * List conversations
@@ -6704,6 +6873,7 @@ var NaturaliClient = class {
6704
6873
  auditLog;
6705
6874
  assistant;
6706
6875
  chains;
6876
+ collections;
6707
6877
  channels;
6708
6878
  auth;
6709
6879
  conversations;
@@ -6761,6 +6931,7 @@ var NaturaliClient = class {
6761
6931
  this.auditLog = bindResource(AuditLog, this.http);
6762
6932
  this.assistant = bindResource(Assistant, this.http);
6763
6933
  this.chains = bindResource(Chains, this.http);
6934
+ this.collections = bindResource(Collections, this.http);
6764
6935
  this.channels = bindResource(Channels, this.http);
6765
6936
  this.auth = bindResource(Auth, this.http);
6766
6937
  this.conversations = bindResource(Conversations, this.http);
@@ -6813,6 +6984,7 @@ exports.AuditLog = AuditLog;
6813
6984
  exports.Auth = Auth;
6814
6985
  exports.Chains = Chains;
6815
6986
  exports.Channels = Channels;
6987
+ exports.Collections = Collections;
6816
6988
  exports.Conversations = Conversations;
6817
6989
  exports.Deciders = Deciders;
6818
6990
  exports.Documents = Documents;