All Projects → nikibobi → pastebin-csharp

nikibobi / pastebin-csharp

Licence: MIT License
API client for Pastebin in C#

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to pastebin-csharp

Clamor
The Python Discord API Framework
Stars: ✭ 14 (-44%)
Mutual labels:  wrapper, api-client
Automatic Client
Client wrapper for the Automatic Link
Stars: ✭ 22 (-12%)
Mutual labels:  wrapper, api-client
cv4pve-api-dotnet
Proxmox VE Client API .Net C#
Stars: ✭ 25 (+0%)
Mutual labels:  api-client, dotnet-standard
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (+384%)
Mutual labels:  wrapper, dotnet-standard
pbwrap
Pastebin API wrapper for Python
Stars: ✭ 19 (-24%)
Mutual labels:  wrapper, pastebin
Workday.WebServices
Workday API clients
Stars: ✭ 18 (-28%)
Mutual labels:  api-client, dotnet-standard
Taviloglu.Wrike.ApiClient
.NET Client for Wrike API
Stars: ✭ 24 (-4%)
Mutual labels:  wrapper, api-client
JirAgileR
User-friendly 🔹JIRA API wrapper. Track projects & issues from within R
Stars: ✭ 22 (-12%)
Mutual labels:  wrapper
messaging-apis
Messaging APIs for multi-platform
Stars: ✭ 1,759 (+6936%)
Mutual labels:  api-client
dns
dns is a simple CLI tool for DNS-LG API
Stars: ✭ 28 (+12%)
Mutual labels:  api-client
python-launch-library
A simple wrapper for the Launch Library web API
Stars: ✭ 20 (-20%)
Mutual labels:  wrapper
hugo-wrapper
The universal way to include Hugo binary to your project.
Stars: ✭ 27 (+8%)
Mutual labels:  wrapper
revolut-php
💳 PHP Bindings for the Revolut Business API
Stars: ✭ 37 (+48%)
Mutual labels:  api-client
tweetsOLAPing
implementing an end-to-end tweets ETL/Analysis pipeline.
Stars: ✭ 24 (-4%)
Mutual labels:  api-client
hanami-bootstrap
Bootstrap wrapper for hanami framework.
Stars: ✭ 13 (-48%)
Mutual labels:  wrapper
downcloud
Download your own Soundcloud tracks (uncompressed)
Stars: ✭ 22 (-12%)
Mutual labels:  api-client
j2ssh-maverick
The open source branch of our legacy API providing a robust, mission critical SSH component to the community.
Stars: ✭ 57 (+128%)
Mutual labels:  api-client
NCalc2
GitHub clone of NCalc from http://ncalc.codeplex.com/
Stars: ✭ 97 (+288%)
Mutual labels:  dotnet-standard
tapi-yandex-direct
Python библиотека API Яндекс Директ
Stars: ✭ 35 (+40%)
Mutual labels:  wrapper
js-http-client
[DEPRECATED] Official Textile JS HTTP Wrapper Client
Stars: ✭ 29 (+16%)
Mutual labels:  api-client

Pastebin API for C#

Nuget Nuget

This is a simple library for accessing Pastebin from C#

Example

using System;
using System.Threading.Tasks;
using PastebinAPI;

namespace Example
{
    class Example
    {
        static void Main()
        {
            PastebinExample().GetAwaiter().GetResult();
        }

        static async Task PastebinExample()
        {
            //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 = await Pastebin.LoginAsync("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 await me.ListPastesAsync(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 = await me.CreatePasteAsync(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
                await me.DeletePasteAsync(newPaste);

                //lists all currently trending pastes(similar to me.ListPastes())
                foreach (Paste paste in await Pastebin.ListTrendingPastesAsync())
                {
                    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 = await Paste.CreateAsync("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();
        }
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].