Ril# support almost everything that is documented on the Read It Later API Documentation with the exception of the Text feature which gets the text only version of a url.

How to:

Add page to the user’s list

There are various ways you can add a page to a user’s list. This method use the Add method.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            string url = "http://rilsharp.suddenelfilio.net";
            string title = "Ril#";

            if (!rcl.Add(url, title, false))
                throw new Exception("Something went wrong while adding the page.");
        }
    }
}
add Page to the user’s list using the automatic title resolvement

When adding a page to a user’s list you can choose to let Ril# resolve the title for the URL. Keep in mind that this will only work when the url leads to an html page that has a <title> tag since this is what is being used to get the title.

To use this feature just pass ‘true’ for the autoTitle argument in the Add method for the RilClient class.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            string url = "http://rilsharp.suddenelfilio.net";
            string title = "Ril#";

            if (!rcl.Add(url, title, true))
                throw new Exception("Something went wrong while adding the page.");
        }
    }
}

NOTE: When setting autoTitle to true the passed value for the argument title will be overwritten by the resolved title.

 

Adding multiple pages to the user’s list at once

Using the Send method you for example can add multiple pages to a user’s list at once. Setting the type argument to SendType.New the pages passed in the List<RilListItem> will be added.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            List<RilListItem> newItems = new List<RilListItem>(2);

            newItems.Add(new RilListItem{
                Url = "http://rilsharp.suddenelfilio.net",
                Title = "Ril#"});

            newItems.Add(new RilListItem{
                Url = "http://www.google.com",
                Title = "Google"});

            ;

            if (!rcl.Send(SendType.New, newItems))
                throw new Exception("Something went wrong while adding the pages.");
        }
    }
}
Updating the title of one or multiple pages

To update the title of an already added page can be done by using the Send method and settings the type argument to SendType.Update_title. Then just pass the RilListItems of the pages you want to update, just make sure the URL is set the same as when you added the pages the first time.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            List<RilListItem> itemsToUpdate = new List<RilListItem>(2);

            newItems.Add(new RilListItem{
                Url = "http://rilsharp.suddenelfilio.net",
                Title = "Ril# Updated Title"});

            newItems.Add(new RilListItem{
                Url = "http://www.google.com",
                Title = "Google Updated Title"});

            ;

            if (!rcl.Send(SendType.Update_title, itemsToUpdate))
                throw new Exception("Something went wrong while adding the pages.");
        }
    }
}
Marking one or multiple pages as read

To mark a page as read you can use the Send method and set the type to SendType.Read.Then just pass the RilListItems of the pages you want to update, just make sure the URL is set the same as when you added the pages the first time.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            List<RilListItem> itemsToBeMarkedAsRead = new List<RilListItem>(2);

            newItems.Add(new RilListItem{
                Url = "http://rilsharp.suddenelfilio.net",
                Title = "Ril#"});

            newItems.Add(new RilListItem{
                Url = "http://www.google.com",
                Title = "Google"});

            ;

            if (!rcl.Send(SendType.Read, itemsToBeMarkedAsRead))
                throw new Exception("Something went wrong while adding the pages.");
        }
    }
}
Authenticating credentials against the Read it later API

When you create an application that uses Ril# you need some way of verifying that the credentials the user of you application provides are valid. You can use the Authenticate method on the RilClient class for that.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;
using System.Security;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            if (!rcl.Authenticate())
                throw new SecurityException("Invalid credentials!");
        }
    }
}
Registering a new user to the read it later list

You can provide a new user to get registered using the Ril# library. You can call the RegisterClient method on the RilClient class.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Net.SuddenElfilio.RilSharp;
using System.Security;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RilClient rcl = new RilClient(new Credentials
            {
                ApiKey = "<YOUR API KEY>",
                UserName = "<YOUR USERNAME>",
                Password = "<YOUR PASSWORD>"
            });

            if (!rcl.RegisterClient())
                throw new Exception("There was a problem when registering the new user");
        }
    }
}