@@ -5,7 +5,7 @@ Pinata.Client for .NET/C# Library
55
66Project Description
77-------------------
8- A .NET implementation for the [ Pinata API ] ( https://pinata.cloud/documentation ) .
8+ A .NET implementation for [ Pinata Cloud ] ( https://pinata.cloud/documentation ) .
99
1010[ 1 ] :https://docs.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client
1111[ 2 ] :https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls
@@ -30,11 +30,66 @@ Install-Package Pinata.Client
3030Getting Started
3131------
3232
33+ ``` csharp
34+ var config = new Config
35+ {
36+ ApiKey = " 2981f1eb1813daf..." ,
37+ ApiSecret = " 42281fa28de32fe3c..."
38+ };
39+
40+ var client = new PinataClient (config );
41+
42+ var html = @"
43+ <html>
44+ <head>
45+ <title>Hello IPFS!</title>
46+ </head>
47+ <body>
48+ <h1>Hello World</h1>
49+ </body>
50+ </html>
51+ " ;
52+
53+ var metadata = new PinataMetadata // optional
54+ {
55+ KeyValues =
56+ {
57+ {" Author" , " Brian Chavez" }
58+ }
59+ };
60+
61+ var options = new PinataOptions (); // optional
62+
63+ options .CustomPinPolicy .AddOrUpdateRegion (" NYC1" , desiredReplicationCount : 1 );
64+
65+ var response = await this .client .Pinning .PinFileToIpfsAsync (content =>
66+ {
67+ var file = new StringContent (html , Encoding .UTF8 , MediaTypeNames .Text .Html );
68+
69+ content .AddPinataFile (file , " index.html" );
70+ },
71+ metadata ,
72+ options );
73+
74+ if ( response .IsSuccess )
75+ {
76+ // File uploaded to Pinata Cloud and can be accessed on IPFS!
77+ var hash = response .IpfsHash ; // QmR9HwzakHVr67HFzzgJHoRjwzTTt4wtD6KU4NFe2ArYuj
78+ }
79+ ```
80+
81+ Now your file can be accessed over [ IPFS] ( https://ipfs.io/ ) and accessed via [ Cloudflare's IPFS gateway] ( https://cloudflare-ipfs.com/ ) !
82+
83+ ```
84+ https://cloudflare-ipfs.com/ipfs/QmR9HwzakHVr67HFzzgJHoRjwzTTt4wtD6KU4NFe2ArYuj
85+ ```
86+
87+ Find more examples [ here] ( https://github.com/bchavez/Pinata.Client/blob/master/Source/Pinata.Client.Tests/IntegrationTests/IntegrationTest.cs ) .
3388
3489-------
3590
3691
37- Easy peasy! ** Happy file sharing!** :tada :
92+ Magic! Easy peasy! ** Happy file sharing!** :tada :
3893
3994
4095Reference
0 commit comments