@seamapi/nextlove-sdk-generator 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +20 -0
- package/README.md +16 -0
- package/index.d.ts +6 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +53 -0
- package/lib/cli.js.map +1 -0
- package/lib/fs-util/index.d.ts +2 -0
- package/lib/fs-util/index.js +3 -0
- package/lib/fs-util/index.js.map +1 -0
- package/lib/fs-util/populate-fs.d.ts +1 -0
- package/lib/fs-util/populate-fs.js +11 -0
- package/lib/fs-util/populate-fs.js.map +1 -0
- package/lib/fs-util/write-fs.d.ts +1 -0
- package/lib/fs-util/write-fs.js +10 -0
- package/lib/fs-util/write-fs.js.map +1 -0
- package/lib/generate-csharp-sdk/codegen.d.ts +235 -0
- package/lib/generate-csharp-sdk/codegen.js +432 -0
- package/lib/generate-csharp-sdk/codegen.js.map +1 -0
- package/lib/generate-csharp-sdk/constants.d.ts +1 -0
- package/lib/generate-csharp-sdk/constants.js +2 -0
- package/lib/generate-csharp-sdk/constants.js.map +1 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.d.ts +1 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.js +81 -0
- package/lib/generate-csharp-sdk/generate-csharp-sdk.js.map +1 -0
- package/lib/generate-csharp-sdk/generate-csproj.d.ts +1 -0
- package/lib/generate-csharp-sdk/generate-csproj.js +45 -0
- package/lib/generate-csharp-sdk/generate-csproj.js.map +1 -0
- package/lib/generate-csharp-sdk/templates/dataclass.d.ts +24 -0
- package/lib/generate-csharp-sdk/templates/dataclass.js +468 -0
- package/lib/generate-csharp-sdk/templates/dataclass.js.map +1 -0
- package/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
- package/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
- package/lib/generate-php-sdk/generate-php-sdk.d.ts +1 -0
- package/lib/generate-php-sdk/generate-php-sdk.js +127 -0
- package/lib/generate-php-sdk/generate-php-sdk.js.map +1 -0
- package/lib/generate-php-sdk/index.d.ts +1 -0
- package/lib/generate-php-sdk/index.js +2 -0
- package/lib/generate-php-sdk/index.js.map +1 -0
- package/lib/generate-php-sdk/templates/composer.json.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/composer.json.template.js +25 -0
- package/lib/generate-php-sdk/templates/composer.json.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/env.example.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/env.example.template.js +4 -0
- package/lib/generate-php-sdk/templates/env.example.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/gitignore.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/gitignore.template.js +6 -0
- package/lib/generate-php-sdk/templates/gitignore.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/package.json.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/package.json.template.js +12 -0
- package/lib/generate-php-sdk/templates/package.json.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/readme.md.template.js +86 -0
- package/lib/generate-php-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.js +30 -0
- package/lib/generate-php-sdk/templates/smoke-test.template.js.map +1 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.d.ts +2 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.js +21 -0
- package/lib/generate-php-sdk/templates/test-fixture.template.js.map +1 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.d.ts +16 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js +97 -0
- package/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.js.map +1 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.d.ts +2 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js +95 -0
- package/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.js.map +1 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.d.ts +8 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.js +73 -0
- package/lib/generate-php-sdk/utils/generate-resource-object-class.js.map +1 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.d.ts +7 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.js +103 -0
- package/lib/generate-php-sdk/utils/generate-seam-client.js.map +1 -0
- package/lib/generate-php-sdk/utils/get-php-type.d.ts +1 -0
- package/lib/generate-php-sdk/utils/get-php-type.js +17 -0
- package/lib/generate-php-sdk/utils/get-php-type.js.map +1 -0
- package/lib/generate-php-sdk/utils/php-client.d.ts +31 -0
- package/lib/generate-php-sdk/utils/php-client.js +130 -0
- package/lib/generate-php-sdk/utils/php-client.js.map +1 -0
- package/lib/generate-python-sdk/class-file.d.ts +20 -0
- package/lib/generate-python-sdk/class-file.js +75 -0
- package/lib/generate-python-sdk/class-file.js.map +1 -0
- package/lib/generate-python-sdk/generate-python-sdk.d.ts +1 -0
- package/lib/generate-python-sdk/generate-python-sdk.js +117 -0
- package/lib/generate-python-sdk/generate-python-sdk.js.map +1 -0
- package/lib/generate-python-sdk/index.d.ts +1 -0
- package/lib/generate-python-sdk/index.js +2 -0
- package/lib/generate-python-sdk/index.js.map +1 -0
- package/lib/generate-python-sdk/map-python-type.d.ts +2 -0
- package/lib/generate-python-sdk/map-python-type.js +26 -0
- package/lib/generate-python-sdk/map-python-type.js.map +1 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.js +12 -0
- package/lib/generate-python-sdk/templates/conftest.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js +21 -0
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/readme.md.template.js +48 -0
- package/lib/generate-python-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/routes.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/routes.py.template.js +13 -0
- package/lib/generate-python-sdk/templates/routes.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/seam.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/seam.py.template.js +74 -0
- package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js +9 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-routes.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +9 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.d.ts +5 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js +10 -0
- package/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.js +13 -0
- package/lib/generate-python-sdk/templates/test_smoke.py.template.js.map +1 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.d.ts +2 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js +28 -0
- package/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.js.map +1 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.d.ts +1 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js +132 -0
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js.map +1 -0
- package/lib/generate-ruby-sdk/index.d.ts +1 -0
- package/lib/generate-ruby-sdk/index.js +2 -0
- package/lib/generate-ruby-sdk/index.js.map +1 -0
- package/lib/generate-ruby-sdk/request.rb.template.d.ts +1 -0
- package/lib/generate-ruby-sdk/request.rb.template.js +2 -0
- package/lib/generate-ruby-sdk/request.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/ruby-client.d.ts +35 -0
- package/lib/generate-ruby-sdk/ruby-client.js +59 -0
- package/lib/generate-ruby-sdk/ruby-client.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js +22 -0
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js +59 -0
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.js +74 -0
- package/lib/generate-ruby-sdk/templates/client.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.js +7 -0
- package/lib/generate-ruby-sdk/templates/gemfile.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js +13 -0
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.js +23 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.js +184 -0
- package/lib/generate-ruby-sdk/templates/readme.md.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.js +71 -0
- package/lib/generate-ruby-sdk/templates/request.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js +8 -0
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js +10 -0
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js +8 -0
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js +10 -0
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js +41 -0
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.d.ts +6 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js +15 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.d.ts +2 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.js +6 -0
- package/lib/generate-ruby-sdk/templates/version.rb.template.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/openapi/flatten-obj-schema.d.ts +5 -0
- package/lib/openapi/flatten-obj-schema.js +86 -0
- package/lib/openapi/flatten-obj-schema.js.map +1 -0
- package/lib/openapi/get-parameter-and-response-schema.d.ts +20 -0
- package/lib/openapi/get-parameter-and-response-schema.js +42 -0
- package/lib/openapi/get-parameter-and-response-schema.js.map +1 -0
- package/lib/openapi/index.d.ts +2 -0
- package/lib/openapi/index.js +3 -0
- package/lib/openapi/index.js.map +1 -0
- package/lib/types.d.ts +91 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +95 -0
- package/src/index.ts +6 -0
- package/src/lib/cli.ts +71 -0
- package/src/lib/fs-util/index.ts +2 -0
- package/src/lib/fs-util/populate-fs.ts +14 -0
- package/src/lib/fs-util/write-fs.ts +10 -0
- package/src/lib/generate-csharp-sdk/codegen.ts +648 -0
- package/src/lib/generate-csharp-sdk/constants.ts +1 -0
- package/src/lib/generate-csharp-sdk/generate-csharp-sdk.ts +126 -0
- package/src/lib/generate-csharp-sdk/generate-csproj.ts +45 -0
- package/src/lib/generate-csharp-sdk/templates/dataclass.ts +973 -0
- package/src/lib/generate-csharp-sdk/templates/fs/csharp-testing.sln +34 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ApiResponse.cs +159 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ClientUtils.cs +280 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ExceptionFactory.cs +12 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/GlobalSeamRequestConfiguration.cs +60 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/HttpMethod.cs +29 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IAsynchronousSeam.cs +142 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/IReadableSeamRequestConfiguration.cs +68 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/ISynchronousSeam.cs +103 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Multimap.cs +286 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RequestOptions.cs +74 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/RetryConfiguration.cs +21 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/Seam.cs +1070 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamException.cs +64 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Client/SeamRequestConfiguration.cs +662 -0
- package/src/lib/generate-csharp-sdk/templates/fs/src/Seam/Model/AsbtractModelSchema.cs +62 -0
- package/src/lib/generate-php-sdk/generate-php-sdk.ts +176 -0
- package/src/lib/generate-php-sdk/index.ts +1 -0
- package/src/lib/generate-php-sdk/templates/composer.json.template.ts +24 -0
- package/src/lib/generate-php-sdk/templates/env.example.template.ts +3 -0
- package/src/lib/generate-php-sdk/templates/gitignore.template.ts +5 -0
- package/src/lib/generate-php-sdk/templates/package.json.template.ts +11 -0
- package/src/lib/generate-php-sdk/templates/readme.md.template.ts +85 -0
- package/src/lib/generate-php-sdk/templates/smoke-test.template.ts +29 -0
- package/src/lib/generate-php-sdk/templates/test-fixture.template.ts +20 -0
- package/src/lib/generate-php-sdk/utils/deep-extract-resource-object-schemas.ts +160 -0
- package/src/lib/generate-php-sdk/utils/deep-flatten-one-of-and-all-of-schema.ts +128 -0
- package/src/lib/generate-php-sdk/utils/generate-resource-object-class.ts +105 -0
- package/src/lib/generate-php-sdk/utils/generate-seam-client.ts +115 -0
- package/src/lib/generate-php-sdk/utils/get-php-type.ts +21 -0
- package/src/lib/generate-php-sdk/utils/php-client.ts +189 -0
- package/src/lib/generate-python-sdk/class-file.ts +114 -0
- package/src/lib/generate-python-sdk/generate-python-sdk.ts +147 -0
- package/src/lib/generate-python-sdk/index.ts +1 -0
- package/src/lib/generate-python-sdk/map-python-type.ts +29 -0
- package/src/lib/generate-python-sdk/templates/conftest.py.template.ts +11 -0
- package/src/lib/generate-python-sdk/templates/pyproject.toml.template.ts +20 -0
- package/src/lib/generate-python-sdk/templates/readme.md.template.ts +47 -0
- package/src/lib/generate-python-sdk/templates/routes.py.template.ts +13 -0
- package/src/lib/generate-python-sdk/templates/seam.py.template.ts +73 -0
- package/src/lib/generate-python-sdk/templates/snippets/abstract-routes.template.ts +9 -0
- package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +8 -0
- package/src/lib/generate-python-sdk/templates/snippets/resource-dataclass.template.ts +15 -0
- package/src/lib/generate-python-sdk/templates/test_smoke.py.template.ts +12 -0
- package/src/lib/generate-python-sdk/templates/utils/deep_attr_dict.py.template.ts +27 -0
- package/src/lib/generate-ruby-sdk/generate-ruby-sdk.ts +153 -0
- package/src/lib/generate-ruby-sdk/index.ts +1 -0
- package/src/lib/generate-ruby-sdk/request.rb.template.ts +0 -0
- package/src/lib/generate-ruby-sdk/ruby-client.ts +81 -0
- package/src/lib/generate-ruby-sdk/templates/base_client.rb.template.ts +21 -0
- package/src/lib/generate-ruby-sdk/templates/base_resource.rb.template.ts +58 -0
- package/src/lib/generate-ruby-sdk/templates/client.rb.template.ts +73 -0
- package/src/lib/generate-ruby-sdk/templates/gemfile.template.ts +6 -0
- package/src/lib/generate-ruby-sdk/templates/logger.rb.template.ts +12 -0
- package/src/lib/generate-ruby-sdk/templates/rakefile.template.ts +22 -0
- package/src/lib/generate-ruby-sdk/templates/readme.md.template.ts +183 -0
- package/src/lib/generate-ruby-sdk/templates/request.rb.template.ts +70 -0
- package/src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts +7 -0
- package/src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts +9 -0
- package/src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts +7 -0
- package/src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts +9 -0
- package/src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts +40 -0
- package/src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts +24 -0
- package/src/lib/generate-ruby-sdk/templates/version.rb.template.ts +5 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/openapi/flatten-obj-schema.ts +124 -0
- package/src/lib/openapi/get-parameter-and-response-schema.ts +59 -0
- package/src/lib/openapi/index.ts +2 -0
- package/src/lib/types.ts +96 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Seam Connect
|
|
3
|
+
*
|
|
4
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
using System;
|
|
12
|
+
using System.Threading.Tasks;
|
|
13
|
+
|
|
14
|
+
namespace Seam.Client
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Contract for Asynchronous RESTful API interactions.
|
|
18
|
+
///
|
|
19
|
+
/// This interface allows consumers to provide a custom API accessor client.
|
|
20
|
+
/// </summary>
|
|
21
|
+
public interface IAsynchronousSeam
|
|
22
|
+
{
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the GET http verb.
|
|
25
|
+
/// </summary>
|
|
26
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
27
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
28
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
29
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
30
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
31
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
32
|
+
Task<ApiResponse<T>> GetAsync<T>(
|
|
33
|
+
string path,
|
|
34
|
+
RequestOptions options,
|
|
35
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
36
|
+
System.Threading.CancellationToken cancellationToken =
|
|
37
|
+
default(System.Threading.CancellationToken)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
|
|
42
|
+
/// </summary>
|
|
43
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
44
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
45
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
46
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
47
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
48
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
49
|
+
Task<ApiResponse<T>> PostAsync<T>(
|
|
50
|
+
string path,
|
|
51
|
+
RequestOptions options,
|
|
52
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
53
|
+
System.Threading.CancellationToken cancellationToken =
|
|
54
|
+
default(System.Threading.CancellationToken)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
|
|
59
|
+
/// </summary>
|
|
60
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
61
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
62
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
63
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
64
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
65
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
66
|
+
Task<ApiResponse<T>> PutAsync<T>(
|
|
67
|
+
string path,
|
|
68
|
+
RequestOptions options,
|
|
69
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
70
|
+
System.Threading.CancellationToken cancellationToken =
|
|
71
|
+
default(System.Threading.CancellationToken)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
|
|
76
|
+
/// </summary>
|
|
77
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
78
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
79
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
80
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
81
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
82
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
83
|
+
Task<ApiResponse<T>> DeleteAsync<T>(
|
|
84
|
+
string path,
|
|
85
|
+
RequestOptions options,
|
|
86
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
87
|
+
System.Threading.CancellationToken cancellationToken =
|
|
88
|
+
default(System.Threading.CancellationToken)
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
/// <summary>
|
|
92
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
|
|
93
|
+
/// </summary>
|
|
94
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
95
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
96
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
97
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
98
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
99
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
100
|
+
Task<ApiResponse<T>> HeadAsync<T>(
|
|
101
|
+
string path,
|
|
102
|
+
RequestOptions options,
|
|
103
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
104
|
+
System.Threading.CancellationToken cancellationToken =
|
|
105
|
+
default(System.Threading.CancellationToken)
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
/// <summary>
|
|
109
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
|
|
110
|
+
/// </summary>
|
|
111
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
112
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
113
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
114
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
115
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
116
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
117
|
+
Task<ApiResponse<T>> OptionsAsync<T>(
|
|
118
|
+
string path,
|
|
119
|
+
RequestOptions options,
|
|
120
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
121
|
+
System.Threading.CancellationToken cancellationToken =
|
|
122
|
+
default(System.Threading.CancellationToken)
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
/// <summary>
|
|
126
|
+
/// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
|
|
127
|
+
/// </summary>
|
|
128
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
129
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
130
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
131
|
+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
|
132
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
133
|
+
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
134
|
+
Task<ApiResponse<T>> PatchAsync<T>(
|
|
135
|
+
string path,
|
|
136
|
+
RequestOptions options,
|
|
137
|
+
IReadableSeamRequestConfiguration configuration = null,
|
|
138
|
+
System.Threading.CancellationToken cancellationToken =
|
|
139
|
+
default(System.Threading.CancellationToken)
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Net;
|
|
4
|
+
using System.Net.Security;
|
|
5
|
+
using System.Security.Cryptography.X509Certificates;
|
|
6
|
+
|
|
7
|
+
namespace Seam.Client
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Represents a readable-only configuration contract.
|
|
11
|
+
/// </summary>
|
|
12
|
+
public interface IReadableSeamRequestConfiguration
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// Gets the base path.
|
|
16
|
+
/// </summary>
|
|
17
|
+
/// <value>Base path.</value>
|
|
18
|
+
string BasePath { get; }
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Gets the date time format.
|
|
22
|
+
/// </summary>
|
|
23
|
+
/// <value>Date time format.</value>
|
|
24
|
+
string DateTimeFormat { get; }
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Gets the default headers.
|
|
28
|
+
/// </summary>
|
|
29
|
+
/// <value>Default headers.</value>
|
|
30
|
+
IDictionary<string, string> DefaultHeaders { get; }
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Gets the temp folder path.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <value>Temp folder path.</value>
|
|
36
|
+
string TempFolderPath { get; }
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Gets the HTTP connection timeout (in milliseconds)
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <value>HTTP connection timeout.</value>
|
|
42
|
+
int Timeout { get; }
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Gets the proxy.
|
|
46
|
+
/// </summary>
|
|
47
|
+
/// <value>Proxy.</value>
|
|
48
|
+
WebProxy Proxy { get; }
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// Gets the user agent.
|
|
52
|
+
/// </summary>
|
|
53
|
+
/// <value>User agent.</value>
|
|
54
|
+
string UserAgent { get; }
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
/// Gets certificate collection to be sent with requests.
|
|
58
|
+
/// </summary>
|
|
59
|
+
/// <value>X509 Certificate collection.</value>
|
|
60
|
+
X509CertificateCollection ClientCertificates { get; }
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
|
|
64
|
+
/// overriding certificate errors in the scope of a request.
|
|
65
|
+
/// </summary>
|
|
66
|
+
RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
namespace Seam.Client
|
|
2
|
+
{
|
|
3
|
+
public interface ISynchronousSeam
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Executes a blocking call to some <paramref name="path"/> using the GET http verb.
|
|
7
|
+
/// </summary>
|
|
8
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
9
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
10
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
11
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
12
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
13
|
+
ApiResponse<T> Get<T>(
|
|
14
|
+
string path,
|
|
15
|
+
RequestOptions options,
|
|
16
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// Executes a blocking call to some <paramref name="path"/> using the POST http verb.
|
|
21
|
+
/// </summary>
|
|
22
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
23
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
24
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
25
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
26
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
27
|
+
ApiResponse<T> Post<T>(
|
|
28
|
+
string path,
|
|
29
|
+
RequestOptions options,
|
|
30
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Executes a blocking call to some <paramref name="path"/> using the PUT http verb.
|
|
35
|
+
/// </summary>
|
|
36
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
37
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
38
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
39
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
40
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
41
|
+
ApiResponse<T> Put<T>(
|
|
42
|
+
string path,
|
|
43
|
+
RequestOptions options,
|
|
44
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Executes a blocking call to some <paramref name="path"/> using the DELETE http verb.
|
|
49
|
+
/// </summary>
|
|
50
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
51
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
52
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
53
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
54
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
55
|
+
ApiResponse<T> Delete<T>(
|
|
56
|
+
string path,
|
|
57
|
+
RequestOptions options,
|
|
58
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
/// Executes a blocking call to some <paramref name="path"/> using the HEAD http verb.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
65
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
66
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
67
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
68
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
69
|
+
ApiResponse<T> Head<T>(
|
|
70
|
+
string path,
|
|
71
|
+
RequestOptions options,
|
|
72
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Executes a blocking call to some <paramref name="path"/> using the OPTIONS http verb.
|
|
77
|
+
/// </summary>
|
|
78
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
79
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
80
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
81
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
82
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
83
|
+
ApiResponse<T> Options<T>(
|
|
84
|
+
string path,
|
|
85
|
+
RequestOptions options,
|
|
86
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
/// Executes a blocking call to some <paramref name="path"/> using the PATCH http verb.
|
|
91
|
+
/// </summary>
|
|
92
|
+
/// <param name="path">The relative path to invoke.</param>
|
|
93
|
+
/// <param name="options">The request parameters to pass along to the client.</param>
|
|
94
|
+
/// <param name="configuration">Per-request configurable settings.</param>
|
|
95
|
+
/// <typeparam name="T">The return type.</typeparam>
|
|
96
|
+
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
|
|
97
|
+
ApiResponse<T> Patch<T>(
|
|
98
|
+
string path,
|
|
99
|
+
RequestOptions options,
|
|
100
|
+
IReadableSeamRequestConfiguration configuration = null
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
|
|
5
|
+
namespace Seam.Client
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// A dictionary in which one key has many associated values.
|
|
9
|
+
/// </summary>
|
|
10
|
+
/// <typeparam name="TKey">The type of the key</typeparam>
|
|
11
|
+
/// <typeparam name="TValue">The type of the value associated with the key.</typeparam>
|
|
12
|
+
public class Multimap<TKey, TValue> : IDictionary<TKey, IList<TValue>>
|
|
13
|
+
{
|
|
14
|
+
#region Private Fields
|
|
15
|
+
|
|
16
|
+
private readonly Dictionary<TKey, IList<TValue>> _dictionary;
|
|
17
|
+
|
|
18
|
+
#endregion Private Fields
|
|
19
|
+
|
|
20
|
+
#region Constructors
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Empty Constructor.
|
|
24
|
+
/// </summary>
|
|
25
|
+
public Multimap()
|
|
26
|
+
{
|
|
27
|
+
_dictionary = new Dictionary<TKey, IList<TValue>>();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Constructor with comparer.
|
|
32
|
+
/// </summary>
|
|
33
|
+
/// <param name="comparer"></param>
|
|
34
|
+
public Multimap(IEqualityComparer<TKey> comparer)
|
|
35
|
+
{
|
|
36
|
+
_dictionary = new Dictionary<TKey, IList<TValue>>(comparer);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#endregion Constructors
|
|
40
|
+
|
|
41
|
+
#region Enumerators
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// To get the enumerator.
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <returns>Enumerator</returns>
|
|
47
|
+
public IEnumerator<KeyValuePair<TKey, IList<TValue>>> GetEnumerator()
|
|
48
|
+
{
|
|
49
|
+
return _dictionary.GetEnumerator();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// To get the enumerator.
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <returns>Enumerator</returns>
|
|
56
|
+
IEnumerator IEnumerable.GetEnumerator()
|
|
57
|
+
{
|
|
58
|
+
return _dictionary.GetEnumerator();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#endregion Enumerators
|
|
62
|
+
|
|
63
|
+
#region Public Members
|
|
64
|
+
/// <summary>
|
|
65
|
+
/// Add values to Multimap
|
|
66
|
+
/// </summary>
|
|
67
|
+
/// <param name="item">Key value pair</param>
|
|
68
|
+
public void Add(KeyValuePair<TKey, IList<TValue>> item)
|
|
69
|
+
{
|
|
70
|
+
if (!TryAdd(item.Key, item.Value))
|
|
71
|
+
throw new InvalidOperationException("Could not add values to Multimap.");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// Add Multimap to Multimap
|
|
76
|
+
/// </summary>
|
|
77
|
+
/// <param name="multimap">Multimap</param>
|
|
78
|
+
public void Add(Multimap<TKey, TValue> multimap)
|
|
79
|
+
{
|
|
80
|
+
foreach (var item in multimap)
|
|
81
|
+
{
|
|
82
|
+
if (!TryAdd(item.Key, item.Value))
|
|
83
|
+
throw new InvalidOperationException("Could not add values to Multimap.");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
/// Clear Multimap
|
|
89
|
+
/// </summary>
|
|
90
|
+
public void Clear()
|
|
91
|
+
{
|
|
92
|
+
_dictionary.Clear();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// Determines whether Multimap contains the specified item.
|
|
97
|
+
/// </summary>
|
|
98
|
+
/// <param name="item">Key value pair</param>
|
|
99
|
+
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
|
|
100
|
+
/// <returns>true if the Multimap contains the item; otherwise, false.</returns>
|
|
101
|
+
public bool Contains(KeyValuePair<TKey, IList<TValue>> item)
|
|
102
|
+
{
|
|
103
|
+
throw new NotImplementedException();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
/// Copy items of the Multimap to an array,
|
|
108
|
+
/// starting at a particular array index.
|
|
109
|
+
/// </summary>
|
|
110
|
+
/// <param name="array">The array that is the destination of the items copied
|
|
111
|
+
/// from Multimap. The array must have zero-based indexing.</param>
|
|
112
|
+
/// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
|
|
113
|
+
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
|
|
114
|
+
public void CopyTo(KeyValuePair<TKey, IList<TValue>>[] array, int arrayIndex)
|
|
115
|
+
{
|
|
116
|
+
throw new NotImplementedException();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// <summary>
|
|
120
|
+
/// Removes the specified item from the Multimap.
|
|
121
|
+
/// </summary>
|
|
122
|
+
/// <param name="item">Key value pair</param>
|
|
123
|
+
/// <returns>true if the item is successfully removed; otherwise, false.</returns>
|
|
124
|
+
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
|
|
125
|
+
public bool Remove(KeyValuePair<TKey, IList<TValue>> item)
|
|
126
|
+
{
|
|
127
|
+
throw new NotImplementedException();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// <summary>
|
|
131
|
+
/// Gets the number of items contained in the Multimap.
|
|
132
|
+
/// </summary>
|
|
133
|
+
public int Count => _dictionary.Count;
|
|
134
|
+
|
|
135
|
+
/// <summary>
|
|
136
|
+
/// Gets a value indicating whether the Multimap is read-only.
|
|
137
|
+
/// </summary>
|
|
138
|
+
public bool IsReadOnly => false;
|
|
139
|
+
|
|
140
|
+
/// <summary>
|
|
141
|
+
/// Adds an item with the provided key and value to the Multimap.
|
|
142
|
+
/// </summary>
|
|
143
|
+
/// <param name="key">The object to use as the key of the item to add.</param>
|
|
144
|
+
/// <param name="value">The object to use as the value of the item to add.</param>
|
|
145
|
+
/// <exception cref="InvalidOperationException">Thrown when couldn't add the value to Multimap.</exception>
|
|
146
|
+
public void Add(TKey key, IList<TValue> value)
|
|
147
|
+
{
|
|
148
|
+
if (value != null && value.Count > 0)
|
|
149
|
+
{
|
|
150
|
+
if (_dictionary.TryGetValue(key, out var list))
|
|
151
|
+
{
|
|
152
|
+
foreach (var k in value)
|
|
153
|
+
list.Add(k);
|
|
154
|
+
}
|
|
155
|
+
else
|
|
156
|
+
{
|
|
157
|
+
list = new List<TValue>(value);
|
|
158
|
+
if (!TryAdd(key, list))
|
|
159
|
+
throw new InvalidOperationException("Could not add values to Multimap.");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// <summary>
|
|
165
|
+
/// Determines whether the Multimap contains an item with the specified key.
|
|
166
|
+
/// </summary>
|
|
167
|
+
/// <param name="key">The key to locate in the Multimap.</param>
|
|
168
|
+
/// <returns>true if the Multimap contains an item with
|
|
169
|
+
/// the key; otherwise, false.</returns>
|
|
170
|
+
public bool ContainsKey(TKey key)
|
|
171
|
+
{
|
|
172
|
+
return _dictionary.ContainsKey(key);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/// <summary>
|
|
176
|
+
/// Removes item with the specified key from the Multimap.
|
|
177
|
+
/// </summary>
|
|
178
|
+
/// <param name="key">The key to locate in the Multimap.</param>
|
|
179
|
+
/// <returns>true if the item is successfully removed; otherwise, false.</returns>
|
|
180
|
+
public bool Remove(TKey key)
|
|
181
|
+
{
|
|
182
|
+
return TryRemove(key, out var _);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/// <summary>
|
|
186
|
+
/// Gets the value associated with the specified key.
|
|
187
|
+
/// </summary>
|
|
188
|
+
/// <param name="key">The key whose value to get.</param>
|
|
189
|
+
/// <param name="value">When this method returns, the value associated with the specified key, if the
|
|
190
|
+
/// key is found; otherwise, the default value for the type of the value parameter.
|
|
191
|
+
/// This parameter is passed uninitialized.</param>
|
|
192
|
+
/// <returns> true if the object that implements Multimap contains
|
|
193
|
+
/// an item with the specified key; otherwise, false.</returns>
|
|
194
|
+
public bool TryGetValue(TKey key, out IList<TValue> value)
|
|
195
|
+
{
|
|
196
|
+
return _dictionary.TryGetValue(key, out value);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/// <summary>
|
|
200
|
+
/// Gets or sets the item with the specified key.
|
|
201
|
+
/// </summary>
|
|
202
|
+
/// <param name="key">The key of the item to get or set.</param>
|
|
203
|
+
/// <returns>The value of the specified key.</returns>
|
|
204
|
+
public IList<TValue> this[TKey key]
|
|
205
|
+
{
|
|
206
|
+
get => _dictionary[key];
|
|
207
|
+
set => _dictionary[key] = value;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/// <summary>
|
|
211
|
+
/// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap.
|
|
212
|
+
/// </summary>
|
|
213
|
+
public ICollection<TKey> Keys => _dictionary.Keys;
|
|
214
|
+
|
|
215
|
+
/// <summary>
|
|
216
|
+
/// Gets a System.Collections.Generic.ICollection containing the values of the Multimap.
|
|
217
|
+
/// </summary>
|
|
218
|
+
public ICollection<IList<TValue>> Values => _dictionary.Values;
|
|
219
|
+
|
|
220
|
+
/// <summary>
|
|
221
|
+
/// Copy the items of the Multimap to an System.Array,
|
|
222
|
+
/// starting at a particular System.Array index.
|
|
223
|
+
/// </summary>
|
|
224
|
+
/// <param name="array">The one-dimensional System.Array that is the destination of the items copied
|
|
225
|
+
/// from Multimap. The System.Array must have zero-based indexing.</param>
|
|
226
|
+
/// <param name="index">The zero-based index in array at which copying begins.</param>
|
|
227
|
+
public void CopyTo(Array array, int index)
|
|
228
|
+
{
|
|
229
|
+
((ICollection)_dictionary).CopyTo(array, index);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/// <summary>
|
|
233
|
+
/// Adds an item with the provided key and value to the Multimap.
|
|
234
|
+
/// </summary>
|
|
235
|
+
/// <param name="key">The object to use as the key of the item to add.</param>
|
|
236
|
+
/// <param name="value">The object to use as the value of the item to add.</param>
|
|
237
|
+
/// <exception cref="InvalidOperationException">Thrown when couldn't add value to Multimap.</exception>
|
|
238
|
+
public void Add(TKey key, TValue value)
|
|
239
|
+
{
|
|
240
|
+
if (value != null)
|
|
241
|
+
{
|
|
242
|
+
if (_dictionary.TryGetValue(key, out var list))
|
|
243
|
+
{
|
|
244
|
+
list.Add(value);
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
{
|
|
248
|
+
list = new List<TValue> { value };
|
|
249
|
+
if (!TryAdd(key, list))
|
|
250
|
+
throw new InvalidOperationException("Could not add value to Multimap.");
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#endregion Public Members
|
|
256
|
+
|
|
257
|
+
#region Private Members
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Helper method to encapsulate generator differences between dictionary types.
|
|
261
|
+
*/
|
|
262
|
+
private bool TryRemove(TKey key, out IList<TValue> value)
|
|
263
|
+
{
|
|
264
|
+
_dictionary.TryGetValue(key, out value);
|
|
265
|
+
return _dictionary.Remove(key);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Helper method to encapsulate generator differences between dictionary types.
|
|
270
|
+
*/
|
|
271
|
+
private bool TryAdd(TKey key, IList<TValue> value)
|
|
272
|
+
{
|
|
273
|
+
try
|
|
274
|
+
{
|
|
275
|
+
_dictionary.Add(key, value);
|
|
276
|
+
}
|
|
277
|
+
catch (ArgumentException)
|
|
278
|
+
{
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
#endregion Private Members
|
|
285
|
+
}
|
|
286
|
+
}
|