Content-Length: 460948 | pFad | http://github.com/ElectronNET/Electron.NET/commit/e610c965508ede4227914083239437f37c3d82c0

FB Merge pull request #547 from Funkrusha/feature/enable-post-requests · ElectronNET/Electron.NET@e610c96 · GitHub
Skip to content

Commit e610c96

Browse files
Merge pull request #547 from Funkrusha/feature/enable-post-requests
Add PostData to LoadURLOptions to allow http-posts in LoadURL calls
2 parents f3bd3d0 + 3838fe8 commit e610c96

File tree

5 files changed

+92
-0
lines changed

5 files changed

+92
-0
lines changed

ElectronNET.API/Entities/Blob.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace ElectronNET.API.Entities
2+
{
3+
//github.com/ <summary>
4+
//github.com/
5+
//github.com/ </summary>
6+
public class Blob : IPostData
7+
{
8+
//github.com/ <summary>
9+
//github.com/ The object represents a Blob
10+
//github.com/ </summary>
11+
public string Type { get; } = "blob";
12+
13+
//github.com/ <summary>
14+
//github.com/ The UUID of the Blob being uploaded
15+
//github.com/ </summary>
16+
public string BlobUUID { get; set; }
17+
}
18+
}

ElectronNET.API/Entities/IPostData.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace ElectronNET.API.Entities
2+
{
3+
//github.com/ <summary>
4+
//github.com/ Interface to use Electrons PostData Object
5+
//github.com/ </summary>
6+
public interface IPostData
7+
{
8+
//github.com/ <summary>
9+
//github.com/ One of the following:
10+
//github.com/ rawData - <see cref="UploadRawData"/> The data is available as a Buffer, in the rawData field.
11+
//github.com/ file - <see cref="UploadFile"/> The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file.
12+
//github.com/ blob - <see cref="Blob"/> The object represents a Blob. The blobUUID field will be used to describe the Blob.
13+
//github.com/ </summary>
14+
public string Type { get; }
15+
}
16+
}

ElectronNET.API/Entities/LoadURLOptions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,11 @@ public class LoadURLOptions
2626
//github.com/ Extra headers for the request.
2727
//github.com/ </summary>
2828
public string ExtraHeaders { get; set; }
29+
30+
//github.com/ <summary>
31+
//github.com/ PostData Object for the request.
32+
//github.com/ Can be <see cref="UploadRawData"/>, <see cref="UploadFile"/> or <see cref="Blob"/>
33+
//github.com/ </summary>
34+
public IPostData[] PostData { get; set; }
2935
}
3036
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace ElectronNET.API.Entities
2+
{
3+
//github.com/ <summary>
4+
//github.com/
5+
//github.com/ </summary>
6+
public class UploadFile : IPostData
7+
{
8+
//github.com/ <summary>
9+
//github.com/ The object represents a file.
10+
//github.com/ </summary>
11+
public string Type { get; } = "file";
12+
13+
//github.com/ <summary>
14+
//github.com/ The path of the file being uploaded.
15+
//github.com/ </summary>
16+
public string FilePath { get; set; }
17+
18+
//github.com/ <summary>
19+
//github.com/ The offset from the beginning of the file being uploaded, in bytes. Defaults to 0.
20+
//github.com/ </summary>
21+
public long Offset { get; set; } = 0;
22+
23+
//github.com/ <summary>
24+
//github.com/ The length of the file being uploaded, <see cref="Offset"/>. Defaults to 0.
25+
//github.com/ If set to -1, the whole file will be uploaded.
26+
//github.com/ </summary>
27+
public long Length { get; set; } = 0;
28+
29+
//github.com/ <summary>
30+
//github.com/ The modification time of the file represented by a double, which is the number of seconds since the UNIX Epoch (Jan 1, 1970)
31+
//github.com/ </summary>
32+
public double ModificationTime { get; set; }
33+
}
34+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace ElectronNET.API.Entities
2+
{
3+
//github.com/ <summary>
4+
//github.com/
5+
//github.com/ </summary>
6+
public class UploadRawData : IPostData
7+
{
8+
//github.com/ <summary>
9+
//github.com/ The data is available as a Buffer, in the rawData field.
10+
//github.com/ </summary>
11+
public string Type { get; } = "rawData";
12+
13+
//github.com/ <summary>
14+
//github.com/ The raw bytes of the post data in a Buffer.
15+
//github.com/ </summary>
16+
public byte[] Bytes { get; set; }
17+
}
18+
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ElectronNET/Electron.NET/commit/e610c965508ede4227914083239437f37c3d82c0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy