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
original
FileParameter
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
name
stringThe parameter name to use in the request.
data
byte[]The data to use as the file's contents.
filename
stringThe filename to use in the request.
contentType
stringThe content type to use in the request.
options
FileParameterOptionsFile 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
name
stringThe parameter name to use in the request.
getFile
Func<Stream>Delegate that will be called with the request stream so you can write to it..
fileName
stringThe filename to use in the request.
contentType
stringOptional: parameter content type, default is "application/g-zip"
options
FileParameterOptionsFile parameter options
Returns
- FileParameter
The FileParameter using the default content type.
Equals(FileParameter?)
public virtual bool Equals(FileParameter? other)
Parameters
other
FileParameter
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
FromFile(string, string?, string?, FileParameterOptions?)
public static FileParameter FromFile(string fullPath, string? name = null, string? contentType = null, FileParameterOptions? options = null)
Parameters
fullPath
stringname
stringcontentType
stringoptions
FileParameterOptions
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builder
StringBuilder
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(FileParameter?, FileParameter?)
public static bool operator ==(FileParameter? left, FileParameter? right)
Parameters
left
FileParameterright
FileParameter
Returns
operator !=(FileParameter?, FileParameter?)
public static bool operator !=(FileParameter? left, FileParameter? right)
Parameters
left
FileParameterright
FileParameter