diff --git a/generators/csharp/base/src/context/CsharpTypeMapper.ts b/generators/csharp/base/src/context/CsharpTypeMapper.ts index ea78ff703907..3279c46d0f69 100644 --- a/generators/csharp/base/src/context/CsharpTypeMapper.ts +++ b/generators/csharp/base/src/context/CsharpTypeMapper.ts @@ -206,6 +206,9 @@ export class CsharpTypeMapper extends WithGeneration { } return objectClassReference; } + if (this.context.protobufResolver.isExternalProtobufType(named.typeId)) { + return this.context.protobufResolver.getExternalProtobufClassReference(named.typeId); + } const typeDeclaration = this.model.dereferenceType(named.typeId).typeDeclaration; switch (typeDeclaration.shape.type) { diff --git a/generators/csharp/base/src/project/CsharpProject.ts b/generators/csharp/base/src/project/CsharpProject.ts index 9c5fad2b3830..bbea0a7800b1 100644 --- a/generators/csharp/base/src/project/CsharpProject.ts +++ b/generators/csharp/base/src/project/CsharpProject.ts @@ -905,7 +905,8 @@ ${this.getAdditionalItemGroups().join(`\n${this.generation.constants.formatting. result.push(""); result.push(""); - result.push(' '); + result.push(' '); + result.push(' '); result.push(' '); result.push(' '); result.push(' '); @@ -918,6 +919,11 @@ ${this.getAdditionalItemGroups().join(`\n${this.generation.constants.formatting. result.push(""); for (const protobufSourceFilePath of protobufSourceFilePaths) { + // Skip proto files provided by external packages (e.g. Google.Api.CommonProtos) + // to avoid conflicting with the types from those packages. + if (EXTERNAL_PROTO_FILE_PREFIXES.some((prefix) => protobufSourceFilePath.startsWith(prefix))) { + continue; + } const protobufSourceWindowsPath = this.relativePathToWindowsPath(protobufSourceFilePath); result.push( ` ` @@ -1009,3 +1015,10 @@ ${this.getAdditionalItemGroups().join(`\n${this.generation.constants.formatting. return path.win32.normalize(relativePath); } } + +/** + * Proto file path prefixes for types provided by external NuGet packages + * (e.g. Google.Api.CommonProtos). These files should be excluded from + * Grpc.Tools compilation to avoid conflicting type definitions. + */ +const EXTERNAL_PROTO_FILE_PREFIXES = ["google/rpc/", "google/api/"]; diff --git a/generators/csharp/base/src/proto/CsharpProtobufTypeMapper.ts b/generators/csharp/base/src/proto/CsharpProtobufTypeMapper.ts index 12b78122b098..0638ae34df1a 100644 --- a/generators/csharp/base/src/proto/CsharpProtobufTypeMapper.ts +++ b/generators/csharp/base/src/proto/CsharpProtobufTypeMapper.ts @@ -302,6 +302,11 @@ class ToProtoPropertyMapper extends WithGeneration { if (this.context.protobufResolver.isWellKnownAnyProtobufType(named.typeId)) { return this.getValueForAny({ propertyName }); } + if (this.context.protobufResolver.isExternalProtobufType(named.typeId)) { + // External proto types (e.g. google.rpc.Status) are used directly; + // no conversion needed since the SDK type IS the proto type. + return this.csharp.codeblock(propertyName); + } const resolvedType = this.model.dereferenceType(named.typeId).typeDeclaration; if (resolvedType.shape.type === "enum") { const enumClassReference = this.context.csharpTypeMapper.convertToClassReference(named, { @@ -668,6 +673,11 @@ class FromProtoPropertyMapper extends WithGeneration { named: NamedType; wrapperType?: WrapperType; }): ast.CodeBlock { + if (this.context.protobufResolver.isExternalProtobufType(named.typeId)) { + // External proto types (e.g. google.rpc.Status) are used directly; + // no conversion needed since the SDK type IS the proto type. + return this.csharp.codeblock(propertyName); + } const resolvedType = this.model.dereferenceType(named.typeId).typeDeclaration; if (resolvedType.shape.type === "enum") { const enumClassReference = this.context.csharpTypeMapper.convertToClassReference(named, { @@ -688,9 +698,12 @@ class FromProtoPropertyMapper extends WithGeneration { propertyName }); } - const propertyClassReference = this.context.csharpTypeMapper.convertToClassReference(named); + const propertyClassReference = this.context.csharpTypeMapper.convertToClassReference(named, { + fullyQualified: true + }); if (wrapperType === WrapperType.List) { // The static function is mapped within a LINQ expression. + // Use fully qualified reference to avoid collisions with property names. return this.csharp.codeblock((writer) => { writer.writeNode(propertyClassReference); writer.write(".FromProto"); diff --git a/generators/csharp/base/src/proto/ProtobufResolver.ts b/generators/csharp/base/src/proto/ProtobufResolver.ts index aa7824646904..46aca5139930 100644 --- a/generators/csharp/base/src/proto/ProtobufResolver.ts +++ b/generators/csharp/base/src/proto/ProtobufResolver.ts @@ -99,6 +99,43 @@ export class ProtobufResolver extends WithGeneration { }); } + /** + * Returns true if the type is an external proto type (e.g. google.rpc.Status) + * that should be surfaced directly in the SDK without generating a wrapper type. + */ + public isExternalProtobufType(typeId: TypeId): boolean { + const protobufType = this.getProtobufTypeForTypeId(typeId); + if (protobufType?.type === "userDefined") { + const packageName = protobufType.file.packageName; + if (packageName != null && EXTERNAL_PROTO_PACKAGES.has(packageName)) { + return true; + } + } + // Fallback: match on the type's declared name for cases where + // proto source may not be fully resolved. + const typeDeclaration = this.generation.ir.types[typeId]; + const typeName = typeDeclaration?.name?.name?.originalName; + return typeName != null && EXTERNAL_PROTO_TYPE_NAMES.has(typeName); + } + + /** + * Returns the class reference for an external proto type, using + * known mappings to resolve the correct namespace and type name. + */ + public getExternalProtobufClassReference(typeId: TypeId): ast.ClassReference { + const typeDeclaration = this.generation.ir.types[typeId]; + const typeName = typeDeclaration?.name?.name?.originalName; + const mapping = EXTERNAL_PROTO_TYPE_CLASS_REFERENCES[typeName ?? ""]; + if (mapping != null) { + return this.csharp.classReference({ + name: mapping.name, + namespace: mapping.namespace + }); + } + // Fall back to the proto source if no known mapping exists. + return this.getProtobufClassReference(typeId); + } + public isWellKnownAnyProtobufType(typeId: TypeId): boolean { return this._isWellKnownProtobufType({ typeId, @@ -130,3 +167,22 @@ export class ProtobufResolver extends WithGeneration { return typeDeclaration.source.type === "proto" ? typeDeclaration.source.value : undefined; } } + +/** + * Proto packages whose types should be surfaced directly in the SDK + * (using the proto-generated class) without generating a separate wrapper type. + */ +const EXTERNAL_PROTO_PACKAGES = new Set(["google.rpc"]); + +/** + * Type names that correspond to external proto types. Used as a fallback + * when proto source info may not be fully resolved (e.g. from OpenAPI imports). + */ +const EXTERNAL_PROTO_TYPE_NAMES = new Set(["GoogleRpcStatus"]); + +/** + * Known external proto type class references, keyed by IR type name. + */ +const EXTERNAL_PROTO_TYPE_CLASS_REFERENCES: Record = { + GoogleRpcStatus: { name: "Status", namespace: "Google.Rpc" } +}; diff --git a/generators/csharp/model/src/generateModels.ts b/generators/csharp/model/src/generateModels.ts index 8bb3efc6396d..a4c3ba039b29 100644 --- a/generators/csharp/model/src/generateModels.ts +++ b/generators/csharp/model/src/generateModels.ts @@ -26,6 +26,11 @@ export function generateModels({ context }: { context: ModelGeneratorContext }): // The well-known Protobuf types are generated separately. continue; } + if (context.protobufResolver.isExternalProtobufType(typeId)) { + // External proto types (e.g. google.rpc.Status) are used directly + // without generating a separate SDK wrapper type. + continue; + } const file = typeDeclaration.shape._visit({ alias: (aliasDeclaration) => { // Generate literal struct files for named literal alias types when generateLiterals is on. diff --git a/generators/csharp/sdk/versions.yml b/generators/csharp/sdk/versions.yml index b8e5e2a03a1c..2d9e716c0f8d 100644 --- a/generators/csharp/sdk/versions.yml +++ b/generators/csharp/sdk/versions.yml @@ -1,4 +1,22 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 2.30.3 + changelogEntry: + - summary: | + Add better support for the `google.rpc.Status` type, and stop + generating redundant wrapper types for `google.api` and + `google.rpc` types. + type: fix + createdAt: "2026-03-13" + irVersion: 65 + +- version: 2.30.2 + changelogEntry: + - summary: | + Fix gRPC code generation to support enums with numeric identifiers. + type: fix + createdAt: "2026-03-13" + irVersion: 65 + - version: 2.30.1 changelogEntry: - summary: | diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__CreateResponse.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__CreateResponse.json new file mode 100644 index 000000000000..a702fb060b74 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__CreateResponse.json @@ -0,0 +1,136 @@ +{ + "type": "object", + "properties": { + "resource": { + "oneOf": [ + { + "$ref": "#/definitions/Column" + }, + { + "type": "null" + } + ] + }, + "success": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ] + }, + "error_message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "MetadataValue": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + } + ] + }, + "Metadata": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/MetadataValue" + } + }, + { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "number", + "boolean", + "object", + "array", + "null" + ] + } + } + ] + }, + "IndexedData": { + "type": "object", + "properties": { + "indices": { + "type": "array", + "items": { + "type": "integer", + "minimum": 0 + } + }, + "values": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "indices", + "values" + ], + "additionalProperties": false + }, + "Column": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "number" + } + }, + "metadata": { + "oneOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "indexed_data": { + "oneOf": [ + { + "$ref": "#/definitions/IndexedData" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "values" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__GoogleRpcStatus.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__GoogleRpcStatus.json new file mode 100644 index 000000000000..b8ab619d3e9f --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__GoogleRpcStatus.json @@ -0,0 +1,47 @@ +{ + "type": "object", + "properties": { + "code": { + "oneOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "message": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "details": { + "oneOf": [ + { + "type": "array", + "items": { + "type": [ + "string", + "number", + "boolean", + "object", + "array", + "null" + ] + } + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": {} +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolChoice.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolChoice.json new file mode 100644 index 000000000000..616ebebfe82c --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolChoice.json @@ -0,0 +1,37 @@ +{ + "type": "object", + "properties": { + "mode": { + "oneOf": [ + { + "$ref": "#/definitions/ToolMode" + }, + { + "type": "null" + } + ] + }, + "function_name": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "ToolMode": { + "type": "string", + "enum": [ + "TOOL_MODE_INVALID", + "TOOL_MODE_AUTO", + "TOOL_MODE_NONE", + "TOOL_MODE_REQUIRED" + ] + } + } +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolMode.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolMode.json new file mode 100644 index 000000000000..278e49cb3954 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/csharp-grpc-proto-exhaustive/type__ToolMode.json @@ -0,0 +1,10 @@ +{ + "type": "string", + "enum": [ + "TOOL_MODE_INVALID", + "TOOL_MODE_AUTO", + "TOOL_MODE_NONE", + "TOOL_MODE_REQUIRED" + ], + "definitions": {} +} \ No newline at end of file diff --git a/packages/cli/generation/ir-generator-tests/src/dynamic-snippets/__test__/test-definitions/csharp-grpc-proto-exhaustive.json b/packages/cli/generation/ir-generator-tests/src/dynamic-snippets/__test__/test-definitions/csharp-grpc-proto-exhaustive.json index 4b5b24fa1905..cb27abdf0f2d 100644 --- a/packages/cli/generation/ir-generator-tests/src/dynamic-snippets/__test__/test-definitions/csharp-grpc-proto-exhaustive.json +++ b/packages/cli/generation/ir-generator-tests/src/dynamic-snippets/__test__/test-definitions/csharp-grpc-proto-exhaustive.json @@ -304,6 +304,138 @@ "extends": null, "additionalProperties": false }, + "type_:CreateResponse": { + "type": "object", + "declaration": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "resource", + "camelCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "snakeCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "screamingSnakeCase": { + "unsafeName": "RESOURCE", + "safeName": "RESOURCE" + }, + "pascalCase": { + "unsafeName": "Resource", + "safeName": "Resource" + } + }, + "wireValue": "resource" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:Column" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "success", + "camelCase": { + "unsafeName": "success", + "safeName": "success" + }, + "snakeCase": { + "unsafeName": "success", + "safeName": "success" + }, + "screamingSnakeCase": { + "unsafeName": "SUCCESS", + "safeName": "SUCCESS" + }, + "pascalCase": { + "unsafeName": "Success", + "safeName": "Success" + } + }, + "wireValue": "success" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "BOOLEAN" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "error_message", + "camelCase": { + "unsafeName": "errorMessage", + "safeName": "errorMessage" + }, + "snakeCase": { + "unsafeName": "error_message", + "safeName": "error_message" + }, + "screamingSnakeCase": { + "unsafeName": "ERROR_MESSAGE", + "safeName": "ERROR_MESSAGE" + }, + "pascalCase": { + "unsafeName": "ErrorMessage", + "safeName": "ErrorMessage" + } + }, + "wireValue": "error_message" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, "type_:DeleteResponse": { "type": "object", "declaration": { @@ -876,6 +1008,140 @@ } ] }, + "type_:GoogleRpcStatus": { + "type": "object", + "declaration": { + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRPCStatus", + "safeName": "googleRPCStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRPCStatus", + "safeName": "GoogleRPCStatus" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "code", + "camelCase": { + "unsafeName": "code", + "safeName": "code" + }, + "snakeCase": { + "unsafeName": "code", + "safeName": "code" + }, + "screamingSnakeCase": { + "unsafeName": "CODE", + "safeName": "CODE" + }, + "pascalCase": { + "unsafeName": "Code", + "safeName": "Code" + } + }, + "wireValue": "code" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "INTEGER" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "message", + "camelCase": { + "unsafeName": "message", + "safeName": "message" + }, + "snakeCase": { + "unsafeName": "message", + "safeName": "message" + }, + "screamingSnakeCase": { + "unsafeName": "MESSAGE", + "safeName": "MESSAGE" + }, + "pascalCase": { + "unsafeName": "Message", + "safeName": "Message" + } + }, + "wireValue": "message" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "details", + "camelCase": { + "unsafeName": "details", + "safeName": "details" + }, + "snakeCase": { + "unsafeName": "details", + "safeName": "details" + }, + "screamingSnakeCase": { + "unsafeName": "DETAILS", + "safeName": "DETAILS" + }, + "pascalCase": { + "unsafeName": "Details", + "safeName": "Details" + } + }, + "wireValue": "details" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "list", + "value": { + "type": "unknown" + } + } + }, + "propertyAccess": null, + "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, "type_:IndexType": { "type": "enum", "declaration": { @@ -2107,26 +2373,26 @@ "extends": null, "additionalProperties": false }, - "type_:UpdateResponse": { + "type_:ToolChoice": { "type": "object", "declaration": { "name": { - "originalName": "UpdateResponse", + "originalName": "ToolChoice", "camelCase": { - "unsafeName": "updateResponse", - "safeName": "updateResponse" + "unsafeName": "toolChoice", + "safeName": "toolChoice" }, "snakeCase": { - "unsafeName": "update_response", - "safeName": "update_response" + "unsafeName": "tool_choice", + "safeName": "tool_choice" }, "screamingSnakeCase": { - "unsafeName": "UPDATE_RESPONSE", - "safeName": "UPDATE_RESPONSE" + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" }, "pascalCase": { - "unsafeName": "UpdateResponse", - "safeName": "UpdateResponse" + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" } }, "fernFilepath": { @@ -2139,31 +2405,31 @@ { "name": { "name": { - "originalName": "updated_at", + "originalName": "mode", "camelCase": { - "unsafeName": "updatedAt", - "safeName": "updatedAt" + "unsafeName": "mode", + "safeName": "mode" }, "snakeCase": { - "unsafeName": "updated_at", - "safeName": "updated_at" + "unsafeName": "mode", + "safeName": "mode" }, "screamingSnakeCase": { - "unsafeName": "UPDATED_AT", - "safeName": "UPDATED_AT" + "unsafeName": "MODE", + "safeName": "MODE" }, "pascalCase": { - "unsafeName": "UpdatedAt", - "safeName": "UpdatedAt" + "unsafeName": "Mode", + "safeName": "Mode" } }, - "wireValue": "updated_at" + "wireValue": "mode" }, "typeReference": { "type": "optional", "value": { - "type": "primitive", - "value": "DATE_TIME" + "type": "named", + "value": "type_:ToolMode" } }, "propertyAccess": null, @@ -2172,42 +2438,260 @@ { "name": { "name": { - "originalName": "index_type", + "originalName": "function_name", "camelCase": { - "unsafeName": "indexType", - "safeName": "indexType" + "unsafeName": "functionName", + "safeName": "functionName" }, "snakeCase": { - "unsafeName": "index_type", - "safeName": "index_type" + "unsafeName": "function_name", + "safeName": "function_name" }, "screamingSnakeCase": { - "unsafeName": "INDEX_TYPE", - "safeName": "INDEX_TYPE" + "unsafeName": "FUNCTION_NAME", + "safeName": "FUNCTION_NAME" }, "pascalCase": { - "unsafeName": "IndexType", - "safeName": "IndexType" + "unsafeName": "FunctionName", + "safeName": "FunctionName" } }, - "wireValue": "index_type" + "wireValue": "function_name" }, "typeReference": { "type": "optional", "value": { - "type": "named", - "value": "type_:IndexType" + "type": "primitive", + "value": "STRING" } }, "propertyAccess": null, "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, + "type_:ToolMode": { + "type": "enum", + "declaration": { + "name": { + "originalName": "ToolMode", + "camelCase": { + "unsafeName": "toolMode", + "safeName": "toolMode" + }, + "snakeCase": { + "unsafeName": "tool_mode", + "safeName": "tool_mode" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE", + "safeName": "TOOL_MODE" + }, + "pascalCase": { + "unsafeName": "ToolMode", + "safeName": "ToolMode" + } }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "values": [ { "name": { - "name": { - "originalName": "details", - "camelCase": { - "unsafeName": "details", + "originalName": "TOOL_MODE_INVALID", + "camelCase": { + "unsafeName": "toolModeInvalid", + "safeName": "toolModeInvalid" + }, + "snakeCase": { + "unsafeName": "tool_mode_invalid", + "safeName": "tool_mode_invalid" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_INVALID", + "safeName": "TOOL_MODE_INVALID" + }, + "pascalCase": { + "unsafeName": "ToolModeInvalid", + "safeName": "ToolModeInvalid" + } + }, + "wireValue": "TOOL_MODE_INVALID" + }, + { + "name": { + "originalName": "TOOL_MODE_AUTO", + "camelCase": { + "unsafeName": "toolModeAuto", + "safeName": "toolModeAuto" + }, + "snakeCase": { + "unsafeName": "tool_mode_auto", + "safeName": "tool_mode_auto" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_AUTO", + "safeName": "TOOL_MODE_AUTO" + }, + "pascalCase": { + "unsafeName": "ToolModeAuto", + "safeName": "ToolModeAuto" + } + }, + "wireValue": "TOOL_MODE_AUTO" + }, + { + "name": { + "originalName": "TOOL_MODE_NONE", + "camelCase": { + "unsafeName": "toolModeNone", + "safeName": "toolModeNone" + }, + "snakeCase": { + "unsafeName": "tool_mode_none", + "safeName": "tool_mode_none" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_NONE", + "safeName": "TOOL_MODE_NONE" + }, + "pascalCase": { + "unsafeName": "ToolModeNone", + "safeName": "ToolModeNone" + } + }, + "wireValue": "TOOL_MODE_NONE" + }, + { + "name": { + "originalName": "TOOL_MODE_REQUIRED", + "camelCase": { + "unsafeName": "toolModeRequired", + "safeName": "toolModeRequired" + }, + "snakeCase": { + "unsafeName": "tool_mode_required", + "safeName": "tool_mode_required" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_REQUIRED", + "safeName": "TOOL_MODE_REQUIRED" + }, + "pascalCase": { + "unsafeName": "ToolModeRequired", + "safeName": "ToolModeRequired" + } + }, + "wireValue": "TOOL_MODE_REQUIRED" + } + ] + }, + "type_:UpdateResponse": { + "type": "object", + "declaration": { + "name": { + "originalName": "UpdateResponse", + "camelCase": { + "unsafeName": "updateResponse", + "safeName": "updateResponse" + }, + "snakeCase": { + "unsafeName": "update_response", + "safeName": "update_response" + }, + "screamingSnakeCase": { + "unsafeName": "UPDATE_RESPONSE", + "safeName": "UPDATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "UpdateResponse", + "safeName": "UpdateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "updated_at", + "camelCase": { + "unsafeName": "updatedAt", + "safeName": "updatedAt" + }, + "snakeCase": { + "unsafeName": "updated_at", + "safeName": "updated_at" + }, + "screamingSnakeCase": { + "unsafeName": "UPDATED_AT", + "safeName": "UPDATED_AT" + }, + "pascalCase": { + "unsafeName": "UpdatedAt", + "safeName": "UpdatedAt" + } + }, + "wireValue": "updated_at" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "DATE_TIME" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "index_type", + "camelCase": { + "unsafeName": "indexType", + "safeName": "indexType" + }, + "snakeCase": { + "unsafeName": "index_type", + "safeName": "index_type" + }, + "screamingSnakeCase": { + "unsafeName": "INDEX_TYPE", + "safeName": "INDEX_TYPE" + }, + "pascalCase": { + "unsafeName": "IndexType", + "safeName": "IndexType" + } + }, + "wireValue": "index_type" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:IndexType" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "details", + "camelCase": { + "unsafeName": "details", "safeName": "details" }, "snakeCase": { @@ -2468,102 +2952,322 @@ "safeName": "Metadata" } }, - "fernFilepath": { - "allParts": [], - "packagePath": [], - "file": null + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "types": [ + { + "type": "map", + "key": { + "type": "primitive", + "value": "STRING" + }, + "value": { + "type": "named", + "value": "type_:MetadataValue" + } + }, + { + "type": "map", + "key": { + "type": "primitive", + "value": "STRING" + }, + "value": { + "type": "unknown" + } + } + ] + }, + "type_:MetadataValue": { + "type": "undiscriminatedUnion", + "declaration": { + "name": { + "originalName": "MetadataValue", + "camelCase": { + "unsafeName": "metadataValue", + "safeName": "metadataValue" + }, + "snakeCase": { + "unsafeName": "metadata_value", + "safeName": "metadata_value" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA_VALUE", + "safeName": "METADATA_VALUE" + }, + "pascalCase": { + "unsafeName": "MetadataValue", + "safeName": "MetadataValue" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "types": [ + { + "type": "primitive", + "value": "DOUBLE" + }, + { + "type": "primitive", + "value": "STRING" + }, + { + "type": "primitive", + "value": "BOOLEAN" + } + ] + } + }, + "headers": [], + "endpoints": { + "endpoint_dataService.Upload": { + "auth": null, + "declaration": { + "name": { + "originalName": "Upload", + "camelCase": { + "unsafeName": "upload", + "safeName": "upload" + }, + "snakeCase": { + "unsafeName": "upload", + "safeName": "upload" + }, + "screamingSnakeCase": { + "unsafeName": "UPLOAD", + "safeName": "UPLOAD" + }, + "pascalCase": { + "unsafeName": "Upload", + "safeName": "Upload" + } + }, + "fernFilepath": { + "allParts": [ + { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + ], + "packagePath": [], + "file": { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + } + }, + "location": { + "method": "POST", + "path": "/data" + }, + "request": { + "type": "inlined", + "declaration": { + "name": { + "originalName": "UploadRequest", + "camelCase": { + "unsafeName": "uploadRequest", + "safeName": "uploadRequest" + }, + "snakeCase": { + "unsafeName": "upload_request", + "safeName": "upload_request" + }, + "screamingSnakeCase": { + "unsafeName": "UPLOAD_REQUEST", + "safeName": "UPLOAD_REQUEST" + }, + "pascalCase": { + "unsafeName": "UploadRequest", + "safeName": "UploadRequest" + } + }, + "fernFilepath": { + "allParts": [ + { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + ], + "packagePath": [], + "file": { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + } + }, + "pathParameters": [], + "queryParameters": [], + "headers": [], + "body": { + "type": "properties", + "value": [ + { + "name": { + "name": { + "originalName": "columns", + "camelCase": { + "unsafeName": "columns", + "safeName": "columns" + }, + "snakeCase": { + "unsafeName": "columns", + "safeName": "columns" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMNS", + "safeName": "COLUMNS" + }, + "pascalCase": { + "unsafeName": "Columns", + "safeName": "Columns" + } + }, + "wireValue": "columns" + }, + "typeReference": { + "type": "list", + "value": { + "type": "named", + "value": "type_:Column" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "namespace", + "camelCase": { + "unsafeName": "namespace", + "safeName": "namespace" + }, + "snakeCase": { + "unsafeName": "namespace", + "safeName": "namespace" + }, + "screamingSnakeCase": { + "unsafeName": "NAMESPACE", + "safeName": "NAMESPACE" + }, + "pascalCase": { + "unsafeName": "Namespace", + "safeName": "Namespace" + } + }, + "wireValue": "namespace" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + } + ] + }, + "metadata": { + "includePathParameters": false, + "onlyPathParameters": false } }, - "types": [ - { - "type": "map", - "key": { - "type": "primitive", - "value": "STRING" - }, - "value": { - "type": "named", - "value": "type_:MetadataValue" - } - }, - { - "type": "map", - "key": { - "type": "primitive", - "value": "STRING" - }, - "value": { - "type": "unknown" - } - } - ] - }, - "type_:MetadataValue": { - "type": "undiscriminatedUnion", - "declaration": { - "name": { - "originalName": "MetadataValue", - "camelCase": { - "unsafeName": "metadataValue", - "safeName": "metadataValue" - }, - "snakeCase": { - "unsafeName": "metadata_value", - "safeName": "metadata_value" - }, - "screamingSnakeCase": { - "unsafeName": "METADATA_VALUE", - "safeName": "METADATA_VALUE" - }, - "pascalCase": { - "unsafeName": "MetadataValue", - "safeName": "MetadataValue" - } - }, - "fernFilepath": { - "allParts": [], - "packagePath": [], - "file": null - } + "response": { + "type": "json" }, - "types": [ - { - "type": "primitive", - "value": "DOUBLE" - }, - { - "type": "primitive", - "value": "STRING" - }, - { - "type": "primitive", - "value": "BOOLEAN" - } - ] - } - }, - "headers": [], - "endpoints": { - "endpoint_dataService.Upload": { + "examples": null + }, + "endpoint_dataService.Create": { "auth": null, "declaration": { "name": { - "originalName": "Upload", + "originalName": "Create", "camelCase": { - "unsafeName": "upload", - "safeName": "upload" + "unsafeName": "create", + "safeName": "create" }, "snakeCase": { - "unsafeName": "upload", - "safeName": "upload" + "unsafeName": "create", + "safeName": "create" }, "screamingSnakeCase": { - "unsafeName": "UPLOAD", - "safeName": "UPLOAD" + "unsafeName": "CREATE", + "safeName": "CREATE" }, "pascalCase": { - "unsafeName": "Upload", - "safeName": "Upload" + "unsafeName": "Create", + "safeName": "Create" } }, "fernFilepath": { @@ -2612,28 +3316,28 @@ }, "location": { "method": "POST", - "path": "/data" + "path": "/data/create" }, "request": { "type": "inlined", "declaration": { "name": { - "originalName": "UploadRequest", + "originalName": "CreateRequest", "camelCase": { - "unsafeName": "uploadRequest", - "safeName": "uploadRequest" + "unsafeName": "createRequest", + "safeName": "createRequest" }, "snakeCase": { - "unsafeName": "upload_request", - "safeName": "upload_request" + "unsafeName": "create_request", + "safeName": "create_request" }, "screamingSnakeCase": { - "unsafeName": "UPLOAD_REQUEST", - "safeName": "UPLOAD_REQUEST" + "unsafeName": "CREATE_REQUEST", + "safeName": "CREATE_REQUEST" }, "pascalCase": { - "unsafeName": "UploadRequest", - "safeName": "UploadRequest" + "unsafeName": "CreateRequest", + "safeName": "CreateRequest" } }, "fernFilepath": { @@ -2689,31 +3393,94 @@ { "name": { "name": { - "originalName": "columns", + "originalName": "name", "camelCase": { - "unsafeName": "columns", - "safeName": "columns" + "unsafeName": "name", + "safeName": "name" }, "snakeCase": { - "unsafeName": "columns", - "safeName": "columns" + "unsafeName": "name", + "safeName": "name" }, "screamingSnakeCase": { - "unsafeName": "COLUMNS", - "safeName": "COLUMNS" + "unsafeName": "NAME", + "safeName": "NAME" }, "pascalCase": { - "unsafeName": "Columns", - "safeName": "Columns" + "unsafeName": "Name", + "safeName": "Name" } }, - "wireValue": "columns" + "wireValue": "name" }, "typeReference": { - "type": "list", + "type": "primitive", + "value": "STRING" + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "description", + "camelCase": { + "unsafeName": "description", + "safeName": "description" + }, + "snakeCase": { + "unsafeName": "description", + "safeName": "description" + }, + "screamingSnakeCase": { + "unsafeName": "DESCRIPTION", + "safeName": "DESCRIPTION" + }, + "pascalCase": { + "unsafeName": "Description", + "safeName": "Description" + } + }, + "wireValue": "description" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "tool_choice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "wireValue": "tool_choice" + }, + "typeReference": { + "type": "optional", "value": { "type": "named", - "value": "type_:Column" + "value": "type_:ToolChoice" } }, "propertyAccess": null, @@ -2722,25 +3489,58 @@ { "name": { "name": { - "originalName": "namespace", + "originalName": "url", "camelCase": { - "unsafeName": "namespace", - "safeName": "namespace" + "unsafeName": "url", + "safeName": "url" }, "snakeCase": { - "unsafeName": "namespace", - "safeName": "namespace" + "unsafeName": "url", + "safeName": "url" }, "screamingSnakeCase": { - "unsafeName": "NAMESPACE", - "safeName": "NAMESPACE" + "unsafeName": "URL", + "safeName": "URL" }, "pascalCase": { - "unsafeName": "Namespace", - "safeName": "Namespace" + "unsafeName": "URL", + "safeName": "URL" } }, - "wireValue": "namespace" + "wireValue": "url" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "content", + "camelCase": { + "unsafeName": "content", + "safeName": "content" + }, + "snakeCase": { + "unsafeName": "content", + "safeName": "content" + }, + "screamingSnakeCase": { + "unsafeName": "CONTENT", + "safeName": "CONTENT" + }, + "pascalCase": { + "unsafeName": "Content", + "safeName": "Content" + } + }, + "wireValue": "content" }, "typeReference": { "type": "optional", @@ -2751,6 +3551,39 @@ }, "propertyAccess": null, "variable": null + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:Metadata" + } + }, + "propertyAccess": null, + "variable": null } ] }, @@ -4671,6 +5504,39 @@ }, "propertyAccess": null, "variable": null + }, + { + "name": { + "name": { + "originalName": "status", + "camelCase": { + "unsafeName": "status", + "safeName": "status" + }, + "snakeCase": { + "unsafeName": "status", + "safeName": "status" + }, + "screamingSnakeCase": { + "unsafeName": "STATUS", + "safeName": "STATUS" + }, + "pascalCase": { + "unsafeName": "Status", + "safeName": "Status" + } + }, + "wireValue": "status" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:GoogleRpcStatus" + } + }, + "propertyAccess": null, + "variable": null } ] }, diff --git a/packages/cli/generation/ir-generator-tests/src/ir/__test__/test-definitions/csharp-grpc-proto-exhaustive.json b/packages/cli/generation/ir-generator-tests/src/ir/__test__/test-definitions/csharp-grpc-proto-exhaustive.json index 6281fc62b896..e8d7dde93ab1 100644 --- a/packages/cli/generation/ir-generator-tests/src/ir/__test__/test-definitions/csharp-grpc-proto-exhaustive.json +++ b/packages/cli/generation/ir-generator-tests/src/ir/__test__/test-definitions/csharp-grpc-proto-exhaustive.json @@ -552,6 +552,257 @@ "availability": null, "docs": null }, + "type_:CreateResponse": { + "inline": null, + "name": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse" + }, + "shape": { + "_type": "object", + "extends": [], + "properties": [ + { + "name": { + "name": { + "originalName": "resource", + "camelCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "snakeCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "screamingSnakeCase": { + "unsafeName": "RESOURCE", + "safeName": "RESOURCE" + }, + "pascalCase": { + "unsafeName": "Resource", + "safeName": "Resource" + } + }, + "wireValue": "resource" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "named", + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column", + "default": null, + "inline": null + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "The created resource." + }, + { + "name": { + "name": { + "originalName": "success", + "camelCase": { + "unsafeName": "success", + "safeName": "success" + }, + "snakeCase": { + "unsafeName": "success", + "safeName": "success" + }, + "screamingSnakeCase": { + "unsafeName": "SUCCESS", + "safeName": "SUCCESS" + }, + "pascalCase": { + "unsafeName": "Success", + "safeName": "Success" + } + }, + "wireValue": "success" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "BOOLEAN", + "v2": { + "type": "boolean", + "default": null + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "Indicates successful creation." + }, + { + "name": { + "name": { + "originalName": "error_message", + "camelCase": { + "unsafeName": "errorMessage", + "safeName": "errorMessage" + }, + "snakeCase": { + "unsafeName": "error_message", + "safeName": "error_message" + }, + "screamingSnakeCase": { + "unsafeName": "ERROR_MESSAGE", + "safeName": "ERROR_MESSAGE" + }, + "pascalCase": { + "unsafeName": "ErrorMessage", + "safeName": "ErrorMessage" + } + }, + "wireValue": "error_message" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "Error message if creation failed." + } + ], + "extra-properties": false, + "extendedProperties": [] + }, + "referencedTypes": [ + "type_:Column", + "type_:Metadata", + "type_:MetadataValue", + "type_:IndexedData" + ], + "encoding": { + "json": null, + "proto": {} + }, + "source": { + "type": "proto", + "value": { + "type": "userDefined", + "file": { + "filepath": "proto/data/v1/data.proto", + "packageName": "data.v1", + "options": { + "csharp": { + "namespace": "Data.V1.Grpc" + } + } + }, + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + } + } + }, + "userProvidedExamples": [], + "autogeneratedExamples": [], + "v2Examples": null, + "availability": null, + "docs": null + }, "type_:DeleteResponse": { "inline": null, "name": { @@ -1538,6 +1789,231 @@ "availability": null, "docs": null }, + "type_:GoogleRpcStatus": { + "inline": null, + "name": { + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRPCStatus", + "safeName": "googleRPCStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRPCStatus", + "safeName": "GoogleRPCStatus" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:GoogleRpcStatus" + }, + "shape": { + "_type": "object", + "extends": [], + "properties": [ + { + "name": { + "name": { + "originalName": "code", + "camelCase": { + "unsafeName": "code", + "safeName": "code" + }, + "snakeCase": { + "unsafeName": "code", + "safeName": "code" + }, + "screamingSnakeCase": { + "unsafeName": "CODE", + "safeName": "CODE" + }, + "pascalCase": { + "unsafeName": "Code", + "safeName": "Code" + } + }, + "wireValue": "code" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "INTEGER", + "v2": { + "type": "integer", + "default": null, + "validation": null + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + }, + { + "name": { + "name": { + "originalName": "message", + "camelCase": { + "unsafeName": "message", + "safeName": "message" + }, + "snakeCase": { + "unsafeName": "message", + "safeName": "message" + }, + "screamingSnakeCase": { + "unsafeName": "MESSAGE", + "safeName": "MESSAGE" + }, + "pascalCase": { + "unsafeName": "Message", + "safeName": "Message" + } + }, + "wireValue": "message" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + }, + { + "name": { + "name": { + "originalName": "details", + "camelCase": { + "unsafeName": "details", + "safeName": "details" + }, + "snakeCase": { + "unsafeName": "details", + "safeName": "details" + }, + "screamingSnakeCase": { + "unsafeName": "DETAILS", + "safeName": "DETAILS" + }, + "pascalCase": { + "unsafeName": "Details", + "safeName": "Details" + } + }, + "wireValue": "details" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "container", + "container": { + "_type": "list", + "list": { + "_type": "unknown" + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "A list of messages that carry the error details. There is a common set of message types for APIs to use." + } + ], + "extra-properties": false, + "extendedProperties": [] + }, + "referencedTypes": [], + "encoding": { + "json": null, + "proto": {} + }, + "source": { + "type": "proto", + "value": { + "type": "userDefined", + "file": { + "filepath": "proto/data/v1/data.proto", + "packageName": "data.v1", + "options": { + "csharp": { + "namespace": "Data.V1.Grpc" + } + } + }, + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRpcStatus", + "safeName": "googleRpcStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRpcStatus", + "safeName": "GoogleRpcStatus" + } + } + } + }, + "userProvidedExamples": [], + "autogeneratedExamples": [], + "v2Examples": null, + "availability": null, + "docs": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors)." + }, "type_:IndexType": { "inline": null, "name": { @@ -3885,6 +4361,393 @@ "availability": null, "docs": null }, + "type_:ToolChoice": { + "inline": null, + "name": { + "name": { + "originalName": "ToolChoice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:ToolChoice" + }, + "shape": { + "_type": "object", + "extends": [], + "properties": [ + { + "name": { + "name": { + "originalName": "mode", + "camelCase": { + "unsafeName": "mode", + "safeName": "mode" + }, + "snakeCase": { + "unsafeName": "mode", + "safeName": "mode" + }, + "screamingSnakeCase": { + "unsafeName": "MODE", + "safeName": "MODE" + }, + "pascalCase": { + "unsafeName": "Mode", + "safeName": "Mode" + } + }, + "wireValue": "mode" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "named", + "name": { + "originalName": "ToolMode", + "camelCase": { + "unsafeName": "toolMode", + "safeName": "toolMode" + }, + "snakeCase": { + "unsafeName": "tool_mode", + "safeName": "tool_mode" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE", + "safeName": "TOOL_MODE" + }, + "pascalCase": { + "unsafeName": "ToolMode", + "safeName": "ToolMode" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:ToolMode", + "default": null, + "inline": null + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "Force the model to perform in a given mode." + }, + { + "name": { + "name": { + "originalName": "function_name", + "camelCase": { + "unsafeName": "functionName", + "safeName": "functionName" + }, + "snakeCase": { + "unsafeName": "function_name", + "safeName": "function_name" + }, + "screamingSnakeCase": { + "unsafeName": "FUNCTION_NAME", + "safeName": "FUNCTION_NAME" + }, + "pascalCase": { + "unsafeName": "FunctionName", + "safeName": "FunctionName" + } + }, + "wireValue": "function_name" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "propertyAccess": null, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "availability": null, + "docs": "Force the model to call a particular function." + } + ], + "extra-properties": false, + "extendedProperties": [] + }, + "referencedTypes": [ + "type_:ToolMode" + ], + "encoding": { + "json": null, + "proto": {} + }, + "source": { + "type": "proto", + "value": { + "type": "userDefined", + "file": { + "filepath": "proto/data/v1/data.proto", + "packageName": "data.v1", + "options": { + "csharp": { + "namespace": "Data.V1.Grpc" + } + } + }, + "name": { + "originalName": "ToolChoice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + } + } + }, + "userProvidedExamples": [], + "autogeneratedExamples": [], + "v2Examples": null, + "availability": null, + "docs": null + }, + "type_:ToolMode": { + "inline": null, + "name": { + "name": { + "originalName": "ToolMode", + "camelCase": { + "unsafeName": "toolMode", + "safeName": "toolMode" + }, + "snakeCase": { + "unsafeName": "tool_mode", + "safeName": "tool_mode" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE", + "safeName": "TOOL_MODE" + }, + "pascalCase": { + "unsafeName": "ToolMode", + "safeName": "ToolMode" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:ToolMode" + }, + "shape": { + "_type": "enum", + "default": null, + "values": [ + { + "name": { + "name": { + "originalName": "TOOL_MODE_INVALID", + "camelCase": { + "unsafeName": "toolModeInvalid", + "safeName": "toolModeInvalid" + }, + "snakeCase": { + "unsafeName": "tool_mode_invalid", + "safeName": "tool_mode_invalid" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_INVALID", + "safeName": "TOOL_MODE_INVALID" + }, + "pascalCase": { + "unsafeName": "ToolModeInvalid", + "safeName": "ToolModeInvalid" + } + }, + "wireValue": "TOOL_MODE_INVALID" + }, + "availability": null, + "docs": null + }, + { + "name": { + "name": { + "originalName": "TOOL_MODE_AUTO", + "camelCase": { + "unsafeName": "toolModeAuto", + "safeName": "toolModeAuto" + }, + "snakeCase": { + "unsafeName": "tool_mode_auto", + "safeName": "tool_mode_auto" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_AUTO", + "safeName": "TOOL_MODE_AUTO" + }, + "pascalCase": { + "unsafeName": "ToolModeAuto", + "safeName": "ToolModeAuto" + } + }, + "wireValue": "TOOL_MODE_AUTO" + }, + "availability": null, + "docs": null + }, + { + "name": { + "name": { + "originalName": "TOOL_MODE_NONE", + "camelCase": { + "unsafeName": "toolModeNone", + "safeName": "toolModeNone" + }, + "snakeCase": { + "unsafeName": "tool_mode_none", + "safeName": "tool_mode_none" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_NONE", + "safeName": "TOOL_MODE_NONE" + }, + "pascalCase": { + "unsafeName": "ToolModeNone", + "safeName": "ToolModeNone" + } + }, + "wireValue": "TOOL_MODE_NONE" + }, + "availability": null, + "docs": null + }, + { + "name": { + "name": { + "originalName": "TOOL_MODE_REQUIRED", + "camelCase": { + "unsafeName": "toolModeRequired", + "safeName": "toolModeRequired" + }, + "snakeCase": { + "unsafeName": "tool_mode_required", + "safeName": "tool_mode_required" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_REQUIRED", + "safeName": "TOOL_MODE_REQUIRED" + }, + "pascalCase": { + "unsafeName": "ToolModeRequired", + "safeName": "ToolModeRequired" + } + }, + "wireValue": "TOOL_MODE_REQUIRED" + }, + "availability": null, + "docs": null + } + ], + "forwardCompatible": null + }, + "referencedTypes": [], + "encoding": { + "json": null, + "proto": {} + }, + "source": { + "type": "proto", + "value": { + "type": "userDefined", + "file": { + "filepath": "proto/data/v1/data.proto", + "packageName": "data.v1", + "options": { + "csharp": { + "namespace": "Data.V1.Grpc" + } + } + }, + "name": { + "originalName": "ToolMode", + "camelCase": { + "unsafeName": "toolMode", + "safeName": "toolMode" + }, + "snakeCase": { + "unsafeName": "tool_mode", + "safeName": "tool_mode" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE", + "safeName": "TOOL_MODE" + }, + "pascalCase": { + "unsafeName": "ToolMode", + "safeName": "ToolMode" + } + } + } + }, + "userProvidedExamples": [], + "autogeneratedExamples": [], + "v2Examples": null, + "availability": null, + "docs": null + }, "type_:UpdateResponse": { "inline": null, "name": { @@ -6707,6 +7570,3180 @@ "availability": null, "docs": null }, + { + "id": "endpoint_dataService.Create", + "name": { + "originalName": "Create", + "camelCase": { + "unsafeName": "create", + "safeName": "create" + }, + "snakeCase": { + "unsafeName": "create", + "safeName": "create" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE", + "safeName": "CREATE" + }, + "pascalCase": { + "unsafeName": "Create", + "safeName": "Create" + } + }, + "displayName": null, + "auth": false, + "security": null, + "idempotent": false, + "baseUrl": null, + "v2BaseUrls": null, + "method": "POST", + "basePath": null, + "path": { + "head": "/data/create", + "parts": [] + }, + "fullPath": { + "head": "data/create", + "parts": [] + }, + "pathParameters": [], + "allPathParameters": [], + "queryParameters": [], + "headers": [], + "requestBody": { + "type": "inlinedRequestBody", + "name": { + "originalName": "CreateRequest", + "camelCase": { + "unsafeName": "createRequest", + "safeName": "createRequest" + }, + "snakeCase": { + "unsafeName": "create_request", + "safeName": "create_request" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_REQUEST", + "safeName": "CREATE_REQUEST" + }, + "pascalCase": { + "unsafeName": "CreateRequest", + "safeName": "CreateRequest" + } + }, + "extends": [], + "properties": [ + { + "name": { + "name": { + "originalName": "name", + "camelCase": { + "unsafeName": "name", + "safeName": "name" + }, + "snakeCase": { + "unsafeName": "name", + "safeName": "name" + }, + "screamingSnakeCase": { + "unsafeName": "NAME", + "safeName": "NAME" + }, + "pascalCase": { + "unsafeName": "Name", + "safeName": "Name" + } + }, + "wireValue": "name" + }, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "The name of the resource to create." + }, + { + "name": { + "name": { + "originalName": "description", + "camelCase": { + "unsafeName": "description", + "safeName": "description" + }, + "snakeCase": { + "unsafeName": "description", + "safeName": "description" + }, + "screamingSnakeCase": { + "unsafeName": "DESCRIPTION", + "safeName": "DESCRIPTION" + }, + "pascalCase": { + "unsafeName": "Description", + "safeName": "Description" + } + }, + "wireValue": "description" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "A description of the resource." + }, + { + "name": { + "name": { + "originalName": "tool_choice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "wireValue": "tool_choice" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "named", + "name": { + "originalName": "ToolChoice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:ToolChoice", + "default": null, + "inline": null + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "The tool choice configuration." + }, + { + "name": { + "name": { + "originalName": "url", + "camelCase": { + "unsafeName": "url", + "safeName": "url" + }, + "snakeCase": { + "unsafeName": "url", + "safeName": "url" + }, + "screamingSnakeCase": { + "unsafeName": "URL", + "safeName": "URL" + }, + "pascalCase": { + "unsafeName": "URL", + "safeName": "URL" + } + }, + "wireValue": "url" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "A URL to fetch the resource from." + }, + { + "name": { + "name": { + "originalName": "content", + "camelCase": { + "unsafeName": "content", + "safeName": "content" + }, + "snakeCase": { + "unsafeName": "content", + "safeName": "content" + }, + "screamingSnakeCase": { + "unsafeName": "CONTENT", + "safeName": "CONTENT" + }, + "pascalCase": { + "unsafeName": "Content", + "safeName": "Content" + } + }, + "wireValue": "content" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "Inline content for the resource." + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "named", + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Metadata", + "default": null, + "inline": null + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": "Optional metadata for the resource." + } + ], + "extra-properties": false, + "extendedProperties": [], + "docs": null, + "v2Examples": null, + "contentType": "application/json" + }, + "v2RequestBodies": null, + "sdkRequest": { + "shape": { + "type": "wrapper", + "wrapperName": { + "originalName": "CreateRequest", + "camelCase": { + "unsafeName": "createRequest", + "safeName": "createRequest" + }, + "snakeCase": { + "unsafeName": "create_request", + "safeName": "create_request" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_REQUEST", + "safeName": "CREATE_REQUEST" + }, + "pascalCase": { + "unsafeName": "CreateRequest", + "safeName": "CreateRequest" + } + }, + "bodyKey": { + "originalName": "body", + "camelCase": { + "unsafeName": "body", + "safeName": "body" + }, + "snakeCase": { + "unsafeName": "body", + "safeName": "body" + }, + "screamingSnakeCase": { + "unsafeName": "BODY", + "safeName": "BODY" + }, + "pascalCase": { + "unsafeName": "Body", + "safeName": "Body" + } + }, + "includePathParameters": false, + "onlyPathParameters": false + }, + "requestParameterName": { + "originalName": "request", + "camelCase": { + "unsafeName": "request", + "safeName": "request" + }, + "snakeCase": { + "unsafeName": "request", + "safeName": "request" + }, + "screamingSnakeCase": { + "unsafeName": "REQUEST", + "safeName": "REQUEST" + }, + "pascalCase": { + "unsafeName": "Request", + "safeName": "Request" + } + }, + "streamParameter": null + }, + "response": { + "body": { + "type": "json", + "value": { + "type": "response", + "responseBodyType": { + "_type": "named", + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse", + "default": null, + "inline": null + }, + "docs": "OK", + "v2Examples": null + } + }, + "status-code": 200, + "isWildcardStatusCode": null, + "docs": "OK" + }, + "v2Responses": null, + "errors": [], + "userSpecifiedExamples": [ + { + "example": { + "id": "54d8ef3c", + "name": null, + "url": "/data/create", + "rootPathParameters": [], + "endpointPathParameters": [], + "servicePathParameters": [], + "endpointHeaders": [], + "serviceHeaders": [], + "queryParameters": [], + "request": { + "type": "inlinedRequestBody", + "properties": [ + { + "name": { + "name": { + "originalName": "name", + "camelCase": { + "unsafeName": "name", + "safeName": "name" + }, + "snakeCase": { + "unsafeName": "name", + "safeName": "name" + }, + "screamingSnakeCase": { + "unsafeName": "NAME", + "safeName": "NAME" + }, + "pascalCase": { + "unsafeName": "Name", + "safeName": "Name" + } + }, + "wireValue": "name" + }, + "value": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "name" + } + } + }, + "jsonExample": "name" + }, + "originalTypeDeclaration": null + } + ], + "extraProperties": null, + "jsonExample": { + "name": "name" + } + }, + "response": { + "type": "ok", + "value": { + "type": "body", + "value": { + "shape": { + "type": "named", + "typeName": { + "typeId": "type_:CreateResponse", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "displayName": null + }, + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "resource", + "camelCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "snakeCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "screamingSnakeCase": { + "unsafeName": "RESOURCE", + "safeName": "RESOURCE" + }, + "pascalCase": { + "unsafeName": "Resource", + "safeName": "Resource" + } + }, + "wireValue": "resource" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "typeName": { + "typeId": "type_:Column", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "displayName": null + }, + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "id", + "camelCase": { + "unsafeName": "id", + "safeName": "id" + }, + "snakeCase": { + "unsafeName": "id", + "safeName": "id" + }, + "screamingSnakeCase": { + "unsafeName": "ID", + "safeName": "ID" + }, + "pascalCase": { + "unsafeName": "ID", + "safeName": "ID" + } + }, + "wireValue": "id" + }, + "value": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "id" + } + } + }, + "jsonExample": "id" + }, + "originalTypeDeclaration": { + "typeId": "type_:Column", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "values", + "camelCase": { + "unsafeName": "values", + "safeName": "values" + }, + "snakeCase": { + "unsafeName": "values", + "safeName": "values" + }, + "screamingSnakeCase": { + "unsafeName": "VALUES", + "safeName": "VALUES" + }, + "pascalCase": { + "unsafeName": "Values", + "safeName": "Values" + } + }, + "wireValue": "values" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "FLOAT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1.1 + ] + }, + "originalTypeDeclaration": { + "typeId": "type_:Column", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "typeName": { + "typeId": "type_:Metadata", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "displayName": null + }, + "shape": { + "type": "undiscriminatedUnion", + "index": 0, + "singleUnionType": { + "shape": { + "type": "container", + "container": { + "type": "map", + "map": [ + { + "key": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "key" + } + } + }, + "jsonExample": "key" + }, + "value": { + "shape": { + "type": "named", + "typeName": { + "typeId": "type_:MetadataValue", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "MetadataValue", + "camelCase": { + "unsafeName": "metadataValue", + "safeName": "metadataValue" + }, + "snakeCase": { + "unsafeName": "metadata_value", + "safeName": "metadata_value" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA_VALUE", + "safeName": "METADATA_VALUE" + }, + "pascalCase": { + "unsafeName": "MetadataValue", + "safeName": "MetadataValue" + } + }, + "displayName": null + }, + "shape": { + "type": "undiscriminatedUnion", + "index": 0, + "singleUnionType": { + "shape": { + "type": "primitive", + "primitive": { + "type": "double", + "double": 1.1 + } + }, + "jsonExample": 1.1 + } + } + }, + "jsonExample": 1.1 + } + } + ], + "keyType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "MetadataValue", + "camelCase": { + "unsafeName": "metadataValue", + "safeName": "metadataValue" + }, + "snakeCase": { + "unsafeName": "metadata_value", + "safeName": "metadata_value" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA_VALUE", + "safeName": "METADATA_VALUE" + }, + "pascalCase": { + "unsafeName": "MetadataValue", + "safeName": "MetadataValue" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:MetadataValue", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "key": 1.1 + } + } + } + }, + "jsonExample": { + "key": 1.1 + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Metadata", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "key": 1.1 + } + }, + "originalTypeDeclaration": { + "typeId": "type_:Column", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "indexed_data", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "wireValue": "indexed_data" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "typeName": { + "typeId": "type_:IndexedData", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "displayName": null + }, + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "indices", + "camelCase": { + "unsafeName": "indices", + "safeName": "indices" + }, + "snakeCase": { + "unsafeName": "indices", + "safeName": "indices" + }, + "screamingSnakeCase": { + "unsafeName": "INDICES", + "safeName": "INDICES" + }, + "pascalCase": { + "unsafeName": "Indices", + "safeName": "Indices" + } + }, + "wireValue": "indices" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "uint", + "uint": 1 + } + }, + "jsonExample": 1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "UINT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1 + ] + }, + "originalTypeDeclaration": { + "typeId": "type_:IndexedData", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "values", + "camelCase": { + "unsafeName": "values", + "safeName": "values" + }, + "snakeCase": { + "unsafeName": "values", + "safeName": "values" + }, + "screamingSnakeCase": { + "unsafeName": "VALUES", + "safeName": "VALUES" + }, + "pascalCase": { + "unsafeName": "Values", + "safeName": "Values" + } + }, + "wireValue": "values" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "FLOAT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1.1 + ] + }, + "originalTypeDeclaration": { + "typeId": "type_:IndexedData", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "displayName": null + }, + "propertyAccess": null + } + ], + "extraProperties": null + } + }, + "jsonExample": { + "indices": [ + 1 + ], + "values": [ + 1.1 + ] + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:IndexedData", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "indices": [ + 1 + ], + "values": [ + 1.1 + ] + } + }, + "originalTypeDeclaration": { + "typeId": "type_:Column", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "displayName": null + }, + "propertyAccess": null + } + ], + "extraProperties": null + } + }, + "jsonExample": { + "id": "id", + "values": [ + 1.1 + ], + "metadata": { + "key": 1.1 + }, + "indexed_data": { + "indices": [ + 1 + ], + "values": [ + 1.1 + ] + } + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "id": "id", + "values": [ + 1.1 + ], + "metadata": { + "key": 1.1 + }, + "indexed_data": { + "indices": [ + 1 + ], + "values": [ + 1.1 + ] + } + } + }, + "originalTypeDeclaration": { + "typeId": "type_:CreateResponse", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "success", + "camelCase": { + "unsafeName": "success", + "safeName": "success" + }, + "snakeCase": { + "unsafeName": "success", + "safeName": "success" + }, + "screamingSnakeCase": { + "unsafeName": "SUCCESS", + "safeName": "SUCCESS" + }, + "pascalCase": { + "unsafeName": "Success", + "safeName": "Success" + } + }, + "wireValue": "success" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "primitive", + "primitive": { + "type": "boolean", + "boolean": true + } + }, + "jsonExample": true + }, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "BOOLEAN", + "v2": { + "type": "boolean", + "default": null + } + } + } + } + }, + "jsonExample": true + }, + "originalTypeDeclaration": { + "typeId": "type_:CreateResponse", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "displayName": null + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "error_message", + "camelCase": { + "unsafeName": "errorMessage", + "safeName": "errorMessage" + }, + "snakeCase": { + "unsafeName": "error_message", + "safeName": "error_message" + }, + "screamingSnakeCase": { + "unsafeName": "ERROR_MESSAGE", + "safeName": "ERROR_MESSAGE" + }, + "pascalCase": { + "unsafeName": "ErrorMessage", + "safeName": "ErrorMessage" + } + }, + "wireValue": "error_message" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "error_message" + } + } + }, + "jsonExample": "error_message" + }, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "jsonExample": "error_message" + }, + "originalTypeDeclaration": { + "typeId": "type_:CreateResponse", + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "displayName": null + }, + "propertyAccess": null + } + ], + "extraProperties": null + } + }, + "jsonExample": { + "resource": { + "id": "id", + "values": [ + 1.1 + ], + "metadata": { + "key": 1.1 + }, + "indexed_data": { + "indices": [ + 1 + ], + "values": [ + 1.1 + ] + } + }, + "success": true, + "error_message": "error_message" + } + } + } + }, + "docs": null + }, + "codeSamples": null + } + ], + "autogeneratedExamples": [ + { + "example": { + "id": "20e8830f", + "url": "/data/create", + "name": null, + "endpointHeaders": [], + "endpointPathParameters": [], + "queryParameters": [], + "servicePathParameters": [], + "serviceHeaders": [], + "rootPathParameters": [], + "request": { + "type": "inlinedRequestBody", + "properties": [ + { + "name": { + "name": { + "originalName": "name", + "camelCase": { + "unsafeName": "name", + "safeName": "name" + }, + "snakeCase": { + "unsafeName": "name", + "safeName": "name" + }, + "screamingSnakeCase": { + "unsafeName": "NAME", + "safeName": "NAME" + }, + "pascalCase": { + "unsafeName": "Name", + "safeName": "Name" + } + }, + "wireValue": "name" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "name" + } + } + }, + "jsonExample": "name" + } + }, + { + "name": { + "name": { + "originalName": "description", + "camelCase": { + "unsafeName": "description", + "safeName": "description" + }, + "snakeCase": { + "unsafeName": "description", + "safeName": "description" + }, + "screamingSnakeCase": { + "unsafeName": "DESCRIPTION", + "safeName": "DESCRIPTION" + }, + "pascalCase": { + "unsafeName": "Description", + "safeName": "Description" + } + }, + "wireValue": "description" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + } + } + }, + { + "name": { + "name": { + "originalName": "tool_choice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "wireValue": "tool_choice" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "named", + "name": { + "originalName": "ToolChoice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:ToolChoice", + "default": null, + "inline": null + } + } + } + } + }, + { + "name": { + "name": { + "originalName": "url", + "camelCase": { + "unsafeName": "url", + "safeName": "url" + }, + "snakeCase": { + "unsafeName": "url", + "safeName": "url" + }, + "screamingSnakeCase": { + "unsafeName": "URL", + "safeName": "URL" + }, + "pascalCase": { + "unsafeName": "URL", + "safeName": "URL" + } + }, + "wireValue": "url" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + } + } + }, + { + "name": { + "name": { + "originalName": "content", + "camelCase": { + "unsafeName": "content", + "safeName": "content" + }, + "snakeCase": { + "unsafeName": "content", + "safeName": "content" + }, + "screamingSnakeCase": { + "unsafeName": "CONTENT", + "safeName": "CONTENT" + }, + "pascalCase": { + "unsafeName": "Content", + "safeName": "Content" + } + }, + "wireValue": "content" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + } + } + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "named", + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Metadata", + "default": null, + "inline": null + } + } + } + } + } + ], + "extraProperties": null, + "jsonExample": { + "name": "name" + } + }, + "response": { + "type": "ok", + "value": { + "type": "body", + "value": { + "shape": { + "type": "named", + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "resource", + "camelCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "snakeCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "screamingSnakeCase": { + "unsafeName": "RESOURCE", + "safeName": "RESOURCE" + }, + "pascalCase": { + "unsafeName": "Resource", + "safeName": "Resource" + } + }, + "wireValue": "resource" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "id", + "camelCase": { + "unsafeName": "id", + "safeName": "id" + }, + "snakeCase": { + "unsafeName": "id", + "safeName": "id" + }, + "screamingSnakeCase": { + "unsafeName": "ID", + "safeName": "ID" + }, + "pascalCase": { + "unsafeName": "ID", + "safeName": "ID" + } + }, + "wireValue": "id" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column" + }, + "value": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "id" + } + } + }, + "jsonExample": "id" + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "values", + "camelCase": { + "unsafeName": "values", + "safeName": "values" + }, + "snakeCase": { + "unsafeName": "values", + "safeName": "values" + }, + "screamingSnakeCase": { + "unsafeName": "VALUES", + "safeName": "VALUES" + }, + "pascalCase": { + "unsafeName": "Values", + "safeName": "Values" + } + }, + "wireValue": "values" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + }, + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "FLOAT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1.1, + 1.1 + ] + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "shape": { + "type": "undiscriminatedUnion", + "index": 0, + "singleUnionType": { + "shape": { + "type": "container", + "container": { + "type": "map", + "map": [ + { + "key": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "metadata" + } + } + }, + "jsonExample": "metadata" + }, + "value": { + "shape": { + "type": "named", + "shape": { + "type": "undiscriminatedUnion", + "index": 0, + "singleUnionType": { + "shape": { + "type": "primitive", + "primitive": { + "type": "double", + "double": 1.1 + } + }, + "jsonExample": 1.1 + } + }, + "typeName": { + "name": { + "originalName": "MetadataValue", + "camelCase": { + "unsafeName": "metadataValue", + "safeName": "metadataValue" + }, + "snakeCase": { + "unsafeName": "metadata_value", + "safeName": "metadata_value" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA_VALUE", + "safeName": "METADATA_VALUE" + }, + "pascalCase": { + "unsafeName": "MetadataValue", + "safeName": "MetadataValue" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:MetadataValue" + } + }, + "jsonExample": 1.1 + } + } + ], + "keyType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "MetadataValue", + "camelCase": { + "unsafeName": "metadataValue", + "safeName": "metadataValue" + }, + "snakeCase": { + "unsafeName": "metadata_value", + "safeName": "metadata_value" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA_VALUE", + "safeName": "METADATA_VALUE" + }, + "pascalCase": { + "unsafeName": "MetadataValue", + "safeName": "MetadataValue" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:MetadataValue", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "metadata": 1.1 + } + } + }, + "typeName": { + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Metadata" + } + }, + "jsonExample": { + "metadata": 1.1 + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "Metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Metadata", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "metadata": 1.1 + } + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "indexed_data", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "wireValue": "indexed_data" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "named", + "shape": { + "type": "object", + "properties": [ + { + "name": { + "name": { + "originalName": "indices", + "camelCase": { + "unsafeName": "indices", + "safeName": "indices" + }, + "snakeCase": { + "unsafeName": "indices", + "safeName": "indices" + }, + "screamingSnakeCase": { + "unsafeName": "INDICES", + "safeName": "INDICES" + }, + "pascalCase": { + "unsafeName": "Indices", + "safeName": "Indices" + } + }, + "wireValue": "indices" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:IndexedData" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "uint", + "uint": 1 + } + }, + "jsonExample": 1 + }, + { + "shape": { + "type": "primitive", + "primitive": { + "type": "uint", + "uint": 1 + } + }, + "jsonExample": 1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "UINT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1, + 1 + ] + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "values", + "camelCase": { + "unsafeName": "values", + "safeName": "values" + }, + "snakeCase": { + "unsafeName": "values", + "safeName": "values" + }, + "screamingSnakeCase": { + "unsafeName": "VALUES", + "safeName": "VALUES" + }, + "pascalCase": { + "unsafeName": "Values", + "safeName": "Values" + } + }, + "wireValue": "values" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:IndexedData" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "list", + "list": [ + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + }, + { + "shape": { + "type": "primitive", + "primitive": { + "type": "float", + "float": 1.1 + } + }, + "jsonExample": 1.1 + } + ], + "itemType": { + "_type": "primitive", + "primitive": { + "v1": "FLOAT", + "v2": null + } + } + } + }, + "jsonExample": [ + 1.1, + 1.1 + ] + }, + "propertyAccess": null + } + ], + "extraProperties": null + }, + "typeName": { + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:IndexedData" + } + }, + "jsonExample": { + "indices": [ + 1, + 1 + ], + "values": [ + 1.1, + 1.1 + ] + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "IndexedData", + "camelCase": { + "unsafeName": "indexedData", + "safeName": "indexedData" + }, + "snakeCase": { + "unsafeName": "indexed_data", + "safeName": "indexed_data" + }, + "screamingSnakeCase": { + "unsafeName": "INDEXED_DATA", + "safeName": "INDEXED_DATA" + }, + "pascalCase": { + "unsafeName": "IndexedData", + "safeName": "IndexedData" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:IndexedData", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "indices": [ + 1, + 1 + ], + "values": [ + 1.1, + 1.1 + ] + } + }, + "propertyAccess": null + } + ], + "extraProperties": null + }, + "typeName": { + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column" + } + }, + "jsonExample": { + "id": "id", + "values": [ + 1.1, + 1.1 + ], + "metadata": { + "metadata": 1.1 + }, + "indexed_data": { + "indices": [ + 1, + 1 + ], + "values": [ + 1.1, + 1.1 + ] + } + } + }, + "valueType": { + "_type": "named", + "name": { + "originalName": "Column", + "camelCase": { + "unsafeName": "column", + "safeName": "column" + }, + "snakeCase": { + "unsafeName": "column", + "safeName": "column" + }, + "screamingSnakeCase": { + "unsafeName": "COLUMN", + "safeName": "COLUMN" + }, + "pascalCase": { + "unsafeName": "Column", + "safeName": "Column" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:Column", + "default": null, + "inline": null + } + } + }, + "jsonExample": { + "id": "id", + "values": [ + 1.1, + 1.1 + ], + "metadata": { + "metadata": 1.1 + }, + "indexed_data": { + "indices": [ + 1, + 1 + ], + "values": [ + 1.1, + 1.1 + ] + } + } + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "success", + "camelCase": { + "unsafeName": "success", + "safeName": "success" + }, + "snakeCase": { + "unsafeName": "success", + "safeName": "success" + }, + "screamingSnakeCase": { + "unsafeName": "SUCCESS", + "safeName": "SUCCESS" + }, + "pascalCase": { + "unsafeName": "Success", + "safeName": "Success" + } + }, + "wireValue": "success" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "primitive", + "primitive": { + "type": "boolean", + "boolean": true + } + }, + "jsonExample": true + }, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "BOOLEAN", + "v2": { + "type": "boolean", + "default": null + } + } + } + } + }, + "jsonExample": true + }, + "propertyAccess": null + }, + { + "name": { + "name": { + "originalName": "error_message", + "camelCase": { + "unsafeName": "errorMessage", + "safeName": "errorMessage" + }, + "snakeCase": { + "unsafeName": "error_message", + "safeName": "error_message" + }, + "screamingSnakeCase": { + "unsafeName": "ERROR_MESSAGE", + "safeName": "ERROR_MESSAGE" + }, + "pascalCase": { + "unsafeName": "ErrorMessage", + "safeName": "ErrorMessage" + } + }, + "wireValue": "error_message" + }, + "originalTypeDeclaration": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse" + }, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": { + "shape": { + "type": "primitive", + "primitive": { + "type": "string", + "string": { + "original": "error_message" + } + } + }, + "jsonExample": "error_message" + }, + "valueType": { + "_type": "primitive", + "primitive": { + "v1": "STRING", + "v2": { + "type": "string", + "default": null, + "validation": null + } + } + } + } + }, + "jsonExample": "error_message" + }, + "propertyAccess": null + } + ], + "extraProperties": null + }, + "typeName": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:CreateResponse" + } + }, + "jsonExample": { + "resource": { + "id": "id", + "values": [ + 1.1, + 1.1 + ], + "metadata": { + "metadata": 1.1 + }, + "indexed_data": { + "indices": [ + 1, + 1 + ], + "values": [ + 1.1, + 1.1 + ] + } + }, + "success": true, + "error_message": "error_message" + } + } + } + }, + "docs": null + } + } + ], + "pagination": null, + "transport": null, + "v2Examples": null, + "source": null, + "audiences": null, + "retries": null, + "apiPlayground": null, + "responseHeaders": [], + "availability": null, + "docs": null + }, { "id": "endpoint_dataService.Delete", "name": { @@ -25237,6 +29274,74 @@ "propertyAccess": null, "availability": null, "docs": null + }, + { + "name": { + "name": { + "originalName": "status", + "camelCase": { + "unsafeName": "status", + "safeName": "status" + }, + "snakeCase": { + "unsafeName": "status", + "safeName": "status" + }, + "screamingSnakeCase": { + "unsafeName": "STATUS", + "safeName": "STATUS" + }, + "pascalCase": { + "unsafeName": "Status", + "safeName": "Status" + } + }, + "wireValue": "status" + }, + "valueType": { + "_type": "container", + "container": { + "_type": "optional", + "optional": { + "_type": "named", + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRPCStatus", + "safeName": "googleRPCStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRPCStatus", + "safeName": "GoogleRPCStatus" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:GoogleRpcStatus", + "default": null, + "inline": null + } + } + }, + "v2Examples": { + "userSpecifiedExamples": {}, + "autogeneratedExamples": {} + }, + "propertyAccess": null, + "availability": null, + "docs": null } ], "extra-properties": false, @@ -26096,7 +30201,7 @@ "autogeneratedExamples": [ { "example": { - "id": "7d56ae3b", + "id": "2ee88907", "url": "/data/update", "name": null, "endpointHeaders": [], @@ -26632,6 +30737,71 @@ } } } + }, + { + "name": { + "name": { + "originalName": "status", + "camelCase": { + "unsafeName": "status", + "safeName": "status" + }, + "snakeCase": { + "unsafeName": "status", + "safeName": "status" + }, + "screamingSnakeCase": { + "unsafeName": "STATUS", + "safeName": "STATUS" + }, + "pascalCase": { + "unsafeName": "Status", + "safeName": "Status" + } + }, + "wireValue": "status" + }, + "originalTypeDeclaration": null, + "value": { + "shape": { + "type": "container", + "container": { + "type": "optional", + "optional": null, + "valueType": { + "_type": "named", + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRPCStatus", + "safeName": "googleRPCStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRPCStatus", + "safeName": "GoogleRPCStatus" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + }, + "displayName": null, + "typeId": "type_:GoogleRpcStatus", + "default": null, + "inline": null + } + } + } + } } ], "extraProperties": null, @@ -27742,9 +31912,11 @@ "service_dataService": [ "type_:AspectRatio", "type_:Column", + "type_:CreateResponse", "type_:DeleteResponse", "type_:DescribeResponse", "type_:FetchResponse", + "type_:GoogleRpcStatus", "type_:IndexType", "type_:IndexedData", "type_:ListElement", @@ -27755,6 +31927,8 @@ "type_:QueryResponse", "type_:QueryResult", "type_:ScoredColumn", + "type_:ToolChoice", + "type_:ToolMode", "type_:UpdateResponse", "type_:UploadResponse", "type_:Usage", @@ -28078,6 +32252,138 @@ "extends": null, "additionalProperties": false }, + "type_:CreateResponse": { + "type": "object", + "declaration": { + "name": { + "originalName": "CreateResponse", + "camelCase": { + "unsafeName": "createResponse", + "safeName": "createResponse" + }, + "snakeCase": { + "unsafeName": "create_response", + "safeName": "create_response" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_RESPONSE", + "safeName": "CREATE_RESPONSE" + }, + "pascalCase": { + "unsafeName": "CreateResponse", + "safeName": "CreateResponse" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "resource", + "camelCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "snakeCase": { + "unsafeName": "resource", + "safeName": "resource" + }, + "screamingSnakeCase": { + "unsafeName": "RESOURCE", + "safeName": "RESOURCE" + }, + "pascalCase": { + "unsafeName": "Resource", + "safeName": "Resource" + } + }, + "wireValue": "resource" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:Column" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "success", + "camelCase": { + "unsafeName": "success", + "safeName": "success" + }, + "snakeCase": { + "unsafeName": "success", + "safeName": "success" + }, + "screamingSnakeCase": { + "unsafeName": "SUCCESS", + "safeName": "SUCCESS" + }, + "pascalCase": { + "unsafeName": "Success", + "safeName": "Success" + } + }, + "wireValue": "success" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "BOOLEAN" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "error_message", + "camelCase": { + "unsafeName": "errorMessage", + "safeName": "errorMessage" + }, + "snakeCase": { + "unsafeName": "error_message", + "safeName": "error_message" + }, + "screamingSnakeCase": { + "unsafeName": "ERROR_MESSAGE", + "safeName": "ERROR_MESSAGE" + }, + "pascalCase": { + "unsafeName": "ErrorMessage", + "safeName": "ErrorMessage" + } + }, + "wireValue": "error_message" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, "type_:DeleteResponse": { "type": "object", "declaration": { @@ -28650,6 +32956,140 @@ } ] }, + "type_:GoogleRpcStatus": { + "type": "object", + "declaration": { + "name": { + "originalName": "GoogleRpcStatus", + "camelCase": { + "unsafeName": "googleRPCStatus", + "safeName": "googleRPCStatus" + }, + "snakeCase": { + "unsafeName": "google_rpc_status", + "safeName": "google_rpc_status" + }, + "screamingSnakeCase": { + "unsafeName": "GOOGLE_RPC_STATUS", + "safeName": "GOOGLE_RPC_STATUS" + }, + "pascalCase": { + "unsafeName": "GoogleRPCStatus", + "safeName": "GoogleRPCStatus" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "code", + "camelCase": { + "unsafeName": "code", + "safeName": "code" + }, + "snakeCase": { + "unsafeName": "code", + "safeName": "code" + }, + "screamingSnakeCase": { + "unsafeName": "CODE", + "safeName": "CODE" + }, + "pascalCase": { + "unsafeName": "Code", + "safeName": "Code" + } + }, + "wireValue": "code" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "INTEGER" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "message", + "camelCase": { + "unsafeName": "message", + "safeName": "message" + }, + "snakeCase": { + "unsafeName": "message", + "safeName": "message" + }, + "screamingSnakeCase": { + "unsafeName": "MESSAGE", + "safeName": "MESSAGE" + }, + "pascalCase": { + "unsafeName": "Message", + "safeName": "Message" + } + }, + "wireValue": "message" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "details", + "camelCase": { + "unsafeName": "details", + "safeName": "details" + }, + "snakeCase": { + "unsafeName": "details", + "safeName": "details" + }, + "screamingSnakeCase": { + "unsafeName": "DETAILS", + "safeName": "DETAILS" + }, + "pascalCase": { + "unsafeName": "Details", + "safeName": "Details" + } + }, + "wireValue": "details" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "list", + "value": { + "type": "unknown" + } + } + }, + "propertyAccess": null, + "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, "type_:IndexType": { "type": "enum", "declaration": { @@ -29881,6 +34321,224 @@ "extends": null, "additionalProperties": false }, + "type_:ToolChoice": { + "type": "object", + "declaration": { + "name": { + "originalName": "ToolChoice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "properties": [ + { + "name": { + "name": { + "originalName": "mode", + "camelCase": { + "unsafeName": "mode", + "safeName": "mode" + }, + "snakeCase": { + "unsafeName": "mode", + "safeName": "mode" + }, + "screamingSnakeCase": { + "unsafeName": "MODE", + "safeName": "MODE" + }, + "pascalCase": { + "unsafeName": "Mode", + "safeName": "Mode" + } + }, + "wireValue": "mode" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:ToolMode" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "function_name", + "camelCase": { + "unsafeName": "functionName", + "safeName": "functionName" + }, + "snakeCase": { + "unsafeName": "function_name", + "safeName": "function_name" + }, + "screamingSnakeCase": { + "unsafeName": "FUNCTION_NAME", + "safeName": "FUNCTION_NAME" + }, + "pascalCase": { + "unsafeName": "FunctionName", + "safeName": "FunctionName" + } + }, + "wireValue": "function_name" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + } + ], + "extends": null, + "additionalProperties": false + }, + "type_:ToolMode": { + "type": "enum", + "declaration": { + "name": { + "originalName": "ToolMode", + "camelCase": { + "unsafeName": "toolMode", + "safeName": "toolMode" + }, + "snakeCase": { + "unsafeName": "tool_mode", + "safeName": "tool_mode" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE", + "safeName": "TOOL_MODE" + }, + "pascalCase": { + "unsafeName": "ToolMode", + "safeName": "ToolMode" + } + }, + "fernFilepath": { + "allParts": [], + "packagePath": [], + "file": null + } + }, + "values": [ + { + "name": { + "originalName": "TOOL_MODE_INVALID", + "camelCase": { + "unsafeName": "toolModeInvalid", + "safeName": "toolModeInvalid" + }, + "snakeCase": { + "unsafeName": "tool_mode_invalid", + "safeName": "tool_mode_invalid" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_INVALID", + "safeName": "TOOL_MODE_INVALID" + }, + "pascalCase": { + "unsafeName": "ToolModeInvalid", + "safeName": "ToolModeInvalid" + } + }, + "wireValue": "TOOL_MODE_INVALID" + }, + { + "name": { + "originalName": "TOOL_MODE_AUTO", + "camelCase": { + "unsafeName": "toolModeAuto", + "safeName": "toolModeAuto" + }, + "snakeCase": { + "unsafeName": "tool_mode_auto", + "safeName": "tool_mode_auto" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_AUTO", + "safeName": "TOOL_MODE_AUTO" + }, + "pascalCase": { + "unsafeName": "ToolModeAuto", + "safeName": "ToolModeAuto" + } + }, + "wireValue": "TOOL_MODE_AUTO" + }, + { + "name": { + "originalName": "TOOL_MODE_NONE", + "camelCase": { + "unsafeName": "toolModeNone", + "safeName": "toolModeNone" + }, + "snakeCase": { + "unsafeName": "tool_mode_none", + "safeName": "tool_mode_none" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_NONE", + "safeName": "TOOL_MODE_NONE" + }, + "pascalCase": { + "unsafeName": "ToolModeNone", + "safeName": "ToolModeNone" + } + }, + "wireValue": "TOOL_MODE_NONE" + }, + { + "name": { + "originalName": "TOOL_MODE_REQUIRED", + "camelCase": { + "unsafeName": "toolModeRequired", + "safeName": "toolModeRequired" + }, + "snakeCase": { + "unsafeName": "tool_mode_required", + "safeName": "tool_mode_required" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_MODE_REQUIRED", + "safeName": "TOOL_MODE_REQUIRED" + }, + "pascalCase": { + "unsafeName": "ToolModeRequired", + "safeName": "ToolModeRequired" + } + }, + "wireValue": "TOOL_MODE_REQUIRED" + } + ] + }, "type_:UpdateResponse": { "type": "object", "declaration": { @@ -30538,6 +35196,355 @@ }, "examples": null }, + "endpoint_dataService.Create": { + "auth": null, + "declaration": { + "name": { + "originalName": "Create", + "camelCase": { + "unsafeName": "create", + "safeName": "create" + }, + "snakeCase": { + "unsafeName": "create", + "safeName": "create" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE", + "safeName": "CREATE" + }, + "pascalCase": { + "unsafeName": "Create", + "safeName": "Create" + } + }, + "fernFilepath": { + "allParts": [ + { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + ], + "packagePath": [], + "file": { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + } + }, + "location": { + "method": "POST", + "path": "/data/create" + }, + "request": { + "type": "inlined", + "declaration": { + "name": { + "originalName": "CreateRequest", + "camelCase": { + "unsafeName": "createRequest", + "safeName": "createRequest" + }, + "snakeCase": { + "unsafeName": "create_request", + "safeName": "create_request" + }, + "screamingSnakeCase": { + "unsafeName": "CREATE_REQUEST", + "safeName": "CREATE_REQUEST" + }, + "pascalCase": { + "unsafeName": "CreateRequest", + "safeName": "CreateRequest" + } + }, + "fernFilepath": { + "allParts": [ + { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + ], + "packagePath": [], + "file": { + "originalName": "dataService", + "camelCase": { + "unsafeName": "dataService", + "safeName": "dataService" + }, + "snakeCase": { + "unsafeName": "data_service", + "safeName": "data_service" + }, + "screamingSnakeCase": { + "unsafeName": "DATA_SERVICE", + "safeName": "DATA_SERVICE" + }, + "pascalCase": { + "unsafeName": "DataService", + "safeName": "DataService" + } + } + } + }, + "pathParameters": [], + "queryParameters": [], + "headers": [], + "body": { + "type": "properties", + "value": [ + { + "name": { + "name": { + "originalName": "name", + "camelCase": { + "unsafeName": "name", + "safeName": "name" + }, + "snakeCase": { + "unsafeName": "name", + "safeName": "name" + }, + "screamingSnakeCase": { + "unsafeName": "NAME", + "safeName": "NAME" + }, + "pascalCase": { + "unsafeName": "Name", + "safeName": "Name" + } + }, + "wireValue": "name" + }, + "typeReference": { + "type": "primitive", + "value": "STRING" + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "description", + "camelCase": { + "unsafeName": "description", + "safeName": "description" + }, + "snakeCase": { + "unsafeName": "description", + "safeName": "description" + }, + "screamingSnakeCase": { + "unsafeName": "DESCRIPTION", + "safeName": "DESCRIPTION" + }, + "pascalCase": { + "unsafeName": "Description", + "safeName": "Description" + } + }, + "wireValue": "description" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "tool_choice", + "camelCase": { + "unsafeName": "toolChoice", + "safeName": "toolChoice" + }, + "snakeCase": { + "unsafeName": "tool_choice", + "safeName": "tool_choice" + }, + "screamingSnakeCase": { + "unsafeName": "TOOL_CHOICE", + "safeName": "TOOL_CHOICE" + }, + "pascalCase": { + "unsafeName": "ToolChoice", + "safeName": "ToolChoice" + } + }, + "wireValue": "tool_choice" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:ToolChoice" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "url", + "camelCase": { + "unsafeName": "url", + "safeName": "url" + }, + "snakeCase": { + "unsafeName": "url", + "safeName": "url" + }, + "screamingSnakeCase": { + "unsafeName": "URL", + "safeName": "URL" + }, + "pascalCase": { + "unsafeName": "URL", + "safeName": "URL" + } + }, + "wireValue": "url" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "content", + "camelCase": { + "unsafeName": "content", + "safeName": "content" + }, + "snakeCase": { + "unsafeName": "content", + "safeName": "content" + }, + "screamingSnakeCase": { + "unsafeName": "CONTENT", + "safeName": "CONTENT" + }, + "pascalCase": { + "unsafeName": "Content", + "safeName": "Content" + } + }, + "wireValue": "content" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "primitive", + "value": "STRING" + } + }, + "propertyAccess": null, + "variable": null + }, + { + "name": { + "name": { + "originalName": "metadata", + "camelCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "snakeCase": { + "unsafeName": "metadata", + "safeName": "metadata" + }, + "screamingSnakeCase": { + "unsafeName": "METADATA", + "safeName": "METADATA" + }, + "pascalCase": { + "unsafeName": "Metadata", + "safeName": "Metadata" + } + }, + "wireValue": "metadata" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:Metadata" + } + }, + "propertyAccess": null, + "variable": null + } + ] + }, + "metadata": { + "includePathParameters": false, + "onlyPathParameters": false + } + }, + "response": { + "type": "json" + }, + "examples": null + }, "endpoint_dataService.Delete": { "auth": null, "declaration": { @@ -32445,6 +37452,39 @@ }, "propertyAccess": null, "variable": null + }, + { + "name": { + "name": { + "originalName": "status", + "camelCase": { + "unsafeName": "status", + "safeName": "status" + }, + "snakeCase": { + "unsafeName": "status", + "safeName": "status" + }, + "screamingSnakeCase": { + "unsafeName": "STATUS", + "safeName": "STATUS" + }, + "pascalCase": { + "unsafeName": "Status", + "safeName": "Status" + } + }, + "wireValue": "status" + }, + "typeReference": { + "type": "optional", + "value": { + "type": "named", + "value": "type_:GoogleRpcStatus" + } + }, + "propertyAccess": null, + "variable": null } ] }, @@ -32627,10 +37667,12 @@ "types": [ "type_:AspectRatio", "type_:Column", + "type_:CreateResponse", "type_:DeleteResponse", "type_:DescribeResponse", "type_:FetchResponse", "type_:FieldBehavior", + "type_:GoogleRpcStatus", "type_:IndexType", "type_:IndexedData", "type_:ListElement", @@ -32641,6 +37683,8 @@ "type_:QueryResponse", "type_:QueryResult", "type_:ScoredColumn", + "type_:ToolChoice", + "type_:ToolMode", "type_:UpdateResponse", "type_:UploadResponse", "type_:Usage", diff --git a/packages/cli/workspace/lazy-fern-workspace/src/protobuf/ProtobufOpenAPIGenerator.ts b/packages/cli/workspace/lazy-fern-workspace/src/protobuf/ProtobufOpenAPIGenerator.ts index bb85a032cdb0..cb23b0900749 100644 --- a/packages/cli/workspace/lazy-fern-workspace/src/protobuf/ProtobufOpenAPIGenerator.ts +++ b/packages/cli/workspace/lazy-fern-workspace/src/protobuf/ProtobufOpenAPIGenerator.ts @@ -215,6 +215,7 @@ plugins: - title="" - enum_type=string - default_response=false + - flatten_oneofs=true - source_root=${relativeFilepathToProtobufRoot} `; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/data/v1/data.proto b/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/data/v1/data.proto index 46947f1d26ee..ad21e7d6fdba 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/data/v1/data.proto +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/data/v1/data.proto @@ -7,6 +7,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; option csharp_namespace = "Data.V1.Grpc"; option go_package = "github.com/acme.co/data-go-grpc"; @@ -164,6 +165,7 @@ message UpdateRequest { google.protobuf.Any details = 7; repeated IndexType index_types = 8; optional AspectRatio aspect_ratio = 9; + optional google.rpc.Status status = 10; } message UpdateResponse { @@ -173,6 +175,67 @@ message UpdateResponse { repeated IndexType index_types = 4; } +enum ToolMode { + // Invalid tool mode. + TOOL_MODE_INVALID = 0; + + // Let the model decide if a tool shall be used. + TOOL_MODE_AUTO = 1; + + // Force the model to not use tools. + TOOL_MODE_NONE = 2; + + // Force the model to use tools. + TOOL_MODE_REQUIRED = 3; +} + +message ToolChoice { + oneof tool_choice { + // Force the model to perform in a given mode. + ToolMode mode = 1; + + // Force the model to call a particular function. + string function_name = 2; + } +} + +message CreateRequest { + // The name of the resource to create. + string name = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // A description of the resource. + string description = 2; + + // The tool choice configuration. + ToolChoice tool_choice = 3; + + oneof source { + // A URL to fetch the resource from. + string url = 4; + + // Inline content for the resource. + string content = 5; + } + + // Optional metadata for the resource. + google.protobuf.Struct metadata = 6; +} + +message CreateResponse { + // The created resource. + Column resource = 1; + + oneof status { + // Indicates successful creation. + bool success = 2; + + // Error message if creation failed. + string error_message = 3; + } +} + message DescribeRequest { google.protobuf.Struct filter = 1; google.protobuf.Timestamp after = 2; @@ -236,4 +299,11 @@ service DataService { body: "*" }; } + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/data/create" + body: "*" + }; + } } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/google/rpc/status.proto b/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/google/rpc/status.proto new file mode 100644 index 000000000000..c667e18e2a60 --- /dev/null +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/proto/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} \ No newline at end of file diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/Column.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/Column.cs index ef225e7518ab..a6acb12cc729 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/Column.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/Column.cs @@ -36,9 +36,9 @@ internal static Column FromProto(ProtoDataV1Grpc.Column value) { Id = value.Id, Values = value.Values?.ToList() ?? Enumerable.Empty(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/CreateResponse.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/CreateResponse.cs new file mode 100644 index 000000000000..7fa2d9fe625a --- /dev/null +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/CreateResponse.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The created resource. + /// + [JsonPropertyName("resource")] + public Column? Resource { get; set; } + + /// + /// Indicates successful creation. + /// + [JsonPropertyName("success")] + public bool? Success { get; set; } + + /// + /// Error message if creation failed. + /// + [JsonPropertyName("error_message")] + public string? ErrorMessage { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new CreateResponse type from its Protobuf-equivalent representation. + /// + internal static CreateResponse FromProto(ProtoDataV1Grpc.CreateResponse value) + { + return new CreateResponse + { + Resource = value.Resource != null ? SeedApi.Column.FromProto(value.Resource) : null, + Success = value.Success, + ErrorMessage = value.ErrorMessage, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the CreateResponse type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.CreateResponse ToProto() + { + var result = new ProtoDataV1Grpc.CreateResponse(); + if (Resource != null) + { + result.Resource = Resource.ToProto(); + } + if (Success != null) + { + result.Success = Success ?? false; + } + if (ErrorMessage != null) + { + result.ErrorMessage = ErrorMessage ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/DescribeResponse.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/DescribeResponse.cs index be7b2a6f4b01..c2e128b16562 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/DescribeResponse.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/DescribeResponse.cs @@ -36,7 +36,7 @@ internal static DescribeResponse FromProto(ProtoDataV1Grpc.DescribeResponse valu { Namespaces = value.Namespaces?.ToDictionary( kvp => kvp.Key, - kvp => NamespaceSummary.FromProto(kvp.Value) + kvp => SeedApi.NamespaceSummary.FromProto(kvp.Value) ), Dimension = value.Dimension, Fullness = value.Fullness, diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/FetchResponse.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/FetchResponse.cs index 0558b91da66e..9fb104c644aa 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/FetchResponse.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/FetchResponse.cs @@ -33,10 +33,10 @@ internal static FetchResponse FromProto(ProtoDataV1Grpc.FetchResponse value) { Columns = value.Columns?.ToDictionary( kvp => kvp.Key, - kvp => Column.FromProto(kvp.Value) + kvp => SeedApi.Column.FromProto(kvp.Value) ), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ListResponse.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ListResponse.cs index 72b63f8287fd..00c91bba9b0f 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ListResponse.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ListResponse.cs @@ -34,10 +34,11 @@ internal static ListResponse FromProto(ProtoDataV1Grpc.ListResponse value) { return new ListResponse { - Columns = value.Columns?.Select(ListElement.FromProto), - Pagination = value.Pagination != null ? Pagination.FromProto(value.Pagination) : null, + Columns = value.Columns?.Select(SeedApi.ListElement.FromProto), + Pagination = + value.Pagination != null ? SeedApi.Pagination.FromProto(value.Pagination) : null, Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryColumn.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryColumn.cs index d2621a6d87c6..45988601ffe4 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryColumn.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryColumn.cs @@ -40,9 +40,9 @@ internal static QueryColumn FromProto(ProtoDataV1Grpc.QueryColumn value) Values = value.Values?.ToList() ?? Enumerable.Empty(), TopK = value.TopK, Namespace = value.Namespace, - Filter = value.Filter != null ? Metadata.FromProto(value.Filter) : null, + Filter = value.Filter != null ? SeedApi.Metadata.FromProto(value.Filter) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResponse.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResponse.cs index 9242ccd094a1..de9bed0dbf47 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResponse.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResponse.cs @@ -34,10 +34,10 @@ internal static QueryResponse FromProto(ProtoDataV1Grpc.QueryResponse value) { return new QueryResponse { - Results = value.Results?.Select(QueryResult.FromProto), - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Results = value.Results?.Select(SeedApi.QueryResult.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResult.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResult.cs index 8a0ab47d124a..583b1934df67 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResult.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/QueryResult.cs @@ -28,7 +28,7 @@ internal static QueryResult FromProto(ProtoDataV1Grpc.QueryResult value) { return new QueryResult { - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ScoredColumn.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ScoredColumn.cs index a0d7fc819768..918bcd5c1126 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ScoredColumn.cs +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ScoredColumn.cs @@ -40,9 +40,9 @@ internal static ScoredColumn FromProto(ProtoDataV1Grpc.ScoredColumn value) Id = value.Id, Score = value.Score, Values = value.Values?.ToList(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/SeedApi.csproj b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/SeedApi.csproj index 70240c028c83..648e0bbc6339 100644 --- a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@ - + + @@ -60,21 +61,6 @@ GrpcServices="Client" ProtoRoot="..\..\proto" > - - - diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolChoice.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolChoice.cs new file mode 100644 index 000000000000..220894b0dc66 --- /dev/null +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolChoice.cs @@ -0,0 +1,81 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record ToolChoice : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Force the model to perform in a given mode. + /// + [JsonPropertyName("mode")] + public ToolMode? Mode { get; set; } + + /// + /// Force the model to call a particular function. + /// + [JsonPropertyName("function_name")] + public string? FunctionName { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new ToolChoice type from its Protobuf-equivalent representation. + /// + internal static ToolChoice FromProto(ProtoDataV1Grpc.ToolChoice value) + { + return new ToolChoice + { + Mode = value.Mode switch + { + ProtoDataV1Grpc.ToolMode.Invalid => SeedApi.ToolMode.ToolModeInvalid, + ProtoDataV1Grpc.ToolMode.Auto => SeedApi.ToolMode.ToolModeAuto, + ProtoDataV1Grpc.ToolMode.None => SeedApi.ToolMode.ToolModeNone, + ProtoDataV1Grpc.ToolMode.Required => SeedApi.ToolMode.ToolModeRequired, + _ => throw new ArgumentException($"Unknown enum value: {value.Mode}"), + }, + FunctionName = value.FunctionName, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the ToolChoice type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.ToolChoice ToProto() + { + var result = new ProtoDataV1Grpc.ToolChoice(); + if (Mode != null) + { + result.Mode = Mode.Value.Value switch + { + SeedApi.ToolMode.Values.ToolModeInvalid => ProtoDataV1Grpc.ToolMode.Invalid, + SeedApi.ToolMode.Values.ToolModeAuto => ProtoDataV1Grpc.ToolMode.Auto, + SeedApi.ToolMode.Values.ToolModeNone => ProtoDataV1Grpc.ToolMode.None, + SeedApi.ToolMode.Values.ToolModeRequired => ProtoDataV1Grpc.ToolMode.Required, + _ => throw new ArgumentException($"Unknown enum value: {Mode.Value.Value}"), + }; + } + if (FunctionName != null) + { + result.FunctionName = FunctionName ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolMode.cs b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolMode.cs new file mode 100644 index 000000000000..793114c3ac94 --- /dev/null +++ b/seed/csharp-model/csharp-grpc-proto-exhaustive/src/SeedApi/ToolMode.cs @@ -0,0 +1,98 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; + +namespace SeedApi; + +[JsonConverter(typeof(ToolMode.ToolModeSerializer))] +[Serializable] +public readonly record struct ToolMode : IStringEnum +{ + public static readonly ToolMode ToolModeInvalid = new(Values.ToolModeInvalid); + + public static readonly ToolMode ToolModeAuto = new(Values.ToolModeAuto); + + public static readonly ToolMode ToolModeNone = new(Values.ToolModeNone); + + public static readonly ToolMode ToolModeRequired = new(Values.ToolModeRequired); + + public ToolMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ToolMode FromCustom(string value) + { + return new ToolMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(ToolMode value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(ToolMode value1, string value2) => !value1.Value.Equals(value2); + + public static explicit operator string(ToolMode value) => value.Value; + + public static explicit operator ToolMode(string value) => new(value); + + internal class ToolModeSerializer : JsonConverter + { + public override ToolMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ToolMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ToolMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ToolModeInvalid = "TOOL_MODE_INVALID"; + + public const string ToolModeAuto = "TOOL_MODE_AUTO"; + + public const string ToolModeNone = "TOOL_MODE_NONE"; + + public const string ToolModeRequired = "TOOL_MODE_REQUIRED"; + } +} diff --git a/seed/csharp-model/csharp-grpc-proto/src/SeedApi/CreateResponse.cs b/seed/csharp-model/csharp-grpc-proto/src/SeedApi/CreateResponse.cs index 9e0d9e26441c..c6c7630c7323 100644 --- a/seed/csharp-model/csharp-grpc-proto/src/SeedApi/CreateResponse.cs +++ b/seed/csharp-model/csharp-grpc-proto/src/SeedApi/CreateResponse.cs @@ -25,7 +25,7 @@ internal static CreateResponse FromProto(ProtoUserV1.CreateResponse value) { return new CreateResponse { - User = value.User != null ? UserModel.FromProto(value.User) : null, + User = value.User != null ? SeedApi.UserModel.FromProto(value.User) : null, }; } diff --git a/seed/csharp-model/csharp-grpc-proto/src/SeedApi/SeedApi.csproj b/seed/csharp-model/csharp-grpc-proto/src/SeedApi/SeedApi.csproj index 7f0abbb33f49..942053cc173c 100644 --- a/seed/csharp-model/csharp-grpc-proto/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-model/csharp-grpc-proto/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@ - + + @@ -55,16 +56,6 @@ - - + + + + +
client.DataService.CreateAsync(CreateRequest { ... }) -> WithRawResponseTask<CreateResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateRequest` + +
+
+
+
+ +
diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/snippet.json b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/snippet.json index c435d6f7c198..932451b1d5c5 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/snippet.json +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/snippet.json @@ -13,6 +13,18 @@ "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.UploadAsync(\n new UploadRequest\n {\n Columns = new List()\n {\n new SeedApi.Column\n {\n Id = \"id\",\n Values = new List() { 1.1f },\n },\n },\n }\n);\n" } }, + { + "example_identifier": null, + "id": { + "path": "/data/create", + "method": "POST", + "identifier_override": "endpoint_dataService.Create" + }, + "snippet": { + "type": "csharp", + "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.CreateAsync(new CreateRequest { Name = \"name\" });\n" + } + }, { "example_identifier": null, "id": { diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/DataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/DataServiceClient.cs index 2732b8386e7f..430f0c86e30b 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/DataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/DataServiceClient.cs @@ -102,6 +102,69 @@ public async Task UploadAsync( .ConfigureAwait(false); } + /// + /// await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); + /// + public async Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return await _client + .Options.ExceptionHandler.TryCatchAsync(async () => + { + try + { + var metadata = new global::Grpc.Core.Metadata(); + foreach (var header in _client.Options.Headers) + { + var value = await header.Value.ResolveAsync().ConfigureAwait(false); + metadata.Add(header.Key, value); + } + if (_client.Options.AdditionalHeaders != null) + { + foreach (var header in _client.Options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + if (options?.AdditionalHeaders != null) + { + foreach (var header in options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + + var callOptions = _grpc.CreateCallOptions( + metadata, + options ?? new GrpcRequestOptions(), + cancellationToken + ); + var call = _dataService.CreateAsync(request.ToProto(), callOptions); + var response = await call.ConfigureAwait(false); + return CreateResponse.FromProto(response); + } + catch (RpcException rpc) + { + var statusCode = (int)rpc.StatusCode; + throw new SeedApiApiException( + $"Error with gRPC status code {statusCode}", + statusCode, + rpc.Message + ); + } + catch (Exception e) + { + throw new SeedApiException("Error", e); + } + }) + .ConfigureAwait(false); + } + /// /// await client.DataService.DeleteAsync(new DeleteRequest()); /// diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/IDataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/IDataServiceClient.cs index 52d48a495b2b..8a0649baf662 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/IDataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/IDataServiceClient.cs @@ -8,6 +8,12 @@ Task UploadAsync( CancellationToken cancellationToken = default ); + Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( DeleteRequest request, GrpcRequestOptions? options = null, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/CreateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/CreateRequest.cs new file mode 100644 index 000000000000..48284d38d15d --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/CreateRequest.cs @@ -0,0 +1,81 @@ +using System.Text.Json.Serialization; +using SeedApi.Core; +using Proto = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateRequest +{ + /// + /// The name of the resource to create. + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// A description of the resource. + /// + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// The tool choice configuration. + /// + [JsonPropertyName("tool_choice")] + public ToolChoice? ToolChoice { get; set; } + + /// + /// A URL to fetch the resource from. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Inline content for the resource. + /// + [JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// Optional metadata for the resource. + /// + [JsonPropertyName("metadata")] + public Metadata? Metadata { get; set; } + + /// + /// Maps the CreateRequest type into its Protobuf-equivalent representation. + /// + internal Proto.CreateRequest ToProto() + { + var result = new Proto.CreateRequest(); + result.Name = Name; + if (Description != null) + { + result.Description = Description ?? ""; + } + if (ToolChoice != null) + { + result.ToolChoice = ToolChoice.ToProto(); + } + if (Url != null) + { + result.Url = Url ?? ""; + } + if (Content != null) + { + result.Content = Content ?? ""; + } + if (Metadata != null) + { + result.Metadata = Metadata.ToProto(); + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/UpdateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/UpdateRequest.cs index 5301c75e711f..ed3242345df0 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/UpdateRequest.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/DataService/Requests/UpdateRequest.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Google.Rpc; using SeedApi.Core; using Proto = Data.V1.Grpc; using ProtoDataV1Grpc = Data.V1.Grpc; @@ -35,6 +36,9 @@ public record UpdateRequest [JsonPropertyName("aspect_ratio")] public AspectRatio? AspectRatio { get; set; } + [JsonPropertyName("status")] + public Status? Status { get; set; } + /// /// Maps the UpdateRequest type into its Protobuf-equivalent representation. /// @@ -106,6 +110,10 @@ internal Proto.UpdateRequest ToProto() _ => throw new ArgumentException($"Unknown enum value: {AspectRatio.Value.Value}"), }; } + if (Status != null) + { + result.Status = Status; + } return result; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/SeedApi.csproj b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/SeedApi.csproj index 70240c028c83..648e0bbc6339 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@
- + + @@ -60,21 +61,6 @@ GrpcServices="Client" ProtoRoot="..\..\proto" > - - - diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/Column.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/Column.cs index ef225e7518ab..a6acb12cc729 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/Column.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/Column.cs @@ -36,9 +36,9 @@ internal static Column FromProto(ProtoDataV1Grpc.Column value) { Id = value.Id, Values = value.Values?.ToList() ?? Enumerable.Empty(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/CreateResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/CreateResponse.cs new file mode 100644 index 000000000000..7fa2d9fe625a --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/CreateResponse.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The created resource. + /// + [JsonPropertyName("resource")] + public Column? Resource { get; set; } + + /// + /// Indicates successful creation. + /// + [JsonPropertyName("success")] + public bool? Success { get; set; } + + /// + /// Error message if creation failed. + /// + [JsonPropertyName("error_message")] + public string? ErrorMessage { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new CreateResponse type from its Protobuf-equivalent representation. + /// + internal static CreateResponse FromProto(ProtoDataV1Grpc.CreateResponse value) + { + return new CreateResponse + { + Resource = value.Resource != null ? SeedApi.Column.FromProto(value.Resource) : null, + Success = value.Success, + ErrorMessage = value.ErrorMessage, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the CreateResponse type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.CreateResponse ToProto() + { + var result = new ProtoDataV1Grpc.CreateResponse(); + if (Resource != null) + { + result.Resource = Resource.ToProto(); + } + if (Success != null) + { + result.Success = Success ?? false; + } + if (ErrorMessage != null) + { + result.ErrorMessage = ErrorMessage ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/DescribeResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/DescribeResponse.cs index be7b2a6f4b01..c2e128b16562 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/DescribeResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/DescribeResponse.cs @@ -36,7 +36,7 @@ internal static DescribeResponse FromProto(ProtoDataV1Grpc.DescribeResponse valu { Namespaces = value.Namespaces?.ToDictionary( kvp => kvp.Key, - kvp => NamespaceSummary.FromProto(kvp.Value) + kvp => SeedApi.NamespaceSummary.FromProto(kvp.Value) ), Dimension = value.Dimension, Fullness = value.Fullness, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/FetchResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/FetchResponse.cs index 0558b91da66e..9fb104c644aa 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/FetchResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/FetchResponse.cs @@ -33,10 +33,10 @@ internal static FetchResponse FromProto(ProtoDataV1Grpc.FetchResponse value) { Columns = value.Columns?.ToDictionary( kvp => kvp.Key, - kvp => Column.FromProto(kvp.Value) + kvp => SeedApi.Column.FromProto(kvp.Value) ), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ListResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ListResponse.cs index 72b63f8287fd..00c91bba9b0f 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ListResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ListResponse.cs @@ -34,10 +34,11 @@ internal static ListResponse FromProto(ProtoDataV1Grpc.ListResponse value) { return new ListResponse { - Columns = value.Columns?.Select(ListElement.FromProto), - Pagination = value.Pagination != null ? Pagination.FromProto(value.Pagination) : null, + Columns = value.Columns?.Select(SeedApi.ListElement.FromProto), + Pagination = + value.Pagination != null ? SeedApi.Pagination.FromProto(value.Pagination) : null, Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryColumn.cs index d2621a6d87c6..45988601ffe4 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryColumn.cs @@ -40,9 +40,9 @@ internal static QueryColumn FromProto(ProtoDataV1Grpc.QueryColumn value) Values = value.Values?.ToList() ?? Enumerable.Empty(), TopK = value.TopK, Namespace = value.Namespace, - Filter = value.Filter != null ? Metadata.FromProto(value.Filter) : null, + Filter = value.Filter != null ? SeedApi.Metadata.FromProto(value.Filter) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResponse.cs index 9242ccd094a1..de9bed0dbf47 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResponse.cs @@ -34,10 +34,10 @@ internal static QueryResponse FromProto(ProtoDataV1Grpc.QueryResponse value) { return new QueryResponse { - Results = value.Results?.Select(QueryResult.FromProto), - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Results = value.Results?.Select(SeedApi.QueryResult.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResult.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResult.cs index 8a0ab47d124a..583b1934df67 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResult.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/QueryResult.cs @@ -28,7 +28,7 @@ internal static QueryResult FromProto(ProtoDataV1Grpc.QueryResult value) { return new QueryResult { - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ScoredColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ScoredColumn.cs index a0d7fc819768..918bcd5c1126 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ScoredColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ScoredColumn.cs @@ -40,9 +40,9 @@ internal static ScoredColumn FromProto(ProtoDataV1Grpc.ScoredColumn value) Id = value.Id, Score = value.Score, Values = value.Values?.ToList(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolChoice.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolChoice.cs new file mode 100644 index 000000000000..220894b0dc66 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolChoice.cs @@ -0,0 +1,81 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record ToolChoice : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Force the model to perform in a given mode. + /// + [JsonPropertyName("mode")] + public ToolMode? Mode { get; set; } + + /// + /// Force the model to call a particular function. + /// + [JsonPropertyName("function_name")] + public string? FunctionName { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new ToolChoice type from its Protobuf-equivalent representation. + /// + internal static ToolChoice FromProto(ProtoDataV1Grpc.ToolChoice value) + { + return new ToolChoice + { + Mode = value.Mode switch + { + ProtoDataV1Grpc.ToolMode.Invalid => SeedApi.ToolMode.ToolModeInvalid, + ProtoDataV1Grpc.ToolMode.Auto => SeedApi.ToolMode.ToolModeAuto, + ProtoDataV1Grpc.ToolMode.None => SeedApi.ToolMode.ToolModeNone, + ProtoDataV1Grpc.ToolMode.Required => SeedApi.ToolMode.ToolModeRequired, + _ => throw new ArgumentException($"Unknown enum value: {value.Mode}"), + }, + FunctionName = value.FunctionName, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the ToolChoice type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.ToolChoice ToProto() + { + var result = new ProtoDataV1Grpc.ToolChoice(); + if (Mode != null) + { + result.Mode = Mode.Value.Value switch + { + SeedApi.ToolMode.Values.ToolModeInvalid => ProtoDataV1Grpc.ToolMode.Invalid, + SeedApi.ToolMode.Values.ToolModeAuto => ProtoDataV1Grpc.ToolMode.Auto, + SeedApi.ToolMode.Values.ToolModeNone => ProtoDataV1Grpc.ToolMode.None, + SeedApi.ToolMode.Values.ToolModeRequired => ProtoDataV1Grpc.ToolMode.Required, + _ => throw new ArgumentException($"Unknown enum value: {Mode.Value.Value}"), + }; + } + if (FunctionName != null) + { + result.FunctionName = FunctionName ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolMode.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolMode.cs new file mode 100644 index 000000000000..793114c3ac94 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/include-exception-handler/src/SeedApi/Types/ToolMode.cs @@ -0,0 +1,98 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; + +namespace SeedApi; + +[JsonConverter(typeof(ToolMode.ToolModeSerializer))] +[Serializable] +public readonly record struct ToolMode : IStringEnum +{ + public static readonly ToolMode ToolModeInvalid = new(Values.ToolModeInvalid); + + public static readonly ToolMode ToolModeAuto = new(Values.ToolModeAuto); + + public static readonly ToolMode ToolModeNone = new(Values.ToolModeNone); + + public static readonly ToolMode ToolModeRequired = new(Values.ToolModeRequired); + + public ToolMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ToolMode FromCustom(string value) + { + return new ToolMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(ToolMode value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(ToolMode value1, string value2) => !value1.Value.Equals(value2); + + public static explicit operator string(ToolMode value) => value.Value; + + public static explicit operator ToolMode(string value) => new(value); + + internal class ToolModeSerializer : JsonConverter + { + public override ToolMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ToolMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ToolMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ToolModeInvalid = "TOOL_MODE_INVALID"; + + public const string ToolModeAuto = "TOOL_MODE_AUTO"; + + public const string ToolModeNone = "TOOL_MODE_NONE"; + + public const string ToolModeRequired = "TOOL_MODE_REQUIRED"; + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/data/v1/data.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/data/v1/data.proto index 46947f1d26ee..ad21e7d6fdba 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/data/v1/data.proto +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/data/v1/data.proto @@ -7,6 +7,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; option csharp_namespace = "Data.V1.Grpc"; option go_package = "github.com/acme.co/data-go-grpc"; @@ -164,6 +165,7 @@ message UpdateRequest { google.protobuf.Any details = 7; repeated IndexType index_types = 8; optional AspectRatio aspect_ratio = 9; + optional google.rpc.Status status = 10; } message UpdateResponse { @@ -173,6 +175,67 @@ message UpdateResponse { repeated IndexType index_types = 4; } +enum ToolMode { + // Invalid tool mode. + TOOL_MODE_INVALID = 0; + + // Let the model decide if a tool shall be used. + TOOL_MODE_AUTO = 1; + + // Force the model to not use tools. + TOOL_MODE_NONE = 2; + + // Force the model to use tools. + TOOL_MODE_REQUIRED = 3; +} + +message ToolChoice { + oneof tool_choice { + // Force the model to perform in a given mode. + ToolMode mode = 1; + + // Force the model to call a particular function. + string function_name = 2; + } +} + +message CreateRequest { + // The name of the resource to create. + string name = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // A description of the resource. + string description = 2; + + // The tool choice configuration. + ToolChoice tool_choice = 3; + + oneof source { + // A URL to fetch the resource from. + string url = 4; + + // Inline content for the resource. + string content = 5; + } + + // Optional metadata for the resource. + google.protobuf.Struct metadata = 6; +} + +message CreateResponse { + // The created resource. + Column resource = 1; + + oneof status { + // Indicates successful creation. + bool success = 2; + + // Error message if creation failed. + string error_message = 3; + } +} + message DescribeRequest { google.protobuf.Struct filter = 1; google.protobuf.Timestamp after = 2; @@ -236,4 +299,11 @@ service DataService { body: "*" }; } + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/data/create" + body: "*" + }; + } } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/google/rpc/status.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/google/rpc/status.proto new file mode 100644 index 000000000000..c667e18e2a60 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/proto/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} \ No newline at end of file diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/reference.md b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/reference.md index bc7264303b43..3a9e571c20d4 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/reference.md +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/reference.md @@ -73,6 +73,46 @@ await client.DataService.UploadAsync( + + + + +
client.DataService.CreateAsync(CreateRequest { ... }) -> WithRawResponseTask<CreateResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateRequest` + +
+
+
+
+ +
diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/snippet.json b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/snippet.json index c435d6f7c198..932451b1d5c5 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/snippet.json +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/snippet.json @@ -13,6 +13,18 @@ "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.UploadAsync(\n new UploadRequest\n {\n Columns = new List()\n {\n new SeedApi.Column\n {\n Id = \"id\",\n Values = new List() { 1.1f },\n },\n },\n }\n);\n" } }, + { + "example_identifier": null, + "id": { + "path": "/data/create", + "method": "POST", + "identifier_override": "endpoint_dataService.Create" + }, + "snippet": { + "type": "csharp", + "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.CreateAsync(new CreateRequest { Name = \"name\" });\n" + } + }, { "example_identifier": null, "id": { diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/DataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/DataServiceClient.cs index 29883eb5de76..823f39bf4999 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/DataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/DataServiceClient.cs @@ -89,6 +89,64 @@ public async Task UploadAsync( } } + /// + /// await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); + /// + public async Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + try + { + var metadata = new global::Grpc.Core.Metadata(); + foreach (var header in _client.Options.Headers) + { + var value = await header.Value.ResolveAsync().ConfigureAwait(false); + metadata.Add(header.Key, value); + } + if (_client.Options.AdditionalHeaders != null) + { + foreach (var header in _client.Options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + if (options?.AdditionalHeaders != null) + { + foreach (var header in options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + + var callOptions = _grpc.CreateCallOptions( + metadata, + options ?? new GrpcRequestOptions(), + cancellationToken + ); + var call = _dataService.CreateAsync(request.ToProto(), callOptions); + var response = await call.ConfigureAwait(false); + return CreateResponse.FromProto(response); + } + catch (RpcException rpc) + { + var statusCode = (int)rpc.StatusCode; + throw new SeedApiApiException( + $"Error with gRPC status code {statusCode}", + statusCode, + rpc.Message + ); + } + catch (Exception e) + { + throw new SeedApiException("Error", e); + } + } + /// /// await client.DataService.DeleteAsync(new DeleteRequest()); /// diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/IDataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/IDataServiceClient.cs index 52d48a495b2b..8a0649baf662 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/IDataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/IDataServiceClient.cs @@ -8,6 +8,12 @@ Task UploadAsync( CancellationToken cancellationToken = default ); + Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( DeleteRequest request, GrpcRequestOptions? options = null, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/CreateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/CreateRequest.cs new file mode 100644 index 000000000000..48284d38d15d --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/CreateRequest.cs @@ -0,0 +1,81 @@ +using System.Text.Json.Serialization; +using SeedApi.Core; +using Proto = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateRequest +{ + /// + /// The name of the resource to create. + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// A description of the resource. + /// + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// The tool choice configuration. + /// + [JsonPropertyName("tool_choice")] + public ToolChoice? ToolChoice { get; set; } + + /// + /// A URL to fetch the resource from. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Inline content for the resource. + /// + [JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// Optional metadata for the resource. + /// + [JsonPropertyName("metadata")] + public Metadata? Metadata { get; set; } + + /// + /// Maps the CreateRequest type into its Protobuf-equivalent representation. + /// + internal Proto.CreateRequest ToProto() + { + var result = new Proto.CreateRequest(); + result.Name = Name; + if (Description != null) + { + result.Description = Description ?? ""; + } + if (ToolChoice != null) + { + result.ToolChoice = ToolChoice.ToProto(); + } + if (Url != null) + { + result.Url = Url ?? ""; + } + if (Content != null) + { + result.Content = Content ?? ""; + } + if (Metadata != null) + { + result.Metadata = Metadata.ToProto(); + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/UpdateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/UpdateRequest.cs index 5301c75e711f..ed3242345df0 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/UpdateRequest.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/DataService/Requests/UpdateRequest.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Google.Rpc; using SeedApi.Core; using Proto = Data.V1.Grpc; using ProtoDataV1Grpc = Data.V1.Grpc; @@ -35,6 +36,9 @@ public record UpdateRequest [JsonPropertyName("aspect_ratio")] public AspectRatio? AspectRatio { get; set; } + [JsonPropertyName("status")] + public Status? Status { get; set; } + /// /// Maps the UpdateRequest type into its Protobuf-equivalent representation. /// @@ -106,6 +110,10 @@ internal Proto.UpdateRequest ToProto() _ => throw new ArgumentException($"Unknown enum value: {AspectRatio.Value.Value}"), }; } + if (Status != null) + { + result.Status = Status; + } return result; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/SeedApi.csproj b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/SeedApi.csproj index 70240c028c83..648e0bbc6339 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@
- + + @@ -60,21 +61,6 @@ GrpcServices="Client" ProtoRoot="..\..\proto" > - - - diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/Column.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/Column.cs index ef225e7518ab..a6acb12cc729 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/Column.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/Column.cs @@ -36,9 +36,9 @@ internal static Column FromProto(ProtoDataV1Grpc.Column value) { Id = value.Id, Values = value.Values?.ToList() ?? Enumerable.Empty(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/CreateResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/CreateResponse.cs new file mode 100644 index 000000000000..7fa2d9fe625a --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/CreateResponse.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The created resource. + /// + [JsonPropertyName("resource")] + public Column? Resource { get; set; } + + /// + /// Indicates successful creation. + /// + [JsonPropertyName("success")] + public bool? Success { get; set; } + + /// + /// Error message if creation failed. + /// + [JsonPropertyName("error_message")] + public string? ErrorMessage { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new CreateResponse type from its Protobuf-equivalent representation. + /// + internal static CreateResponse FromProto(ProtoDataV1Grpc.CreateResponse value) + { + return new CreateResponse + { + Resource = value.Resource != null ? SeedApi.Column.FromProto(value.Resource) : null, + Success = value.Success, + ErrorMessage = value.ErrorMessage, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the CreateResponse type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.CreateResponse ToProto() + { + var result = new ProtoDataV1Grpc.CreateResponse(); + if (Resource != null) + { + result.Resource = Resource.ToProto(); + } + if (Success != null) + { + result.Success = Success ?? false; + } + if (ErrorMessage != null) + { + result.ErrorMessage = ErrorMessage ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/DescribeResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/DescribeResponse.cs index be7b2a6f4b01..c2e128b16562 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/DescribeResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/DescribeResponse.cs @@ -36,7 +36,7 @@ internal static DescribeResponse FromProto(ProtoDataV1Grpc.DescribeResponse valu { Namespaces = value.Namespaces?.ToDictionary( kvp => kvp.Key, - kvp => NamespaceSummary.FromProto(kvp.Value) + kvp => SeedApi.NamespaceSummary.FromProto(kvp.Value) ), Dimension = value.Dimension, Fullness = value.Fullness, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/FetchResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/FetchResponse.cs index 0558b91da66e..9fb104c644aa 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/FetchResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/FetchResponse.cs @@ -33,10 +33,10 @@ internal static FetchResponse FromProto(ProtoDataV1Grpc.FetchResponse value) { Columns = value.Columns?.ToDictionary( kvp => kvp.Key, - kvp => Column.FromProto(kvp.Value) + kvp => SeedApi.Column.FromProto(kvp.Value) ), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ListResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ListResponse.cs index 72b63f8287fd..00c91bba9b0f 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ListResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ListResponse.cs @@ -34,10 +34,11 @@ internal static ListResponse FromProto(ProtoDataV1Grpc.ListResponse value) { return new ListResponse { - Columns = value.Columns?.Select(ListElement.FromProto), - Pagination = value.Pagination != null ? Pagination.FromProto(value.Pagination) : null, + Columns = value.Columns?.Select(SeedApi.ListElement.FromProto), + Pagination = + value.Pagination != null ? SeedApi.Pagination.FromProto(value.Pagination) : null, Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryColumn.cs index d2621a6d87c6..45988601ffe4 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryColumn.cs @@ -40,9 +40,9 @@ internal static QueryColumn FromProto(ProtoDataV1Grpc.QueryColumn value) Values = value.Values?.ToList() ?? Enumerable.Empty(), TopK = value.TopK, Namespace = value.Namespace, - Filter = value.Filter != null ? Metadata.FromProto(value.Filter) : null, + Filter = value.Filter != null ? SeedApi.Metadata.FromProto(value.Filter) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResponse.cs index 9242ccd094a1..de9bed0dbf47 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResponse.cs @@ -34,10 +34,10 @@ internal static QueryResponse FromProto(ProtoDataV1Grpc.QueryResponse value) { return new QueryResponse { - Results = value.Results?.Select(QueryResult.FromProto), - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Results = value.Results?.Select(SeedApi.QueryResult.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResult.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResult.cs index 8a0ab47d124a..583b1934df67 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResult.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/QueryResult.cs @@ -28,7 +28,7 @@ internal static QueryResult FromProto(ProtoDataV1Grpc.QueryResult value) { return new QueryResult { - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ScoredColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ScoredColumn.cs index a0d7fc819768..918bcd5c1126 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ScoredColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ScoredColumn.cs @@ -40,9 +40,9 @@ internal static ScoredColumn FromProto(ProtoDataV1Grpc.ScoredColumn value) Id = value.Id, Score = value.Score, Values = value.Values?.ToList(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolChoice.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolChoice.cs new file mode 100644 index 000000000000..220894b0dc66 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolChoice.cs @@ -0,0 +1,81 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record ToolChoice : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Force the model to perform in a given mode. + /// + [JsonPropertyName("mode")] + public ToolMode? Mode { get; set; } + + /// + /// Force the model to call a particular function. + /// + [JsonPropertyName("function_name")] + public string? FunctionName { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new ToolChoice type from its Protobuf-equivalent representation. + /// + internal static ToolChoice FromProto(ProtoDataV1Grpc.ToolChoice value) + { + return new ToolChoice + { + Mode = value.Mode switch + { + ProtoDataV1Grpc.ToolMode.Invalid => SeedApi.ToolMode.ToolModeInvalid, + ProtoDataV1Grpc.ToolMode.Auto => SeedApi.ToolMode.ToolModeAuto, + ProtoDataV1Grpc.ToolMode.None => SeedApi.ToolMode.ToolModeNone, + ProtoDataV1Grpc.ToolMode.Required => SeedApi.ToolMode.ToolModeRequired, + _ => throw new ArgumentException($"Unknown enum value: {value.Mode}"), + }, + FunctionName = value.FunctionName, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the ToolChoice type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.ToolChoice ToProto() + { + var result = new ProtoDataV1Grpc.ToolChoice(); + if (Mode != null) + { + result.Mode = Mode.Value.Value switch + { + SeedApi.ToolMode.Values.ToolModeInvalid => ProtoDataV1Grpc.ToolMode.Invalid, + SeedApi.ToolMode.Values.ToolModeAuto => ProtoDataV1Grpc.ToolMode.Auto, + SeedApi.ToolMode.Values.ToolModeNone => ProtoDataV1Grpc.ToolMode.None, + SeedApi.ToolMode.Values.ToolModeRequired => ProtoDataV1Grpc.ToolMode.Required, + _ => throw new ArgumentException($"Unknown enum value: {Mode.Value.Value}"), + }; + } + if (FunctionName != null) + { + result.FunctionName = FunctionName ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolMode.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolMode.cs new file mode 100644 index 000000000000..793114c3ac94 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/no-custom-config/src/SeedApi/Types/ToolMode.cs @@ -0,0 +1,98 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; + +namespace SeedApi; + +[JsonConverter(typeof(ToolMode.ToolModeSerializer))] +[Serializable] +public readonly record struct ToolMode : IStringEnum +{ + public static readonly ToolMode ToolModeInvalid = new(Values.ToolModeInvalid); + + public static readonly ToolMode ToolModeAuto = new(Values.ToolModeAuto); + + public static readonly ToolMode ToolModeNone = new(Values.ToolModeNone); + + public static readonly ToolMode ToolModeRequired = new(Values.ToolModeRequired); + + public ToolMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ToolMode FromCustom(string value) + { + return new ToolMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(ToolMode value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(ToolMode value1, string value2) => !value1.Value.Equals(value2); + + public static explicit operator string(ToolMode value) => value.Value; + + public static explicit operator ToolMode(string value) => new(value); + + internal class ToolModeSerializer : JsonConverter + { + public override ToolMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ToolMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ToolMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ToolModeInvalid = "TOOL_MODE_INVALID"; + + public const string ToolModeAuto = "TOOL_MODE_AUTO"; + + public const string ToolModeNone = "TOOL_MODE_NONE"; + + public const string ToolModeRequired = "TOOL_MODE_REQUIRED"; + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/data/v1/data.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/data/v1/data.proto index 46947f1d26ee..ad21e7d6fdba 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/data/v1/data.proto +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/data/v1/data.proto @@ -7,6 +7,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; option csharp_namespace = "Data.V1.Grpc"; option go_package = "github.com/acme.co/data-go-grpc"; @@ -164,6 +165,7 @@ message UpdateRequest { google.protobuf.Any details = 7; repeated IndexType index_types = 8; optional AspectRatio aspect_ratio = 9; + optional google.rpc.Status status = 10; } message UpdateResponse { @@ -173,6 +175,67 @@ message UpdateResponse { repeated IndexType index_types = 4; } +enum ToolMode { + // Invalid tool mode. + TOOL_MODE_INVALID = 0; + + // Let the model decide if a tool shall be used. + TOOL_MODE_AUTO = 1; + + // Force the model to not use tools. + TOOL_MODE_NONE = 2; + + // Force the model to use tools. + TOOL_MODE_REQUIRED = 3; +} + +message ToolChoice { + oneof tool_choice { + // Force the model to perform in a given mode. + ToolMode mode = 1; + + // Force the model to call a particular function. + string function_name = 2; + } +} + +message CreateRequest { + // The name of the resource to create. + string name = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // A description of the resource. + string description = 2; + + // The tool choice configuration. + ToolChoice tool_choice = 3; + + oneof source { + // A URL to fetch the resource from. + string url = 4; + + // Inline content for the resource. + string content = 5; + } + + // Optional metadata for the resource. + google.protobuf.Struct metadata = 6; +} + +message CreateResponse { + // The created resource. + Column resource = 1; + + oneof status { + // Indicates successful creation. + bool success = 2; + + // Error message if creation failed. + string error_message = 3; + } +} + message DescribeRequest { google.protobuf.Struct filter = 1; google.protobuf.Timestamp after = 2; @@ -236,4 +299,11 @@ service DataService { body: "*" }; } + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/data/create" + body: "*" + }; + } } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/google/rpc/status.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/google/rpc/status.proto new file mode 100644 index 000000000000..c667e18e2a60 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/proto/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} \ No newline at end of file diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/reference.md b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/reference.md index bc7264303b43..3a9e571c20d4 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/reference.md +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/reference.md @@ -73,6 +73,46 @@ await client.DataService.UploadAsync( + + + + +
client.DataService.CreateAsync(CreateRequest { ... }) -> WithRawResponseTask<CreateResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateRequest` + +
+
+
+
+ +
diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/snippet.json b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/snippet.json index c435d6f7c198..932451b1d5c5 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/snippet.json +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/snippet.json @@ -13,6 +13,18 @@ "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.UploadAsync(\n new UploadRequest\n {\n Columns = new List()\n {\n new SeedApi.Column\n {\n Id = \"id\",\n Values = new List() { 1.1f },\n },\n },\n }\n);\n" } }, + { + "example_identifier": null, + "id": { + "path": "/data/create", + "method": "POST", + "identifier_override": "endpoint_dataService.Create" + }, + "snippet": { + "type": "csharp", + "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.CreateAsync(new CreateRequest { Name = \"name\" });\n" + } + }, { "example_identifier": null, "id": { diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/DataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/DataServiceClient.cs index 29883eb5de76..823f39bf4999 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/DataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/DataServiceClient.cs @@ -89,6 +89,64 @@ public async Task UploadAsync( } } + /// + /// await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); + /// + public async Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + try + { + var metadata = new global::Grpc.Core.Metadata(); + foreach (var header in _client.Options.Headers) + { + var value = await header.Value.ResolveAsync().ConfigureAwait(false); + metadata.Add(header.Key, value); + } + if (_client.Options.AdditionalHeaders != null) + { + foreach (var header in _client.Options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + if (options?.AdditionalHeaders != null) + { + foreach (var header in options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + + var callOptions = _grpc.CreateCallOptions( + metadata, + options ?? new GrpcRequestOptions(), + cancellationToken + ); + var call = _dataService.CreateAsync(request.ToProto(), callOptions); + var response = await call.ConfigureAwait(false); + return CreateResponse.FromProto(response); + } + catch (RpcException rpc) + { + var statusCode = (int)rpc.StatusCode; + throw new SeedApiApiException( + $"Error with gRPC status code {statusCode}", + statusCode, + rpc.Message + ); + } + catch (Exception e) + { + throw new SeedApiException("Error", e); + } + } + /// /// await client.DataService.DeleteAsync(new DeleteRequest()); /// diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/IDataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/IDataServiceClient.cs index 52d48a495b2b..8a0649baf662 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/IDataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/IDataServiceClient.cs @@ -8,6 +8,12 @@ Task UploadAsync( CancellationToken cancellationToken = default ); + Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( DeleteRequest request, GrpcRequestOptions? options = null, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/CreateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/CreateRequest.cs new file mode 100644 index 000000000000..48284d38d15d --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/CreateRequest.cs @@ -0,0 +1,81 @@ +using System.Text.Json.Serialization; +using SeedApi.Core; +using Proto = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateRequest +{ + /// + /// The name of the resource to create. + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// A description of the resource. + /// + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// The tool choice configuration. + /// + [JsonPropertyName("tool_choice")] + public ToolChoice? ToolChoice { get; set; } + + /// + /// A URL to fetch the resource from. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Inline content for the resource. + /// + [JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// Optional metadata for the resource. + /// + [JsonPropertyName("metadata")] + public Metadata? Metadata { get; set; } + + /// + /// Maps the CreateRequest type into its Protobuf-equivalent representation. + /// + internal Proto.CreateRequest ToProto() + { + var result = new Proto.CreateRequest(); + result.Name = Name; + if (Description != null) + { + result.Description = Description ?? ""; + } + if (ToolChoice != null) + { + result.ToolChoice = ToolChoice.ToProto(); + } + if (Url != null) + { + result.Url = Url ?? ""; + } + if (Content != null) + { + result.Content = Content ?? ""; + } + if (Metadata != null) + { + result.Metadata = Metadata.ToProto(); + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/UpdateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/UpdateRequest.cs index 5301c75e711f..ed3242345df0 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/UpdateRequest.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/DataService/Requests/UpdateRequest.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Google.Rpc; using SeedApi.Core; using Proto = Data.V1.Grpc; using ProtoDataV1Grpc = Data.V1.Grpc; @@ -35,6 +36,9 @@ public record UpdateRequest [JsonPropertyName("aspect_ratio")] public AspectRatio? AspectRatio { get; set; } + [JsonPropertyName("status")] + public Status? Status { get; set; } + /// /// Maps the UpdateRequest type into its Protobuf-equivalent representation. /// @@ -106,6 +110,10 @@ internal Proto.UpdateRequest ToProto() _ => throw new ArgumentException($"Unknown enum value: {AspectRatio.Value.Value}"), }; } + if (Status != null) + { + result.Status = Status; + } return result; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/SeedApi.csproj b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/SeedApi.csproj index 9f74bcc70d1a..4aa98166b003 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/SeedApi.csproj @@ -46,7 +46,8 @@
- + + @@ -61,21 +62,6 @@ GrpcServices="Client" ProtoRoot="..\..\proto" > - - - diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/Column.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/Column.cs index ef225e7518ab..a6acb12cc729 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/Column.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/Column.cs @@ -36,9 +36,9 @@ internal static Column FromProto(ProtoDataV1Grpc.Column value) { Id = value.Id, Values = value.Values?.ToList() ?? Enumerable.Empty(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/CreateResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/CreateResponse.cs new file mode 100644 index 000000000000..7fa2d9fe625a --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/CreateResponse.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The created resource. + /// + [JsonPropertyName("resource")] + public Column? Resource { get; set; } + + /// + /// Indicates successful creation. + /// + [JsonPropertyName("success")] + public bool? Success { get; set; } + + /// + /// Error message if creation failed. + /// + [JsonPropertyName("error_message")] + public string? ErrorMessage { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new CreateResponse type from its Protobuf-equivalent representation. + /// + internal static CreateResponse FromProto(ProtoDataV1Grpc.CreateResponse value) + { + return new CreateResponse + { + Resource = value.Resource != null ? SeedApi.Column.FromProto(value.Resource) : null, + Success = value.Success, + ErrorMessage = value.ErrorMessage, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the CreateResponse type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.CreateResponse ToProto() + { + var result = new ProtoDataV1Grpc.CreateResponse(); + if (Resource != null) + { + result.Resource = Resource.ToProto(); + } + if (Success != null) + { + result.Success = Success ?? false; + } + if (ErrorMessage != null) + { + result.ErrorMessage = ErrorMessage ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/DescribeResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/DescribeResponse.cs index be7b2a6f4b01..c2e128b16562 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/DescribeResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/DescribeResponse.cs @@ -36,7 +36,7 @@ internal static DescribeResponse FromProto(ProtoDataV1Grpc.DescribeResponse valu { Namespaces = value.Namespaces?.ToDictionary( kvp => kvp.Key, - kvp => NamespaceSummary.FromProto(kvp.Value) + kvp => SeedApi.NamespaceSummary.FromProto(kvp.Value) ), Dimension = value.Dimension, Fullness = value.Fullness, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/FetchResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/FetchResponse.cs index 0558b91da66e..9fb104c644aa 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/FetchResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/FetchResponse.cs @@ -33,10 +33,10 @@ internal static FetchResponse FromProto(ProtoDataV1Grpc.FetchResponse value) { Columns = value.Columns?.ToDictionary( kvp => kvp.Key, - kvp => Column.FromProto(kvp.Value) + kvp => SeedApi.Column.FromProto(kvp.Value) ), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ListResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ListResponse.cs index 72b63f8287fd..00c91bba9b0f 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ListResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ListResponse.cs @@ -34,10 +34,11 @@ internal static ListResponse FromProto(ProtoDataV1Grpc.ListResponse value) { return new ListResponse { - Columns = value.Columns?.Select(ListElement.FromProto), - Pagination = value.Pagination != null ? Pagination.FromProto(value.Pagination) : null, + Columns = value.Columns?.Select(SeedApi.ListElement.FromProto), + Pagination = + value.Pagination != null ? SeedApi.Pagination.FromProto(value.Pagination) : null, Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryColumn.cs index d2621a6d87c6..45988601ffe4 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryColumn.cs @@ -40,9 +40,9 @@ internal static QueryColumn FromProto(ProtoDataV1Grpc.QueryColumn value) Values = value.Values?.ToList() ?? Enumerable.Empty(), TopK = value.TopK, Namespace = value.Namespace, - Filter = value.Filter != null ? Metadata.FromProto(value.Filter) : null, + Filter = value.Filter != null ? SeedApi.Metadata.FromProto(value.Filter) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResponse.cs index 9242ccd094a1..de9bed0dbf47 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResponse.cs @@ -34,10 +34,10 @@ internal static QueryResponse FromProto(ProtoDataV1Grpc.QueryResponse value) { return new QueryResponse { - Results = value.Results?.Select(QueryResult.FromProto), - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Results = value.Results?.Select(SeedApi.QueryResult.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResult.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResult.cs index 8a0ab47d124a..583b1934df67 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResult.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/QueryResult.cs @@ -28,7 +28,7 @@ internal static QueryResult FromProto(ProtoDataV1Grpc.QueryResult value) { return new QueryResult { - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ScoredColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ScoredColumn.cs index a0d7fc819768..918bcd5c1126 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ScoredColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ScoredColumn.cs @@ -40,9 +40,9 @@ internal static ScoredColumn FromProto(ProtoDataV1Grpc.ScoredColumn value) Id = value.Id, Score = value.Score, Values = value.Values?.ToList(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolChoice.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolChoice.cs new file mode 100644 index 000000000000..220894b0dc66 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolChoice.cs @@ -0,0 +1,81 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record ToolChoice : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Force the model to perform in a given mode. + /// + [JsonPropertyName("mode")] + public ToolMode? Mode { get; set; } + + /// + /// Force the model to call a particular function. + /// + [JsonPropertyName("function_name")] + public string? FunctionName { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new ToolChoice type from its Protobuf-equivalent representation. + /// + internal static ToolChoice FromProto(ProtoDataV1Grpc.ToolChoice value) + { + return new ToolChoice + { + Mode = value.Mode switch + { + ProtoDataV1Grpc.ToolMode.Invalid => SeedApi.ToolMode.ToolModeInvalid, + ProtoDataV1Grpc.ToolMode.Auto => SeedApi.ToolMode.ToolModeAuto, + ProtoDataV1Grpc.ToolMode.None => SeedApi.ToolMode.ToolModeNone, + ProtoDataV1Grpc.ToolMode.Required => SeedApi.ToolMode.ToolModeRequired, + _ => throw new ArgumentException($"Unknown enum value: {value.Mode}"), + }, + FunctionName = value.FunctionName, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the ToolChoice type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.ToolChoice ToProto() + { + var result = new ProtoDataV1Grpc.ToolChoice(); + if (Mode != null) + { + result.Mode = Mode.Value.Value switch + { + SeedApi.ToolMode.Values.ToolModeInvalid => ProtoDataV1Grpc.ToolMode.Invalid, + SeedApi.ToolMode.Values.ToolModeAuto => ProtoDataV1Grpc.ToolMode.Auto, + SeedApi.ToolMode.Values.ToolModeNone => ProtoDataV1Grpc.ToolMode.None, + SeedApi.ToolMode.Values.ToolModeRequired => ProtoDataV1Grpc.ToolMode.Required, + _ => throw new ArgumentException($"Unknown enum value: {Mode.Value.Value}"), + }; + } + if (FunctionName != null) + { + result.FunctionName = FunctionName ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolMode.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolMode.cs new file mode 100644 index 000000000000..793114c3ac94 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/package-id/src/SeedApi/Types/ToolMode.cs @@ -0,0 +1,98 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; + +namespace SeedApi; + +[JsonConverter(typeof(ToolMode.ToolModeSerializer))] +[Serializable] +public readonly record struct ToolMode : IStringEnum +{ + public static readonly ToolMode ToolModeInvalid = new(Values.ToolModeInvalid); + + public static readonly ToolMode ToolModeAuto = new(Values.ToolModeAuto); + + public static readonly ToolMode ToolModeNone = new(Values.ToolModeNone); + + public static readonly ToolMode ToolModeRequired = new(Values.ToolModeRequired); + + public ToolMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ToolMode FromCustom(string value) + { + return new ToolMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(ToolMode value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(ToolMode value1, string value2) => !value1.Value.Equals(value2); + + public static explicit operator string(ToolMode value) => value.Value; + + public static explicit operator ToolMode(string value) => new(value); + + internal class ToolModeSerializer : JsonConverter + { + public override ToolMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ToolMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ToolMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ToolModeInvalid = "TOOL_MODE_INVALID"; + + public const string ToolModeAuto = "TOOL_MODE_AUTO"; + + public const string ToolModeNone = "TOOL_MODE_NONE"; + + public const string ToolModeRequired = "TOOL_MODE_REQUIRED"; + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/data/v1/data.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/data/v1/data.proto index 46947f1d26ee..ad21e7d6fdba 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/data/v1/data.proto +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/data/v1/data.proto @@ -7,6 +7,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; option csharp_namespace = "Data.V1.Grpc"; option go_package = "github.com/acme.co/data-go-grpc"; @@ -164,6 +165,7 @@ message UpdateRequest { google.protobuf.Any details = 7; repeated IndexType index_types = 8; optional AspectRatio aspect_ratio = 9; + optional google.rpc.Status status = 10; } message UpdateResponse { @@ -173,6 +175,67 @@ message UpdateResponse { repeated IndexType index_types = 4; } +enum ToolMode { + // Invalid tool mode. + TOOL_MODE_INVALID = 0; + + // Let the model decide if a tool shall be used. + TOOL_MODE_AUTO = 1; + + // Force the model to not use tools. + TOOL_MODE_NONE = 2; + + // Force the model to use tools. + TOOL_MODE_REQUIRED = 3; +} + +message ToolChoice { + oneof tool_choice { + // Force the model to perform in a given mode. + ToolMode mode = 1; + + // Force the model to call a particular function. + string function_name = 2; + } +} + +message CreateRequest { + // The name of the resource to create. + string name = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // A description of the resource. + string description = 2; + + // The tool choice configuration. + ToolChoice tool_choice = 3; + + oneof source { + // A URL to fetch the resource from. + string url = 4; + + // Inline content for the resource. + string content = 5; + } + + // Optional metadata for the resource. + google.protobuf.Struct metadata = 6; +} + +message CreateResponse { + // The created resource. + Column resource = 1; + + oneof status { + // Indicates successful creation. + bool success = 2; + + // Error message if creation failed. + string error_message = 3; + } +} + message DescribeRequest { google.protobuf.Struct filter = 1; google.protobuf.Timestamp after = 2; @@ -236,4 +299,11 @@ service DataService { body: "*" }; } + + rpc Create(CreateRequest) returns (CreateResponse) { + option (google.api.http) = { + post: "/data/create" + body: "*" + }; + } } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/google/rpc/status.proto b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/google/rpc/status.proto new file mode 100644 index 000000000000..c667e18e2a60 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/proto/google/rpc/status.proto @@ -0,0 +1,49 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). Each `Status` message contains +// three pieces of data: error code, error message, and error details. +// +// You can find out more about this error model and how to work with it in the +// [API Design Guide](https://cloud.google.com/apis/design/errors). +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} \ No newline at end of file diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/reference.md b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/reference.md index f917cef928b8..fe9c1925528e 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/reference.md +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/reference.md @@ -69,6 +69,46 @@ await client.DataService.UploadAsync( + + + + +
client.DataService.CreateAsync(CreateRequest { ... }) -> WithRawResponseTask<CreateResponse> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateRequest` + +
+
+
+
+ +
diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/snippet.json b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/snippet.json index d4bcabc08c38..096af1c1c5a9 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/snippet.json +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/snippet.json @@ -13,6 +13,18 @@ "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.UploadAsync(\n new UploadRequest\n {\n Columns = new List()\n {\n new SeedApi.Column { Id = \"id\", Values = new[] { 1.1f } },\n },\n }\n);\n" } }, + { + "example_identifier": null, + "id": { + "path": "/data/create", + "method": "POST", + "identifier_override": "endpoint_dataService.Create" + }, + "snippet": { + "type": "csharp", + "client": "using SeedApi;\n\nvar client = new SeedApiClient();\nawait client.DataService.CreateAsync(new CreateRequest { Name = \"name\" });\n" + } + }, { "example_identifier": null, "id": { diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/DataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/DataServiceClient.cs index 2d2ef821558d..2ed3cd082af0 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/DataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/DataServiceClient.cs @@ -85,6 +85,64 @@ public async Task UploadAsync( } } + /// + /// await client.DataService.CreateAsync(new CreateRequest { Name = "name" }); + /// + public async Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + try + { + var metadata = new global::Grpc.Core.Metadata(); + foreach (var header in _client.Options.Headers) + { + var value = await header.Value.ResolveAsync().ConfigureAwait(false); + metadata.Add(header.Key, value); + } + if (_client.Options.AdditionalHeaders != null) + { + foreach (var header in _client.Options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + if (options?.AdditionalHeaders != null) + { + foreach (var header in options.AdditionalHeaders) + { + if (header.Value != null) + metadata.Add(header.Key, header.Value); + } + } + + var callOptions = _grpc.CreateCallOptions( + metadata, + options ?? new GrpcRequestOptions(), + cancellationToken + ); + var call = _dataService.CreateAsync(request.ToProto(), callOptions); + var response = await call.ConfigureAwait(false); + return CreateResponse.FromProto(response); + } + catch (RpcException rpc) + { + var statusCode = (int)rpc.StatusCode; + throw new SeedApiApiException( + $"Error with gRPC status code {statusCode}", + statusCode, + rpc.Message + ); + } + catch (Exception e) + { + throw new SeedApiException("Error", e); + } + } + /// /// await client.DataService.DeleteAsync(new DeleteRequest()); /// diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/IDataServiceClient.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/IDataServiceClient.cs index 52d48a495b2b..8a0649baf662 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/IDataServiceClient.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/IDataServiceClient.cs @@ -8,6 +8,12 @@ Task UploadAsync( CancellationToken cancellationToken = default ); + Task CreateAsync( + CreateRequest request, + GrpcRequestOptions? options = null, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( DeleteRequest request, GrpcRequestOptions? options = null, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/CreateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/CreateRequest.cs new file mode 100644 index 000000000000..48284d38d15d --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/CreateRequest.cs @@ -0,0 +1,81 @@ +using System.Text.Json.Serialization; +using SeedApi.Core; +using Proto = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateRequest +{ + /// + /// The name of the resource to create. + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// A description of the resource. + /// + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// The tool choice configuration. + /// + [JsonPropertyName("tool_choice")] + public ToolChoice? ToolChoice { get; set; } + + /// + /// A URL to fetch the resource from. + /// + [JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Inline content for the resource. + /// + [JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// Optional metadata for the resource. + /// + [JsonPropertyName("metadata")] + public Metadata? Metadata { get; set; } + + /// + /// Maps the CreateRequest type into its Protobuf-equivalent representation. + /// + internal Proto.CreateRequest ToProto() + { + var result = new Proto.CreateRequest(); + result.Name = Name; + if (Description != null) + { + result.Description = Description ?? ""; + } + if (ToolChoice != null) + { + result.ToolChoice = ToolChoice.ToProto(); + } + if (Url != null) + { + result.Url = Url ?? ""; + } + if (Content != null) + { + result.Content = Content ?? ""; + } + if (Metadata != null) + { + result.Metadata = Metadata.ToProto(); + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/UpdateRequest.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/UpdateRequest.cs index ac0730dc2546..a8884cc7b7d0 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/UpdateRequest.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/DataService/Requests/UpdateRequest.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Google.Rpc; using SeedApi.Core; using Proto = Data.V1.Grpc; using ProtoDataV1Grpc = Data.V1.Grpc; @@ -35,6 +36,9 @@ public record UpdateRequest [JsonPropertyName("aspect_ratio")] public AspectRatio? AspectRatio { get; set; } + [JsonPropertyName("status")] + public Status? Status { get; set; } + /// /// Maps the UpdateRequest type into its Protobuf-equivalent representation. /// @@ -106,6 +110,10 @@ internal Proto.UpdateRequest ToProto() _ => throw new ArgumentException($"Unknown enum value: {AspectRatio.Value.Value}"), }; } + if (Status != null) + { + result.Status = Status; + } return result; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/SeedApi.csproj b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/SeedApi.csproj index 70240c028c83..648e0bbc6339 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@
- + + @@ -60,21 +61,6 @@ GrpcServices="Client" ProtoRoot="..\..\proto" > - - - diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/Column.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/Column.cs index 05b06d26bbdc..feca8ec750a2 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/Column.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/Column.cs @@ -36,9 +36,9 @@ internal static Column FromProto(ProtoDataV1Grpc.Column value) { Id = value.Id, Values = value.Values?.ToArray() ?? new ReadOnlyMemory(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/CreateResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/CreateResponse.cs new file mode 100644 index 000000000000..7fa2d9fe625a --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/CreateResponse.cs @@ -0,0 +1,78 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record CreateResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The created resource. + /// + [JsonPropertyName("resource")] + public Column? Resource { get; set; } + + /// + /// Indicates successful creation. + /// + [JsonPropertyName("success")] + public bool? Success { get; set; } + + /// + /// Error message if creation failed. + /// + [JsonPropertyName("error_message")] + public string? ErrorMessage { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new CreateResponse type from its Protobuf-equivalent representation. + /// + internal static CreateResponse FromProto(ProtoDataV1Grpc.CreateResponse value) + { + return new CreateResponse + { + Resource = value.Resource != null ? SeedApi.Column.FromProto(value.Resource) : null, + Success = value.Success, + ErrorMessage = value.ErrorMessage, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the CreateResponse type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.CreateResponse ToProto() + { + var result = new ProtoDataV1Grpc.CreateResponse(); + if (Resource != null) + { + result.Resource = Resource.ToProto(); + } + if (Success != null) + { + result.Success = Success ?? false; + } + if (ErrorMessage != null) + { + result.ErrorMessage = ErrorMessage ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/DescribeResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/DescribeResponse.cs index be7b2a6f4b01..c2e128b16562 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/DescribeResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/DescribeResponse.cs @@ -36,7 +36,7 @@ internal static DescribeResponse FromProto(ProtoDataV1Grpc.DescribeResponse valu { Namespaces = value.Namespaces?.ToDictionary( kvp => kvp.Key, - kvp => NamespaceSummary.FromProto(kvp.Value) + kvp => SeedApi.NamespaceSummary.FromProto(kvp.Value) ), Dimension = value.Dimension, Fullness = value.Fullness, diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/FetchResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/FetchResponse.cs index 0558b91da66e..9fb104c644aa 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/FetchResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/FetchResponse.cs @@ -33,10 +33,10 @@ internal static FetchResponse FromProto(ProtoDataV1Grpc.FetchResponse value) { Columns = value.Columns?.ToDictionary( kvp => kvp.Key, - kvp => Column.FromProto(kvp.Value) + kvp => SeedApi.Column.FromProto(kvp.Value) ), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ListResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ListResponse.cs index 72b63f8287fd..00c91bba9b0f 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ListResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ListResponse.cs @@ -34,10 +34,11 @@ internal static ListResponse FromProto(ProtoDataV1Grpc.ListResponse value) { return new ListResponse { - Columns = value.Columns?.Select(ListElement.FromProto), - Pagination = value.Pagination != null ? Pagination.FromProto(value.Pagination) : null, + Columns = value.Columns?.Select(SeedApi.ListElement.FromProto), + Pagination = + value.Pagination != null ? SeedApi.Pagination.FromProto(value.Pagination) : null, Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryColumn.cs index 7120dfef5ed1..2d6ddd32e3d8 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryColumn.cs @@ -40,9 +40,9 @@ internal static QueryColumn FromProto(ProtoDataV1Grpc.QueryColumn value) Values = value.Values?.ToArray() ?? new ReadOnlyMemory(), TopK = value.TopK, Namespace = value.Namespace, - Filter = value.Filter != null ? Metadata.FromProto(value.Filter) : null, + Filter = value.Filter != null ? SeedApi.Metadata.FromProto(value.Filter) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResponse.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResponse.cs index 9242ccd094a1..de9bed0dbf47 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResponse.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResponse.cs @@ -34,10 +34,10 @@ internal static QueryResponse FromProto(ProtoDataV1Grpc.QueryResponse value) { return new QueryResponse { - Results = value.Results?.Select(QueryResult.FromProto), - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Results = value.Results?.Select(SeedApi.QueryResult.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, - Usage = value.Usage != null ? Usage.FromProto(value.Usage) : null, + Usage = value.Usage != null ? SeedApi.Usage.FromProto(value.Usage) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResult.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResult.cs index 8a0ab47d124a..583b1934df67 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResult.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/QueryResult.cs @@ -28,7 +28,7 @@ internal static QueryResult FromProto(ProtoDataV1Grpc.QueryResult value) { return new QueryResult { - Matches = value.Matches?.Select(ScoredColumn.FromProto), + Matches = value.Matches?.Select(SeedApi.ScoredColumn.FromProto), Namespace = value.Namespace, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ScoredColumn.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ScoredColumn.cs index 80499319efe7..71713148716c 100644 --- a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ScoredColumn.cs +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ScoredColumn.cs @@ -40,9 +40,9 @@ internal static ScoredColumn FromProto(ProtoDataV1Grpc.ScoredColumn value) Id = value.Id, Score = value.Score, Values = value.Values?.ToArray(), - Metadata = value.Metadata != null ? Metadata.FromProto(value.Metadata) : null, + Metadata = value.Metadata != null ? SeedApi.Metadata.FromProto(value.Metadata) : null, IndexedData = - value.IndexedData != null ? IndexedData.FromProto(value.IndexedData) : null, + value.IndexedData != null ? SeedApi.IndexedData.FromProto(value.IndexedData) : null, }; } diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolChoice.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolChoice.cs new file mode 100644 index 000000000000..220894b0dc66 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolChoice.cs @@ -0,0 +1,81 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; +using ProtoDataV1Grpc = Data.V1.Grpc; + +namespace SeedApi; + +[Serializable] +public record ToolChoice : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Force the model to perform in a given mode. + /// + [JsonPropertyName("mode")] + public ToolMode? Mode { get; set; } + + /// + /// Force the model to call a particular function. + /// + [JsonPropertyName("function_name")] + public string? FunctionName { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + /// + /// Returns a new ToolChoice type from its Protobuf-equivalent representation. + /// + internal static ToolChoice FromProto(ProtoDataV1Grpc.ToolChoice value) + { + return new ToolChoice + { + Mode = value.Mode switch + { + ProtoDataV1Grpc.ToolMode.Invalid => SeedApi.ToolMode.ToolModeInvalid, + ProtoDataV1Grpc.ToolMode.Auto => SeedApi.ToolMode.ToolModeAuto, + ProtoDataV1Grpc.ToolMode.None => SeedApi.ToolMode.ToolModeNone, + ProtoDataV1Grpc.ToolMode.Required => SeedApi.ToolMode.ToolModeRequired, + _ => throw new ArgumentException($"Unknown enum value: {value.Mode}"), + }, + FunctionName = value.FunctionName, + }; + } + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + /// Maps the ToolChoice type into its Protobuf-equivalent representation. + /// + internal ProtoDataV1Grpc.ToolChoice ToProto() + { + var result = new ProtoDataV1Grpc.ToolChoice(); + if (Mode != null) + { + result.Mode = Mode.Value.Value switch + { + SeedApi.ToolMode.Values.ToolModeInvalid => ProtoDataV1Grpc.ToolMode.Invalid, + SeedApi.ToolMode.Values.ToolModeAuto => ProtoDataV1Grpc.ToolMode.Auto, + SeedApi.ToolMode.Values.ToolModeNone => ProtoDataV1Grpc.ToolMode.None, + SeedApi.ToolMode.Values.ToolModeRequired => ProtoDataV1Grpc.ToolMode.Required, + _ => throw new ArgumentException($"Unknown enum value: {Mode.Value.Value}"), + }; + } + if (FunctionName != null) + { + result.FunctionName = FunctionName ?? ""; + } + return result; + } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolMode.cs b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolMode.cs new file mode 100644 index 000000000000..793114c3ac94 --- /dev/null +++ b/seed/csharp-sdk/csharp-grpc-proto-exhaustive/read-only-memory/src/SeedApi/Types/ToolMode.cs @@ -0,0 +1,98 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SeedApi.Core; + +namespace SeedApi; + +[JsonConverter(typeof(ToolMode.ToolModeSerializer))] +[Serializable] +public readonly record struct ToolMode : IStringEnum +{ + public static readonly ToolMode ToolModeInvalid = new(Values.ToolModeInvalid); + + public static readonly ToolMode ToolModeAuto = new(Values.ToolModeAuto); + + public static readonly ToolMode ToolModeNone = new(Values.ToolModeNone); + + public static readonly ToolMode ToolModeRequired = new(Values.ToolModeRequired); + + public ToolMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ToolMode FromCustom(string value) + { + return new ToolMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(ToolMode value1, string value2) => value1.Value.Equals(value2); + + public static bool operator !=(ToolMode value1, string value2) => !value1.Value.Equals(value2); + + public static explicit operator string(ToolMode value) => value.Value; + + public static explicit operator ToolMode(string value) => new(value); + + internal class ToolModeSerializer : JsonConverter + { + public override ToolMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ToolMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ToolMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string ToolModeInvalid = "TOOL_MODE_INVALID"; + + public const string ToolModeAuto = "TOOL_MODE_AUTO"; + + public const string ToolModeNone = "TOOL_MODE_NONE"; + + public const string ToolModeRequired = "TOOL_MODE_REQUIRED"; + } +} diff --git a/seed/csharp-sdk/csharp-grpc-proto/no-custom-config/src/SeedApi/SeedApi.csproj b/seed/csharp-sdk/csharp-grpc-proto/no-custom-config/src/SeedApi/SeedApi.csproj index 7f0abbb33f49..942053cc173c 100644 --- a/seed/csharp-sdk/csharp-grpc-proto/no-custom-config/src/SeedApi/SeedApi.csproj +++ b/seed/csharp-sdk/csharp-grpc-proto/no-custom-config/src/SeedApi/SeedApi.csproj @@ -45,7 +45,8 @@ - + + @@ -55,16 +56,6 @@ - -