Exemple #1
0
 public void PostFriendship(FriendRequest friendrequest)
 {
     using (var request = new Friendship.Base()
     {
         DefaultHeaders = new WebHeaderCollection()
         {
             { HttpRequestHeader.Accept, "application/json" },
             { HttpRequestHeader.ContentType, "application/json" },
             { HttpRequestHeader.Authorization, "Token " + Auth.Token }
         }
     }.POST(Parser.EntitytoJSON(friendrequest, typeof(FriendRequest)))) { }
 }
Exemple #2
0
        public Entities.Friendship[] GetAllFriendships()
        {
            Cursor <Entities.Friendship> cursor = new Cursor <Entities.Friendship>();

            do
            {
                using (var request = new Friendship.Base()
                {
                    DefaultHeaders = new WebHeaderCollection()
                    {
                        { HttpRequestHeader.Accept, "application/json" },
                        { HttpRequestHeader.ContentType, "application/json" },
                        { HttpRequestHeader.Authorization, "Token " + Auth.Token }
                    }
                }.GET(!string.IsNullOrEmpty(cursor.Next) ? ExtractQueryString(cursor.Next) : null)) {
                    cursor.AddRange((Entities.Friendship[])Parser.JSONtoEntity(request.Payload, typeof(Entities.Friendship[])));
                    cursor.Next     = request.Payload.next.ToString();
                    cursor.Previous = request.Payload.previous.ToString();
                }
            } while (!string.IsNullOrEmpty(cursor.Next));
            return(cursor.ToArray());
        }
Exemple #3
0
        public Cursor <Entities.Friendship> GetFriendships(string page = "1")
        {
            Cursor <Entities.Friendship> cursor = new Cursor <Entities.Friendship>();

            using (var request = new Friendship.Base()
            {
                DefaultHeaders = new WebHeaderCollection()
                {
                    { HttpRequestHeader.Accept, "application/json" },
                    { HttpRequestHeader.ContentType, "application/json" },
                    { HttpRequestHeader.Authorization, "Token " + Auth.Token }
                }
            }.GET(page != null ? new Dictionary <string, string>()
            {
                { "page", page }
            } : null)) {
                cursor.AddRange((Entities.Friendship[])Parser.JSONtoEntity(request.Payload, typeof(Entities.Friendship[])));
                cursor.Next     = request.Payload.next.ToString();
                cursor.Previous = request.Payload.previous.ToString();

                return(cursor);
            }
        }