From c72cf3cdce2e0f4732a0ea057c5b6769780d7dc8 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Sun, 17 Dec 2023 15:36:19 +0200 Subject: [PATCH 1/9] [Bug #3829] consider openapiv2_tag.name attribute when generating openapi docs --- .../internal/clients/abe/api/swagger.yaml | 6 +- .../internal/clients/echo/api/swagger.yaml | 4 +- .../clients/responsebody/api/swagger.yaml | 4 +- .../proto/examplepb/a_bit_of_everything.pb.go | 277 +++++++++--------- .../proto/examplepb/a_bit_of_everything.proto | 1 + .../a_bit_of_everything.swagger.json | 6 +- .../proto/examplepb/echo_service.swagger.json | 4 +- .../examplepb/flow_combination.swagger.json | 4 +- .../examplepb/generated_input.swagger.json | 4 +- .../examplepb/non_standard_names.swagger.json | 4 +- .../examplepb/openapi_merge_a.swagger.json | 4 +- .../examplepb/openapi_merge_b.swagger.json | 4 +- .../response_body_service.swagger.json | 4 +- .../proto/examplepb/stream.swagger.json | 4 +- .../proto/examplepb/wrappers.swagger.json | 4 +- .../internal/genopenapi/template.go | 3 + 16 files changed, 171 insertions(+), 166 deletions(-) diff --git a/examples/internal/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml index 0b8f9d79ca5..c5643575fe1 100644 --- a/examples/internal/clients/abe/api/swagger.yaml +++ b/examples/internal/clients/abe/api/swagger.yaml @@ -15,7 +15,7 @@ tags: - name: "echo rpc" description: "Echo Rpc description" x-traitTag: true -- name: "ABitOfEverythingService" +- name: "ABitOfEverything" description: "ABitOfEverythingService description -- which should not be used in\ \ place of the documentation comment!" externalDocs: @@ -5727,12 +5727,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized by the client." + \ field, or localized\nby the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/clients/echo/api/swagger.yaml b/examples/internal/clients/echo/api/swagger.yaml index 03e677324a5..4006c7bce34 100644 --- a/examples/internal/clients/echo/api/swagger.yaml +++ b/examples/internal/clients/echo/api/swagger.yaml @@ -993,12 +993,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized by the client." + \ field, or localized\nby the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml index 8cf3af7163f..d2cfb08174a 100644 --- a/examples/internal/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -206,12 +206,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized by the client." + \ field, or localized\nby the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.pb.go b/examples/internal/proto/examplepb/a_bit_of_everything.pb.go index 3488471ece9..bce03dd007d 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/internal/proto/examplepb/a_bit_of_everything.pb.go @@ -2275,7 +2275,7 @@ var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc = [ 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x64, 0x10, 0x01, 0x2a, 0x2d, 0x0a, 0x11, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x30, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x65, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x10, 0x01, 0x32, 0xd3, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x66, 0x10, 0x01, 0x32, 0xe5, 0x37, 0x0a, 0x17, 0x41, 0x42, 0x69, 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8c, 0x04, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, @@ -2709,147 +2709,148 @@ var file_examples_internal_proto_examplepb_a_bit_of_everything_proto_rawDesc = [ 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x74, 0x79, - 0x70, 0x65, 0x1a, 0xbf, 0x01, 0x92, 0x41, 0xbb, 0x01, 0x12, 0x66, 0x41, 0x42, 0x69, 0x74, 0x4f, - 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2d, - 0x2d, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6e, - 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x21, 0x1a, 0x51, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, - 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, - 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x32, 0x6a, 0x0a, 0x14, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, 0x61, 0x73, - 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x05, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, - 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x32, 0x5e, 0x0a, 0x1c, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, - 0x12, 0x3e, 0x0a, 0x0a, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, - 0x32, 0xd5, 0x01, 0x0a, 0x10, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc0, 0x01, 0x0a, 0x09, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, + 0x70, 0x65, 0x1a, 0xd1, 0x01, 0x92, 0x41, 0xcd, 0x01, 0x0a, 0x10, 0x41, 0x42, 0x69, 0x74, 0x4f, + 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x66, 0x41, 0x42, 0x69, + 0x74, 0x4f, 0x66, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x20, 0x2d, 0x2d, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x21, 0x1a, 0x51, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, + 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x45, 0x63, 0x68, 0x6f, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, + 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x32, 0x6a, 0x0a, 0x14, 0x63, 0x61, 0x6d, 0x65, 0x6c, 0x43, + 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, + 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, + 0x11, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x65, 0x6d, 0x70, + 0x74, 0x79, 0x32, 0x5e, 0x0a, 0x1c, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x4e, 0x6f, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x22, 0x00, 0x32, 0xd5, 0x01, 0x0a, 0x10, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc0, 0x01, 0x0a, 0x09, 0x53, 0x6e, 0x61, 0x6b, + 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, 0x75, 0x6d, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, - 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x73, 0x6e, - 0x61, 0x6b, 0x65, 0x2f, 0x7b, 0x77, 0x68, 0x6f, 0x7d, 0x2f, 0x7b, 0x77, 0x68, 0x61, 0x74, 0x7d, - 0x2f, 0x7b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x7d, 0x42, 0xcf, 0x0c, 0x5a, 0x4b, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x92, 0x41, 0xfe, 0x0b, 0x12, 0xf0, 0x01, 0x0a, - 0x13, 0x41, 0x20, 0x42, 0x69, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, - 0x68, 0x69, 0x6e, 0x67, 0x22, 0x58, 0x0a, 0x14, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x68, 0x74, - 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x10, 0x6e, 0x6f, - 0x6e, 0x65, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2a, 0x58, - 0x0a, 0x14, 0x42, 0x53, 0x44, 0x20, 0x33, 0x2d, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x20, 0x4c, - 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, - 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, - 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x3a, 0x20, 0x0a, - 0x15, 0x78, 0x2d, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2d, 0x73, 0x6f, 0x6d, - 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x07, 0x1a, 0x05, 0x79, 0x61, 0x64, 0x64, 0x61, 0x2a, - 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x32, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x3a, 0x10, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, - 0x3a, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, - 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x52, 0x50, 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, - 0x49, 0x0a, 0x47, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, - 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x3b, 0x0a, 0x03, 0x34, 0x30, - 0x34, 0x12, 0x34, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, - 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, - 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, - 0x06, 0x0a, 0x04, 0x9a, 0x02, 0x01, 0x07, 0x52, 0x57, 0x0a, 0x03, 0x34, 0x31, 0x38, 0x12, 0x50, - 0x0a, 0x0d, 0x49, 0x27, 0x6d, 0x20, 0x61, 0x20, 0x74, 0x65, 0x61, 0x70, 0x6f, 0x74, 0x2e, 0x12, - 0x3f, 0x0a, 0x3d, 0x1a, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, 0x75, 0x6d, - 0x52, 0x9b, 0x02, 0x0a, 0x03, 0x35, 0x30, 0x30, 0x12, 0x93, 0x02, 0x0a, 0x0c, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x41, 0x0a, 0x3f, 0x1a, 0x3d, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0xbf, 0x01, 0x0a, - 0x10, 0x58, 0x2d, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x49, - 0x64, 0x12, 0xaa, 0x01, 0x0a, 0x2b, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x65, 0x76, 0x65, - 0x6e, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x73, 0x12, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x32, - 0x26, 0x22, 0x32, 0x34, 0x33, 0x38, 0x61, 0x63, 0x33, 0x63, 0x2d, 0x33, 0x37, 0x65, 0x62, 0x2d, - 0x34, 0x39, 0x30, 0x32, 0x2d, 0x61, 0x64, 0x65, 0x66, 0x2d, 0x65, 0x64, 0x31, 0x36, 0x62, 0x34, - 0x34, 0x33, 0x31, 0x30, 0x33, 0x30, 0x22, 0x6a, 0x45, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, - 0x46, 0x5d, 0x7b, 0x38, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x34, - 0x7d, 0x2d, 0x34, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, 0x2d, 0x5b, - 0x38, 0x39, 0x41, 0x42, 0x5d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, - 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x31, 0x32, 0x7d, 0x24, 0x5a, 0x97, - 0x03, 0x0a, 0xaa, 0x01, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, - 0x12, 0x9b, 0x01, 0x08, 0x02, 0x1a, 0x09, 0x58, 0x2d, 0x41, 0x50, 0x49, 0x2d, 0x4b, 0x65, 0x79, - 0x20, 0x02, 0x4a, 0x60, 0x0a, 0x1e, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x2d, 0x61, - 0x70, 0x69, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x72, 0x12, 0x3e, 0x2a, 0x3c, 0x0a, 0x29, 0x0a, 0x1c, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x54, 0x74, 0x6c, 0x49, - 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x4e, 0x40, 0x0a, 0x0f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, 0x1a, 0x05, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x4a, 0x28, 0x0a, 0x1c, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x53, 0x6e, 0x61, 0x6b, 0x65, 0x45, 0x6e, + 0x75, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x28, 0x12, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, + 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x2f, 0x7b, 0x77, 0x68, 0x6f, 0x7d, 0x2f, 0x7b, 0x77, 0x68, 0x61, + 0x74, 0x7d, 0x2f, 0x7b, 0x77, 0x68, 0x65, 0x72, 0x65, 0x7d, 0x42, 0xcf, 0x0c, 0x5a, 0x4b, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, + 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x32, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x92, 0x41, 0xfe, 0x0b, 0x12, 0xf0, + 0x01, 0x0a, 0x13, 0x41, 0x20, 0x42, 0x69, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x45, 0x76, 0x65, 0x72, + 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x22, 0x58, 0x0a, 0x14, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, + 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x10, + 0x6e, 0x6f, 0x6e, 0x65, 0x40, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, + 0x2a, 0x58, 0x0a, 0x14, 0x42, 0x53, 0x44, 0x20, 0x33, 0x2d, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, + 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, + 0x69, 0x6e, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x3a, + 0x20, 0x0a, 0x15, 0x78, 0x2d, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x2d, 0x73, + 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x12, 0x07, 0x1a, 0x05, 0x79, 0x61, 0x64, 0x64, + 0x61, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x32, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, + 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, + 0x6f, 0x6e, 0x3a, 0x16, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x78, 0x2d, 0x66, 0x6f, 0x6f, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x52, 0x50, 0x0a, 0x03, 0x34, 0x30, + 0x33, 0x12, 0x49, 0x0a, 0x47, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, + 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x3b, 0x0a, 0x03, + 0x34, 0x30, 0x34, 0x12, 0x34, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, + 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, + 0x2e, 0x12, 0x06, 0x0a, 0x04, 0x9a, 0x02, 0x01, 0x07, 0x52, 0x57, 0x0a, 0x03, 0x34, 0x31, 0x38, + 0x12, 0x50, 0x0a, 0x0d, 0x49, 0x27, 0x6d, 0x20, 0x61, 0x20, 0x74, 0x65, 0x61, 0x70, 0x6f, 0x74, + 0x2e, 0x12, 0x3f, 0x0a, 0x3d, 0x1a, 0x3b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2e, 0x4e, 0x75, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x45, 0x6e, + 0x75, 0x6d, 0x52, 0x9b, 0x02, 0x0a, 0x03, 0x35, 0x30, 0x30, 0x12, 0x93, 0x02, 0x0a, 0x0c, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x41, 0x0a, 0x3f, 0x1a, + 0x3d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0xbf, + 0x01, 0x0a, 0x10, 0x58, 0x2d, 0x43, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2d, 0x49, 0x64, 0x12, 0xaa, 0x01, 0x0a, 0x2b, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x73, 0x12, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x1a, 0x04, 0x75, 0x75, 0x69, + 0x64, 0x32, 0x26, 0x22, 0x32, 0x34, 0x33, 0x38, 0x61, 0x63, 0x33, 0x63, 0x2d, 0x33, 0x37, 0x65, + 0x62, 0x2d, 0x34, 0x39, 0x30, 0x32, 0x2d, 0x61, 0x64, 0x65, 0x66, 0x2d, 0x65, 0x64, 0x31, 0x36, + 0x62, 0x34, 0x34, 0x33, 0x31, 0x30, 0x33, 0x30, 0x22, 0x6a, 0x45, 0x5e, 0x5b, 0x30, 0x2d, 0x39, + 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x38, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, + 0x7b, 0x34, 0x7d, 0x2d, 0x34, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x33, 0x7d, + 0x2d, 0x5b, 0x38, 0x39, 0x41, 0x42, 0x5d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, + 0x33, 0x7d, 0x2d, 0x5b, 0x30, 0x2d, 0x39, 0x41, 0x2d, 0x46, 0x5d, 0x7b, 0x31, 0x32, 0x7d, 0x24, + 0x5a, 0x97, 0x03, 0x0a, 0xaa, 0x01, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, + 0x74, 0x68, 0x12, 0x9b, 0x01, 0x08, 0x02, 0x1a, 0x09, 0x58, 0x2d, 0x41, 0x50, 0x49, 0x2d, 0x4b, + 0x65, 0x79, 0x20, 0x02, 0x4a, 0x60, 0x0a, 0x1e, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, 0x6f, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x61, 0x75, 0x74, 0x68, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x08, 0x1a, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x0a, 0x0f, - 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, 0x08, 0x01, 0x0a, - 0xd6, 0x01, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0xcb, 0x01, 0x08, 0x03, 0x28, - 0x04, 0x32, 0x23, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x3a, 0x1f, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, 0x75, 0x74, - 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x7f, 0x0a, 0x43, 0x0a, 0x05, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x12, 0x3a, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, - 0x61, 0x6e, 0x64, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x20, 0x74, 0x6f, 0x20, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x1a, - 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x12, 0x12, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x72, - 0x65, 0x61, 0x64, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x0a, 0x1c, 0x0a, 0x05, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x12, 0x13, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x72, 0x69, 0x74, - 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x62, 0x1f, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, - 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x0d, 0x0a, 0x09, 0x42, 0x61, - 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x62, 0x29, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, - 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x17, 0x0a, 0x06, 0x4f, - 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0x0d, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x05, 0x77, - 0x72, 0x69, 0x74, 0x65, 0x6a, 0x32, 0x0a, 0x08, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x72, 0x70, 0x63, - 0x12, 0x14, 0x45, 0x63, 0x68, 0x6f, 0x20, 0x52, 0x70, 0x63, 0x20, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x10, 0x0a, 0x0a, 0x78, 0x2d, 0x74, 0x72, 0x61, 0x69, - 0x74, 0x54, 0x61, 0x67, 0x12, 0x02, 0x20, 0x01, 0x72, 0x49, 0x0a, 0x17, 0x4d, 0x6f, 0x72, 0x65, - 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x7a, 0x28, 0x0a, 0x17, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x62, 0x61, 0x7a, 0x2d, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x0d, - 0x32, 0x0b, 0x0a, 0x05, 0x1a, 0x03, 0x6f, 0x6e, 0x65, 0x0a, 0x02, 0x20, 0x01, 0x7a, 0x1b, 0x0a, - 0x12, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, - 0x66, 0x6f, 0x6f, 0x12, 0x05, 0x1a, 0x03, 0x62, 0x61, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x12, 0x3e, 0x2a, 0x3c, 0x0a, 0x29, 0x0a, 0x1c, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x54, 0x74, + 0x6c, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x09, 0x11, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x4e, 0x40, 0x0a, 0x0f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, 0x1a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4a, 0x28, 0x0a, 0x1c, 0x78, 0x2d, 0x61, 0x6d, 0x61, 0x7a, + 0x6f, 0x6e, 0x2d, 0x61, 0x70, 0x69, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x61, 0x75, + 0x74, 0x68, 0x74, 0x79, 0x70, 0x65, 0x12, 0x08, 0x1a, 0x06, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, + 0x0a, 0x0f, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, 0x08, + 0x01, 0x0a, 0xd6, 0x01, 0x0a, 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0xcb, 0x01, 0x08, + 0x03, 0x28, 0x04, 0x32, 0x23, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x3a, 0x1f, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, + 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x61, + 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x7f, 0x0a, 0x43, 0x0a, 0x05, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x3a, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x72, 0x65, 0x61, + 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x0a, 0x1a, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x12, 0x12, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, + 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x0a, 0x1c, 0x0a, 0x05, + 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, 0x13, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x20, 0x77, 0x72, + 0x69, 0x74, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x62, 0x1f, 0x0a, 0x0e, 0x0a, 0x0a, + 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x0d, 0x0a, 0x09, + 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x62, 0x29, 0x0a, 0x0e, 0x0a, + 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x0a, 0x17, 0x0a, + 0x06, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x12, 0x0d, 0x0a, 0x04, 0x72, 0x65, 0x61, 0x64, 0x0a, + 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6a, 0x32, 0x0a, 0x08, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x72, + 0x70, 0x63, 0x12, 0x14, 0x45, 0x63, 0x68, 0x6f, 0x20, 0x52, 0x70, 0x63, 0x20, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x10, 0x0a, 0x0a, 0x78, 0x2d, 0x74, 0x72, + 0x61, 0x69, 0x74, 0x54, 0x61, 0x67, 0x12, 0x02, 0x20, 0x01, 0x72, 0x49, 0x0a, 0x17, 0x4d, 0x6f, + 0x72, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x67, 0x52, 0x50, 0x43, 0x2d, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, + 0x63, 0x6f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x7a, 0x28, 0x0a, 0x17, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2d, 0x62, 0x61, 0x7a, 0x2d, 0x6c, 0x69, 0x73, 0x74, + 0x12, 0x0d, 0x32, 0x0b, 0x0a, 0x05, 0x1a, 0x03, 0x6f, 0x6e, 0x65, 0x0a, 0x02, 0x20, 0x01, 0x7a, + 0x1b, 0x0a, 0x12, 0x78, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2d, 0x66, 0x6f, 0x6f, 0x12, 0x05, 0x1a, 0x03, 0x62, 0x61, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.proto b/examples/internal/proto/examplepb/a_bit_of_everything.proto index a40b5abb47b..324a9505729 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.proto +++ b/examples/internal/proto/examplepb/a_bit_of_everything.proto @@ -495,6 +495,7 @@ message UpdateBookRequest { // proto messages and URL templates are still processed correctly. service ABitOfEverythingService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { + name: "ABitOfEverything" description: "ABitOfEverythingService description -- which should not be used in place of the documentation comment!" external_docs: { url: "https://github.com/grpc-ecosystem/grpc-gateway"; diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json index 159d072fbb1..09f27d898db 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json @@ -21,7 +21,7 @@ "x-traitTag": true }, { - "name": "ABitOfEverythingService", + "name": "ABitOfEverything", "description": "ABitOfEverythingService description -- which should not be used in place of the documentation comment!", "externalDocs": { "description": "Find out more about EchoService", @@ -7898,11 +7898,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/echo_service.swagger.json b/examples/internal/proto/examplepb/echo_service.swagger.json index 63ada7660f3..5a74a6281a0 100644 --- a/examples/internal/proto/examplepb/echo_service.swagger.json +++ b/examples/internal/proto/examplepb/echo_service.swagger.json @@ -1080,11 +1080,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/flow_combination.swagger.json b/examples/internal/proto/examplepb/flow_combination.swagger.json index ba73e272d21..dceead8b785 100644 --- a/examples/internal/proto/examplepb/flow_combination.swagger.json +++ b/examples/internal/proto/examplepb/flow_combination.swagger.json @@ -1165,11 +1165,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/generated_input.swagger.json b/examples/internal/proto/examplepb/generated_input.swagger.json index c2303613e0d..e36fa2126a3 100644 --- a/examples/internal/proto/examplepb/generated_input.swagger.json +++ b/examples/internal/proto/examplepb/generated_input.swagger.json @@ -387,11 +387,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/non_standard_names.swagger.json b/examples/internal/proto/examplepb/non_standard_names.swagger.json index b86a36024a5..68b95f981e7 100644 --- a/examples/internal/proto/examplepb/non_standard_names.swagger.json +++ b/examples/internal/proto/examplepb/non_standard_names.swagger.json @@ -201,11 +201,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/openapi_merge_a.swagger.json b/examples/internal/proto/examplepb/openapi_merge_a.swagger.json index 092791daaa7..478510aca21 100644 --- a/examples/internal/proto/examplepb/openapi_merge_a.swagger.json +++ b/examples/internal/proto/examplepb/openapi_merge_a.swagger.json @@ -212,11 +212,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/openapi_merge_b.swagger.json b/examples/internal/proto/examplepb/openapi_merge_b.swagger.json index 148763678fa..81a023a4d1c 100644 --- a/examples/internal/proto/examplepb/openapi_merge_b.swagger.json +++ b/examples/internal/proto/examplepb/openapi_merge_b.swagger.json @@ -129,11 +129,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json index 8ba17f37d05..b0ae59a6e21 100644 --- a/examples/internal/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -231,11 +231,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/stream.swagger.json b/examples/internal/proto/examplepb/stream.swagger.json index 3fc27f6a9d2..6f75c7f0cea 100644 --- a/examples/internal/proto/examplepb/stream.swagger.json +++ b/examples/internal/proto/examplepb/stream.swagger.json @@ -524,11 +524,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/wrappers.swagger.json b/examples/internal/proto/examplepb/wrappers.swagger.json index 94ca04a4ae8..e9e4ce3a7b3 100644 --- a/examples/internal/proto/examplepb/wrappers.swagger.json +++ b/examples/internal/proto/examplepb/wrappers.swagger.json @@ -442,11 +442,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." }, "details": { "type": "array", diff --git a/protoc-gen-openapiv2/internal/genopenapi/template.go b/protoc-gen-openapiv2/internal/genopenapi/template.go index 5fe42c2b0d8..5432587323f 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -1108,6 +1108,9 @@ func renderServiceTags(services []*descriptor.Service, reg *descriptor.Registry) tag.ExternalDocs.Description = goTemplateComments(opts.ExternalDocs.Description, svc, reg) } } + if opts.GetName() != "" { + tag.Name = opts.GetName() + } } tags = append(tags, tag) } From 70e5e6207bc56b447be51a3307099aa436019e00 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 12:40:28 +0200 Subject: [PATCH 2/9] fix tags in methods --- protoc-gen-openapiv2/internal/genopenapi/template.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/protoc-gen-openapiv2/internal/genopenapi/template.go b/protoc-gen-openapiv2/internal/genopenapi/template.go index 5432587323f..be48e5920c8 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -1482,7 +1482,15 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r } if !reg.GetDisableServiceTags() { + opts, err := getServiceOpenAPIOption(reg, svc) + if err != nil { + grpclog.Error(err) + return nil + } tag := svc.GetName() + if opts.Name != "" { + tag = opts.Name + } if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tag = pkg + "." + tag } From 5f95d6d70be4162f6c281af347e90463476ead61 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 14:36:00 +0200 Subject: [PATCH 3/9] fixup --- protoc-gen-openapiv2/internal/genopenapi/template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protoc-gen-openapiv2/internal/genopenapi/template.go b/protoc-gen-openapiv2/internal/genopenapi/template.go index be48e5920c8..9a5f16d8ed2 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -1485,11 +1485,11 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r opts, err := getServiceOpenAPIOption(reg, svc) if err != nil { grpclog.Error(err) - return nil + return err } tag := svc.GetName() - if opts.Name != "" { - tag = opts.Name + if opts.GetName() != "" { + tag = opts.GetName() } if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tag = pkg + "." + tag From 884cb0cb2672e3c62f5f651c475bbcbc2fe8fe03 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 15:00:52 +0200 Subject: [PATCH 4/9] generated --- .../internal/clients/abe/api/swagger.yaml | 66 +- .../clients/abe/api_a_bit_of_everything.go | 6940 +++++++++++++++++ examples/internal/clients/abe/client.go | 4 +- .../internal/clients/echo/api/swagger.yaml | 4 +- .../clients/responsebody/api/swagger.yaml | 4 +- .../a_bit_of_everything.swagger.json | 66 +- .../proto/examplepb/echo_service.swagger.json | 4 +- .../examplepb/flow_combination.swagger.json | 4 +- .../examplepb/generated_input.swagger.json | 4 +- .../examplepb/non_standard_names.swagger.json | 4 +- .../examplepb/openapi_merge_a.swagger.json | 4 +- .../examplepb/openapi_merge_b.swagger.json | 4 +- .../response_body_service.swagger.json | 4 +- .../proto/examplepb/stream.swagger.json | 4 +- .../proto/examplepb/wrappers.swagger.json | 4 +- 15 files changed, 7030 insertions(+), 90 deletions(-) create mode 100644 examples/internal/clients/abe/api_a_bit_of_everything.go diff --git a/examples/internal/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml index c5643575fe1..6865bd881e1 100644 --- a/examples/internal/clients/abe/api/swagger.yaml +++ b/examples/internal/clients/abe/api/swagger.yaml @@ -45,7 +45,7 @@ paths: /v1/example/a_bit_of_everything: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CreateBody" parameters: - in: "body" @@ -134,7 +134,7 @@ paths: /v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckNestedEnumGetQueryParams" parameters: - name: "singleNested.ok" @@ -556,7 +556,7 @@ paths: /v1/example/a_bit_of_everything/params/get/{singleNested.name}: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckGetQueryParams" parameters: - name: "singleNested.name" @@ -985,7 +985,7 @@ paths: /v1/example/a_bit_of_everything/params/post/{stringValue}: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckPostQueryParams" parameters: - name: "stringValue" @@ -1401,7 +1401,7 @@ paths: /v1/example/a_bit_of_everything/query/{uuidName}: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_GetQuery" parameters: - name: "uuidName" @@ -1842,7 +1842,7 @@ paths: ? /v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation} : post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" summary: "Create a new ABitOfEverything" description: "This API creates a new ABitOfEverything" operationId: "ABitOfEverythingService_Create" @@ -2260,7 +2260,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}: head: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Exists" parameters: - name: "uuidName" @@ -2678,7 +2678,7 @@ paths: $ref: "#/definitions/rpcStatus" put: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Update" parameters: - name: "uuidName" @@ -2722,7 +2722,7 @@ paths: $ref: "#/definitions/rpcStatus" options: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CustomOptionsRequest" parameters: - name: "uuidName" @@ -3141,7 +3141,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}:custom: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Custom" parameters: - name: "uuidName" @@ -3577,7 +3577,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}:custom:custom: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_DoubleColon" parameters: - name: "uuidName" @@ -4013,7 +4013,7 @@ paths: /v1/example/a_bit_of_everything/{uuid}: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Lookup" parameters: - name: "uuid" @@ -4049,7 +4049,7 @@ paths: $ref: "#/definitions/rpcStatus" delete: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Delete" parameters: - name: "uuid" @@ -4092,7 +4092,7 @@ paths: ? /v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value} : get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_GetRepeatedQuery" parameters: - name: "pathRepeatedFloatValue" @@ -4286,7 +4286,7 @@ paths: /v1/example/checkStatus: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckStatus" parameters: [] responses: @@ -4318,7 +4318,7 @@ paths: /v1/example/deep_path/{singleNested.name}: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_DeepPathEcho" parameters: - name: "singleNested.name" @@ -4362,7 +4362,7 @@ paths: /v1/example/oneofenum: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_PostOneofEnum" parameters: - in: "body" @@ -4400,7 +4400,7 @@ paths: /v1/example/requiredmessagetype: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_PostRequiredMessageType" parameters: - in: "body" @@ -4494,7 +4494,7 @@ paths: /v1/{book.name}: patch: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateBook" parameters: - name: "book.name" @@ -4550,7 +4550,7 @@ paths: /v1/{parent}/books: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" summary: "Create a book." operationId: "ABitOfEverythingService_CreateBook" parameters: @@ -4606,7 +4606,7 @@ paths: /v2/example/a_bit_of_everything/{uuidName}: put: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV2" parameters: - name: "uuidName" @@ -4659,7 +4659,7 @@ paths: $ref: "#/definitions/rpcStatus" patch: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV22" parameters: - name: "uuidName" @@ -4837,7 +4837,7 @@ paths: /v2/example/errorwithdetails: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_ErrorWithDetails" parameters: [] responses: @@ -4869,7 +4869,7 @@ paths: /v2/example/overwriterequestcontenttype: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteRequestContentType" consumes: - "application/x-bar-mime" @@ -4909,7 +4909,7 @@ paths: /v2/example/overwriteresponsecontenttype: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteResponseContentType" produces: - "application/text" @@ -4943,7 +4943,7 @@ paths: /v2/example/postwithemptybody/{name}: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_PostWithEmptyBody" parameters: - name: "name" @@ -4986,7 +4986,7 @@ paths: /v2/example/timeout: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_Timeout" parameters: [] responses: @@ -5018,7 +5018,7 @@ paths: /v2/example/withbody/{id}: post: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_GetMessageWithBody" parameters: - name: "id" @@ -5061,7 +5061,7 @@ paths: /v2/{value}:check: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalPathEnum" parameters: - name: "value" @@ -5101,7 +5101,7 @@ paths: /v2a/example/a_bit_of_everything/{uuidName}: patch: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV23" parameters: - name: "uuidName" @@ -5147,7 +5147,7 @@ paths: /v3/{value}:check: get: tags: - - "ABitOfEverythingService" + - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalNestedPathEnum" parameters: - name: "value" @@ -5727,12 +5727,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized\nby the client." + \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/clients/abe/api_a_bit_of_everything.go b/examples/internal/clients/abe/api_a_bit_of_everything.go new file mode 100644 index 00000000000..ca4c5f647e6 --- /dev/null +++ b/examples/internal/clients/abe/api_a_bit_of_everything.go @@ -0,0 +1,6940 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type ABitOfEverythingApiService service + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalNestedPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v3/{value}:check" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/{value}:check" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{singleNested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedOk DeepEnum description. + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stringValue + * @param singleNested + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckPostQueryParamsOpts - Optional Parameters: + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckPostQueryParamsOpts struct { + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, singleNested ABitOfEverythingNested, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckPostQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{stringValue}" + localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &singleNested + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return ExamplepbCheckStatusResponse +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckStatus(ctx context.Context) (ExamplepbCheckStatusResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbCheckStatusResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/checkStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbCheckStatusResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService Create a new ABitOfEverything +This API creates a new ABitOfEverything + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @param enumValue + * @param pathEnumValue + * @param nestedPathEnumValue + * @param enumValueAnnotation Numeric enum description. + * @param uuid + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCreateOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "BytesValue" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCreateOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + BytesValue optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string, uuid string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCreateOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}" + localVarPath = strings.Replace(localVarPath, "{"+"floatValue"+"}", fmt.Sprintf("%v", floatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"doubleValue"+"}", fmt.Sprintf("%v", doubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int64Value"+"}", fmt.Sprintf("%v", int64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint64Value"+"}", fmt.Sprintf("%v", uint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int32Value"+"}", fmt.Sprintf("%v", int32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed64Value"+"}", fmt.Sprintf("%v", fixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed32Value"+"}", fmt.Sprintf("%v", fixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"boolValue"+"}", fmt.Sprintf("%v", boolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint32Value"+"}", fmt.Sprintf("%v", uint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed32Value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed64Value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint32Value"+"}", fmt.Sprintf("%v", sint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint64Value"+"}", fmt.Sprintf("%v", sint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enumValue"+"}", fmt.Sprintf("%v", enumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathEnumValue"+"}", fmt.Sprintf("%v", pathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nestedPathEnumValue"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enumValueAnnotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Intentionally complicated message type to cover many features of Protobuf. + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService Create a book. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param parent The publisher in which to create the book. Format: `publishers/{publisher}` Example: `publishers/1257894000000000000` + * @param book The book to create. + * @param optional nil or *ABitOfEverythingServiceCreateBookOpts - Optional Parameters: + * @param "BookId" (optional.String) - The ID to use for the book. This must start with an alphanumeric character. + +@return ExamplepbBook +*/ + +type ABitOfEverythingServiceCreateBookOpts struct { + BookId optional.String +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreateBook(ctx context.Context, parent string, book ExamplepbBook, localVarOptionals *ABitOfEverythingServiceCreateBookOpts) (ExamplepbBook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbBook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/{parent}/books" + localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.BookId.IsSet() { + localVarQueryParams.Add("bookId", parameterToString(localVarOptionals.BookId.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &book + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbBook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCustomOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCustomOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCustom(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCustomOptionsRequestOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceCustomOptionsRequestOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCustomOptionsRequest(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOptionsRequestOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Options") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param body + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ABitOfEverything1) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/deep_path/{singleNested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceDoubleColonOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceDoubleColonOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDoubleColon(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceDoubleColonOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom:custom" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceExistsOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceExistsOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceExists(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceExistsOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Head") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id + * @param data + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, data ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &data + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceGetQueryOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pathRepeatedFloatValue repeated values. they are comma-separated in path + * @param pathRepeatedDoubleValue + * @param pathRepeatedInt64Value + * @param pathRepeatedUint64Value + * @param pathRepeatedInt32Value + * @param pathRepeatedFixed64Value + * @param pathRepeatedFixed32Value + * @param pathRepeatedBoolValue + * @param pathRepeatedStringValue + * @param pathRepeatedBytesValue + * @param pathRepeatedUint32Value + * @param pathRepeatedEnumValue + * @param pathRepeatedSfixed32Value + * @param pathRepeatedSfixed64Value + * @param pathRepeatedSint32Value + * @param pathRepeatedSint64Value + +@return ExamplepbABitOfEverythingRepeated +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverythingRepeated + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if len(pathRepeatedFloatValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") + } + if len(pathRepeatedDoubleValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") + } + if len(pathRepeatedInt64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") + } + if len(pathRepeatedUint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") + } + if len(pathRepeatedInt32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") + } + if len(pathRepeatedFixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") + } + if len(pathRepeatedFixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") + } + if len(pathRepeatedBoolValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") + } + if len(pathRepeatedStringValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") + } + if len(pathRepeatedBytesValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") + } + if len(pathRepeatedUint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") + } + if len(pathRepeatedEnumValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") + } + if len(pathRepeatedSfixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") + } + if len(pathRepeatedSfixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") + } + if len(pathRepeatedSint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") + } + if len(pathRepeatedSint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverythingRepeated + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-bar-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return string +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/text"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param exampleEnum + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostOneofEnum(ctx context.Context, exampleEnum OneofenumExampleEnum) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/oneofenum" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &exampleEnum + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostRequiredMessageType(ctx context.Context, body ExamplepbRequiredMessageTypeRequest) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/requiredmessagetype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body interface{}) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuidName string, body ABitOfEverything) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bookName The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` + * @param book The book to update. The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} + * @param optional nil or *ABitOfEverythingServiceUpdateBookOpts - Optional Parameters: + * @param "AllowMissing" (optional.Bool) - If set to true, and the book is not found, a new book will be created. In this situation, `update_mask` is ignored. + +@return ExamplepbBook +*/ + +type ABitOfEverythingServiceUpdateBookOpts struct { + AllowMissing optional.Bool +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateBook(ctx context.Context, bookName string, book TheBookToUpdate_, localVarOptionals *ABitOfEverythingServiceUpdateBookOpts) (ExamplepbBook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbBook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/{book.name}" + localVarPath = strings.Replace(localVarPath, "{"+"book.name"+"}", fmt.Sprintf("%v", bookName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.AllowMissing.IsSet() { + localVarQueryParams.Add("allowMissing", parameterToString(localVarOptionals.AllowMissing.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &book + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbBook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. + * @param optional nil or *ABitOfEverythingServiceUpdateV2Opts - Optional Parameters: + * @param "UpdateMask" (optional.String) - The paths to update. + +@return interface{} +*/ + +type ABitOfEverythingServiceUpdateV2Opts struct { + UpdateMask optional.String +} + +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, uuidName string, abe ABitOfEverything2, localVarOptionals *ABitOfEverythingServiceUpdateV2Opts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.UpdateMask.IsSet() { + localVarQueryParams.Add("updateMask", parameterToString(localVarOptionals.UpdateMask.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &abe + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, uuidName string, abe ABitOfEverything3) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &abe + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, uuidName string, body UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/internal/clients/abe/client.go b/examples/internal/clients/abe/client.go index 8552ff007bc..3293aadf212 100644 --- a/examples/internal/clients/abe/client.go +++ b/examples/internal/clients/abe/client.go @@ -46,7 +46,7 @@ type APIClient struct { // API Services - ABitOfEverythingServiceApi *ABitOfEverythingServiceApiService + ABitOfEverythingApi *ABitOfEverythingApiService CamelCaseServiceNameApi *CamelCaseServiceNameApiService @@ -71,7 +71,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.ABitOfEverythingServiceApi = (*ABitOfEverythingServiceApiService)(&c.common) + c.ABitOfEverythingApi = (*ABitOfEverythingApiService)(&c.common) c.CamelCaseServiceNameApi = (*CamelCaseServiceNameApiService)(&c.common) c.EchoRpcApi = (*EchoRpcApiService)(&c.common) c.SnakeEnumServiceApi = (*SnakeEnumServiceApiService)(&c.common) diff --git a/examples/internal/clients/echo/api/swagger.yaml b/examples/internal/clients/echo/api/swagger.yaml index 4006c7bce34..03e677324a5 100644 --- a/examples/internal/clients/echo/api/swagger.yaml +++ b/examples/internal/clients/echo/api/swagger.yaml @@ -993,12 +993,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized\nby the client." + \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/clients/responsebody/api/swagger.yaml b/examples/internal/clients/responsebody/api/swagger.yaml index d2cfb08174a..8cf3af7163f 100644 --- a/examples/internal/clients/responsebody/api/swagger.yaml +++ b/examples/internal/clients/responsebody/api/swagger.yaml @@ -206,12 +206,12 @@ definitions: code: type: "integer" format: "int32" - description: "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + description: "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." message: type: "string" description: "A developer-facing error message, which should be in English.\ \ Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details]\ - \ field, or localized\nby the client." + \ field, or localized by the client." details: type: "array" description: "A list of messages that carry the error details. There is a\ diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json index 09f27d898db..78a5747c60d 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json @@ -104,7 +104,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -627,7 +627,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -1087,7 +1087,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -1536,7 +1536,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -2003,7 +2003,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ], "deprecated": true, "security": [], @@ -2474,7 +2474,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -2790,7 +2790,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] }, "head": { @@ -3232,7 +3232,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] }, "options": { @@ -3674,7 +3674,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -4140,7 +4140,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -4606,7 +4606,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -4659,7 +4659,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] }, "delete": { @@ -4711,7 +4711,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ], "security": [ { @@ -4962,7 +4962,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5007,7 +5007,7 @@ } }, "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5343,7 +5343,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5399,7 +5399,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5455,7 +5455,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5618,7 +5618,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -5690,7 +5690,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6014,7 +6014,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] }, "patch": { @@ -6329,7 +6329,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6559,7 +6559,7 @@ } }, "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6615,7 +6615,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ], "consumes": [ "application/x-bar-mime" @@ -6663,7 +6663,7 @@ } }, "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ], "produces": [ "application/text" @@ -6728,7 +6728,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6774,7 +6774,7 @@ } }, "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6836,7 +6836,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -6894,7 +6894,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -7220,7 +7220,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } }, @@ -7278,7 +7278,7 @@ } ], "tags": [ - "ABitOfEverythingService" + "ABitOfEverything" ] } } @@ -7898,11 +7898,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/echo_service.swagger.json b/examples/internal/proto/examplepb/echo_service.swagger.json index 5a74a6281a0..63ada7660f3 100644 --- a/examples/internal/proto/examplepb/echo_service.swagger.json +++ b/examples/internal/proto/examplepb/echo_service.swagger.json @@ -1080,11 +1080,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/flow_combination.swagger.json b/examples/internal/proto/examplepb/flow_combination.swagger.json index dceead8b785..ba73e272d21 100644 --- a/examples/internal/proto/examplepb/flow_combination.swagger.json +++ b/examples/internal/proto/examplepb/flow_combination.swagger.json @@ -1165,11 +1165,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/generated_input.swagger.json b/examples/internal/proto/examplepb/generated_input.swagger.json index e36fa2126a3..c2303613e0d 100644 --- a/examples/internal/proto/examplepb/generated_input.swagger.json +++ b/examples/internal/proto/examplepb/generated_input.swagger.json @@ -387,11 +387,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/non_standard_names.swagger.json b/examples/internal/proto/examplepb/non_standard_names.swagger.json index 68b95f981e7..b86a36024a5 100644 --- a/examples/internal/proto/examplepb/non_standard_names.swagger.json +++ b/examples/internal/proto/examplepb/non_standard_names.swagger.json @@ -201,11 +201,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/openapi_merge_a.swagger.json b/examples/internal/proto/examplepb/openapi_merge_a.swagger.json index 478510aca21..092791daaa7 100644 --- a/examples/internal/proto/examplepb/openapi_merge_a.swagger.json +++ b/examples/internal/proto/examplepb/openapi_merge_a.swagger.json @@ -212,11 +212,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/openapi_merge_b.swagger.json b/examples/internal/proto/examplepb/openapi_merge_b.swagger.json index 81a023a4d1c..148763678fa 100644 --- a/examples/internal/proto/examplepb/openapi_merge_b.swagger.json +++ b/examples/internal/proto/examplepb/openapi_merge_b.swagger.json @@ -129,11 +129,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/response_body_service.swagger.json b/examples/internal/proto/examplepb/response_body_service.swagger.json index b0ae59a6e21..8ba17f37d05 100644 --- a/examples/internal/proto/examplepb/response_body_service.swagger.json +++ b/examples/internal/proto/examplepb/response_body_service.swagger.json @@ -231,11 +231,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/stream.swagger.json b/examples/internal/proto/examplepb/stream.swagger.json index 6f75c7f0cea..3fc27f6a9d2 100644 --- a/examples/internal/proto/examplepb/stream.swagger.json +++ b/examples/internal/proto/examplepb/stream.swagger.json @@ -524,11 +524,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", diff --git a/examples/internal/proto/examplepb/wrappers.swagger.json b/examples/internal/proto/examplepb/wrappers.swagger.json index e9e4ce3a7b3..94ca04a4ae8 100644 --- a/examples/internal/proto/examplepb/wrappers.swagger.json +++ b/examples/internal/proto/examplepb/wrappers.swagger.json @@ -442,11 +442,11 @@ "code": { "type": "integer", "format": "int32", - "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", - "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", From de8dd495d0326516a98b33e16a4f6c05288ae2d2 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 15:07:58 +0200 Subject: [PATCH 5/9] fixup --- .../abe/api_a_bit_of_everything_service.go | 6940 ----------------- 1 file changed, 6940 deletions(-) delete mode 100644 examples/internal/clients/abe/api_a_bit_of_everything_service.go diff --git a/examples/internal/clients/abe/api_a_bit_of_everything_service.go b/examples/internal/clients/abe/api_a_bit_of_everything_service.go deleted file mode 100644 index 8153f7f8c3b..00000000000 --- a/examples/internal/clients/abe/api_a_bit_of_everything_service.go +++ /dev/null @@ -1,6940 +0,0 @@ -/* - * A Bit of Everything - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1.0 - * Contact: none@example.com - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ - -package abe - -import ( - "context" - "io/ioutil" - "net/http" - "net/url" - "strings" - "fmt" - "github.com/antihax/optional" -) - -// Linger please -var ( - _ context.Context -) - -type ABitOfEverythingServiceApiService service - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param value - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalNestedPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v3/{value}:check" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param value - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/{value}:check" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedName name is nested field. - * @param uuid - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{singleNested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedOk DeepEnum description. - * @param uuid - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param stringValue - * @param singleNested - * @param uuid - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckPostQueryParamsOpts - Optional Parameters: - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCheckPostQueryParamsOpts struct { - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, singleNested ABitOfEverythingNested, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckPostQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{stringValue}" - localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &singleNested - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return ExamplepbCheckStatusResponse -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckStatus(ctx context.Context) (ExamplepbCheckStatusResponse, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbCheckStatusResponse - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/checkStatus" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbCheckStatusResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService Create a new ABitOfEverything -This API creates a new ABitOfEverything - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param uint32Value - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param nonConventionalNameValue - * @param enumValue - * @param pathEnumValue - * @param nestedPathEnumValue - * @param enumValueAnnotation Numeric enum description. - * @param uuid - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCreateOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "BytesValue" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCreateOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - BytesValue optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string, uuid string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCreateOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}" - localVarPath = strings.Replace(localVarPath, "{"+"floatValue"+"}", fmt.Sprintf("%v", floatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"doubleValue"+"}", fmt.Sprintf("%v", doubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int64Value"+"}", fmt.Sprintf("%v", int64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint64Value"+"}", fmt.Sprintf("%v", uint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int32Value"+"}", fmt.Sprintf("%v", int32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed64Value"+"}", fmt.Sprintf("%v", fixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed32Value"+"}", fmt.Sprintf("%v", fixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"boolValue"+"}", fmt.Sprintf("%v", boolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint32Value"+"}", fmt.Sprintf("%v", uint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed32Value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed64Value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint32Value"+"}", fmt.Sprintf("%v", sint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint64Value"+"}", fmt.Sprintf("%v", sint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enumValue"+"}", fmt.Sprintf("%v", enumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathEnumValue"+"}", fmt.Sprintf("%v", pathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nestedPathEnumValue"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enumValueAnnotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Intentionally complicated message type to cover many features of Protobuf. - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService Create a book. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param parent The publisher in which to create the book. Format: `publishers/{publisher}` Example: `publishers/1257894000000000000` - * @param book The book to create. - * @param optional nil or *ABitOfEverythingServiceCreateBookOpts - Optional Parameters: - * @param "BookId" (optional.String) - The ID to use for the book. This must start with an alphanumeric character. - -@return ExamplepbBook -*/ - -type ABitOfEverythingServiceCreateBookOpts struct { - BookId optional.String -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBook(ctx context.Context, parent string, book ExamplepbBook, localVarOptionals *ABitOfEverythingServiceCreateBookOpts) (ExamplepbBook, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbBook - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/{parent}/books" - localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.BookId.IsSet() { - localVarQueryParams.Add("bookId", parameterToString(localVarOptionals.BookId.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &book - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbBook - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCustomOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCustomOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustom(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCustomOptionsRequestOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceCustomOptionsRequestOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustomOptionsRequest(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOptionsRequestOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Options") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedName name is nested field. - * @param body - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ABitOfEverything1) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/deep_path/{singleNested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Delete") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceDoubleColonOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceDoubleColonOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDoubleColon(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceDoubleColonOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom:custom" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceExistsOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceExistsOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceExists(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceExistsOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Head") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id - * @param data - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, data ExamplepbBody) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &data - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceGetQueryOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pathRepeatedFloatValue repeated values. they are comma-separated in path - * @param pathRepeatedDoubleValue - * @param pathRepeatedInt64Value - * @param pathRepeatedUint64Value - * @param pathRepeatedInt32Value - * @param pathRepeatedFixed64Value - * @param pathRepeatedFixed32Value - * @param pathRepeatedBoolValue - * @param pathRepeatedStringValue - * @param pathRepeatedBytesValue - * @param pathRepeatedUint32Value - * @param pathRepeatedEnumValue - * @param pathRepeatedSfixed32Value - * @param pathRepeatedSfixed64Value - * @param pathRepeatedSint32Value - * @param pathRepeatedSint64Value - -@return ExamplepbABitOfEverythingRepeated -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverythingRepeated - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if len(pathRepeatedFloatValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") - } - if len(pathRepeatedDoubleValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") - } - if len(pathRepeatedInt64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") - } - if len(pathRepeatedUint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") - } - if len(pathRepeatedInt32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") - } - if len(pathRepeatedFixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") - } - if len(pathRepeatedFixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") - } - if len(pathRepeatedBoolValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") - } - if len(pathRepeatedStringValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") - } - if len(pathRepeatedBytesValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") - } - if len(pathRepeatedUint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") - } - if len(pathRepeatedEnumValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") - } - if len(pathRepeatedSfixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") - } - if len(pathRepeatedSfixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") - } - if len(pathRepeatedSint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") - } - if len(pathRepeatedSint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverythingRepeated - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/x-bar-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return string -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue string - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/text"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param exampleEnum - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostOneofEnum(ctx context.Context, exampleEnum OneofenumExampleEnum) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/oneofenum" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &exampleEnum - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostRequiredMessageType(ctx context.Context, body ExamplepbRequiredMessageTypeRequest) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/requiredmessagetype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param name - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body interface{}) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuidName string, body ABitOfEverything) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bookName The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` - * @param book The book to update. The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} - * @param optional nil or *ABitOfEverythingServiceUpdateBookOpts - Optional Parameters: - * @param "AllowMissing" (optional.Bool) - If set to true, and the book is not found, a new book will be created. In this situation, `update_mask` is ignored. - -@return ExamplepbBook -*/ - -type ABitOfEverythingServiceUpdateBookOpts struct { - AllowMissing optional.Bool -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateBook(ctx context.Context, bookName string, book TheBookToUpdate_, localVarOptionals *ABitOfEverythingServiceUpdateBookOpts) (ExamplepbBook, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbBook - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/{book.name}" - localVarPath = strings.Replace(localVarPath, "{"+"book.name"+"}", fmt.Sprintf("%v", bookName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.AllowMissing.IsSet() { - localVarQueryParams.Add("allowMissing", parameterToString(localVarOptionals.AllowMissing.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &book - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbBook - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. - * @param optional nil or *ABitOfEverythingServiceUpdateV2Opts - Optional Parameters: - * @param "UpdateMask" (optional.String) - The paths to update. - -@return interface{} -*/ - -type ABitOfEverythingServiceUpdateV2Opts struct { - UpdateMask optional.String -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, uuidName string, abe ABitOfEverything2, localVarOptionals *ABitOfEverythingServiceUpdateV2Opts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.UpdateMask.IsSet() { - localVarQueryParams.Add("updateMask", parameterToString(localVarOptionals.UpdateMask.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &abe - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, uuidName string, abe ABitOfEverything3) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &abe - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, uuidName string, body UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} From 2d8579890b9ea375fb8824a526f9eef82696ec24 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 15:15:59 +0200 Subject: [PATCH 6/9] fu --- .../internal/clients/abe/api/swagger.yaml | 31 + .../abe/api_a_bit_of_everything_service.go | 6940 +++++++++++++++++ examples/internal/clients/abe/client.go | 3 + .../a_bit_of_everything.swagger.json | 31 + .../internal/genopenapi/template.go | 6 +- .../internal/genopenapi/template_test.go | 6 +- 6 files changed, 7013 insertions(+), 4 deletions(-) create mode 100644 examples/internal/clients/abe/api_a_bit_of_everything_service.go diff --git a/examples/internal/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml index 6865bd881e1..a9fcc78441c 100644 --- a/examples/internal/clients/abe/api/swagger.yaml +++ b/examples/internal/clients/abe/api/swagger.yaml @@ -45,6 +45,7 @@ paths: /v1/example/a_bit_of_everything: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CreateBody" parameters: @@ -134,6 +135,7 @@ paths: /v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckNestedEnumGetQueryParams" parameters: @@ -556,6 +558,7 @@ paths: /v1/example/a_bit_of_everything/params/get/{singleNested.name}: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckGetQueryParams" parameters: @@ -985,6 +988,7 @@ paths: /v1/example/a_bit_of_everything/params/post/{stringValue}: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckPostQueryParams" parameters: @@ -1401,6 +1405,7 @@ paths: /v1/example/a_bit_of_everything/query/{uuidName}: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_GetQuery" parameters: @@ -1842,6 +1847,7 @@ paths: ? /v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation} : post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" summary: "Create a new ABitOfEverything" description: "This API creates a new ABitOfEverything" @@ -2260,6 +2266,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}: head: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Exists" parameters: @@ -2678,6 +2685,7 @@ paths: $ref: "#/definitions/rpcStatus" put: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Update" parameters: @@ -2722,6 +2730,7 @@ paths: $ref: "#/definitions/rpcStatus" options: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CustomOptionsRequest" parameters: @@ -3141,6 +3150,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}:custom: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Custom" parameters: @@ -3577,6 +3587,7 @@ paths: /v1/example/a_bit_of_everything/{uuidName}:custom:custom: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_DoubleColon" parameters: @@ -4013,6 +4024,7 @@ paths: /v1/example/a_bit_of_everything/{uuid}: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Lookup" parameters: @@ -4049,6 +4061,7 @@ paths: $ref: "#/definitions/rpcStatus" delete: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Delete" parameters: @@ -4092,6 +4105,7 @@ paths: ? /v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value} : get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_GetRepeatedQuery" parameters: @@ -4286,6 +4300,7 @@ paths: /v1/example/checkStatus: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckStatus" parameters: [] @@ -4318,6 +4333,7 @@ paths: /v1/example/deep_path/{singleNested.name}: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_DeepPathEcho" parameters: @@ -4362,6 +4378,7 @@ paths: /v1/example/oneofenum: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_PostOneofEnum" parameters: @@ -4400,6 +4417,7 @@ paths: /v1/example/requiredmessagetype: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_PostRequiredMessageType" parameters: @@ -4494,6 +4512,7 @@ paths: /v1/{book.name}: patch: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateBook" parameters: @@ -4550,6 +4569,7 @@ paths: /v1/{parent}/books: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" summary: "Create a book." operationId: "ABitOfEverythingService_CreateBook" @@ -4606,6 +4626,7 @@ paths: /v2/example/a_bit_of_everything/{uuidName}: put: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV2" parameters: @@ -4659,6 +4680,7 @@ paths: $ref: "#/definitions/rpcStatus" patch: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV22" parameters: @@ -4837,6 +4859,7 @@ paths: /v2/example/errorwithdetails: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_ErrorWithDetails" parameters: [] @@ -4869,6 +4892,7 @@ paths: /v2/example/overwriterequestcontenttype: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteRequestContentType" consumes: @@ -4909,6 +4933,7 @@ paths: /v2/example/overwriteresponsecontenttype: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteResponseContentType" produces: @@ -4943,6 +4968,7 @@ paths: /v2/example/postwithemptybody/{name}: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_PostWithEmptyBody" parameters: @@ -4986,6 +5012,7 @@ paths: /v2/example/timeout: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Timeout" parameters: [] @@ -5018,6 +5045,7 @@ paths: /v2/example/withbody/{id}: post: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_GetMessageWithBody" parameters: @@ -5061,6 +5089,7 @@ paths: /v2/{value}:check: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalPathEnum" parameters: @@ -5101,6 +5130,7 @@ paths: /v2a/example/a_bit_of_everything/{uuidName}: patch: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV23" parameters: @@ -5147,6 +5177,7 @@ paths: /v3/{value}:check: get: tags: + - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalNestedPathEnum" parameters: diff --git a/examples/internal/clients/abe/api_a_bit_of_everything_service.go b/examples/internal/clients/abe/api_a_bit_of_everything_service.go new file mode 100644 index 00000000000..8153f7f8c3b --- /dev/null +++ b/examples/internal/clients/abe/api_a_bit_of_everything_service.go @@ -0,0 +1,6940 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0 + * Contact: none@example.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package abe + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type ABitOfEverythingServiceApiService service + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalNestedPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v3/{value}:check" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param value + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckExternalPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/{value}:check" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{singleNested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedOk DeepEnum description. + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stringValue + * @param singleNested + * @param uuid + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCheckPostQueryParamsOpts - Optional Parameters: + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCheckPostQueryParamsOpts struct { + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, singleNested ABitOfEverythingNested, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckPostQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{stringValue}" + localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &singleNested + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return ExamplepbCheckStatusResponse +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCheckStatus(ctx context.Context) (ExamplepbCheckStatusResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbCheckStatusResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/checkStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbCheckStatusResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService Create a new ABitOfEverything +This API creates a new ABitOfEverything + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @param enumValue + * @param pathEnumValue + * @param nestedPathEnumValue + * @param enumValueAnnotation Numeric enum description. + * @param uuid + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCreateOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "BytesValue" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCreateOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + BytesValue optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string, uuid string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCreateOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}" + localVarPath = strings.Replace(localVarPath, "{"+"floatValue"+"}", fmt.Sprintf("%v", floatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"doubleValue"+"}", fmt.Sprintf("%v", doubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int64Value"+"}", fmt.Sprintf("%v", int64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint64Value"+"}", fmt.Sprintf("%v", uint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int32Value"+"}", fmt.Sprintf("%v", int32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed64Value"+"}", fmt.Sprintf("%v", fixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed32Value"+"}", fmt.Sprintf("%v", fixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"boolValue"+"}", fmt.Sprintf("%v", boolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint32Value"+"}", fmt.Sprintf("%v", uint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed32Value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed64Value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint32Value"+"}", fmt.Sprintf("%v", sint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint64Value"+"}", fmt.Sprintf("%v", sint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enumValue"+"}", fmt.Sprintf("%v", enumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathEnumValue"+"}", fmt.Sprintf("%v", pathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nestedPathEnumValue"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enumValueAnnotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("uuid", parameterToString(uuid, "")) + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Intentionally complicated message type to cover many features of Protobuf. + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService Create a book. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param parent The publisher in which to create the book. Format: `publishers/{publisher}` Example: `publishers/1257894000000000000` + * @param book The book to create. + * @param optional nil or *ABitOfEverythingServiceCreateBookOpts - Optional Parameters: + * @param "BookId" (optional.String) - The ID to use for the book. This must start with an alphanumeric character. + +@return ExamplepbBook +*/ + +type ABitOfEverythingServiceCreateBookOpts struct { + BookId optional.String +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCreateBook(ctx context.Context, parent string, book ExamplepbBook, localVarOptionals *ABitOfEverythingServiceCreateBookOpts) (ExamplepbBook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbBook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/{parent}/books" + localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.BookId.IsSet() { + localVarQueryParams.Add("bookId", parameterToString(localVarOptionals.BookId.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &book + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbBook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCustomOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceCustomOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustom(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceCustomOptionsRequestOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceCustomOptionsRequestOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceCustomOptionsRequest(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOptionsRequestOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Options") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param singleNestedName name is nested field. + * @param body + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ABitOfEverything1) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/deep_path/{singleNested.name}" + localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceDoubleColonOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return ExamplepbABitOfEverything +*/ + +type ABitOfEverythingServiceDoubleColonOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDoubleColon(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceDoubleColonOpts) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom:custom" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceExistsOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceExistsOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceExists(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceExistsOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Head") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id + * @param data + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, data ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &data + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param floatValue Float value field + * @param doubleValue + * @param int64Value + * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition + * @param requiredStringField1 + * @param requiredStringField2 + * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields + * @param requiredFieldSchemaJsonNameCustom + * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. + * @param "SingleNestedAmount" (optional.Int64) - + * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Uint64Value" (optional.String) - + * @param "Int32Value" (optional.Int32) - + * @param "Fixed64Value" (optional.String) - + * @param "Fixed32Value" (optional.Int64) - + * @param "BoolValue" (optional.Bool) - + * @param "StringValue" (optional.String) - + * @param "BytesValue" (optional.String) - + * @param "Uint32Value" (optional.Int64) - + * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "PathEnumValue" (optional.String) - + * @param "NestedPathEnumValue" (optional.String) - + * @param "Sfixed32Value" (optional.Int32) - + * @param "Sfixed64Value" (optional.String) - + * @param "Sint32Value" (optional.Int32) - + * @param "Sint64Value" (optional.String) - + * @param "RepeatedStringValue" (optional.Interface of []string) - + * @param "OneofEmpty" (optional.Interface of map[string]string) - + * @param "OneofString" (optional.String) - + * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 + * @param "NonConventionalNameValue" (optional.String) - + * @param "TimestampValue" (optional.Time) - + * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 + * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. + * @param "NestedAnnotationAmount" (optional.Int64) - + * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. + * @param "Int64OverrideType" (optional.Int64) - + * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition + * @param "OptionalStringValue" (optional.String) - + * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. + * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce + * @param "TrailingOnly" (optional.String) - Trailing only + * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. + * @param "TrailingBoth" (optional.String) - Leading both Trailing both. + * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. + * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + +@return interface{} +*/ + +type ABitOfEverythingServiceGetQueryOpts struct { + SingleNestedName optional.String + SingleNestedAmount optional.Int64 + SingleNestedOk optional.String + Uint64Value optional.String + Int32Value optional.Int32 + Fixed64Value optional.String + Fixed32Value optional.Int64 + BoolValue optional.Bool + StringValue optional.String + BytesValue optional.String + Uint32Value optional.Int64 + EnumValue optional.String + PathEnumValue optional.String + NestedPathEnumValue optional.String + Sfixed32Value optional.Int32 + Sfixed64Value optional.String + Sint32Value optional.Int32 + Sint64Value optional.String + RepeatedStringValue optional.Interface + OneofEmpty optional.Interface + OneofString optional.String + MapValue optional.Interface + MappedStringValue optional.String + MappedNestedValue optional.Interface + NonConventionalNameValue optional.String + TimestampValue optional.Time + RepeatedEnumValue optional.Interface + RepeatedEnumAnnotation optional.Interface + EnumValueAnnotation optional.String + RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String + NestedAnnotationAmount optional.Int64 + NestedAnnotationOk optional.String + Int64OverrideType optional.Int64 + OutputOnlyStringViaFieldBehaviorAnnotation optional.String + OptionalStringValue optional.String + ProductId optional.Interface + OptionalStringField optional.String + TrailingOnly optional.String + TrailingOnlyDot optional.String + TrailingBoth optional.String + TrailingMultiline optional.String + Uuids optional.Interface +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { + localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { + localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) + } + localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) + localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) + localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) + if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { + localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { + localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { + localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { + localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { + localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { + localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { + localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { + localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { + localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { + localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { + localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { + localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { + localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { + localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { + localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { + localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { + localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { + localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { + localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { + localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { + localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { + localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { + localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { + localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { + localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { + localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { + localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { + localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { + localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { + localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) + } + localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) + if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { + localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { + localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { + localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { + localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) + } + localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) + localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) + localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) + localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) + if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { + localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { + localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { + localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { + localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { + localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pathRepeatedFloatValue repeated values. they are comma-separated in path + * @param pathRepeatedDoubleValue + * @param pathRepeatedInt64Value + * @param pathRepeatedUint64Value + * @param pathRepeatedInt32Value + * @param pathRepeatedFixed64Value + * @param pathRepeatedFixed32Value + * @param pathRepeatedBoolValue + * @param pathRepeatedStringValue + * @param pathRepeatedBytesValue + * @param pathRepeatedUint32Value + * @param pathRepeatedEnumValue + * @param pathRepeatedSfixed32Value + * @param pathRepeatedSfixed64Value + * @param pathRepeatedSint32Value + * @param pathRepeatedSint64Value + +@return ExamplepbABitOfEverythingRepeated +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverythingRepeated + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if len(pathRepeatedFloatValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") + } + if len(pathRepeatedDoubleValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") + } + if len(pathRepeatedInt64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") + } + if len(pathRepeatedUint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") + } + if len(pathRepeatedInt32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") + } + if len(pathRepeatedFixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") + } + if len(pathRepeatedFixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") + } + if len(pathRepeatedBoolValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") + } + if len(pathRepeatedStringValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") + } + if len(pathRepeatedBytesValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") + } + if len(pathRepeatedUint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") + } + if len(pathRepeatedEnumValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") + } + if len(pathRepeatedSfixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") + } + if len(pathRepeatedSfixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") + } + if len(pathRepeatedSint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") + } + if len(pathRepeatedSint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverythingRepeated + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid + +@return ExamplepbABitOfEverything +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverything + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbABitOfEverything + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/x-bar-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return string +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/text"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param exampleEnum + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostOneofEnum(ctx context.Context, exampleEnum OneofenumExampleEnum) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/oneofenum" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &exampleEnum + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostRequiredMessageType(ctx context.Context, body ExamplepbRequiredMessageTypeRequest) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/requiredmessagetype" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body interface{}) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuidName string, body ABitOfEverything) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bookName The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` + * @param book The book to update. The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} + * @param optional nil or *ABitOfEverythingServiceUpdateBookOpts - Optional Parameters: + * @param "AllowMissing" (optional.Bool) - If set to true, and the book is not found, a new book will be created. In this situation, `update_mask` is ignored. + +@return ExamplepbBook +*/ + +type ABitOfEverythingServiceUpdateBookOpts struct { + AllowMissing optional.Bool +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateBook(ctx context.Context, bookName string, book TheBookToUpdate_, localVarOptionals *ABitOfEverythingServiceUpdateBookOpts) (ExamplepbBook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbBook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/{book.name}" + localVarPath = strings.Replace(localVarPath, "{"+"book.name"+"}", fmt.Sprintf("%v", bookName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.AllowMissing.IsSet() { + localVarQueryParams.Add("allowMissing", parameterToString(localVarOptionals.AllowMissing.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &book + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v ExamplepbBook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. + * @param optional nil or *ABitOfEverythingServiceUpdateV2Opts - Optional Parameters: + * @param "UpdateMask" (optional.String) - The paths to update. + +@return interface{} +*/ + +type ABitOfEverythingServiceUpdateV2Opts struct { + UpdateMask optional.String +} + +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, uuidName string, abe ABitOfEverything2, localVarOptionals *ABitOfEverythingServiceUpdateV2Opts) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.UpdateMask.IsSet() { + localVarQueryParams.Add("updateMask", parameterToString(localVarOptionals.UpdateMask.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &abe + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, uuidName string, abe ABitOfEverything3) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &abe + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ABitOfEverythingServiceApiService + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuidName + * @param body + +@return interface{} +*/ +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, uuidName string, body UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["X-API-Key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + + if localVarHttpResponse.StatusCode == 200 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 418 { + var v ExamplepbNumericEnum + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 500 { + var v ExamplepbErrorResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + if localVarHttpResponse.StatusCode == 0 { + var v RpcStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/examples/internal/clients/abe/client.go b/examples/internal/clients/abe/client.go index 3293aadf212..22eb067bda1 100644 --- a/examples/internal/clients/abe/client.go +++ b/examples/internal/clients/abe/client.go @@ -48,6 +48,8 @@ type APIClient struct { ABitOfEverythingApi *ABitOfEverythingApiService + ABitOfEverythingServiceApi *ABitOfEverythingServiceApiService + CamelCaseServiceNameApi *CamelCaseServiceNameApiService EchoRpcApi *EchoRpcApiService @@ -72,6 +74,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { // API Services c.ABitOfEverythingApi = (*ABitOfEverythingApiService)(&c.common) + c.ABitOfEverythingServiceApi = (*ABitOfEverythingServiceApiService)(&c.common) c.CamelCaseServiceNameApi = (*CamelCaseServiceNameApiService)(&c.common) c.EchoRpcApi = (*EchoRpcApiService)(&c.common) c.SnakeEnumServiceApi = (*SnakeEnumServiceApiService)(&c.common) diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json index 78a5747c60d..cd8858a1320 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json @@ -104,6 +104,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -627,6 +628,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -1087,6 +1089,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -1536,6 +1539,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -2003,6 +2007,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ], "deprecated": true, @@ -2474,6 +2479,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -2790,6 +2796,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] }, @@ -3232,6 +3239,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] }, @@ -3674,6 +3682,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -4140,6 +4149,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -4606,6 +4616,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -4659,6 +4670,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] }, @@ -4711,6 +4723,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ], "security": [ @@ -4962,6 +4975,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5007,6 +5021,7 @@ } }, "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5343,6 +5358,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5399,6 +5415,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5455,6 +5472,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5618,6 +5636,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -5690,6 +5709,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6014,6 +6034,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] }, @@ -6329,6 +6350,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6559,6 +6581,7 @@ } }, "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6615,6 +6638,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ], "consumes": [ @@ -6663,6 +6687,7 @@ } }, "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ], "produces": [ @@ -6728,6 +6753,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6774,6 +6800,7 @@ } }, "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6836,6 +6863,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -6894,6 +6922,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -7220,6 +7249,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } @@ -7278,6 +7308,7 @@ } ], "tags": [ + "ABitOfEverythingService", "ABitOfEverything" ] } diff --git a/protoc-gen-openapiv2/internal/genopenapi/template.go b/protoc-gen-openapiv2/internal/genopenapi/template.go index 9a5f16d8ed2..969ddc49cb3 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -1488,13 +1488,13 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r return err } tag := svc.GetName() - if opts.GetName() != "" { - tag = opts.GetName() - } if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tag = pkg + "." + tag } operationObject.Tags = []string{tag} + if opts.GetName() != "" { + operationObject.Tags = append(operationObject.Tags, opts.GetName()) + } } if !reg.GetDisableDefaultErrors() { diff --git a/protoc-gen-openapiv2/internal/genopenapi/template_test.go b/protoc-gen-openapiv2/internal/genopenapi/template_test.go index d6635d678da..0ceb5ddb7a2 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template_test.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template_test.go @@ -6344,7 +6344,7 @@ func TestTagsWithGoTemplate(t *testing.T) { }, { Name: "ExampleService", - Description: "ExampleService!", + Description: "", }, { Name: "not a service tag 2", @@ -6354,6 +6354,10 @@ func TestTagsWithGoTemplate(t *testing.T) { Name: "Service with my_key", Description: "the my_value", }, + { + Name: "service tag", + Description: "ExampleService!", + }, } if !reflect.DeepEqual(actual.Tags, expectedTags) { t.Errorf("Expected tags %+v, not %+v", expectedTags, actual.Tags) From ba1aff80b8da34e81a01b7eb46ab28da706d7d80 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Thu, 21 Dec 2023 15:24:49 +0200 Subject: [PATCH 7/9] fixup of code --- .../internal/clients/abe/api/swagger.yaml | 31 - .../clients/abe/api_a_bit_of_everything.go | 6152 +---------------- .../abe/api_a_bit_of_everything_service.go | 1030 +-- .../a_bit_of_everything.swagger.json | 85 +- .../internal/genopenapi/template.go | 15 +- 5 files changed, 169 insertions(+), 7144 deletions(-) diff --git a/examples/internal/clients/abe/api/swagger.yaml b/examples/internal/clients/abe/api/swagger.yaml index a9fcc78441c..99b2e05010f 100644 --- a/examples/internal/clients/abe/api/swagger.yaml +++ b/examples/internal/clients/abe/api/swagger.yaml @@ -46,7 +46,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CreateBody" parameters: - in: "body" @@ -136,7 +135,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckNestedEnumGetQueryParams" parameters: - name: "singleNested.ok" @@ -559,7 +557,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckGetQueryParams" parameters: - name: "singleNested.name" @@ -989,7 +986,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckPostQueryParams" parameters: - name: "stringValue" @@ -1405,7 +1401,6 @@ paths: /v1/example/a_bit_of_everything/query/{uuidName}: get: tags: - - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_GetQuery" parameters: @@ -1848,7 +1843,6 @@ paths: : post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" summary: "Create a new ABitOfEverything" description: "This API creates a new ABitOfEverything" operationId: "ABitOfEverythingService_Create" @@ -2267,7 +2261,6 @@ paths: head: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_Exists" parameters: - name: "uuidName" @@ -2686,7 +2679,6 @@ paths: put: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_Update" parameters: - name: "uuidName" @@ -2731,7 +2723,6 @@ paths: options: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CustomOptionsRequest" parameters: - name: "uuidName" @@ -3151,7 +3142,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_Custom" parameters: - name: "uuidName" @@ -3588,7 +3578,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_DoubleColon" parameters: - name: "uuidName" @@ -4025,7 +4014,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_Lookup" parameters: - name: "uuid" @@ -4061,7 +4049,6 @@ paths: $ref: "#/definitions/rpcStatus" delete: tags: - - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_Delete" parameters: @@ -4106,7 +4093,6 @@ paths: : get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_GetRepeatedQuery" parameters: - name: "pathRepeatedFloatValue" @@ -4301,7 +4287,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckStatus" parameters: [] responses: @@ -4334,7 +4319,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_DeepPathEcho" parameters: - name: "singleNested.name" @@ -4379,7 +4363,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_PostOneofEnum" parameters: - in: "body" @@ -4418,7 +4401,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_PostRequiredMessageType" parameters: - in: "body" @@ -4513,7 +4495,6 @@ paths: patch: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateBook" parameters: - name: "book.name" @@ -4570,7 +4551,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" summary: "Create a book." operationId: "ABitOfEverythingService_CreateBook" parameters: @@ -4627,7 +4607,6 @@ paths: put: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV2" parameters: - name: "uuidName" @@ -4681,7 +4660,6 @@ paths: patch: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV22" parameters: - name: "uuidName" @@ -4860,7 +4838,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_ErrorWithDetails" parameters: [] responses: @@ -4892,7 +4869,6 @@ paths: /v2/example/overwriterequestcontenttype: post: tags: - - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteRequestContentType" consumes: @@ -4933,7 +4909,6 @@ paths: /v2/example/overwriteresponsecontenttype: get: tags: - - "ABitOfEverythingService" - "ABitOfEverything" operationId: "ABitOfEverythingService_OverwriteResponseContentType" produces: @@ -4969,7 +4944,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_PostWithEmptyBody" parameters: - name: "name" @@ -5013,7 +4987,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_Timeout" parameters: [] responses: @@ -5046,7 +5019,6 @@ paths: post: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_GetMessageWithBody" parameters: - name: "id" @@ -5090,7 +5062,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalPathEnum" parameters: - name: "value" @@ -5131,7 +5102,6 @@ paths: patch: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_UpdateV23" parameters: - name: "uuidName" @@ -5178,7 +5148,6 @@ paths: get: tags: - "ABitOfEverythingService" - - "ABitOfEverything" operationId: "ABitOfEverythingService_CheckExternalNestedPathEnum" parameters: - name: "value" diff --git a/examples/internal/clients/abe/api_a_bit_of_everything.go b/examples/internal/clients/abe/api_a_bit_of_everything.go index ca4c5f647e6..b914a38663d 100644 --- a/examples/internal/clients/abe/api_a_bit_of_everything.go +++ b/examples/internal/clients/abe/api_a_bit_of_everything.go @@ -30,169 +30,13 @@ type ABitOfEverythingApiService service /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param value - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalNestedPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v3/{value}:check" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param value + * @param uuid @return interface{} */ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalPathEnum(ctx context.Context, value string) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte @@ -200,8 +44,8 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalPathEnu ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/{value}:check" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -342,8 +186,7 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckExternalPathEnu /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedName name is nested field. - * @param uuid + * @param uuidName * @param floatValue Float value field * @param doubleValue * @param int64Value @@ -352,7 +195,8 @@ ABitOfEverythingApiService * @param requiredStringField2 * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckGetQueryParamsOpts - Optional Parameters: + * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: + * @param "SingleNestedName" (optional.String) - name is nested field. * @param "SingleNestedAmount" (optional.Int64) - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Uint64Value" (optional.String) - @@ -382,6 +226,7 @@ ABitOfEverythingApiService * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. + * @param "NestedAnnotationName" (optional.String) - name is nested field. * @param "NestedAnnotationAmount" (optional.Int64) - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. * @param "Int64OverrideType" (optional.Int64) - @@ -395,10 +240,11 @@ ABitOfEverythingApiService * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items -@return ExamplepbABitOfEverything +@return interface{} */ -type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { +type ABitOfEverythingServiceGetQueryOpts struct { + SingleNestedName optional.String SingleNestedAmount optional.Int64 SingleNestedOk optional.String Uint64Value optional.String @@ -428,6 +274,7 @@ type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { RepeatedEnumAnnotation optional.Interface EnumValueAnnotation optional.String RepeatedStringAnnotation optional.Interface + NestedAnnotationName optional.String NestedAnnotationAmount optional.Int64 NestedAnnotationOk optional.String Int64OverrideType optional.Int64 @@ -442,30 +289,32 @@ type ABitOfEverythingServiceCheckGetQueryParamsOpts struct { Uuids optional.Interface } -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams(ctx context.Context, singleNestedName string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything + localVarReturnValue interface{} ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/{singleNested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" + localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { + localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) + } if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) } if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) @@ -550,6 +399,9 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams( if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) } + if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { + localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) + } if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) } @@ -608,19 +460,6 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams( if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -652,7 +491,7 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams( } if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything + var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() @@ -726,5769 +565,28 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckGetQueryParams( /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedOk DeepEnum description. - * @param uuid - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + * @param body -@return ExamplepbABitOfEverything +@return interface{} */ - -type ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckNestedEnumGetQueryParams(ctx context.Context, singleNestedOk string, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckNestedEnumGetQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/get/nested_enum/{singleNested.ok}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.ok"+"}", fmt.Sprintf("%v", singleNestedOk), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param stringValue - * @param singleNested - * @param uuid - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCheckPostQueryParamsOpts - Optional Parameters: - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCheckPostQueryParamsOpts struct { - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckPostQueryParams(ctx context.Context, stringValue string, singleNested ABitOfEverythingNested, uuid string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCheckPostQueryParamsOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/params/post/{stringValue}" - localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &singleNested - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return ExamplepbCheckStatusResponse -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCheckStatus(ctx context.Context) (ExamplepbCheckStatusResponse, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbCheckStatusResponse - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/checkStatus" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbCheckStatusResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService Create a new ABitOfEverything -This API creates a new ABitOfEverything - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param uint64Value - * @param int32Value - * @param fixed64Value - * @param fixed32Value - * @param boolValue - * @param stringValue - * @param uint32Value - * @param sfixed32Value - * @param sfixed64Value - * @param sint32Value - * @param sint64Value - * @param nonConventionalNameValue - * @param enumValue - * @param pathEnumValue - * @param nestedPathEnumValue - * @param enumValueAnnotation Numeric enum description. - * @param uuid - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCreateOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "BytesValue" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCreateOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - BytesValue optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreate(ctx context.Context, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string, enumValueAnnotation string, uuid string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCreateOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{floatValue}/{doubleValue}/{int64Value}/separator/{uint64Value}/{int32Value}/{fixed64Value}/{fixed32Value}/{boolValue}/{stringValue}/{uint32Value}/{sfixed32Value}/{sfixed64Value}/{sint32Value}/{sint64Value}/{nonConventionalNameValue}/{enumValue}/{pathEnumValue}/{nestedPathEnumValue}/{enumValueAnnotation}" - localVarPath = strings.Replace(localVarPath, "{"+"floatValue"+"}", fmt.Sprintf("%v", floatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"doubleValue"+"}", fmt.Sprintf("%v", doubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int64Value"+"}", fmt.Sprintf("%v", int64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint64Value"+"}", fmt.Sprintf("%v", uint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"int32Value"+"}", fmt.Sprintf("%v", int32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed64Value"+"}", fmt.Sprintf("%v", fixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"fixed32Value"+"}", fmt.Sprintf("%v", fixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"boolValue"+"}", fmt.Sprintf("%v", boolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"stringValue"+"}", fmt.Sprintf("%v", stringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"uint32Value"+"}", fmt.Sprintf("%v", uint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed32Value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sfixed64Value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint32Value"+"}", fmt.Sprintf("%v", sint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"sint64Value"+"}", fmt.Sprintf("%v", sint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enumValue"+"}", fmt.Sprintf("%v", enumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathEnumValue"+"}", fmt.Sprintf("%v", pathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nestedPathEnumValue"+"}", fmt.Sprintf("%v", nestedPathEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"enumValueAnnotation"+"}", fmt.Sprintf("%v", enumValueAnnotation), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("uuid", parameterToString(uuid, "")) - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Intentionally complicated message type to cover many features of Protobuf. - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreateBody(ctx context.Context, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService Create a book. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param parent The publisher in which to create the book. Format: `publishers/{publisher}` Example: `publishers/1257894000000000000` - * @param book The book to create. - * @param optional nil or *ABitOfEverythingServiceCreateBookOpts - Optional Parameters: - * @param "BookId" (optional.String) - The ID to use for the book. This must start with an alphanumeric character. - -@return ExamplepbBook -*/ - -type ABitOfEverythingServiceCreateBookOpts struct { - BookId optional.String -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCreateBook(ctx context.Context, parent string, book ExamplepbBook, localVarOptionals *ABitOfEverythingServiceCreateBookOpts) (ExamplepbBook, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbBook - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/{parent}/books" - localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.BookId.IsSet() { - localVarQueryParams.Add("bookId", parameterToString(localVarOptionals.BookId.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &book - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbBook - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCustomOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceCustomOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCustom(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceCustomOptionsRequestOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceCustomOptionsRequestOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceCustomOptionsRequest(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceCustomOptionsRequestOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Options") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param singleNestedName name is nested field. - * @param body - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDeepPathEcho(ctx context.Context, singleNestedName string, body ABitOfEverything1) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/deep_path/{singleNested.name}" - localVarPath = strings.Replace(localVarPath, "{"+"singleNested.name"+"}", fmt.Sprintf("%v", singleNestedName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Delete") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceDoubleColonOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return ExamplepbABitOfEverything -*/ - -type ABitOfEverythingServiceDoubleColonOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceDoubleColon(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceDoubleColonOpts) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}:custom:custom" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceErrorWithDetails(ctx context.Context) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/errorwithdetails" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceExistsOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceExistsOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceExists(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceExistsOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Head") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param id - * @param data - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetMessageWithBody(ctx context.Context, id string, data ExamplepbBody) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/withbody/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &data - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items - -@return interface{} -*/ - -type ABitOfEverythingServiceGetQueryOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pathRepeatedFloatValue repeated values. they are comma-separated in path - * @param pathRepeatedDoubleValue - * @param pathRepeatedInt64Value - * @param pathRepeatedUint64Value - * @param pathRepeatedInt32Value - * @param pathRepeatedFixed64Value - * @param pathRepeatedFixed32Value - * @param pathRepeatedBoolValue - * @param pathRepeatedStringValue - * @param pathRepeatedBytesValue - * @param pathRepeatedUint32Value - * @param pathRepeatedEnumValue - * @param pathRepeatedSfixed32Value - * @param pathRepeatedSfixed64Value - * @param pathRepeatedSint32Value - * @param pathRepeatedSint64Value - -@return ExamplepbABitOfEverythingRepeated -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverythingRepeated - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if len(pathRepeatedFloatValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") - } - if len(pathRepeatedDoubleValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") - } - if len(pathRepeatedInt64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") - } - if len(pathRepeatedUint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") - } - if len(pathRepeatedInt32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") - } - if len(pathRepeatedFixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") - } - if len(pathRepeatedFixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") - } - if len(pathRepeatedBoolValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") - } - if len(pathRepeatedStringValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") - } - if len(pathRepeatedBytesValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") - } - if len(pathRepeatedUint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") - } - if len(pathRepeatedEnumValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") - } - if len(pathRepeatedSfixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") - } - if len(pathRepeatedSfixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") - } - if len(pathRepeatedSint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") - } - if len(pathRepeatedSint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverythingRepeated - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/x-bar-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return string -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue string - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/text"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param exampleEnum - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostOneofEnum(ctx context.Context, exampleEnum OneofenumExampleEnum) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/oneofenum" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &exampleEnum - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostRequiredMessageType(ctx context.Context, body ExamplepbRequiredMessageTypeRequest) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/requiredmessagetype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param name - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServicePostWithEmptyBody(ctx context.Context, name string, body interface{}) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/postwithemptybody/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceTimeout(ctx context.Context) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/timeout" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdate(ctx context.Context, uuidName string, body ABitOfEverything) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bookName The resource name of the book. Format: `publishers/{publisher}/books/{book}` Example: `publishers/1257894000000000000/books/my-book` - * @param book The book to update. The book's `name` field is used to identify the book to be updated. Format: publishers/{publisher}/books/{book} - * @param optional nil or *ABitOfEverythingServiceUpdateBookOpts - Optional Parameters: - * @param "AllowMissing" (optional.Bool) - If set to true, and the book is not found, a new book will be created. In this situation, `update_mask` is ignored. - -@return ExamplepbBook -*/ - -type ABitOfEverythingServiceUpdateBookOpts struct { - AllowMissing optional.Bool -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateBook(ctx context.Context, bookName string, book TheBookToUpdate_, localVarOptionals *ABitOfEverythingServiceUpdateBookOpts) (ExamplepbBook, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbBook - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/{book.name}" - localVarPath = strings.Replace(localVarPath, "{"+"book.name"+"}", fmt.Sprintf("%v", bookName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.AllowMissing.IsSet() { - localVarQueryParams.Add("allowMissing", parameterToString(localVarOptionals.AllowMissing.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &book - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbBook - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. - * @param optional nil or *ABitOfEverythingServiceUpdateV2Opts - Optional Parameters: - * @param "UpdateMask" (optional.String) - The paths to update. - -@return interface{} -*/ - -type ABitOfEverythingServiceUpdateV2Opts struct { - UpdateMask optional.String -} - -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV2(ctx context.Context, uuidName string, abe ABitOfEverything2, localVarOptionals *ABitOfEverythingServiceUpdateV2Opts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if localVarOptionals != nil && localVarOptionals.UpdateMask.IsSet() { - localVarQueryParams.Add("updateMask", parameterToString(localVarOptionals.UpdateMask.Value(), "")) - } // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} + localVarHttpContentTypes := []string{"application/x-bar-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) @@ -6505,7 +603,7 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV2(ctx context localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - localVarPostBody = &abe + localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { @@ -6624,23 +722,20 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV2(ctx context /* ABitOfEverythingApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param abe A bit of everything Intentionally complicated message type to cover many features of Protobuf. -@return interface{} +@return string */ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV22(ctx context.Context, uuidName string, abe ABitOfEverything3) (interface{}, *http.Response, error) { +func (a *ABitOfEverythingApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte - localVarReturnValue interface{} + localVarReturnValue string ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) + localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -6656,15 +751,13 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV22(ctx contex } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} + localVarHttpHeaderAccepts := []string{"application/text"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - // body params - localVarPostBody = &abe if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { @@ -6709,28 +802,6 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV22(ctx contex } if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { @@ -6741,143 +812,6 @@ func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV22(ctx contex return localVarReturnValue, localVarHttpResponse, newErr } - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingApiService) ABitOfEverythingServiceUpdateV23(ctx context.Context, uuidName string, body UpdateV2RequestRequestForUpdateIncludesTheMessageAndTheUpdateMask) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2a/example/a_bit_of_everything/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); diff --git a/examples/internal/clients/abe/api_a_bit_of_everything_service.go b/examples/internal/clients/abe/api_a_bit_of_everything_service.go index 8153f7f8c3b..6b736033e99 100644 --- a/examples/internal/clients/abe/api_a_bit_of_everything_service.go +++ b/examples/internal/clients/abe/api_a_bit_of_everything_service.go @@ -3208,162 +3208,6 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDeepPathEcho( return localVarReturnValue, localVarHttpResponse, nil } -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceDelete(ctx context.Context, uuid string) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Delete") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -4420,797 +4264,107 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetMessageWit /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuidName - * @param floatValue Float value field - * @param doubleValue - * @param int64Value - * @param requiredStringViaFieldBehaviorAnnotation mark a field as required in Open API definition - * @param requiredStringField1 - * @param requiredStringField2 - * @param requiredFieldBehaviorJsonNameCustom Test openapiv2 handling of required json_name fields - * @param requiredFieldSchemaJsonNameCustom - * @param optional nil or *ABitOfEverythingServiceGetQueryOpts - Optional Parameters: - * @param "SingleNestedName" (optional.String) - name is nested field. - * @param "SingleNestedAmount" (optional.Int64) - - * @param "SingleNestedOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Uint64Value" (optional.String) - - * @param "Int32Value" (optional.Int32) - - * @param "Fixed64Value" (optional.String) - - * @param "Fixed32Value" (optional.Int64) - - * @param "BoolValue" (optional.Bool) - - * @param "StringValue" (optional.String) - - * @param "BytesValue" (optional.String) - - * @param "Uint32Value" (optional.Int64) - - * @param "EnumValue" (optional.String) - - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "PathEnumValue" (optional.String) - - * @param "NestedPathEnumValue" (optional.String) - - * @param "Sfixed32Value" (optional.Int32) - - * @param "Sfixed64Value" (optional.String) - - * @param "Sint32Value" (optional.Int32) - - * @param "Sint64Value" (optional.String) - - * @param "RepeatedStringValue" (optional.Interface of []string) - - * @param "OneofEmpty" (optional.Interface of map[string]string) - - * @param "OneofString" (optional.String) - - * @param "MapValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedStringValue" (optional.String) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "MappedNestedValue" (optional.Interface of interface{}) - This is a request variable of the map type. The query format is \"map_name[key]=value\", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age[\"bob\"]=18 - * @param "NonConventionalNameValue" (optional.String) - - * @param "TimestampValue" (optional.Time) - - * @param "RepeatedEnumValue" (optional.Interface of []string) - repeated enum value. it is comma-separated in query - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedEnumAnnotation" (optional.Interface of []string) - Repeated numeric enum title Repeated numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "EnumValueAnnotation" (optional.String) - Numeric enum title Numeric enum description. - ZERO: ZERO means 0 - ONE: ONE means 1 - * @param "RepeatedStringAnnotation" (optional.Interface of []string) - Repeated string title Repeated string description. - * @param "NestedAnnotationName" (optional.String) - name is nested field. - * @param "NestedAnnotationAmount" (optional.Int64) - - * @param "NestedAnnotationOk" (optional.String) - DeepEnum description. - FALSE: FALSE is false. - TRUE: TRUE is true. - * @param "Int64OverrideType" (optional.Int64) - - * @param "OutputOnlyStringViaFieldBehaviorAnnotation" (optional.String) - mark a field as readonly in Open API definition - * @param "OptionalStringValue" (optional.String) - - * @param "ProductId" (optional.Interface of []string) - Test openapiv2 generation of repeated fields Only digits are allowed. - * @param "OptionalStringField" (optional.String) - Test openapiv2 generation of required fields with annotation and jsonschema to reproduce - * @param "TrailingOnly" (optional.String) - Trailing only - * @param "TrailingOnlyDot" (optional.String) - Trailing only dot. - * @param "TrailingBoth" (optional.String) - Leading both Trailing both. - * @param "TrailingMultiline" (optional.String) - Leading multiline This is an example of a multi-line comment. Trailing multiline. - * @param "Uuids" (optional.Interface of []string) - Specify a custom format of repeated field items + * @param pathRepeatedFloatValue repeated values. they are comma-separated in path + * @param pathRepeatedDoubleValue + * @param pathRepeatedInt64Value + * @param pathRepeatedUint64Value + * @param pathRepeatedInt32Value + * @param pathRepeatedFixed64Value + * @param pathRepeatedFixed32Value + * @param pathRepeatedBoolValue + * @param pathRepeatedStringValue + * @param pathRepeatedBytesValue + * @param pathRepeatedUint32Value + * @param pathRepeatedEnumValue + * @param pathRepeatedSfixed32Value + * @param pathRepeatedSfixed64Value + * @param pathRepeatedSint32Value + * @param pathRepeatedSint64Value -@return interface{} +@return ExamplepbABitOfEverythingRepeated */ - -type ABitOfEverythingServiceGetQueryOpts struct { - SingleNestedName optional.String - SingleNestedAmount optional.Int64 - SingleNestedOk optional.String - Uint64Value optional.String - Int32Value optional.Int32 - Fixed64Value optional.String - Fixed32Value optional.Int64 - BoolValue optional.Bool - StringValue optional.String - BytesValue optional.String - Uint32Value optional.Int64 - EnumValue optional.String - PathEnumValue optional.String - NestedPathEnumValue optional.String - Sfixed32Value optional.Int32 - Sfixed64Value optional.String - Sint32Value optional.Int32 - Sint64Value optional.String - RepeatedStringValue optional.Interface - OneofEmpty optional.Interface - OneofString optional.String - MapValue optional.Interface - MappedStringValue optional.String - MappedNestedValue optional.Interface - NonConventionalNameValue optional.String - TimestampValue optional.Time - RepeatedEnumValue optional.Interface - RepeatedEnumAnnotation optional.Interface - EnumValueAnnotation optional.String - RepeatedStringAnnotation optional.Interface - NestedAnnotationName optional.String - NestedAnnotationAmount optional.Int64 - NestedAnnotationOk optional.String - Int64OverrideType optional.Int64 - OutputOnlyStringViaFieldBehaviorAnnotation optional.String - OptionalStringValue optional.String - ProductId optional.Interface - OptionalStringField optional.String - TrailingOnly optional.String - TrailingOnlyDot optional.String - TrailingBoth optional.String - TrailingMultiline optional.String - Uuids optional.Interface -} - -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetQuery(ctx context.Context, uuidName string, floatValue float32, doubleValue float64, int64Value string, requiredStringViaFieldBehaviorAnnotation string, requiredStringField1 string, requiredStringField2 string, requiredFieldBehaviorJsonNameCustom string, requiredFieldSchemaJsonNameCustom string, localVarOptionals *ABitOfEverythingServiceGetQueryOpts) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/query/{uuidName}" - localVarPath = strings.Replace(localVarPath, "{"+"uuidName"+"}", fmt.Sprintf("%v", uuidName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.SingleNestedName.IsSet() { - localVarQueryParams.Add("singleNested.name", parameterToString(localVarOptionals.SingleNestedName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedAmount.IsSet() { - localVarQueryParams.Add("singleNested.amount", parameterToString(localVarOptionals.SingleNestedAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.SingleNestedOk.IsSet() { - localVarQueryParams.Add("singleNested.ok", parameterToString(localVarOptionals.SingleNestedOk.Value(), "")) - } - localVarQueryParams.Add("floatValue", parameterToString(floatValue, "")) - localVarQueryParams.Add("doubleValue", parameterToString(doubleValue, "")) - localVarQueryParams.Add("int64Value", parameterToString(int64Value, "")) - if localVarOptionals != nil && localVarOptionals.Uint64Value.IsSet() { - localVarQueryParams.Add("uint64Value", parameterToString(localVarOptionals.Uint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int32Value.IsSet() { - localVarQueryParams.Add("int32Value", parameterToString(localVarOptionals.Int32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed64Value.IsSet() { - localVarQueryParams.Add("fixed64Value", parameterToString(localVarOptionals.Fixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Fixed32Value.IsSet() { - localVarQueryParams.Add("fixed32Value", parameterToString(localVarOptionals.Fixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BoolValue.IsSet() { - localVarQueryParams.Add("boolValue", parameterToString(localVarOptionals.BoolValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.StringValue.IsSet() { - localVarQueryParams.Add("stringValue", parameterToString(localVarOptionals.StringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.BytesValue.IsSet() { - localVarQueryParams.Add("bytesValue", parameterToString(localVarOptionals.BytesValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uint32Value.IsSet() { - localVarQueryParams.Add("uint32Value", parameterToString(localVarOptionals.Uint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.EnumValue.IsSet() { - localVarQueryParams.Add("enumValue", parameterToString(localVarOptionals.EnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PathEnumValue.IsSet() { - localVarQueryParams.Add("pathEnumValue", parameterToString(localVarOptionals.PathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedPathEnumValue.IsSet() { - localVarQueryParams.Add("nestedPathEnumValue", parameterToString(localVarOptionals.NestedPathEnumValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed32Value.IsSet() { - localVarQueryParams.Add("sfixed32Value", parameterToString(localVarOptionals.Sfixed32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sfixed64Value.IsSet() { - localVarQueryParams.Add("sfixed64Value", parameterToString(localVarOptionals.Sfixed64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint32Value.IsSet() { - localVarQueryParams.Add("sint32Value", parameterToString(localVarOptionals.Sint32Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Sint64Value.IsSet() { - localVarQueryParams.Add("sint64Value", parameterToString(localVarOptionals.Sint64Value.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringValue.IsSet() { - localVarQueryParams.Add("repeatedStringValue", parameterToString(localVarOptionals.RepeatedStringValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OneofEmpty.IsSet() { - localVarQueryParams.Add("oneofEmpty", parameterToString(localVarOptionals.OneofEmpty.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OneofString.IsSet() { - localVarQueryParams.Add("oneofString", parameterToString(localVarOptionals.OneofString.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MapValue.IsSet() { - localVarQueryParams.Add("mapValue", parameterToString(localVarOptionals.MapValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedStringValue.IsSet() { - localVarQueryParams.Add("mappedStringValue", parameterToString(localVarOptionals.MappedStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MappedNestedValue.IsSet() { - localVarQueryParams.Add("mappedNestedValue", parameterToString(localVarOptionals.MappedNestedValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NonConventionalNameValue.IsSet() { - localVarQueryParams.Add("nonConventionalNameValue", parameterToString(localVarOptionals.NonConventionalNameValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TimestampValue.IsSet() { - localVarQueryParams.Add("timestampValue", parameterToString(localVarOptionals.TimestampValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumValue.IsSet() { - localVarQueryParams.Add("repeatedEnumValue", parameterToString(localVarOptionals.RepeatedEnumValue.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedEnumAnnotation.IsSet() { - localVarQueryParams.Add("repeatedEnumAnnotation", parameterToString(localVarOptionals.RepeatedEnumAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.EnumValueAnnotation.IsSet() { - localVarQueryParams.Add("enumValueAnnotation", parameterToString(localVarOptionals.EnumValueAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.RepeatedStringAnnotation.IsSet() { - localVarQueryParams.Add("repeatedStringAnnotation", parameterToString(localVarOptionals.RepeatedStringAnnotation.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationName.IsSet() { - localVarQueryParams.Add("nestedAnnotation.name", parameterToString(localVarOptionals.NestedAnnotationName.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationAmount.IsSet() { - localVarQueryParams.Add("nestedAnnotation.amount", parameterToString(localVarOptionals.NestedAnnotationAmount.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.NestedAnnotationOk.IsSet() { - localVarQueryParams.Add("nestedAnnotation.ok", parameterToString(localVarOptionals.NestedAnnotationOk.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Int64OverrideType.IsSet() { - localVarQueryParams.Add("int64OverrideType", parameterToString(localVarOptionals.Int64OverrideType.Value(), "")) - } - localVarQueryParams.Add("requiredStringViaFieldBehaviorAnnotation", parameterToString(requiredStringViaFieldBehaviorAnnotation, "")) - if localVarOptionals != nil && localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.IsSet() { - localVarQueryParams.Add("outputOnlyStringViaFieldBehaviorAnnotation", parameterToString(localVarOptionals.OutputOnlyStringViaFieldBehaviorAnnotation.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringValue.IsSet() { - localVarQueryParams.Add("optionalStringValue", parameterToString(localVarOptionals.OptionalStringValue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ProductId.IsSet() { - localVarQueryParams.Add("productId", parameterToString(localVarOptionals.ProductId.Value(), "multi")) - } - if localVarOptionals != nil && localVarOptionals.OptionalStringField.IsSet() { - localVarQueryParams.Add("optionalStringField", parameterToString(localVarOptionals.OptionalStringField.Value(), "")) - } - localVarQueryParams.Add("requiredStringField1", parameterToString(requiredStringField1, "")) - localVarQueryParams.Add("requiredStringField2", parameterToString(requiredStringField2, "")) - localVarQueryParams.Add("required_field_behavior_json_name_custom", parameterToString(requiredFieldBehaviorJsonNameCustom, "")) - localVarQueryParams.Add("required_field_schema_json_name_custom", parameterToString(requiredFieldSchemaJsonNameCustom, "")) - if localVarOptionals != nil && localVarOptionals.TrailingOnly.IsSet() { - localVarQueryParams.Add("trailingOnly", parameterToString(localVarOptionals.TrailingOnly.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingOnlyDot.IsSet() { - localVarQueryParams.Add("trailingOnlyDot", parameterToString(localVarOptionals.TrailingOnlyDot.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingBoth.IsSet() { - localVarQueryParams.Add("trailingBoth", parameterToString(localVarOptionals.TrailingBoth.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TrailingMultiline.IsSet() { - localVarQueryParams.Add("trailingMultiline", parameterToString(localVarOptionals.TrailingMultiline.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Uuids.IsSet() { - localVarQueryParams.Add("uuids", parameterToString(localVarOptionals.Uuids.Value(), "multi")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param pathRepeatedFloatValue repeated values. they are comma-separated in path - * @param pathRepeatedDoubleValue - * @param pathRepeatedInt64Value - * @param pathRepeatedUint64Value - * @param pathRepeatedInt32Value - * @param pathRepeatedFixed64Value - * @param pathRepeatedFixed32Value - * @param pathRepeatedBoolValue - * @param pathRepeatedStringValue - * @param pathRepeatedBytesValue - * @param pathRepeatedUint32Value - * @param pathRepeatedEnumValue - * @param pathRepeatedSfixed32Value - * @param pathRepeatedSfixed64Value - * @param pathRepeatedSint32Value - * @param pathRepeatedSint64Value - -@return ExamplepbABitOfEverythingRepeated -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverythingRepeated - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) - localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if len(pathRepeatedFloatValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") - } - if len(pathRepeatedDoubleValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") - } - if len(pathRepeatedInt64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") - } - if len(pathRepeatedUint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") - } - if len(pathRepeatedInt32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") - } - if len(pathRepeatedFixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") - } - if len(pathRepeatedFixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") - } - if len(pathRepeatedBoolValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") - } - if len(pathRepeatedStringValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") - } - if len(pathRepeatedBytesValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") - } - if len(pathRepeatedUint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") - } - if len(pathRepeatedEnumValue) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") - } - if len(pathRepeatedSfixed32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") - } - if len(pathRepeatedSfixed64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") - } - if len(pathRepeatedSint32Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") - } - if len(pathRepeatedSint64Value) < 1 { - return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverythingRepeated - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param uuid - -@return ExamplepbABitOfEverything -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue ExamplepbABitOfEverything - ) +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceGetRepeatedQuery(ctx context.Context, pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (ExamplepbABitOfEverythingRepeated, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplepbABitOfEverythingRepeated + ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" - localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything_repeated/{pathRepeatedFloatValue}/{pathRepeatedDoubleValue}/{pathRepeatedInt64Value}/{pathRepeatedUint64Value}/{pathRepeatedInt32Value}/{pathRepeatedFixed64Value}/{pathRepeatedFixed32Value}/{pathRepeatedBoolValue}/{pathRepeatedStringValue}/{pathRepeatedBytesValue}/{pathRepeatedUint32Value}/{pathRepeatedEnumValue}/{pathRepeatedSfixed32Value}/{pathRepeatedSfixed64Value}/{pathRepeatedSint32Value}/{pathRepeatedSint64Value}" + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFloatValue"+"}", fmt.Sprintf("%v", pathRepeatedFloatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedDoubleValue"+"}", fmt.Sprintf("%v", pathRepeatedDoubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt64Value"+"}", fmt.Sprintf("%v", pathRepeatedInt64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint64Value"+"}", fmt.Sprintf("%v", pathRepeatedUint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedInt32Value"+"}", fmt.Sprintf("%v", pathRepeatedInt32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedFixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedFixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBoolValue"+"}", fmt.Sprintf("%v", pathRepeatedBoolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedStringValue"+"}", fmt.Sprintf("%v", pathRepeatedStringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedBytesValue"+"}", fmt.Sprintf("%v", pathRepeatedBytesValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedUint32Value"+"}", fmt.Sprintf("%v", pathRepeatedUint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedEnumValue"+"}", fmt.Sprintf("%v", pathRepeatedEnumValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed32Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSfixed64Value"+"}", fmt.Sprintf("%v", pathRepeatedSfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint32Value"+"}", fmt.Sprintf("%v", pathRepeatedSint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pathRepeatedSint64Value"+"}", fmt.Sprintf("%v", pathRepeatedSint64Value), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType + if len(pathRepeatedFloatValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFloatValue must have at least 1 elements") } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + if len(pathRepeatedDoubleValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedDoubleValue must have at least 1 elements") } - if ctx != nil { - // API Key Authentication - if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { - var key string - if auth.Prefix != "" { - key = auth.Prefix + " " + auth.Key - } else { - key = auth.Key - } - localVarHeaderParams["X-API-Key"] = key - - } + if len(pathRepeatedInt64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt64Value must have at least 1 elements") } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err + if len(pathRepeatedUint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint64Value must have at least 1 elements") } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err + if len(pathRepeatedInt32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedInt32Value must have at least 1 elements") } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err + if len(pathRepeatedFixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed64Value must have at least 1 elements") } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } + if len(pathRepeatedFixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedFixed32Value must have at least 1 elements") } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - - if localVarHttpResponse.StatusCode == 200 { - var v ExamplepbABitOfEverything - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 403 { - var v interface{} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 404 { - var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 418 { - var v ExamplepbNumericEnum - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 500 { - var v ExamplepbErrorResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - if localVarHttpResponse.StatusCode == 0 { - var v RpcStatus - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, newErr + if len(pathRepeatedBoolValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBoolValue must have at least 1 elements") + } + if len(pathRepeatedStringValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedStringValue must have at least 1 elements") + } + if len(pathRepeatedBytesValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedBytesValue must have at least 1 elements") + } + if len(pathRepeatedUint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedUint32Value must have at least 1 elements") + } + if len(pathRepeatedEnumValue) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedEnumValue must have at least 1 elements") + } + if len(pathRepeatedSfixed32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed32Value must have at least 1 elements") + } + if len(pathRepeatedSfixed64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSfixed64Value must have at least 1 elements") + } + if len(pathRepeatedSint32Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint32Value must have at least 1 elements") + } + if len(pathRepeatedSint64Value) < 1 { + return localVarReturnValue, nil, reportError("pathRepeatedSint64Value must have at least 1 elements") } - - return localVarReturnValue, localVarHttpResponse, nil -} - -/* -ABitOfEverythingServiceApiService - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - -@return interface{} -*/ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequestContentType(ctx context.Context, body ExamplepbBody) (interface{}, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue interface{} - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriterequestcontenttype" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/x-bar-mime"} + localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) @@ -5226,8 +4380,6 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequ if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - // body params - localVarPostBody = &body if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { @@ -5272,7 +4424,7 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequ } if localVarHttpResponse.StatusCode == 200 { - var v interface{} + var v ExamplepbABitOfEverythingRepeated err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() @@ -5346,20 +4498,22 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteRequ /* ABitOfEverythingServiceApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param uuid -@return string +@return ExamplepbABitOfEverything */ -func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResponseContentType(ctx context.Context) (string, *http.Response, error) { +func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceLookup(ctx context.Context, uuid string) (ExamplepbABitOfEverything, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte - localVarReturnValue string + localVarReturnValue ExamplepbABitOfEverything ) // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v2/example/overwriteresponsecontenttype" + localVarPath := a.client.cfg.BasePath + "/v1/example/a_bit_of_everything/{uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"uuid"+"}", fmt.Sprintf("%v", uuid), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -5375,7 +4529,7 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResp } // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/text"} + localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) @@ -5426,7 +4580,7 @@ func (a *ABitOfEverythingServiceApiService) ABitOfEverythingServiceOverwriteResp } if localVarHttpResponse.StatusCode == 200 { - var v string + var v ExamplepbABitOfEverything err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() diff --git a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json index cd8858a1320..333cdc3fddc 100644 --- a/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json +++ b/examples/internal/proto/examplepb/a_bit_of_everything.swagger.json @@ -104,8 +104,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -628,8 +627,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -1089,8 +1087,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -1539,8 +1536,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -2007,7 +2003,6 @@ } ], "tags": [ - "ABitOfEverythingService", "ABitOfEverything" ], "deprecated": true, @@ -2479,8 +2474,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -2796,8 +2790,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] }, "head": { @@ -3239,8 +3232,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] }, "options": { @@ -3682,8 +3674,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -4149,8 +4140,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -4616,8 +4606,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -4670,8 +4659,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] }, "delete": { @@ -4723,7 +4711,6 @@ } ], "tags": [ - "ABitOfEverythingService", "ABitOfEverything" ], "security": [ @@ -4975,8 +4962,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5021,8 +5007,7 @@ } }, "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5358,8 +5343,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5415,8 +5399,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5472,8 +5455,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5636,8 +5618,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -5709,8 +5690,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6034,8 +6014,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] }, "patch": { @@ -6350,8 +6329,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6581,8 +6559,7 @@ } }, "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6638,7 +6615,6 @@ } ], "tags": [ - "ABitOfEverythingService", "ABitOfEverything" ], "consumes": [ @@ -6687,7 +6663,6 @@ } }, "tags": [ - "ABitOfEverythingService", "ABitOfEverything" ], "produces": [ @@ -6753,8 +6728,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6800,8 +6774,7 @@ } }, "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6863,8 +6836,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -6922,8 +6894,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -7249,8 +7220,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } }, @@ -7308,8 +7278,7 @@ } ], "tags": [ - "ABitOfEverythingService", - "ABitOfEverything" + "ABitOfEverythingService" ] } } diff --git a/protoc-gen-openapiv2/internal/genopenapi/template.go b/protoc-gen-openapiv2/internal/genopenapi/template.go index 969ddc49cb3..c1d2ec97aae 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template.go @@ -1482,19 +1482,11 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r } if !reg.GetDisableServiceTags() { - opts, err := getServiceOpenAPIOption(reg, svc) - if err != nil { - grpclog.Error(err) - return err - } tag := svc.GetName() if pkg := svc.File.GetPackage(); pkg != "" && reg.IsIncludePackageInTags() { tag = pkg + "." + tag } operationObject.Tags = []string{tag} - if opts.GetName() != "" { - operationObject.Tags = append(operationObject.Tags, opts.GetName()) - } } if !reg.GetDisableDefaultErrors() { @@ -1532,6 +1524,11 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r panic(err) } + svcOpts, err := getServiceOpenAPIOption(reg, svc) + if err != nil { + grpclog.Error(err) + return err + } opts, err := getMethodOpenAPIOption(reg, meth) if opts != nil { if err != nil { @@ -1550,6 +1547,8 @@ func renderServices(services []*descriptor.Service, paths *openapiPathsObject, r if len(opts.Tags) > 0 { operationObject.Tags = make([]string, len(opts.Tags)) copy(operationObject.Tags, opts.Tags) + } else if svcOpts.GetName() != "" { + operationObject.Tags = []string{svcOpts.GetName()} } if opts.OperationId != "" { operationObject.OperationID = opts.OperationId From 449d66e2f0618b0ab32bf15e5078329659e6363d Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Mon, 25 Dec 2023 08:06:33 +0200 Subject: [PATCH 8/9] ran bazel build command --- examples/internal/clients/abe/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/internal/clients/abe/BUILD.bazel b/examples/internal/clients/abe/BUILD.bazel index 57f5cb2da9e..39a7279e3e9 100644 --- a/examples/internal/clients/abe/BUILD.bazel +++ b/examples/internal/clients/abe/BUILD.bazel @@ -5,6 +5,7 @@ package(default_visibility = ["//visibility:public"]) go_library( name = "abe", srcs = [ + "api_a_bit_of_everything.go", "api_a_bit_of_everything_service.go", "api_camel_case_service_name.go", "api_echo_rpc.go", From 4294e5af353d5feeea8b89b1379d56e16c2984e8 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Mon, 25 Dec 2023 08:12:10 +0200 Subject: [PATCH 9/9] weird test is flakey --- protoc-gen-openapiv2/internal/genopenapi/template_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-openapiv2/internal/genopenapi/template_test.go b/protoc-gen-openapiv2/internal/genopenapi/template_test.go index 0ceb5ddb7a2..1ae15850f3a 100644 --- a/protoc-gen-openapiv2/internal/genopenapi/template_test.go +++ b/protoc-gen-openapiv2/internal/genopenapi/template_test.go @@ -6344,7 +6344,7 @@ func TestTagsWithGoTemplate(t *testing.T) { }, { Name: "ExampleService", - Description: "", + Description: "ExampleService!", }, { Name: "not a service tag 2",