コード例 #1
0
ファイル: Session.cs プロジェクト: mehdi-payday/spherechat
 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)))) { }
 }
コード例 #2
0
ファイル: Session.cs プロジェクト: mehdi-payday/spherechat
        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());
        }
コード例 #3
0
ファイル: Session.cs プロジェクト: mehdi-payday/spherechat
        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);
            }
        }