Skip to content
Aarav Navani edited this page Jul 17, 2021 · 3 revisions

Welcome to the MystPaste.NET wiki!

Installation

To install MystPaste, run the following command in your terminal

dotnet add package MystPaste.NET

You should always have the latest version of the library. To check the latest version you can see the NuGet listing.

Getting Started

To get started using MystPaste.NET, you need to create a MystPasteClient

var myst = new MystPasteClient();

Each endpoint group in the PasteMyst API has been split into separate 'Clients' and they will be discussed further along in this wiki.

Configuration

Some configuration options can also be set when creating the MystPasteClient

var myst = new MystPasteClient(new MystPasteConfiguration
{
    AuthToken = "<AUTH TOKEN>",
});

The auth token is your user's token obtained from here. This is used for making requests that require authentication, such as getting private pastes or deleting pastes.

Alternatively an action can also be used to set up the client

var myst = new MystPasteClient(x => 
{
    x.AuthToken = "<AUTH TOKEN>";
});

Logging

Optional logging can also be configured through the client.

To start, create a logger factory, This can be from any provider (Serilog, log4net, etc.)

var logger = LoggerFactory
    .Create(x => x.AddConsole())
    .CreateLogger<Program>();

Now tell the client to use this logger

var myst = new MystPasteClient(new MystPasteConfiguration
{
    Logger = logger
});

Or with the action

var myst = new MystPasteClient(x => 
{
    x.Logger = logger;
});