Pastebin.API.CSharp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Pastebin.API.CSharp --version 1.0.0
NuGet\Install-Package Pastebin.API.CSharp -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pastebin.API.CSharp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pastebin.API.CSharp --version 1.0.0
#r "nuget: Pastebin.API.CSharp, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pastebin.API.CSharp as a Cake Addin
#addin nuget:?package=Pastebin.API.CSharp&version=1.0.0

// Install Pastebin.API.CSharp as a Cake Tool
#tool nuget:?package=Pastebin.API.CSharp&version=1.0.0

Pastebin API for C#

This is a simple library for accessing Pastebin from C#

Example

using System;
using PastebinAPI;

namespace Example
{
    class Example
    {
        static void Main()
        {
            //before using any class in the api you must enter your api dev key
            Pastebin.DevKey = "your dev key goes here";
            //you can see yours here: https://pastebin.com/api#1
            try
            {
                // login and get user object
                User me = Pastebin.Login("user", "pass");
                // user contains information like e-mail, location etc...
                Console.WriteLine("{0}({1}) lives in {2}", me, me.Email, me.Location);
                // lists all pastes for this user
                foreach (Paste paste in me.ListPastes(3)) // we limmit the results to 3
                {
                    Console.WriteLine(paste.Title);
                }

                string code = "<your fancy &code#() goes here>";
                //creates a new paste and get paste object
                Paste newPaste = me.CreatePaste(code, "MyPasteTitle", Language.HTML5, Visibility.Public, Expiration.TenMinutes);
                //newPaste now contains the link returned from the server
                Console.WriteLine("URL: {0}",newPaste.Url);
                Console.WriteLine("Paste key: {0}", newPaste.Key);
                Console.WriteLine("Content: {0}", newPaste.Text);
                //deletes the paste we just created
                me.DeletePaste(newPaste);

                //lists all currently trending pastes(similar to me.ListPastes())
                foreach (Paste paste in Pastebin.ListTrendingPastes())
                {
                    Console.WriteLine("{0} - {1}", paste.Title, paste.Url);
                }
                //you can create pastes directly from Pastebin static class but they are created as guests and you have a limited number of guest uploads
                Paste anotherPaste = Paste.Create("another paste", "MyPasteTitle2", Language.CSharp, Visibility.Unlisted, Expiration.OneHour);
                Console.WriteLine(anotherPaste.Title);
            }
            catch(PastebinException ex) //api throws PastebinException
            {
                //in the Parameter property you can see what invalid parameter was sent
                //here we check if the exeption is thrown because of invalid login details
                if (ex.Parameter == PastebinException.ParameterType.Login)
                {
                    Console.Error.WriteLine("Invalid username/password");
                }
                else
                {
                    throw; //all other types are rethrown and not swalowed!
                }
            }
            Console.ReadKey();
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 2,685 4/28/2018
1.0.13 1,159 5/1/2018
1.0.12 1,269 4/28/2018
1.0.7 1,415 10/22/2017
1.0.5 1,042 10/22/2017
1.0.4 1,338 10/22/2017
1.0.3 1,064 10/22/2017
1.0.2 1,054 10/22/2017
1.0.1 1,052 10/22/2017
1.0.0 1,277 10/22/2017

First Release