openapi-generator/samples/client/others/csharp-netcore-complex-files
devhl-labs c3b9bd7459
[csharp-netcore] Adds ability to inherit api (#13797)
* refactor nrt annotation

* enable nrt by default in .net6.0+

* use shorter nrt annotation

* build samples

* removed debugging lines

* fixed model and operatoin constructors

* reverted a commented line for comparison

* upgraded to System.Text.Json

* build samples

* build samples

* deleted samples to remove old files

* bug fixes

* bug fixes

* added cumpulsory property to codegen

* build samples

* fixed bug

* fixed bug

* fixes

* removed bugged code that wasnt needed

* build samples

* restored sorting and default values for required params

* fixed bugs in comparison

* fixed sort comparators

* recreate tests

* build samples...again...

* removed debugging line breaks

* simplified constructor signature

* inject json options

* build samples...again...

* build samples

* add support for composed primitives

* build samples

* build all samples

* avoid reserved words

* restored a file

* multiple fixes

* bug fixes

* bug fixes

* api clients now transient, added EventHub

* bug fix

* bug fix

* added ability to inherit api

* added ability to inherit api

* bug fix

* added requiredAndNotNullable

* added custom serialization

* added request info to error handler

* added OrDefault for enum parsing

* fixed DateTime? deserialization

* added support for server override

* added IServiceCollection to host builder extensions

* improve cookie support

* bug fixes

* fixed spacing

* fixed content type header

* fixed spacing

* removed reference to newtonsoft

* bug fixes in deserialization

* resolved conflicts

* removed postProcessAllModels code now present in abstract

* added a comment with url to an issue

* removed unneeded code

* removed change that should be another pr

* build and update samples

* reduce number of files modified

* reduce number of files modified

* delete and build samples

* delete and build samples

* fixed property name issue

* fixed CodegenModel collection properties

* avoid a conflict

* avoid a conflict

* add a todo

* added todo

* fixed circular reference

* small changes

* synced with other branches

* commented some code for now

* copied samples from master

* changed mustache templates

* build samples

* fixed invalid property names

* rebuild samples

* rebuild samples

* fixed casing issue

* resolved conflicts

* fixed bug in resolving conflicts

* removed default api, users can handle that if required

* removed default api, users can handle that if required

* build samples......again....

* addressed comment

* addressed comment

* addressed comment

* addressed comment

* build samples
2022-12-09 18:01:54 +08:00
..

Org.OpenAPITools - the C# library for the MultipartFile test

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
Install-Package CompareNETObjects

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new MultipartApi(config);
            var files = new List<System.IO.Stream>(); // List<System.IO.Stream> | Many files (optional) 

            try
            {
                apiInstance.MultipartArray(files);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling MultipartApi.MultipartArray: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
MultipartApi MultipartArray POST /multipart-array
MultipartApi MultipartMixed POST /multipart-mixed
MultipartApi MultipartSingle POST /multipart-single

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.