Skip to content

Commit

Permalink
updated csharp-restsharp samples
Browse files Browse the repository at this point in the history
  • Loading branch information
lewishazell committed Dec 18, 2024
1 parent 5df2a0f commit a5c93a7
Show file tree
Hide file tree
Showing 65 changed files with 437 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestAuthHttpBasicWithHttpInfo
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -412,6 +413,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestAuthHttpBearerWithHttpInf
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ public System.IO.Stream TestBinaryGif(int operationIndex = 0)
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -792,6 +793,7 @@ public System.IO.Stream TestBinaryGif(int operationIndex = 0)
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -932,6 +934,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1078,6 +1081,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1218,6 +1222,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1352,6 +1357,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1486,6 +1492,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1620,6 +1627,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1754,6 +1762,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1888,6 +1897,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestBodyMultipartFormdataArra
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestFormObjectMultipartWithHt
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand All @@ -543,7 +545,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestFormObjectMultipartWithHt
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}

localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter
localVarRequestOptions.FormParameters.Add("marker", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker) : Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter

localVarRequestOptions.Operation = "FormApi.TestFormObjectMultipart";
localVarRequestOptions.OperationIndex = operationIndex;
Expand Down Expand Up @@ -682,6 +684,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestFormObjectMultipartWithHt
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public Org.OpenAPITools.Client.ApiResponse<string> TestsPathStringPathStringInte
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1005,6 +1007,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1163,6 +1166,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1347,6 +1351,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1483,6 +1488,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1621,6 +1627,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1759,6 +1766,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -1897,6 +1905,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -2035,6 +2044,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ private RestRequest NewRequest(
}
}

if (options.HeaderParameters != null)
{
if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data")))
{
request.AlwaysMultipartFormData = true;
}
}

return request;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down Expand Up @@ -497,6 +498,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand All @@ -511,12 +513,12 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter
if (marker != null)
{
localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter
localVarRequestOptions.FormParameters.Add("marker", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker) : Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter
}
localVarRequestOptions.FileParameters.Add("file", file);
if (statusArray != null)
{
localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter
localVarRequestOptions.FormParameters.Add("statusArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(statusArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter
}

localVarRequestOptions.Operation = "MultipartApi.MultipartMixed";
Expand Down Expand Up @@ -657,6 +659,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
};

var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
var localVarMultipartFormData = localVarContentType == "multipart/form-data";
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ private RestRequest NewRequest(
}
}

if (options.HeaderParameters != null)
{
if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data")))
{
request.AlwaysMultipartFormData = true;
}
}

return request;
}

Expand Down
Loading

0 comments on commit a5c93a7

Please sign in to comment.