From f82039c76b1486119e400bd3ea7cf9c609d798cf Mon Sep 17 00:00:00 2001 From: Wahab Alshahin Date: Sun, 12 Nov 2023 19:58:37 -0500 Subject: [PATCH] Bump to v0.7.0 --- CHANGELOG.md | 5 + lib/src/generated/client.dart | 158 ++++-- lib/src/generated/schema/collection.dart | 2 +- .../schema/configure_index_request.dart | 1 + .../schema/create_index_request.dart | 8 +- lib/src/generated/schema/delete_request.dart | 8 +- lib/src/generated/schema/index_database.dart | 1 + lib/src/generated/schema/index_stats.dart | 8 +- .../generated/schema/index_stats_request.dart | 2 +- lib/src/generated/schema/index_status.dart | 4 +- lib/src/generated/schema/pod_type.dart | 24 +- lib/src/generated/schema/query_request.dart | 12 +- lib/src/generated/schema/schema.freezed.dart | 470 ++++++++++++------ lib/src/generated/schema/schema.g.dart | 344 ++++++++----- lib/src/generated/schema/sparse_vector.dart | 4 +- lib/src/generated/schema/update_request.dart | 10 +- lib/src/generated/schema/upsert_request.dart | 2 +- lib/src/generated/schema/upsert_response.dart | 2 +- lib/src/generated/schema/vector.dart | 6 +- lib/src/generated/schema/vector_match.dart | 10 +- pubspec.yaml | 5 +- test/pinecone_test.dart | 2 +- 22 files changed, 721 insertions(+), 367 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 070ab92..a802331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.7.0 + +* Client generation using latest `openapi_spec` package (v0.7.6) +* Breaking: `PodType` enum values are now camel case + ## 0.6.0 * Client generation using latest `openapi_spec` package (v0.6.0) diff --git a/lib/src/generated/client.dart b/lib/src/generated/client.dart index 2590aae..6c9ddbb 100644 --- a/lib/src/generated/client.dart +++ b/lib/src/generated/client.dart @@ -1,12 +1,16 @@ // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint -// ignore_for_file: invalid_annotation_target +// ignore_for_file: invalid_annotation_target, unused_import -import 'dart:io' as io; import 'dart:convert'; +import 'dart:io' as io; +import 'dart:typed_data'; + import 'package:http/http.dart' as http; import 'package:http/retry.dart'; +import 'package:meta/meta.dart'; + import 'schema/schema.dart'; /// Enum of HTTP methods @@ -25,6 +29,7 @@ class PineconeClientException implements io.HttpException { this.code, this.body, }); + @override final String message; @override @@ -56,31 +61,38 @@ class PineconeClientException implements io.HttpException { // CLASS: PineconeClient // ========================================== -/// Client for Pinecone API -/// -/// `baseUrl`: Override baseUrl URL - else defaults to server url defined in spec +/// Client for Pinecone API (v.1.1.0) /// -/// `client`: Override HTTP client to use for requests +/// No description class PineconeClient { + /// Creates a new PineconeClient instance. + /// + /// - [PineconeClient.baseUrl] Override base URL (default: server url defined in spec) + /// - [PineconeClient.headers] Global headers to be sent with every request + /// - [PineconeClient.client] Override HTTP client to use for requests PineconeClient({ this.apiKey = '', - String? baseUrl, + this.baseUrl, + this.headers = const {}, http.Client? client, - }) : assert( + }) : assert( baseUrl == null || baseUrl.startsWith('http'), 'baseUrl must start with http', - ) { - // Ensure trailing slash is removed from baseUrl - this.baseUrl = baseUrl?.replaceAll(RegExp(r'/$'), ''); - // Create a retry client - this.client = RetryClient(client ?? http.Client()); - } + ), + assert( + baseUrl == null || !baseUrl.endsWith('/'), + 'baseUrl must not end with /', + ), + client = RetryClient(client ?? http.Client()); + + /// Override base URL (default: server url defined in spec) + final String? baseUrl; - /// User provided override for baseUrl URL - late final String? baseUrl; + /// Global headers to be sent with every request + final Map headers; /// HTTP client for requests - late final http.Client client; + final http.Client client; /// Authentication related variables final String apiKey; @@ -99,8 +111,19 @@ class PineconeClient { /// Middleware for HTTP requests (user can override) /// /// The request can be of type [http.Request] or [http.MultipartRequest] - Future onRequest(http.BaseRequest request) async { - return request; + Future onRequest(http.BaseRequest request) { + return Future.value(request); + } + + // ------------------------------------------ + // METHOD: onStreamedResponse + // ------------------------------------------ + + /// Middleware for HTTP streamed responses (user can override) + Future onStreamedResponse( + final http.StreamedResponse response, + ) { + return Future.value(response); } // ------------------------------------------ @@ -108,16 +131,17 @@ class PineconeClient { // ------------------------------------------ /// Middleware for HTTP responses (user can override) - Future onResponse(http.Response response) async { - return response; + Future onResponse(http.Response response) { + return Future.value(response); } // ------------------------------------------ - // METHOD: _request + // METHOD: makeRequestStream // ------------------------------------------ - /// Reusable request method - Future _request({ + /// Reusable request stream method + @protected + Future makeRequestStream({ required String baseUrl, required String path, required HttpMethod method, @@ -165,8 +189,11 @@ class PineconeClient { headers['accept'] = responseType; } + // Add global headers + headers.addAll(this.headers); + // Build the request object - late http.Response response; + late http.StreamedResponse response; try { http.BaseRequest request; if (isMultipart) { @@ -204,10 +231,10 @@ class PineconeClient { request = await onRequest(request); // Submit request - response = await http.Response.fromStream(await client.send(request)); + response = await client.send(request); // Handle user response middleware - response = await onResponse(response); + response = await onStreamedResponse(response); } catch (e) { // Handle request and response errors throw PineconeClientException( @@ -229,10 +256,55 @@ class PineconeClient { method: method, message: 'Unsuccessful response', code: response.statusCode, - body: response.body, + body: (await http.Response.fromStream(response)).body, ); } + // ------------------------------------------ + // METHOD: makeRequest + // ------------------------------------------ + + /// Reusable request method + @protected + Future makeRequest({ + required String baseUrl, + required String path, + required HttpMethod method, + Map queryParams = const {}, + Map headerParams = const {}, + bool isMultipart = false, + String requestType = '', + String responseType = '', + Object? body, + }) async { + try { + final streamedResponse = await makeRequestStream( + baseUrl: baseUrl, + path: path, + method: method, + queryParams: queryParams, + headerParams: headerParams, + requestType: requestType, + responseType: responseType, + body: body, + ); + final response = await http.Response.fromStream(streamedResponse); + + // Handle user response middleware + return await onResponse(response); + } on PineconeClientException { + rethrow; + } catch (e) { + // Handle request and response errors + throw PineconeClientException( + uri: Uri.parse((this.baseUrl ?? baseUrl) + path), + method: method, + message: 'Response error', + body: e, + ); + } + } + // ------------------------------------------ // METHOD: listCollections // ------------------------------------------ @@ -247,7 +319,7 @@ class PineconeClient { Future> listCollections({ String environment = 'us-west1-gcp-free', }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/collections', method: HttpMethod.get, @@ -278,7 +350,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required CreateCollectionRequest request, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/collections', method: HttpMethod.post, @@ -309,7 +381,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required String collectionName, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/collections/$collectionName', method: HttpMethod.get, @@ -340,7 +412,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required String collectionName, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/collections/$collectionName', method: HttpMethod.delete, @@ -367,7 +439,7 @@ class PineconeClient { Future> listIndexes({ String environment = 'us-west1-gcp-free', }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/databases', method: HttpMethod.get, @@ -398,7 +470,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required CreateIndexRequest request, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/databases', method: HttpMethod.post, @@ -429,7 +501,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required String indexName, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/databases/$indexName', method: HttpMethod.get, @@ -460,7 +532,7 @@ class PineconeClient { String environment = 'us-west1-gcp-free', required String indexName, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/databases/$indexName', method: HttpMethod.delete, @@ -493,7 +565,7 @@ class PineconeClient { required String indexName, required ConfigureIndexRequest request, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://controller.${environment}.pinecone.io', path: '/databases/$indexName', method: HttpMethod.patch, @@ -530,7 +602,7 @@ class PineconeClient { required String environment, IndexStatsRequest? request, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/describe_index_stats', @@ -569,7 +641,7 @@ class PineconeClient { required String environment, required QueryRequest request, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/query', @@ -608,7 +680,7 @@ class PineconeClient { required String environment, required DeleteRequest request, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/vectors/delete', @@ -649,7 +721,7 @@ class PineconeClient { required List ids, String? namespace, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/vectors/fetch', @@ -691,7 +763,7 @@ class PineconeClient { required String environment, required UpdateRequest request, }) async { - final _ = await _request( + final _ = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/vectors/update', @@ -729,7 +801,7 @@ class PineconeClient { required String environment, required UpsertRequest request, }) async { - final r = await _request( + final r = await makeRequest( baseUrl: 'https://${indexName}-${projectId}.svc.${environment}.pinecone.io', path: '/vectors/upsert', diff --git a/lib/src/generated/schema/collection.dart b/lib/src/generated/schema/collection.dart index c7308a7..89faaa2 100644 --- a/lib/src/generated/schema/collection.dart +++ b/lib/src/generated/schema/collection.dart @@ -22,7 +22,7 @@ class Collection with _$Collection { required CollectionStatus status, /// The size of the collection in bytes. - int? size, + @JsonKey(includeIfNull: false) int? size, /// The dimensionality of the collection. required int dimension, diff --git a/lib/src/generated/schema/configure_index_request.dart b/lib/src/generated/schema/configure_index_request.dart index fb5e6df..d88fd86 100644 --- a/lib/src/generated/schema/configure_index_request.dart +++ b/lib/src/generated/schema/configure_index_request.dart @@ -21,6 +21,7 @@ class ConfigureIndexRequest with _$ConfigureIndexRequest { /// An enumeration of the available pod types. @JsonKey( name: 'pod_type', + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue, ) PodType? podType, diff --git a/lib/src/generated/schema/create_index_request.dart b/lib/src/generated/schema/create_index_request.dart index a01157b..340b9c4 100644 --- a/lib/src/generated/schema/create_index_request.dart +++ b/lib/src/generated/schema/create_index_request.dart @@ -31,13 +31,15 @@ class CreateIndexRequest with _$CreateIndexRequest { @Default(1) int replicas, /// An enumeration of the available pod types. - @JsonKey(name: 'pod_type') @Default(PodType.p1x1) PodType podType, + @JsonKey(name: 'pod_type') @Default(PodType.p1X1) PodType podType, /// Configuration for the behavior of Pinecone's internal metadata index. - @JsonKey(name: 'metadata_config') Map? metadataConfig, + @JsonKey(name: 'metadata_config', includeIfNull: false) + Map? metadataConfig, /// The name of the collection to create an index from. - @JsonKey(name: 'source_collection') String? sourceCollection, + @JsonKey(name: 'source_collection', includeIfNull: false) + String? sourceCollection, }) = _CreateIndexRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/delete_request.dart b/lib/src/generated/schema/delete_request.dart index 2c917ef..8a5a0da 100644 --- a/lib/src/generated/schema/delete_request.dart +++ b/lib/src/generated/schema/delete_request.dart @@ -16,16 +16,16 @@ class DeleteRequest with _$DeleteRequest { /// Factory constructor for DeleteRequest const factory DeleteRequest({ /// Vectors to delete, by id. - List? ids, + @JsonKey(includeIfNull: false) List? ids, /// This indicates that all vectors in the index namespace should be deleted. - bool? deleteAll, + @JsonKey(includeIfNull: false) bool? deleteAll, /// The namespace to delete vectors from, if applicable. - String? namespace, + @JsonKey(includeIfNull: false) String? namespace, /// If specified, the metadata filter here will be used to select the vectors to delete. - Map? filter, + @JsonKey(includeIfNull: false) Map? filter, }) = _DeleteRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/index_database.dart b/lib/src/generated/schema/index_database.dart index c8f14d7..23eb631 100644 --- a/lib/src/generated/schema/index_database.dart +++ b/lib/src/generated/schema/index_database.dart @@ -36,6 +36,7 @@ class IndexDatabase with _$IndexDatabase { /// An enumeration of the available pod types. @JsonKey( name: 'pod_type', + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue, ) PodType? podType, diff --git a/lib/src/generated/schema/index_stats.dart b/lib/src/generated/schema/index_stats.dart index a6ca09c..1883f47 100644 --- a/lib/src/generated/schema/index_stats.dart +++ b/lib/src/generated/schema/index_stats.dart @@ -16,16 +16,16 @@ class IndexStats with _$IndexStats { /// Factory constructor for IndexStats const factory IndexStats({ /// A mapping for each namespace in the index from the namespace name to a summary of its contents. - Map? namespaces, + @JsonKey(includeIfNull: false) Map? namespaces, /// The dimension of the indexed vectors. - int? dimension, + @JsonKey(includeIfNull: false) int? dimension, /// The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. - double? indexFullness, + @JsonKey(includeIfNull: false) double? indexFullness, /// Indicator of index readiness. - int? totalVectorCount, + @JsonKey(includeIfNull: false) int? totalVectorCount, }) = _IndexStats; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/index_stats_request.dart b/lib/src/generated/schema/index_stats_request.dart index 855bad4..c2dcb75 100644 --- a/lib/src/generated/schema/index_stats_request.dart +++ b/lib/src/generated/schema/index_stats_request.dart @@ -16,7 +16,7 @@ class IndexStatsRequest with _$IndexStatsRequest { /// Factory constructor for IndexStatsRequest const factory IndexStatsRequest({ /// If defined, the operation only returns statistics for vectors that satisfy the filter. - Map? filter, + @JsonKey(includeIfNull: false) Map? filter, }) = _IndexStatsRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/index_status.dart b/lib/src/generated/schema/index_status.dart index 4d75977..314cedc 100644 --- a/lib/src/generated/schema/index_status.dart +++ b/lib/src/generated/schema/index_status.dart @@ -22,7 +22,9 @@ class IndexStatus with _$IndexStatus { required int port, /// The current state of a index. - @JsonKey(unknownEnumValue: IndexState.terminating) + @JsonKey( + unknownEnumValue: IndexState.terminating, + ) required IndexState state, /// Indicator of index readiness. diff --git a/lib/src/generated/schema/pod_type.dart b/lib/src/generated/schema/pod_type.dart index cd8a126..f2a6cf4 100644 --- a/lib/src/generated/schema/pod_type.dart +++ b/lib/src/generated/schema/pod_type.dart @@ -11,27 +11,27 @@ part of pinecone_schema; /// An enumeration of the available pod types. enum PodType { @JsonValue('s1.x1') - s1x1, + s1X1, @JsonValue('s1.x2') - s1x2, + s1X2, @JsonValue('s1.x4') - s1x4, + s1X4, @JsonValue('s1.x8') - s1x8, + s1X8, @JsonValue('p1.x1') - p1x1, + p1X1, @JsonValue('p1.x2') - p1x2, + p1X2, @JsonValue('p1.x4') - p1x4, + p1X4, @JsonValue('p1.x8') - p1x8, + p1X8, @JsonValue('p2.x1') - p2x1, + p2X1, @JsonValue('p2.x2') - p2x2, + p2X2, @JsonValue('p2.x4') - p2x4, + p2X4, @JsonValue('p2.x8') - p2x8, + p2X8, } diff --git a/lib/src/generated/schema/query_request.dart b/lib/src/generated/schema/query_request.dart index 5619de0..40159c4 100644 --- a/lib/src/generated/schema/query_request.dart +++ b/lib/src/generated/schema/query_request.dart @@ -16,13 +16,13 @@ class QueryRequest with _$QueryRequest { /// Factory constructor for QueryRequest const factory QueryRequest({ /// The namespace to query. - String? namespace, + @JsonKey(includeIfNull: false) String? namespace, /// The number of results to return for each query. @Default(10) int topK, /// The filter to apply. You can use vector metadata to limit your search. - Map? filter, + @JsonKey(includeIfNull: false) Map? filter, /// Indicates whether vector values are included in the response. @Default(false) bool includeValues, @@ -31,13 +31,13 @@ class QueryRequest with _$QueryRequest { @Default(false) bool includeMetadata, /// The query vector. This should be the same length as the dimension of the index being queried. - List? vector, + @JsonKey(includeIfNull: false) List? vector, - /// No Description - SparseVector? sparseVector, + /// Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length. + @JsonKey(includeIfNull: false) SparseVector? sparseVector, /// The unique ID of the vector to be used as a query vector. - String? id, + @JsonKey(includeIfNull: false) String? id, }) = _QueryRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/schema.freezed.dart b/lib/src/generated/schema/schema.freezed.dart index 5d34de9..37dd1ae 100644 --- a/lib/src/generated/schema/schema.freezed.dart +++ b/lib/src/generated/schema/schema.freezed.dart @@ -226,7 +226,9 @@ mixin _$IndexDatabase { /// An enumeration of the available pod types. @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? get podType => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -249,7 +251,9 @@ abstract class $IndexDatabaseCopyWith<$Res> { int shards, int pods, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? podType}); } @@ -323,7 +327,9 @@ abstract class _$$IndexDatabaseImplCopyWith<$Res> int shards, int pods, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? podType}); } @@ -390,7 +396,9 @@ class _$IndexDatabaseImpl extends _IndexDatabase { required this.shards, required this.pods, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) this.podType}) : super._(); @@ -424,7 +432,9 @@ class _$IndexDatabaseImpl extends _IndexDatabase { /// An enumeration of the available pod types. @override @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) final PodType? podType; @override @@ -476,7 +486,9 @@ abstract class _IndexDatabase extends IndexDatabase { required final int shards, required final int pods, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) final PodType? podType}) = _$IndexDatabaseImpl; const _IndexDatabase._() : super._(); @@ -511,7 +523,9 @@ abstract class _IndexDatabase extends IndexDatabase { /// An enumeration of the available pod types. @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? get podType; @override @JsonKey(ignore: true) @@ -754,16 +768,20 @@ IndexStats _$IndexStatsFromJson(Map json) { /// @nodoc mixin _$IndexStats { /// A mapping for each namespace in the index from the namespace name to a summary of its contents. + @JsonKey(includeIfNull: false) Map? get namespaces => throw _privateConstructorUsedError; /// The dimension of the indexed vectors. + @JsonKey(includeIfNull: false) int? get dimension => throw _privateConstructorUsedError; /// The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. + @JsonKey(includeIfNull: false) double? get indexFullness => throw _privateConstructorUsedError; /// Indicator of index readiness. + @JsonKey(includeIfNull: false) int? get totalVectorCount => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -779,10 +797,10 @@ abstract class $IndexStatsCopyWith<$Res> { _$IndexStatsCopyWithImpl<$Res, IndexStats>; @useResult $Res call( - {Map? namespaces, - int? dimension, - double? indexFullness, - int? totalVectorCount}); + {@JsonKey(includeIfNull: false) Map? namespaces, + @JsonKey(includeIfNull: false) int? dimension, + @JsonKey(includeIfNull: false) double? indexFullness, + @JsonKey(includeIfNull: false) int? totalVectorCount}); } /// @nodoc @@ -833,10 +851,10 @@ abstract class _$$IndexStatsImplCopyWith<$Res> @override @useResult $Res call( - {Map? namespaces, - int? dimension, - double? indexFullness, - int? totalVectorCount}); + {@JsonKey(includeIfNull: false) Map? namespaces, + @JsonKey(includeIfNull: false) int? dimension, + @JsonKey(includeIfNull: false) double? indexFullness, + @JsonKey(includeIfNull: false) int? totalVectorCount}); } /// @nodoc @@ -880,10 +898,11 @@ class __$$IndexStatsImplCopyWithImpl<$Res> @JsonSerializable() class _$IndexStatsImpl extends _IndexStats { const _$IndexStatsImpl( - {final Map? namespaces, - this.dimension, - this.indexFullness, - this.totalVectorCount}) + {@JsonKey(includeIfNull: false) + final Map? namespaces, + @JsonKey(includeIfNull: false) this.dimension, + @JsonKey(includeIfNull: false) this.indexFullness, + @JsonKey(includeIfNull: false) this.totalVectorCount}) : _namespaces = namespaces, super._(); @@ -895,6 +914,7 @@ class _$IndexStatsImpl extends _IndexStats { /// A mapping for each namespace in the index from the namespace name to a summary of its contents. @override + @JsonKey(includeIfNull: false) Map? get namespaces { final value = _namespaces; if (value == null) return null; @@ -905,14 +925,17 @@ class _$IndexStatsImpl extends _IndexStats { /// The dimension of the indexed vectors. @override + @JsonKey(includeIfNull: false) final int? dimension; /// The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. @override + @JsonKey(includeIfNull: false) final double? indexFullness; /// Indicator of index readiness. @override + @JsonKey(includeIfNull: false) final int? totalVectorCount; @override @@ -960,10 +983,12 @@ class _$IndexStatsImpl extends _IndexStats { abstract class _IndexStats extends IndexStats { const factory _IndexStats( - {final Map? namespaces, - final int? dimension, - final double? indexFullness, - final int? totalVectorCount}) = _$IndexStatsImpl; + {@JsonKey(includeIfNull: false) + final Map? namespaces, + @JsonKey(includeIfNull: false) final int? dimension, + @JsonKey(includeIfNull: false) final double? indexFullness, + @JsonKey(includeIfNull: false) final int? totalVectorCount}) = + _$IndexStatsImpl; const _IndexStats._() : super._(); factory _IndexStats.fromJson(Map json) = @@ -972,18 +997,22 @@ abstract class _IndexStats extends IndexStats { @override /// A mapping for each namespace in the index from the namespace name to a summary of its contents. + @JsonKey(includeIfNull: false) Map? get namespaces; @override /// The dimension of the indexed vectors. + @JsonKey(includeIfNull: false) int? get dimension; @override /// The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. + @JsonKey(includeIfNull: false) double? get indexFullness; @override /// Indicator of index readiness. + @JsonKey(includeIfNull: false) int? get totalVectorCount; @override @JsonKey(ignore: true) @@ -1148,6 +1177,7 @@ mixin _$Collection { CollectionStatus get status => throw _privateConstructorUsedError; /// The size of the collection in bytes. + @JsonKey(includeIfNull: false) int? get size => throw _privateConstructorUsedError; /// The dimensionality of the collection. @@ -1165,7 +1195,11 @@ abstract class $CollectionCopyWith<$Res> { Collection value, $Res Function(Collection) then) = _$CollectionCopyWithImpl<$Res, Collection>; @useResult - $Res call({String name, CollectionStatus status, int? size, int dimension}); + $Res call( + {String name, + CollectionStatus status, + @JsonKey(includeIfNull: false) int? size, + int dimension}); } /// @nodoc @@ -1215,7 +1249,11 @@ abstract class _$$CollectionImplCopyWith<$Res> __$$CollectionImplCopyWithImpl<$Res>; @override @useResult - $Res call({String name, CollectionStatus status, int? size, int dimension}); + $Res call( + {String name, + CollectionStatus status, + @JsonKey(includeIfNull: false) int? size, + int dimension}); } /// @nodoc @@ -1261,7 +1299,7 @@ class _$CollectionImpl extends _Collection { const _$CollectionImpl( {required this.name, required this.status, - this.size, + @JsonKey(includeIfNull: false) this.size, required this.dimension}) : super._(); @@ -1278,6 +1316,7 @@ class _$CollectionImpl extends _Collection { /// The size of the collection in bytes. @override + @JsonKey(includeIfNull: false) final int? size; /// The dimensionality of the collection. @@ -1323,7 +1362,7 @@ abstract class _Collection extends Collection { const factory _Collection( {required final String name, required final CollectionStatus status, - final int? size, + @JsonKey(includeIfNull: false) final int? size, required final int dimension}) = _$CollectionImpl; const _Collection._() : super._(); @@ -1341,6 +1380,7 @@ abstract class _Collection extends Collection { @override /// The size of the collection in bytes. + @JsonKey(includeIfNull: false) int? get size; @override @@ -1364,7 +1404,9 @@ mixin _$ConfigureIndexRequest { /// An enumeration of the available pod types. @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? get podType => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -1382,7 +1424,9 @@ abstract class $ConfigureIndexRequestCopyWith<$Res> { $Res call( {int replicas, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? podType}); } @@ -1428,7 +1472,9 @@ abstract class _$$ConfigureIndexRequestImplCopyWith<$Res> $Res call( {int replicas, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? podType}); } @@ -1466,7 +1512,9 @@ class _$ConfigureIndexRequestImpl extends _ConfigureIndexRequest { const _$ConfigureIndexRequestImpl( {this.replicas = 1, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) this.podType}) : super._(); @@ -1481,7 +1529,9 @@ class _$ConfigureIndexRequestImpl extends _ConfigureIndexRequest { /// An enumeration of the available pod types. @override @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) final PodType? podType; @override @@ -1522,7 +1572,9 @@ abstract class _ConfigureIndexRequest extends ConfigureIndexRequest { const factory _ConfigureIndexRequest( {final int replicas, @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) final PodType? podType}) = _$ConfigureIndexRequestImpl; const _ConfigureIndexRequest._() : super._(); @@ -1537,7 +1589,9 @@ abstract class _ConfigureIndexRequest extends ConfigureIndexRequest { /// An enumeration of the available pod types. @JsonKey( - name: 'pod_type', unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + name: 'pod_type', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) PodType? get podType; @override @JsonKey(ignore: true) @@ -1744,12 +1798,12 @@ mixin _$CreateIndexRequest { PodType get podType => throw _privateConstructorUsedError; /// Configuration for the behavior of Pinecone's internal metadata index. - @JsonKey(name: 'metadata_config') + @JsonKey(name: 'metadata_config', includeIfNull: false) Map? get metadataConfig => throw _privateConstructorUsedError; /// The name of the collection to create an index from. - @JsonKey(name: 'source_collection') + @JsonKey(name: 'source_collection', includeIfNull: false) String? get sourceCollection => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -1771,8 +1825,10 @@ abstract class $CreateIndexRequestCopyWith<$Res> { int pods, int replicas, @JsonKey(name: 'pod_type') PodType podType, - @JsonKey(name: 'metadata_config') Map? metadataConfig, - @JsonKey(name: 'source_collection') String? sourceCollection}); + @JsonKey(name: 'metadata_config', includeIfNull: false) + Map? metadataConfig, + @JsonKey(name: 'source_collection', includeIfNull: false) + String? sourceCollection}); } /// @nodoc @@ -1849,8 +1905,10 @@ abstract class _$$CreateIndexRequestImplCopyWith<$Res> int pods, int replicas, @JsonKey(name: 'pod_type') PodType podType, - @JsonKey(name: 'metadata_config') Map? metadataConfig, - @JsonKey(name: 'source_collection') String? sourceCollection}); + @JsonKey(name: 'metadata_config', includeIfNull: false) + Map? metadataConfig, + @JsonKey(name: 'source_collection', includeIfNull: false) + String? sourceCollection}); } /// @nodoc @@ -1919,10 +1977,11 @@ class _$CreateIndexRequestImpl extends _CreateIndexRequest { this.metric = SearchMetric.cosine, this.pods = 1, this.replicas = 1, - @JsonKey(name: 'pod_type') this.podType = PodType.p1x1, - @JsonKey(name: 'metadata_config') + @JsonKey(name: 'pod_type') this.podType = PodType.p1X1, + @JsonKey(name: 'metadata_config', includeIfNull: false) final Map? metadataConfig, - @JsonKey(name: 'source_collection') this.sourceCollection}) + @JsonKey(name: 'source_collection', includeIfNull: false) + this.sourceCollection}) : _metadataConfig = metadataConfig, super._(); @@ -1962,7 +2021,7 @@ class _$CreateIndexRequestImpl extends _CreateIndexRequest { /// Configuration for the behavior of Pinecone's internal metadata index. @override - @JsonKey(name: 'metadata_config') + @JsonKey(name: 'metadata_config', includeIfNull: false) Map? get metadataConfig { final value = _metadataConfig; if (value == null) return null; @@ -1973,7 +2032,7 @@ class _$CreateIndexRequestImpl extends _CreateIndexRequest { /// The name of the collection to create an index from. @override - @JsonKey(name: 'source_collection') + @JsonKey(name: 'source_collection', includeIfNull: false) final String? sourceCollection; @override @@ -2030,16 +2089,16 @@ class _$CreateIndexRequestImpl extends _CreateIndexRequest { abstract class _CreateIndexRequest extends CreateIndexRequest { const factory _CreateIndexRequest( - {required final String name, - required final int dimension, - final SearchMetric metric, - final int pods, - final int replicas, - @JsonKey(name: 'pod_type') final PodType podType, - @JsonKey(name: 'metadata_config') - final Map? metadataConfig, - @JsonKey(name: 'source_collection') final String? sourceCollection}) = - _$CreateIndexRequestImpl; + {required final String name, + required final int dimension, + final SearchMetric metric, + final int pods, + final int replicas, + @JsonKey(name: 'pod_type') final PodType podType, + @JsonKey(name: 'metadata_config', includeIfNull: false) + final Map? metadataConfig, + @JsonKey(name: 'source_collection', includeIfNull: false) + final String? sourceCollection}) = _$CreateIndexRequestImpl; const _CreateIndexRequest._() : super._(); factory _CreateIndexRequest.fromJson(Map json) = @@ -2073,12 +2132,12 @@ abstract class _CreateIndexRequest extends CreateIndexRequest { @override /// Configuration for the behavior of Pinecone's internal metadata index. - @JsonKey(name: 'metadata_config') + @JsonKey(name: 'metadata_config', includeIfNull: false) Map? get metadataConfig; @override /// The name of the collection to create an index from. - @JsonKey(name: 'source_collection') + @JsonKey(name: 'source_collection', includeIfNull: false) String? get sourceCollection; @override @JsonKey(ignore: true) @@ -2093,6 +2152,7 @@ IndexStatsRequest _$IndexStatsRequestFromJson(Map json) { /// @nodoc mixin _$IndexStatsRequest { /// If defined, the operation only returns statistics for vectors that satisfy the filter. + @JsonKey(includeIfNull: false) Map? get filter => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -2107,7 +2167,7 @@ abstract class $IndexStatsRequestCopyWith<$Res> { IndexStatsRequest value, $Res Function(IndexStatsRequest) then) = _$IndexStatsRequestCopyWithImpl<$Res, IndexStatsRequest>; @useResult - $Res call({Map? filter}); + $Res call({@JsonKey(includeIfNull: false) Map? filter}); } /// @nodoc @@ -2142,7 +2202,7 @@ abstract class _$$IndexStatsRequestImplCopyWith<$Res> __$$IndexStatsRequestImplCopyWithImpl<$Res>; @override @useResult - $Res call({Map? filter}); + $Res call({@JsonKey(includeIfNull: false) Map? filter}); } /// @nodoc @@ -2170,7 +2230,8 @@ class __$$IndexStatsRequestImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$IndexStatsRequestImpl extends _IndexStatsRequest { - const _$IndexStatsRequestImpl({final Map? filter}) + const _$IndexStatsRequestImpl( + {@JsonKey(includeIfNull: false) final Map? filter}) : _filter = filter, super._(); @@ -2182,6 +2243,7 @@ class _$IndexStatsRequestImpl extends _IndexStatsRequest { /// If defined, the operation only returns statistics for vectors that satisfy the filter. @override + @JsonKey(includeIfNull: false) Map? get filter { final value = _filter; if (value == null) return null; @@ -2224,7 +2286,8 @@ class _$IndexStatsRequestImpl extends _IndexStatsRequest { } abstract class _IndexStatsRequest extends IndexStatsRequest { - const factory _IndexStatsRequest({final Map? filter}) = + const factory _IndexStatsRequest( + {@JsonKey(includeIfNull: false) final Map? filter}) = _$IndexStatsRequestImpl; const _IndexStatsRequest._() : super._(); @@ -2234,6 +2297,7 @@ abstract class _IndexStatsRequest extends IndexStatsRequest { @override /// If defined, the operation only returns statistics for vectors that satisfy the filter. + @JsonKey(includeIfNull: false) Map? get filter; @override @JsonKey(ignore: true) @@ -2248,15 +2312,19 @@ DeleteRequest _$DeleteRequestFromJson(Map json) { /// @nodoc mixin _$DeleteRequest { /// Vectors to delete, by id. + @JsonKey(includeIfNull: false) List? get ids => throw _privateConstructorUsedError; /// This indicates that all vectors in the index namespace should be deleted. + @JsonKey(includeIfNull: false) bool? get deleteAll => throw _privateConstructorUsedError; /// The namespace to delete vectors from, if applicable. + @JsonKey(includeIfNull: false) String? get namespace => throw _privateConstructorUsedError; /// If specified, the metadata filter here will be used to select the vectors to delete. + @JsonKey(includeIfNull: false) Map? get filter => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -2272,10 +2340,10 @@ abstract class $DeleteRequestCopyWith<$Res> { _$DeleteRequestCopyWithImpl<$Res, DeleteRequest>; @useResult $Res call( - {List? ids, - bool? deleteAll, - String? namespace, - Map? filter}); + {@JsonKey(includeIfNull: false) List? ids, + @JsonKey(includeIfNull: false) bool? deleteAll, + @JsonKey(includeIfNull: false) String? namespace, + @JsonKey(includeIfNull: false) Map? filter}); } /// @nodoc @@ -2326,10 +2394,10 @@ abstract class _$$DeleteRequestImplCopyWith<$Res> @override @useResult $Res call( - {List? ids, - bool? deleteAll, - String? namespace, - Map? filter}); + {@JsonKey(includeIfNull: false) List? ids, + @JsonKey(includeIfNull: false) bool? deleteAll, + @JsonKey(includeIfNull: false) String? namespace, + @JsonKey(includeIfNull: false) Map? filter}); } /// @nodoc @@ -2373,10 +2441,10 @@ class __$$DeleteRequestImplCopyWithImpl<$Res> @JsonSerializable() class _$DeleteRequestImpl extends _DeleteRequest { const _$DeleteRequestImpl( - {final List? ids, - this.deleteAll, - this.namespace, - final Map? filter}) + {@JsonKey(includeIfNull: false) final List? ids, + @JsonKey(includeIfNull: false) this.deleteAll, + @JsonKey(includeIfNull: false) this.namespace, + @JsonKey(includeIfNull: false) final Map? filter}) : _ids = ids, _filter = filter, super._(); @@ -2389,6 +2457,7 @@ class _$DeleteRequestImpl extends _DeleteRequest { /// Vectors to delete, by id. @override + @JsonKey(includeIfNull: false) List? get ids { final value = _ids; if (value == null) return null; @@ -2399,10 +2468,12 @@ class _$DeleteRequestImpl extends _DeleteRequest { /// This indicates that all vectors in the index namespace should be deleted. @override + @JsonKey(includeIfNull: false) final bool? deleteAll; /// The namespace to delete vectors from, if applicable. @override + @JsonKey(includeIfNull: false) final String? namespace; /// If specified, the metadata filter here will be used to select the vectors to delete. @@ -2410,6 +2481,7 @@ class _$DeleteRequestImpl extends _DeleteRequest { /// If specified, the metadata filter here will be used to select the vectors to delete. @override + @JsonKey(includeIfNull: false) Map? get filter { final value = _filter; if (value == null) return null; @@ -2461,10 +2533,11 @@ class _$DeleteRequestImpl extends _DeleteRequest { abstract class _DeleteRequest extends DeleteRequest { const factory _DeleteRequest( - {final List? ids, - final bool? deleteAll, - final String? namespace, - final Map? filter}) = _$DeleteRequestImpl; + {@JsonKey(includeIfNull: false) final List? ids, + @JsonKey(includeIfNull: false) final bool? deleteAll, + @JsonKey(includeIfNull: false) final String? namespace, + @JsonKey(includeIfNull: false) final Map? filter}) = + _$DeleteRequestImpl; const _DeleteRequest._() : super._(); factory _DeleteRequest.fromJson(Map json) = @@ -2473,18 +2546,22 @@ abstract class _DeleteRequest extends DeleteRequest { @override /// Vectors to delete, by id. + @JsonKey(includeIfNull: false) List? get ids; @override /// This indicates that all vectors in the index namespace should be deleted. + @JsonKey(includeIfNull: false) bool? get deleteAll; @override /// The namespace to delete vectors from, if applicable. + @JsonKey(includeIfNull: false) String? get namespace; @override /// If specified, the metadata filter here will be used to select the vectors to delete. + @JsonKey(includeIfNull: false) Map? get filter; @override @JsonKey(ignore: true) @@ -2499,12 +2576,14 @@ QueryRequest _$QueryRequestFromJson(Map json) { /// @nodoc mixin _$QueryRequest { /// The namespace to query. + @JsonKey(includeIfNull: false) String? get namespace => throw _privateConstructorUsedError; /// The number of results to return for each query. int get topK => throw _privateConstructorUsedError; /// The filter to apply. You can use vector metadata to limit your search. + @JsonKey(includeIfNull: false) Map? get filter => throw _privateConstructorUsedError; /// Indicates whether vector values are included in the response. @@ -2514,12 +2593,15 @@ mixin _$QueryRequest { bool get includeMetadata => throw _privateConstructorUsedError; /// The query vector. This should be the same length as the dimension of the index being queried. + @JsonKey(includeIfNull: false) List? get vector => throw _privateConstructorUsedError; - /// No Description + /// Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length. + @JsonKey(includeIfNull: false) SparseVector? get sparseVector => throw _privateConstructorUsedError; /// The unique ID of the vector to be used as a query vector. + @JsonKey(includeIfNull: false) String? get id => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -2535,14 +2617,14 @@ abstract class $QueryRequestCopyWith<$Res> { _$QueryRequestCopyWithImpl<$Res, QueryRequest>; @useResult $Res call( - {String? namespace, + {@JsonKey(includeIfNull: false) String? namespace, int topK, - Map? filter, + @JsonKey(includeIfNull: false) Map? filter, bool includeValues, bool includeMetadata, - List? vector, - SparseVector? sparseVector, - String? id}); + @JsonKey(includeIfNull: false) List? vector, + @JsonKey(includeIfNull: false) SparseVector? sparseVector, + @JsonKey(includeIfNull: false) String? id}); $SparseVectorCopyWith<$Res>? get sparseVector; } @@ -2627,14 +2709,14 @@ abstract class _$$QueryRequestImplCopyWith<$Res> @override @useResult $Res call( - {String? namespace, + {@JsonKey(includeIfNull: false) String? namespace, int topK, - Map? filter, + @JsonKey(includeIfNull: false) Map? filter, bool includeValues, bool includeMetadata, - List? vector, - SparseVector? sparseVector, - String? id}); + @JsonKey(includeIfNull: false) List? vector, + @JsonKey(includeIfNull: false) SparseVector? sparseVector, + @JsonKey(includeIfNull: false) String? id}); @override $SparseVectorCopyWith<$Res>? get sparseVector; @@ -2701,14 +2783,14 @@ class __$$QueryRequestImplCopyWithImpl<$Res> @JsonSerializable() class _$QueryRequestImpl extends _QueryRequest { const _$QueryRequestImpl( - {this.namespace, + {@JsonKey(includeIfNull: false) this.namespace, this.topK = 10, - final Map? filter, + @JsonKey(includeIfNull: false) final Map? filter, this.includeValues = false, this.includeMetadata = false, - final List? vector, - this.sparseVector, - this.id}) + @JsonKey(includeIfNull: false) final List? vector, + @JsonKey(includeIfNull: false) this.sparseVector, + @JsonKey(includeIfNull: false) this.id}) : _filter = filter, _vector = vector, super._(); @@ -2718,6 +2800,7 @@ class _$QueryRequestImpl extends _QueryRequest { /// The namespace to query. @override + @JsonKey(includeIfNull: false) final String? namespace; /// The number of results to return for each query. @@ -2730,6 +2813,7 @@ class _$QueryRequestImpl extends _QueryRequest { /// The filter to apply. You can use vector metadata to limit your search. @override + @JsonKey(includeIfNull: false) Map? get filter { final value = _filter; if (value == null) return null; @@ -2753,6 +2837,7 @@ class _$QueryRequestImpl extends _QueryRequest { /// The query vector. This should be the same length as the dimension of the index being queried. @override + @JsonKey(includeIfNull: false) List? get vector { final value = _vector; if (value == null) return null; @@ -2761,12 +2846,14 @@ class _$QueryRequestImpl extends _QueryRequest { return EqualUnmodifiableListView(value); } - /// No Description + /// Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length. @override + @JsonKey(includeIfNull: false) final SparseVector? sparseVector; /// The unique ID of the vector to be used as a query vector. @override + @JsonKey(includeIfNull: false) final String? id; @override @@ -2822,14 +2909,14 @@ class _$QueryRequestImpl extends _QueryRequest { abstract class _QueryRequest extends QueryRequest { const factory _QueryRequest( - {final String? namespace, + {@JsonKey(includeIfNull: false) final String? namespace, final int topK, - final Map? filter, + @JsonKey(includeIfNull: false) final Map? filter, final bool includeValues, final bool includeMetadata, - final List? vector, - final SparseVector? sparseVector, - final String? id}) = _$QueryRequestImpl; + @JsonKey(includeIfNull: false) final List? vector, + @JsonKey(includeIfNull: false) final SparseVector? sparseVector, + @JsonKey(includeIfNull: false) final String? id}) = _$QueryRequestImpl; const _QueryRequest._() : super._(); factory _QueryRequest.fromJson(Map json) = @@ -2838,6 +2925,7 @@ abstract class _QueryRequest extends QueryRequest { @override /// The namespace to query. + @JsonKey(includeIfNull: false) String? get namespace; @override @@ -2846,6 +2934,7 @@ abstract class _QueryRequest extends QueryRequest { @override /// The filter to apply. You can use vector metadata to limit your search. + @JsonKey(includeIfNull: false) Map? get filter; @override @@ -2858,14 +2947,17 @@ abstract class _QueryRequest extends QueryRequest { @override /// The query vector. This should be the same length as the dimension of the index being queried. + @JsonKey(includeIfNull: false) List? get vector; @override - /// No Description + /// Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length. + @JsonKey(includeIfNull: false) SparseVector? get sparseVector; @override /// The unique ID of the vector to be used as a query vector. + @JsonKey(includeIfNull: false) String? get id; @override @JsonKey(ignore: true) @@ -3237,15 +3329,19 @@ mixin _$UpdateRequest { String get id => throw _privateConstructorUsedError; /// The vector values + @JsonKey(includeIfNull: false) List? get values => throw _privateConstructorUsedError; - /// No Description + /// Vector sparse data. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues => throw _privateConstructorUsedError; /// Metadata to set for the vector. + @JsonKey(includeIfNull: false) Map? get setMetadata => throw _privateConstructorUsedError; /// The namespace containing the vector to update. + @JsonKey(includeIfNull: false) String? get namespace => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -3262,10 +3358,10 @@ abstract class $UpdateRequestCopyWith<$Res> { @useResult $Res call( {String id, - List? values, - SparseVector? sparseValues, - Map? setMetadata, - String? namespace}); + @JsonKey(includeIfNull: false) List? values, + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? setMetadata, + @JsonKey(includeIfNull: false) String? namespace}); $SparseVectorCopyWith<$Res>? get sparseValues; } @@ -3336,10 +3432,10 @@ abstract class _$$UpdateRequestImplCopyWith<$Res> @useResult $Res call( {String id, - List? values, - SparseVector? sparseValues, - Map? setMetadata, - String? namespace}); + @JsonKey(includeIfNull: false) List? values, + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? setMetadata, + @JsonKey(includeIfNull: false) String? namespace}); @override $SparseVectorCopyWith<$Res>? get sparseValues; @@ -3392,10 +3488,10 @@ class __$$UpdateRequestImplCopyWithImpl<$Res> class _$UpdateRequestImpl extends _UpdateRequest { const _$UpdateRequestImpl( {required this.id, - final List? values, - this.sparseValues, - final Map? setMetadata, - this.namespace}) + @JsonKey(includeIfNull: false) final List? values, + @JsonKey(includeIfNull: false) this.sparseValues, + @JsonKey(includeIfNull: false) final Map? setMetadata, + @JsonKey(includeIfNull: false) this.namespace}) : _values = values, _setMetadata = setMetadata, super._(); @@ -3412,6 +3508,7 @@ class _$UpdateRequestImpl extends _UpdateRequest { /// The vector values @override + @JsonKey(includeIfNull: false) List? get values { final value = _values; if (value == null) return null; @@ -3420,8 +3517,9 @@ class _$UpdateRequestImpl extends _UpdateRequest { return EqualUnmodifiableListView(value); } - /// No Description + /// Vector sparse data. @override + @JsonKey(includeIfNull: false) final SparseVector? sparseValues; /// Metadata to set for the vector. @@ -3429,6 +3527,7 @@ class _$UpdateRequestImpl extends _UpdateRequest { /// Metadata to set for the vector. @override + @JsonKey(includeIfNull: false) Map? get setMetadata { final value = _setMetadata; if (value == null) return null; @@ -3439,6 +3538,7 @@ class _$UpdateRequestImpl extends _UpdateRequest { /// The namespace containing the vector to update. @override + @JsonKey(includeIfNull: false) final String? namespace; @override @@ -3488,9 +3588,10 @@ class _$UpdateRequestImpl extends _UpdateRequest { abstract class _UpdateRequest extends UpdateRequest { const factory _UpdateRequest( {required final String id, - final List? values, - final SparseVector? sparseValues, - final Map? setMetadata, + @JsonKey(includeIfNull: false) final List? values, + @JsonKey(includeIfNull: false) final SparseVector? sparseValues, + @JsonKey(includeIfNull: false) final Map? setMetadata, + @JsonKey(includeIfNull: false) final String? namespace}) = _$UpdateRequestImpl; const _UpdateRequest._() : super._(); @@ -3504,18 +3605,22 @@ abstract class _UpdateRequest extends UpdateRequest { @override /// The vector values + @JsonKey(includeIfNull: false) List? get values; @override - /// No Description + /// Vector sparse data. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues; @override /// Metadata to set for the vector. + @JsonKey(includeIfNull: false) Map? get setMetadata; @override /// The namespace containing the vector to update. + @JsonKey(includeIfNull: false) String? get namespace; @override @JsonKey(ignore: true) @@ -3533,6 +3638,7 @@ mixin _$UpsertRequest { List get vectors => throw _privateConstructorUsedError; /// This is the namespace name where you upsert vectors. + @JsonKey(includeIfNull: false) String? get namespace => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -3547,7 +3653,8 @@ abstract class $UpsertRequestCopyWith<$Res> { UpsertRequest value, $Res Function(UpsertRequest) then) = _$UpsertRequestCopyWithImpl<$Res, UpsertRequest>; @useResult - $Res call({List vectors, String? namespace}); + $Res call( + {List vectors, @JsonKey(includeIfNull: false) String? namespace}); } /// @nodoc @@ -3587,7 +3694,8 @@ abstract class _$$UpsertRequestImplCopyWith<$Res> __$$UpsertRequestImplCopyWithImpl<$Res>; @override @useResult - $Res call({List vectors, String? namespace}); + $Res call( + {List vectors, @JsonKey(includeIfNull: false) String? namespace}); } /// @nodoc @@ -3621,7 +3729,8 @@ class __$$UpsertRequestImplCopyWithImpl<$Res> @JsonSerializable() class _$UpsertRequestImpl extends _UpsertRequest { const _$UpsertRequestImpl( - {required final List vectors, this.namespace}) + {required final List vectors, + @JsonKey(includeIfNull: false) this.namespace}) : _vectors = vectors, super._(); @@ -3641,6 +3750,7 @@ class _$UpsertRequestImpl extends _UpsertRequest { /// This is the namespace name where you upsert vectors. @override + @JsonKey(includeIfNull: false) final String? namespace; @override @@ -3679,8 +3789,9 @@ class _$UpsertRequestImpl extends _UpsertRequest { abstract class _UpsertRequest extends UpsertRequest { const factory _UpsertRequest( - {required final List vectors, - final String? namespace}) = _$UpsertRequestImpl; + {required final List vectors, + @JsonKey(includeIfNull: false) final String? namespace}) = + _$UpsertRequestImpl; const _UpsertRequest._() : super._(); factory _UpsertRequest.fromJson(Map json) = @@ -3693,6 +3804,7 @@ abstract class _UpsertRequest extends UpsertRequest { @override /// This is the namespace name where you upsert vectors. + @JsonKey(includeIfNull: false) String? get namespace; @override @JsonKey(ignore: true) @@ -3707,6 +3819,7 @@ UpsertResponse _$UpsertResponseFromJson(Map json) { /// @nodoc mixin _$UpsertResponse { /// The number of vectors upserted. + @JsonKey(includeIfNull: false) int? get upsertedCount => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -3721,7 +3834,7 @@ abstract class $UpsertResponseCopyWith<$Res> { UpsertResponse value, $Res Function(UpsertResponse) then) = _$UpsertResponseCopyWithImpl<$Res, UpsertResponse>; @useResult - $Res call({int? upsertedCount}); + $Res call({@JsonKey(includeIfNull: false) int? upsertedCount}); } /// @nodoc @@ -3756,7 +3869,7 @@ abstract class _$$UpsertResponseImplCopyWith<$Res> __$$UpsertResponseImplCopyWithImpl<$Res>; @override @useResult - $Res call({int? upsertedCount}); + $Res call({@JsonKey(includeIfNull: false) int? upsertedCount}); } /// @nodoc @@ -3784,13 +3897,16 @@ class __$$UpsertResponseImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$UpsertResponseImpl extends _UpsertResponse { - const _$UpsertResponseImpl({this.upsertedCount}) : super._(); + const _$UpsertResponseImpl( + {@JsonKey(includeIfNull: false) this.upsertedCount}) + : super._(); factory _$UpsertResponseImpl.fromJson(Map json) => _$$UpsertResponseImplFromJson(json); /// The number of vectors upserted. @override + @JsonKey(includeIfNull: false) final int? upsertedCount; @override @@ -3827,7 +3943,8 @@ class _$UpsertResponseImpl extends _UpsertResponse { } abstract class _UpsertResponse extends UpsertResponse { - const factory _UpsertResponse({final int? upsertedCount}) = + const factory _UpsertResponse( + {@JsonKey(includeIfNull: false) final int? upsertedCount}) = _$UpsertResponseImpl; const _UpsertResponse._() : super._(); @@ -3837,6 +3954,7 @@ abstract class _UpsertResponse extends UpsertResponse { @override /// The number of vectors upserted. + @JsonKey(includeIfNull: false) int? get upsertedCount; @override @JsonKey(ignore: true) @@ -3856,10 +3974,12 @@ mixin _$Vector { /// The vector values List get values => throw _privateConstructorUsedError; - /// No Description + /// Sparse vector data for this vector. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues => throw _privateConstructorUsedError; /// Metadata associated with this vector. + @JsonKey(includeIfNull: false) Map? get metadata => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -3875,8 +3995,8 @@ abstract class $VectorCopyWith<$Res> { $Res call( {String id, List values, - SparseVector? sparseValues, - Map? metadata}); + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? metadata}); $SparseVectorCopyWith<$Res>? get sparseValues; } @@ -3942,8 +4062,8 @@ abstract class _$$VectorImplCopyWith<$Res> implements $VectorCopyWith<$Res> { $Res call( {String id, List values, - SparseVector? sparseValues, - Map? metadata}); + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? metadata}); @override $SparseVectorCopyWith<$Res>? get sparseValues; @@ -3992,8 +4112,8 @@ class _$VectorImpl extends _Vector { const _$VectorImpl( {required this.id, required final List values, - this.sparseValues, - final Map? metadata}) + @JsonKey(includeIfNull: false) this.sparseValues, + @JsonKey(includeIfNull: false) final Map? metadata}) : _values = values, _metadata = metadata, super._(); @@ -4016,8 +4136,9 @@ class _$VectorImpl extends _Vector { return EqualUnmodifiableListView(_values); } - /// No Description + /// Sparse vector data for this vector. @override + @JsonKey(includeIfNull: false) final SparseVector? sparseValues; /// Metadata associated with this vector. @@ -4025,6 +4146,7 @@ class _$VectorImpl extends _Vector { /// Metadata associated with this vector. @override + @JsonKey(includeIfNull: false) Map? get metadata { final value = _metadata; if (value == null) return null; @@ -4077,7 +4199,8 @@ abstract class _Vector extends Vector { const factory _Vector( {required final String id, required final List values, - final SparseVector? sparseValues, + @JsonKey(includeIfNull: false) final SparseVector? sparseValues, + @JsonKey(includeIfNull: false) final Map? metadata}) = _$VectorImpl; const _Vector._() : super._(); @@ -4093,11 +4216,13 @@ abstract class _Vector extends Vector { List get values; @override - /// No Description + /// Sparse vector data for this vector. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues; @override /// Metadata associated with this vector. + @JsonKey(includeIfNull: false) Map? get metadata; @override @JsonKey(ignore: true) @@ -4115,15 +4240,19 @@ mixin _$VectorMatch { String get id => throw _privateConstructorUsedError; /// This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. + @JsonKey(includeIfNull: false) double? get score => throw _privateConstructorUsedError; /// This is the vector data, if it is requested. + @JsonKey(includeIfNull: false) List? get values => throw _privateConstructorUsedError; - /// No Description + /// This is the sparse vector data, if it is requested. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues => throw _privateConstructorUsedError; /// This is the metadata, if it is requested. + @JsonKey(includeIfNull: false) Map? get metadata => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -4140,10 +4269,10 @@ abstract class $VectorMatchCopyWith<$Res> { @useResult $Res call( {String id, - double? score, - List? values, - SparseVector? sparseValues, - Map? metadata}); + @JsonKey(includeIfNull: false) double? score, + @JsonKey(includeIfNull: false) List? values, + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? metadata}); $SparseVectorCopyWith<$Res>? get sparseValues; } @@ -4214,10 +4343,10 @@ abstract class _$$VectorMatchImplCopyWith<$Res> @useResult $Res call( {String id, - double? score, - List? values, - SparseVector? sparseValues, - Map? metadata}); + @JsonKey(includeIfNull: false) double? score, + @JsonKey(includeIfNull: false) List? values, + @JsonKey(includeIfNull: false) SparseVector? sparseValues, + @JsonKey(includeIfNull: false) Map? metadata}); @override $SparseVectorCopyWith<$Res>? get sparseValues; @@ -4270,10 +4399,10 @@ class __$$VectorMatchImplCopyWithImpl<$Res> class _$VectorMatchImpl extends _VectorMatch { const _$VectorMatchImpl( {required this.id, - this.score, - final List? values, - this.sparseValues, - final Map? metadata}) + @JsonKey(includeIfNull: false) this.score, + @JsonKey(includeIfNull: false) final List? values, + @JsonKey(includeIfNull: false) this.sparseValues, + @JsonKey(includeIfNull: false) final Map? metadata}) : _values = values, _metadata = metadata, super._(); @@ -4287,6 +4416,7 @@ class _$VectorMatchImpl extends _VectorMatch { /// This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. @override + @JsonKey(includeIfNull: false) final double? score; /// This is the vector data, if it is requested. @@ -4294,6 +4424,7 @@ class _$VectorMatchImpl extends _VectorMatch { /// This is the vector data, if it is requested. @override + @JsonKey(includeIfNull: false) List? get values { final value = _values; if (value == null) return null; @@ -4302,8 +4433,9 @@ class _$VectorMatchImpl extends _VectorMatch { return EqualUnmodifiableListView(value); } - /// No Description + /// This is the sparse vector data, if it is requested. @override + @JsonKey(includeIfNull: false) final SparseVector? sparseValues; /// This is the metadata, if it is requested. @@ -4311,6 +4443,7 @@ class _$VectorMatchImpl extends _VectorMatch { /// This is the metadata, if it is requested. @override + @JsonKey(includeIfNull: false) Map? get metadata { final value = _metadata; if (value == null) return null; @@ -4364,9 +4497,10 @@ class _$VectorMatchImpl extends _VectorMatch { abstract class _VectorMatch extends VectorMatch { const factory _VectorMatch( {required final String id, - final double? score, - final List? values, - final SparseVector? sparseValues, + @JsonKey(includeIfNull: false) final double? score, + @JsonKey(includeIfNull: false) final List? values, + @JsonKey(includeIfNull: false) final SparseVector? sparseValues, + @JsonKey(includeIfNull: false) final Map? metadata}) = _$VectorMatchImpl; const _VectorMatch._() : super._(); @@ -4380,18 +4514,22 @@ abstract class _VectorMatch extends VectorMatch { @override /// This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. + @JsonKey(includeIfNull: false) double? get score; @override /// This is the vector data, if it is requested. + @JsonKey(includeIfNull: false) List? get values; @override - /// No Description + /// This is the sparse vector data, if it is requested. + @JsonKey(includeIfNull: false) SparseVector? get sparseValues; @override /// This is the metadata, if it is requested. + @JsonKey(includeIfNull: false) Map? get metadata; @override @JsonKey(ignore: true) @@ -4406,9 +4544,11 @@ SparseVector _$SparseVectorFromJson(Map json) { /// @nodoc mixin _$SparseVector { /// The indices of the sparse data. + @JsonKey(includeIfNull: false) List? get indices => throw _privateConstructorUsedError; /// The corresponding values of the sparse data, which must be the same length as the indices. + @JsonKey(includeIfNull: false) List? get values => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @@ -4423,7 +4563,9 @@ abstract class $SparseVectorCopyWith<$Res> { SparseVector value, $Res Function(SparseVector) then) = _$SparseVectorCopyWithImpl<$Res, SparseVector>; @useResult - $Res call({List? indices, List? values}); + $Res call( + {@JsonKey(includeIfNull: false) List? indices, + @JsonKey(includeIfNull: false) List? values}); } /// @nodoc @@ -4463,7 +4605,9 @@ abstract class _$$SparseVectorImplCopyWith<$Res> __$$SparseVectorImplCopyWithImpl<$Res>; @override @useResult - $Res call({List? indices, List? values}); + $Res call( + {@JsonKey(includeIfNull: false) List? indices, + @JsonKey(includeIfNull: false) List? values}); } /// @nodoc @@ -4497,7 +4641,8 @@ class __$$SparseVectorImplCopyWithImpl<$Res> @JsonSerializable() class _$SparseVectorImpl extends _SparseVector { const _$SparseVectorImpl( - {final List? indices, final List? values}) + {@JsonKey(includeIfNull: false) final List? indices, + @JsonKey(includeIfNull: false) final List? values}) : _indices = indices, _values = values, super._(); @@ -4510,6 +4655,7 @@ class _$SparseVectorImpl extends _SparseVector { /// The indices of the sparse data. @override + @JsonKey(includeIfNull: false) List? get indices { final value = _indices; if (value == null) return null; @@ -4523,6 +4669,7 @@ class _$SparseVectorImpl extends _SparseVector { /// The corresponding values of the sparse data, which must be the same length as the indices. @override + @JsonKey(includeIfNull: false) List? get values { final value = _values; if (value == null) return null; @@ -4568,8 +4715,9 @@ class _$SparseVectorImpl extends _SparseVector { abstract class _SparseVector extends SparseVector { const factory _SparseVector( - {final List? indices, - final List? values}) = _$SparseVectorImpl; + {@JsonKey(includeIfNull: false) final List? indices, + @JsonKey(includeIfNull: false) final List? values}) = + _$SparseVectorImpl; const _SparseVector._() : super._(); factory _SparseVector.fromJson(Map json) = @@ -4578,10 +4726,12 @@ abstract class _SparseVector extends SparseVector { @override /// The indices of the sparse data. + @JsonKey(includeIfNull: false) List? get indices; @override /// The corresponding values of the sparse data, which must be the same length as the indices. + @JsonKey(includeIfNull: false) List? get values; @override @JsonKey(ignore: true) diff --git a/lib/src/generated/schema/schema.g.dart b/lib/src/generated/schema/schema.g.dart index a4a2523..083296f 100644 --- a/lib/src/generated/schema/schema.g.dart +++ b/lib/src/generated/schema/schema.g.dart @@ -32,16 +32,25 @@ _$IndexDatabaseImpl _$$IndexDatabaseImplFromJson(Map json) => unknownValue: JsonKey.nullForUndefinedEnumValue), ); -Map _$$IndexDatabaseImplToJson(_$IndexDatabaseImpl instance) => - { - 'name': instance.name, - 'metric': _$SearchMetricEnumMap[instance.metric]!, - 'dimension': instance.dimension, - 'replicas': instance.replicas, - 'shards': instance.shards, - 'pods': instance.pods, - 'pod_type': _$PodTypeEnumMap[instance.podType], - }; +Map _$$IndexDatabaseImplToJson(_$IndexDatabaseImpl instance) { + final val = { + 'name': instance.name, + 'metric': _$SearchMetricEnumMap[instance.metric]!, + 'dimension': instance.dimension, + 'replicas': instance.replicas, + 'shards': instance.shards, + 'pods': instance.pods, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('pod_type', _$PodTypeEnumMap[instance.podType]); + return val; +} const _$SearchMetricEnumMap = { SearchMetric.euclidean: 'euclidean', @@ -50,18 +59,18 @@ const _$SearchMetricEnumMap = { }; const _$PodTypeEnumMap = { - PodType.s1x1: 's1.x1', - PodType.s1x2: 's1.x2', - PodType.s1x4: 's1.x4', - PodType.s1x8: 's1.x8', - PodType.p1x1: 'p1.x1', - PodType.p1x2: 'p1.x2', - PodType.p1x4: 'p1.x4', - PodType.p1x8: 'p1.x8', - PodType.p2x1: 'p2.x1', - PodType.p2x2: 'p2.x2', - PodType.p2x4: 'p2.x4', - PodType.p2x8: 'p2.x8', + PodType.s1X1: 's1.x1', + PodType.s1X2: 's1.x2', + PodType.s1X4: 's1.x4', + PodType.s1X8: 's1.x8', + PodType.p1X1: 'p1.x1', + PodType.p1X2: 'p1.x2', + PodType.p1X4: 'p1.x4', + PodType.p1X8: 'p1.x8', + PodType.p2X1: 'p2.x1', + PodType.p2X2: 'p2.x2', + PodType.p2X4: 'p2.x4', + PodType.p2X8: 'p2.x8', }; _$IndexStatusImpl _$$IndexStatusImplFromJson(Map json) => @@ -100,13 +109,21 @@ _$IndexStatsImpl _$$IndexStatsImplFromJson(Map json) => totalVectorCount: json['totalVectorCount'] as int?, ); -Map _$$IndexStatsImplToJson(_$IndexStatsImpl instance) => - { - 'namespaces': instance.namespaces, - 'dimension': instance.dimension, - 'indexFullness': instance.indexFullness, - 'totalVectorCount': instance.totalVectorCount, - }; +Map _$$IndexStatsImplToJson(_$IndexStatsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('namespaces', instance.namespaces); + writeNotNull('dimension', instance.dimension); + writeNotNull('indexFullness', instance.indexFullness); + writeNotNull('totalVectorCount', instance.totalVectorCount); + return val; +} _$NamespaceStatsImpl _$$NamespaceStatsImplFromJson(Map json) => _$NamespaceStatsImpl( @@ -127,13 +144,22 @@ _$CollectionImpl _$$CollectionImplFromJson(Map json) => dimension: json['dimension'] as int, ); -Map _$$CollectionImplToJson(_$CollectionImpl instance) => - { - 'name': instance.name, - 'status': _$CollectionStatusEnumMap[instance.status]!, - 'size': instance.size, - 'dimension': instance.dimension, - }; +Map _$$CollectionImplToJson(_$CollectionImpl instance) { + final val = { + 'name': instance.name, + 'status': _$CollectionStatusEnumMap[instance.status]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('size', instance.size); + val['dimension'] = instance.dimension; + return val; +} const _$CollectionStatusEnumMap = { CollectionStatus.initializing: 'Initializing', @@ -149,11 +175,20 @@ _$ConfigureIndexRequestImpl _$$ConfigureIndexRequestImplFromJson( ); Map _$$ConfigureIndexRequestImplToJson( - _$ConfigureIndexRequestImpl instance) => - { - 'replicas': instance.replicas, - 'pod_type': _$PodTypeEnumMap[instance.podType], - }; + _$ConfigureIndexRequestImpl instance) { + final val = { + 'replicas': instance.replicas, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('pod_type', _$PodTypeEnumMap[instance.podType]); + return val; +} _$CreateCollectionRequestImpl _$$CreateCollectionRequestImplFromJson( Map json) => @@ -179,23 +214,32 @@ _$CreateIndexRequestImpl _$$CreateIndexRequestImplFromJson( pods: json['pods'] as int? ?? 1, replicas: json['replicas'] as int? ?? 1, podType: $enumDecodeNullable(_$PodTypeEnumMap, json['pod_type']) ?? - PodType.p1x1, + PodType.p1X1, metadataConfig: json['metadata_config'] as Map?, sourceCollection: json['source_collection'] as String?, ); Map _$$CreateIndexRequestImplToJson( - _$CreateIndexRequestImpl instance) => - { - 'name': instance.name, - 'dimension': instance.dimension, - 'metric': _$SearchMetricEnumMap[instance.metric]!, - 'pods': instance.pods, - 'replicas': instance.replicas, - 'pod_type': _$PodTypeEnumMap[instance.podType]!, - 'metadata_config': instance.metadataConfig, - 'source_collection': instance.sourceCollection, - }; + _$CreateIndexRequestImpl instance) { + final val = { + 'name': instance.name, + 'dimension': instance.dimension, + 'metric': _$SearchMetricEnumMap[instance.metric]!, + 'pods': instance.pods, + 'replicas': instance.replicas, + 'pod_type': _$PodTypeEnumMap[instance.podType]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('metadata_config', instance.metadataConfig); + writeNotNull('source_collection', instance.sourceCollection); + return val; +} _$IndexStatsRequestImpl _$$IndexStatsRequestImplFromJson( Map json) => @@ -204,10 +248,18 @@ _$IndexStatsRequestImpl _$$IndexStatsRequestImplFromJson( ); Map _$$IndexStatsRequestImplToJson( - _$IndexStatsRequestImpl instance) => - { - 'filter': instance.filter, - }; + _$IndexStatsRequestImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('filter', instance.filter); + return val; +} _$DeleteRequestImpl _$$DeleteRequestImplFromJson(Map json) => _$DeleteRequestImpl( @@ -217,13 +269,21 @@ _$DeleteRequestImpl _$$DeleteRequestImplFromJson(Map json) => filter: json['filter'] as Map?, ); -Map _$$DeleteRequestImplToJson(_$DeleteRequestImpl instance) => - { - 'ids': instance.ids, - 'deleteAll': instance.deleteAll, - 'namespace': instance.namespace, - 'filter': instance.filter, - }; +Map _$$DeleteRequestImplToJson(_$DeleteRequestImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('ids', instance.ids); + writeNotNull('deleteAll', instance.deleteAll); + writeNotNull('namespace', instance.namespace); + writeNotNull('filter', instance.filter); + return val; +} _$QueryRequestImpl _$$QueryRequestImplFromJson(Map json) => _$QueryRequestImpl( @@ -241,17 +301,25 @@ _$QueryRequestImpl _$$QueryRequestImplFromJson(Map json) => id: json['id'] as String?, ); -Map _$$QueryRequestImplToJson(_$QueryRequestImpl instance) => - { - 'namespace': instance.namespace, - 'topK': instance.topK, - 'filter': instance.filter, - 'includeValues': instance.includeValues, - 'includeMetadata': instance.includeMetadata, - 'vector': instance.vector, - 'sparseVector': instance.sparseVector, - 'id': instance.id, - }; +Map _$$QueryRequestImplToJson(_$QueryRequestImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('namespace', instance.namespace); + val['topK'] = instance.topK; + writeNotNull('filter', instance.filter); + val['includeValues'] = instance.includeValues; + val['includeMetadata'] = instance.includeMetadata; + writeNotNull('vector', instance.vector); + writeNotNull('sparseVector', instance.sparseVector); + writeNotNull('id', instance.id); + return val; +} _$QueryResponseImpl _$$QueryResponseImplFromJson(Map json) => _$QueryResponseImpl( @@ -294,14 +362,23 @@ _$UpdateRequestImpl _$$UpdateRequestImplFromJson(Map json) => namespace: json['namespace'] as String?, ); -Map _$$UpdateRequestImplToJson(_$UpdateRequestImpl instance) => - { - 'id': instance.id, - 'values': instance.values, - 'sparseValues': instance.sparseValues, - 'setMetadata': instance.setMetadata, - 'namespace': instance.namespace, - }; +Map _$$UpdateRequestImplToJson(_$UpdateRequestImpl instance) { + final val = { + 'id': instance.id, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('values', instance.values); + writeNotNull('sparseValues', instance.sparseValues); + writeNotNull('setMetadata', instance.setMetadata); + writeNotNull('namespace', instance.namespace); + return val; +} _$UpsertRequestImpl _$$UpsertRequestImplFromJson(Map json) => _$UpsertRequestImpl( @@ -311,11 +388,20 @@ _$UpsertRequestImpl _$$UpsertRequestImplFromJson(Map json) => namespace: json['namespace'] as String?, ); -Map _$$UpsertRequestImplToJson(_$UpsertRequestImpl instance) => - { - 'vectors': instance.vectors, - 'namespace': instance.namespace, - }; +Map _$$UpsertRequestImplToJson(_$UpsertRequestImpl instance) { + final val = { + 'vectors': instance.vectors, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('namespace', instance.namespace); + return val; +} _$UpsertResponseImpl _$$UpsertResponseImplFromJson(Map json) => _$UpsertResponseImpl( @@ -323,10 +409,18 @@ _$UpsertResponseImpl _$$UpsertResponseImplFromJson(Map json) => ); Map _$$UpsertResponseImplToJson( - _$UpsertResponseImpl instance) => - { - 'upsertedCount': instance.upsertedCount, - }; + _$UpsertResponseImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('upsertedCount', instance.upsertedCount); + return val; +} _$VectorImpl _$$VectorImplFromJson(Map json) => _$VectorImpl( id: json['id'] as String, @@ -339,13 +433,22 @@ _$VectorImpl _$$VectorImplFromJson(Map json) => _$VectorImpl( metadata: json['metadata'] as Map?, ); -Map _$$VectorImplToJson(_$VectorImpl instance) => - { - 'id': instance.id, - 'values': instance.values, - 'sparseValues': instance.sparseValues, - 'metadata': instance.metadata, - }; +Map _$$VectorImplToJson(_$VectorImpl instance) { + final val = { + 'id': instance.id, + 'values': instance.values, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('sparseValues', instance.sparseValues); + writeNotNull('metadata', instance.metadata); + return val; +} _$VectorMatchImpl _$$VectorMatchImplFromJson(Map json) => _$VectorMatchImpl( @@ -360,14 +463,23 @@ _$VectorMatchImpl _$$VectorMatchImplFromJson(Map json) => metadata: json['metadata'] as Map?, ); -Map _$$VectorMatchImplToJson(_$VectorMatchImpl instance) => - { - 'id': instance.id, - 'score': instance.score, - 'values': instance.values, - 'sparseValues': instance.sparseValues, - 'metadata': instance.metadata, - }; +Map _$$VectorMatchImplToJson(_$VectorMatchImpl instance) { + final val = { + 'id': instance.id, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('score', instance.score); + writeNotNull('values', instance.values); + writeNotNull('sparseValues', instance.sparseValues); + writeNotNull('metadata', instance.metadata); + return val; +} _$SparseVectorImpl _$$SparseVectorImplFromJson(Map json) => _$SparseVectorImpl( @@ -378,8 +490,16 @@ _$SparseVectorImpl _$$SparseVectorImplFromJson(Map json) => .toList(), ); -Map _$$SparseVectorImplToJson(_$SparseVectorImpl instance) => - { - 'indices': instance.indices, - 'values': instance.values, - }; +Map _$$SparseVectorImplToJson(_$SparseVectorImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('indices', instance.indices); + writeNotNull('values', instance.values); + return val; +} diff --git a/lib/src/generated/schema/sparse_vector.dart b/lib/src/generated/schema/sparse_vector.dart index 0c1fa83..175db21 100644 --- a/lib/src/generated/schema/sparse_vector.dart +++ b/lib/src/generated/schema/sparse_vector.dart @@ -16,10 +16,10 @@ class SparseVector with _$SparseVector { /// Factory constructor for SparseVector const factory SparseVector({ /// The indices of the sparse data. - List? indices, + @JsonKey(includeIfNull: false) List? indices, /// The corresponding values of the sparse data, which must be the same length as the indices. - List? values, + @JsonKey(includeIfNull: false) List? values, }) = _SparseVector; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/update_request.dart b/lib/src/generated/schema/update_request.dart index 3989ea4..7347c25 100644 --- a/lib/src/generated/schema/update_request.dart +++ b/lib/src/generated/schema/update_request.dart @@ -19,16 +19,16 @@ class UpdateRequest with _$UpdateRequest { required String id, /// The vector values - List? values, + @JsonKey(includeIfNull: false) List? values, - /// No Description - SparseVector? sparseValues, + /// Vector sparse data. + @JsonKey(includeIfNull: false) SparseVector? sparseValues, /// Metadata to set for the vector. - Map? setMetadata, + @JsonKey(includeIfNull: false) Map? setMetadata, /// The namespace containing the vector to update. - String? namespace, + @JsonKey(includeIfNull: false) String? namespace, }) = _UpdateRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/upsert_request.dart b/lib/src/generated/schema/upsert_request.dart index 4199674..564af56 100644 --- a/lib/src/generated/schema/upsert_request.dart +++ b/lib/src/generated/schema/upsert_request.dart @@ -19,7 +19,7 @@ class UpsertRequest with _$UpsertRequest { required List vectors, /// This is the namespace name where you upsert vectors. - String? namespace, + @JsonKey(includeIfNull: false) String? namespace, }) = _UpsertRequest; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/upsert_response.dart b/lib/src/generated/schema/upsert_response.dart index efcdc77..3ebfa0f 100644 --- a/lib/src/generated/schema/upsert_response.dart +++ b/lib/src/generated/schema/upsert_response.dart @@ -16,7 +16,7 @@ class UpsertResponse with _$UpsertResponse { /// Factory constructor for UpsertResponse const factory UpsertResponse({ /// The number of vectors upserted. - int? upsertedCount, + @JsonKey(includeIfNull: false) int? upsertedCount, }) = _UpsertResponse; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/vector.dart b/lib/src/generated/schema/vector.dart index e2c5629..04c6e2a 100644 --- a/lib/src/generated/schema/vector.dart +++ b/lib/src/generated/schema/vector.dart @@ -21,11 +21,11 @@ class Vector with _$Vector { /// The vector values required List values, - /// No Description - SparseVector? sparseValues, + /// Sparse vector data for this vector. + @JsonKey(includeIfNull: false) SparseVector? sparseValues, /// Metadata associated with this vector. - Map? metadata, + @JsonKey(includeIfNull: false) Map? metadata, }) = _Vector; /// Object construction from a JSON representation diff --git a/lib/src/generated/schema/vector_match.dart b/lib/src/generated/schema/vector_match.dart index 90e7736..2e4ffa2 100644 --- a/lib/src/generated/schema/vector_match.dart +++ b/lib/src/generated/schema/vector_match.dart @@ -19,16 +19,16 @@ class VectorMatch with _$VectorMatch { required String id, /// This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. - double? score, + @JsonKey(includeIfNull: false) double? score, /// This is the vector data, if it is requested. - List? values, + @JsonKey(includeIfNull: false) List? values, - /// No Description - SparseVector? sparseValues, + /// This is the sparse vector data, if it is requested. + @JsonKey(includeIfNull: false) SparseVector? sparseValues, /// This is the metadata, if it is requested. - Map? metadata, + @JsonKey(includeIfNull: false) Map? metadata, }) = _VectorMatch; /// Object construction from a JSON representation diff --git a/pubspec.yaml b/pubspec.yaml index 19c6aee..31634ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pinecone description: Unofficial Dart client for Pinecone vector database. For more details on Pinecone, please visit https://docs.pinecone.io/docs/overview. -version: 0.6.0 +version: 0.7.0 maintainer: Taza Technology LLC repository: https://github.com/tazatechnology/pinecone issue_tracker: https://github.com/tazatechnology/pinecone/issues @@ -14,9 +14,10 @@ dependencies: http: ">=0.13.0 <2.0.0" freezed_annotation: ^2.4.1 json_annotation: ^4.8.1 + meta: ^1.11.0 dev_dependencies: - openapi_spec: ^0.6.0 + openapi_spec: 0.7.6 build_runner: ^2.4.6 lints: ^3.0.0 freezed: ^2.4.5 diff --git a/test/pinecone_test.dart b/test/pinecone_test.dart index 9e24846..1e3021a 100644 --- a/test/pinecone_test.dart +++ b/test/pinecone_test.dart @@ -64,7 +64,7 @@ void main() async { metric: SearchMetric.dotproduct, pods: 1, replicas: 1, - podType: PodType.p1x1, + podType: PodType.p1X1, ), ); }