Class FileParameter
- Namespace
- RestSharp
- Assembly
- RestSharp.dll
Container for files to be uploaded with requests
public record FileParameter : IEquatable<FileParameter>
- Inheritance
-
FileParameter
- Implements
- Inherited Members
Constructors
FileParameter(FileParameter)
protected FileParameter(FileParameter original)
Parameters
originalFileParameter
Properties
ContentType
MIME content type of file
public string? ContentType { get; }
Property Value
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
FileName
Name of the file to use when uploading
public string FileName { get; }
Property Value
GetFile
Provides raw data for file
public Func<Stream> GetFile { get; }
Property Value
Name
Name of the parameter
public string Name { get; }
Property Value
Options
public FileParameterOptions Options { get; }
Property Value
Methods
Create(string, byte[], string, string?, FileParameterOptions?)
Creates a file parameter from an array of bytes.
public static FileParameter Create(string name, byte[] data, string filename, string? contentType = null, FileParameterOptions? options = null)
Parameters
namestringThe parameter name to use in the request.
databyte[]The data to use as the file's contents.
filenamestringThe filename to use in the request.
contentTypestringThe content type to use in the request.
optionsFileParameterOptionsFile parameter options
Returns
Create(string, Func<Stream>, string, string?, FileParameterOptions?)
Creates a file parameter from an array of bytes.
public static FileParameter Create(string name, Func<Stream> getFile, string fileName, string? contentType = null, FileParameterOptions? options = null)
Parameters
namestringThe parameter name to use in the request.
getFileFunc<Stream>Delegate that will be called with the request stream so you can write to it..
fileNamestringThe filename to use in the request.
contentTypestringOptional: parameter content type, default is "application/g-zip"
optionsFileParameterOptionsFile parameter options
Returns
- FileParameter
The FileParameter using the default content type.
Equals(FileParameter?)
public virtual bool Equals(FileParameter? other)
Parameters
otherFileParameter
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
FromFile(string, string?, string?, FileParameterOptions?)
public static FileParameter FromFile(string fullPath, string? name = null, string? contentType = null, FileParameterOptions? options = null)
Parameters
fullPathstringnamestringcontentTypestringoptionsFileParameterOptions
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(FileParameter?, FileParameter?)
public static bool operator ==(FileParameter? left, FileParameter? right)
Parameters
leftFileParameterrightFileParameter
Returns
operator !=(FileParameter?, FileParameter?)
public static bool operator !=(FileParameter? left, FileParameter? right)
Parameters
leftFileParameterrightFileParameter