/// <summary>
        /// Need to clear navigation properties before storing to database.
        /// </summary>
        /// <returns>This instance prepared for storing to databse.</returns>
        public override ComplexDbObject PrepareMappedProps()
        {
            Friendships.Clear();
            FriendRequests.Clear();

            return(this);
        }
Exemple #2
0
        public void ImportAllFriendships(string filePath)
        {
            var parsedFriendships = new Friendships();

            using (var xmlStream = new StreamReader(filePath))
            {
                var xmlSer = new XmlSerializer(typeof(Friendships)).Deserialize(xmlStream);
                parsedFriendships = (Friendships)xmlSer;
            }

            var existingDbUsernames = db.Users.Select(u => u.Username).ToList();

            foreach (var parsedFriendship in parsedFriendships.Friendship)
            {
                ImportFirstUser(parsedFriendship.FirstUser, existingDbUsernames);
                ImportSecondUser(parsedFriendship.SecondUser, existingDbUsernames);
                db.SaveChanges();

                ImportFriendshipAndMessages(parsedFriendship);

                OptimizedDbSave();
            }

            db.SaveChanges();
        }
        public ActionResult AcceptFriendRequest(ProfileViewModel profileViewModel)
        {
            User requestor = context.Users.Single(u => u.ScreenName == profileViewModel.ProfileUserScreenName);
            User requested = context.Users.Single(u => u.Email == (HttpContext.Session.GetString("_Email")));

            Friendships friendship = new Friendships
            {
                ScreenNameA = requested.ScreenName,
                ScreenNameB = requestor.ScreenName
            };

            context.Friendships.Add(friendship);

            foreach (var request in context.FriendRequests)
            {
                if (request.RequestedUserID == requested.ID)
                {
                    if (request.RequestingUserID == requestor.ID)
                    {
                        context.FriendRequests.Remove(request);
                    }
                }
            }

            context.SaveChanges();

            TempData["Alert"] = "Friend request has been Accepted!";
            return(Redirect("/User"));
        }
        public async Task <IActionResult> PutFriendships(int id, Friendships friendships)
        {
            if (id != friendships.FriendshipId)
            {
                return(BadRequest());
            }

            _context.Entry(friendships).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FriendshipsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #5
0
        public async Task <IActionResult> SendMessage([FromBody] MessageModel model)
        {
            if (!await Users.CheckIfExists(model.ReceiverId))
            {
                return(NotFound());
            }
            if (!await Friendships.CheckIfFriendshipExist(User.Id(), model.ReceiverId))
            {
                return(NotFound());
            }

            var message = await Chat.WriteMessage(User.Id(), Mapper.Map <Message>(model));

            var messageForReceiver = new MessageDTO();

            messageForReceiver = new MessageDTO
            {
                MessageText = message.MessageText,
                DateCreated = message.DateCreated,
                Id          = message.Id
            };

            await HubContext.Clients.Clients(await SignalRService.GetUserConnections(User.Id()))
            .ChatMessageReceived(model.ReceiverId, message);

            await HubContext.Clients.Clients(await SignalRService.GetUserConnections(model.ReceiverId))
            .ChatMessageReceived(User.Id(), messageForReceiver);

            return(Ok());
        }
        public async Task <IActionResult> OnPostAcceptAsync(string id)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(RedirectToPage("/Account/Login"));
            }

            Friendships = await _context.Friendships
                          .Include(f => f.Receiver)
                          .Include(f => f.Sender)
                          .Where(x => x.ReceiverId == user.Id || x.SenderId == user.Id).ToListAsync();

            var friendship = Friendships.FirstOrDefault(x => x.ReceiverId == id || x.SenderId == id);

            friendship.RequestStatus = FriendStatusCode.Accepted;

            try
            {
                _context.Friendships.Update(friendship);
                await _context.SaveChangesAsync();

                StatusMessage = $"You have accepted their friend request.";
                return(RedirectToPage("Index"));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.InnerException);
            }

            StatusMessage = $"Error: Couldn't accept friend.";
            return(Page());
        }
Exemple #7
0
        public void CanGetFriendshipMessageTest()
        {
            Friendships friendship = new Friendships();

            friendship.User1 = "chillbel";

            Assert.Equal("chillbel", friendship.User1);
        }
Exemple #8
0
        public async Task <IActionResult> GetMessages(long friendId, [FromQuery] InfiniteScroll scroll)
        {
            if (!await Friendships.CheckIfFriendshipExist(User.Id(), friendId))
            {
                return(NotFound());
            }

            return(Ok(await Chat.GetMessages(scroll, User.Id(), friendId)));
        }
        public void SendRequest(int requesterId, int recipientId)
        {
            var request = new Friendships();

            request.RequestAccepted = false;
            request.User            = db.UserSet.FirstOrDefault(u => u.Id == requesterId);
            request.Friend          = db.UserSet.FirstOrDefault(f => f.Id == recipientId);

            db.FriendshipsSet.Add(request);
            db.SaveChanges();
        }
        public async Task CreateFriendRequest(string username1, string username2)
        {
            Friendships friendRequest = new Friendships()
            {
                User1    = username1,
                User2    = username2,
                Accepted = false
            };

            _context.Friendships.Add(friendRequest);
            await _context.SaveChangesAsync();
        }
Exemple #11
0
        public async Task <IActionResult> RefuseInvitation([FromBody] FriendIdModel model)
        {
            if (!await Friendships.CheckIfInvitationExistByInvitationRoles(User.Id(), model.FriendId))
            {
                return(NotFound());
            }
            await Friendships.RemoveInvitation(User.Id(), model.FriendId);

            await Notifications.SetDecisionRefused(User.Id(), model.FriendId);

            return(Ok());
        }
Exemple #12
0
        public async Task <IActionResult> CancelInvitation([FromBody] FriendIdModel model)
        {
            if (!await Users.CheckIfExists(model.FriendId))
            {
                return(NotFound());
            }
            if (!await Friendships.CheckIfInvitationExistByInvitationRoles(model.FriendId, User.Id()))
            {
                return(NotFound());
            }

            await HubContext.Clients.Clients(await SignalRService.GetUserConnections(model.FriendId))
            .RefreshNotifications(await Friendships.RemoveInvitation(User.Id(), model.FriendId));

            return(Ok());
        }
Exemple #13
0
        public string AnwserRequest(string token, int userId, int requestorUserId, int accepted)
        {
            bool   bAccepted = (accepted == 0) ? false : true;
            string toRet     = "OK";

            Token t = Token.Exists(token);

            if (t == null || !t.IsUser)
            {
                return("TokenERROR");
            }

            if (!bAccepted)
            {
                FriendshipRequests fr = this._database.FriendshipRequests.Where(f => f.IdUser2 == userId && f.IdUserRequestor == requestorUserId).FirstOrDefault();
                this._database.FriendshipRequests.Remove(fr);
                this._database.SaveChanges();
                return("OK");
            }

            try
            {
                FriendshipRequests fr = this._database.FriendshipRequests.Where(f => f.IdUserRequestor == requestorUserId && userId == f.IdUser2 && f.Accepted == false).FirstOrDefault();
                fr.Accepted = bAccepted;
                this._database.SaveChanges();

                if (bAccepted)
                {
                    string      now        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    Friendships friendship = new Friendships()
                    {
                        TimeCreated = now,
                        IdUser1     = userId,
                        IdUser2     = requestorUserId
                    };

                    this._database.Friendships.Add(friendship);
                    this._database.SaveChanges();
                }
            }
            catch
            {
                toRet = "ERROR";
            }

            return(toRet);
        }
Exemple #14
0
        public async Task <IActionResult> AcceptInvitation([FromBody] FriendIdModel model)
        {
            if (!await Friendships.CheckIfInvitationExistByInvitationRoles(User.Id(), model.FriendId))
            {
                return(NotFound());
            }

            await HubContext.Clients.Clients(await SignalRService.GetUserConnections(model.FriendId))
            .NotificationReceived(await Friendships.AcceptInvitation(User.Id(), model.FriendId));

            await Notifications.SetDecisionAccepted(User.Id(), model.FriendId);

            await HubContext.Clients.Clients
                ((await SignalRService.GetUserConnections(model.FriendId))
                .Concat(await SignalRService.GetUserConnections(User.Id())).ToList())
            .RefreshChatList();

            return(Ok());
        }
Exemple #15
0
        public async Task <IActionResult> RemoveFriend([FromBody] FriendIdModel model)
        {
            if (!await Users.CheckIfExists(model.FriendId))
            {
                return(NotFound());
            }
            if (!await Friendships.CheckIfFriendshipExist(User.Id(), model.FriendId))
            {
                return(NotFound());
            }

            await Friendships.RemoveFriend(User.Id(), model.FriendId);

            await HubContext.Clients.Clients
                ((await SignalRService.GetUserConnections(model.FriendId))
                .Concat(await SignalRService.GetUserConnections(User.Id())).ToList())
            .RefreshChatList();

            return(Ok());
        }
Exemple #16
0
        public async Task <IActionResult> Invite([FromBody] FriendIdModel model)
        {
            if (model.FriendId == User.Id())
            {
                return(BadRequest("Nie można wysłać zaproszenia do siebie"));
            }
            if (!await Users.CheckIfExists(model.FriendId))
            {
                return(NotFound());
            }
            if (await Friendships.CheckIfFriendshipExist(User.Id(), model.FriendId))
            {
                return(BadRequest("Użytkownicy są już znajomymi."));
            }

            await HubContext.Clients.Clients(await SignalRService.GetUserConnections(model.FriendId))
            .NotificationReceived(await Friendships.InviteFriend(User.Id(), model.FriendId));

            return(Ok());
        }
        public int[] GetExtendedNetwork(int wordId)
        {
            // check wordId is valid
            if (wordId < 0 || wordId >= Words.Length)
            {
                throw new ArgumentOutOfRangeException("wordId");
            }
            // create processing queue for BFS
            Queue <int> queue = new Queue <int>();
            // create set to hold social network
            HashSet <int> extendedNetwork = new HashSet <int>();
            // placeholder for temporary peer lists
            HashSet <int> tmpPeers;

            // enqueue self
            queue.Enqueue(wordId);
            // iterate until queue is exhausted
            while (queue.Count > 0)
            {
                // get next word to process
                wordId = queue.Dequeue();
                // add to extended network
                extendedNetwork.Add(wordId);
                // get friends of this word
                if (Friendships.TryGetValues(wordId, out tmpPeers))
                {
                    // iterate friends of this word
                    foreach (int peer in tmpPeers)
                    {
                        // if not yet in extended network
                        if (!extendedNetwork.Contains(peer))
                        {
                            // enqueue
                            queue.Enqueue(peer);
                        }
                    }
                }
            }
            // return network as array
            return(extendedNetwork.ToArray());
        }
        public async Task <ActionResult <Friendships> > PostFriendships(Friendships friendships)
        {
            _context.Friendships.Add(friendships);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (FriendshipsExists(friendships.FriendshipId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetFriendships", new { id = friendships.FriendshipId }, friendships));
        }
        public void AcceptRequest(int requesterId, int recipientId)
        {
            var requester = db.UserSet.FirstOrDefault(r => r.Id == requesterId);
            var recipient = db.UserSet.FirstOrDefault(r => r.Id == recipientId);

            var request = db.FriendshipsSet
                          .Where(a => a.RequestAccepted == false)
                          .Where(f => f.User.Id == requester.Id)
                          .FirstOrDefault(f => f.Friend.Id == recipient.Id);

            request.RequestAccepted = true;

            var newFriendship = new Friendships
            {
                User            = recipient,
                Friend          = requester,
                RequestAccepted = true
            };

            db.FriendshipsSet.Add(newFriendship);
            db.SaveChanges();
        }
Exemple #20
0
        public string RemoveFriend(string token, int userId, int userToRemove)
        {
            string toRet = "OK";

            Token t = Token.Exists(token);

            if (t == null || !t.IsUser)
            {
                return("TokenERROR");
            }

            Friendships fr = this._database.Friendships.Where(f => (f.IdUser1 == userId && f.IdUser2 == userToRemove) || (f.IdUser1 == userToRemove && f.IdUser2 == userId)).FirstOrDefault();

            if (fr == null)
            {
                return("FriendshipDoesntExists");
            }
            else
            {
                this._database.Friendships.Remove(fr);
                this._database.SaveChanges();
                return("OK");
            }
        }
Exemple #21
0
 public Friendships.Outgoing.Result[] Outgoing(Friendships.Outgoing.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Outgoing.Command, Friendships.Outgoing.Result[]>(command);
 }
Exemple #22
0
 public String[] No_Retweets_Ids(Friendships.No_Retweets_Ids.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.No_Retweets_Ids.Command, String[]>(command);
 }
Exemple #23
0
 public Friendships.Lookup.Result[] Lookup(Friendships.Lookup.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Lookup.Command, Friendships.Lookup.Result[]>(command);
 }
Exemple #24
0
 public Friendships.Destroy.Result[] Destroy(Friendships.Destroy.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Destroy.Command, Friendships.Destroy.Result[]>(command);
 }
Exemple #25
0
		/// <summary>
		/// This is a sync request of \friendships\destroy rest call.
		///It returns JsonResponse&lt;Stream&gt;
		/// Here comes request Comments:
		///<para>取消对某用户的关注。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/destroy.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	POST/DELETE</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Stream> RequestFriendshipsDestroy(Friendships.DestroyRequest request)
		{
			return RequestFriendshipsDestroyAsync(request).Result;
		}
Exemple #26
0
 public async Task <IActionResult> GetUserFriends([FromQuery] InfiniteScroll scroll)
 {
     return(Ok(await Friendships.GetFriends(scroll, User.Id())));
 }
Exemple #27
0
		/// <summary>
		/// This is a sync request of \friendships\create rest call.
		///It returns JsonResponse&lt;Stream&gt;
		/// Here comes request Comments:
		///<para>关注一个用户。关注成功则返回关注人的资料,目前的最多关注2000人。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/create.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	POST</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Stream> RequestFriendshipsCreate(Friendships.CreateRequest request)
		{
			return RequestFriendshipsCreateAsync(request).Result;
		}
Exemple #28
0
 public Friendships.Incoming.Result Incoming(Friendships.Incoming.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Incoming.Command, Friendships.Incoming.Result>(command);
 }
Exemple #29
0
		/// <summary>
		/// This is a sync execution of \friendships\exists rest call. 
		/// It returns JsonResponse&lt;Friendships.ExistsResponse&gt;
		/// Here comes request Comments:
		///<para>查看用户A是否关注了用户B。如果用户A关注了用户B,则返回true,否则返回false。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/exists.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Friendships.ExistsResponse> ExecuteFriendshipsExists(Friendships.ExistsRequest request)
		{
			return ExecuteFriendshipsExistsAsync(request).Result;
		}
Exemple #30
0
		/// <summary>
		/// This is a sync request of \friendships\exists rest call.
		///It returns JsonResponse&lt;Stream&gt;
		/// Here comes request Comments:
		///<para>查看用户A是否关注了用户B。如果用户A关注了用户B,则返回true,否则返回false。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/exists.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Stream> RequestFriendshipsExists(Friendships.ExistsRequest request)
		{
			return RequestFriendshipsExistsAsync(request).Result;
		}
Exemple #31
0
		/// <summary>
		/// This is a async execution of \friendships\exists rest call. 
		/// It returns JsonResponse&lt;Friendships.ExistsResponse&gt;
		/// Here comes request Comments:
		///<para>查看用户A是否关注了用户B。如果用户A关注了用户B,则返回true,否则返回false。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/exists.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public async Task<JsonResponse<Friendships.ExistsResponse>> ExecuteFriendshipsExistsAsync (
			Friendships.ExistsRequest request,
			CancellationToken cancellationToken =default(CancellationToken),
			IProgress<ProgressReport> progress=null 
			)			
		{
			return await _executeFriendshipsExistsMethod.GetResponseAsync(request, cancellationToken, progress);
		}
Exemple #32
0
 public Friendships.Show.Result[] Show(Friendships.Show.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Show.Command, Friendships.Show.Result[]>(command);
 }
Exemple #33
0
        /// <summary>
        /// Goes through the GAME_MASTERs and collects the data we want to leverage for the PokeRef site.
        /// </summary>
        /// <param name="gameMaster"></param>
        /// <param name="legacyGameMasters"></param>
        private void CollectData(GameMasterTemplate gameMasterTemplate, IEnumerable <GameMasterTemplate> legacyGameMasterTemplates)
        {
            // Get a list of all of the GAME_MASTER files.
            CurrentGameMaster = gameMasterTemplate;
            GameMasters.Add(gameMasterTemplate.FileName, gameMasterTemplate.HaveRawGameMaster);
            foreach (var legacyGameMasterTemplate in legacyGameMasterTemplates)
            {
                GameMasters.Add(legacyGameMasterTemplate.FileName, legacyGameMasterTemplate.HaveRawGameMaster);
            }

            // Process the current GameMaster
            foreach (var itemTemplate in gameMasterTemplate.GameMaster.item_templates)
            {
                try
                {
                    if (itemTemplate.pokemon_settings != null)
                    {
                        PokemonTranslator pokemon = new PokemonTranslator(itemTemplate);
                        Pokemon.Add(pokemon.Key, pokemon);
                    }
                    else if (itemTemplate.move_settings != null)
                    {
                        MoveTranslator move = new MoveTranslator(itemTemplate);
                        PokeMoves.Add(move.Key, move);
                    }
                    else if (itemTemplate.gender_settings != null)
                    {
                        GenderRatioTranslator genderRatio = new GenderRatioTranslator(itemTemplate);

                        // Some Pokemon are duplicated and should be ignored. (E.G. Castform for each of the weathers.)
                        if (GenderRatios.ContainsKey(genderRatio.Key))
                        {
                            continue;
                        }

                        GenderRatios.Add(genderRatio.Key, genderRatio);
                    }
                    else if (itemTemplate.player_level != null)
                    {
                        PlayerLevel = new PlayerLevelTranslator(itemTemplate);
                    }
                    else if (itemTemplate.form_settings != null)
                    {
                        if (itemTemplate.form_settings.forms != null)
                        {
                            FormSettingsTranslator formSettings = new FormSettingsTranslator(itemTemplate);
                            Forms.Add(formSettings.Key, formSettings);
                        }
                    }
                    else if (itemTemplate.friendship_milestone_settings != null)
                    {
                        Friendships.Add(new FriendshipTranslator(itemTemplate));
                    }

                    #region Data I am currently not using.

                    //else if (itemTemplate.avatarCustomization != null)
                    //{
                    //}
                    //else if (itemTemplate.badgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.battleSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.camera != null)
                    //{
                    //}
                    //else if (itemTemplate.encounterSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymBadgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymLevel != null)
                    //{
                    //}
                    //else if (itemTemplate.iapItemDisplay != null)
                    //{
                    //}
                    //else if (itemTemplate.iapSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.itemSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.moveSequenceSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.pokemonUpgrades != null)
                    //{
                    //}
                    //else if (itemTemplate.questSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.typeEffective != null)
                    //{
                    //}

                    #endregion Data I am currently not using.
                }
                catch (Exception ex)
                {
                    ConsoleOutput.OutputException(ex, $"Error processing {itemTemplate.template_id} ({gameMasterTemplate.FileName})");
                }
            }

            Legacy.Initialize(gameMasterTemplate, legacyGameMasterTemplates, ManualDataSettings.PokemonAvailability, ManualDataSettings.SpecialMoves);
            foreach (var pokemon in Pokemon.Values)
            {
                pokemon.AssignProperties(Pokemon,
                                         GenderRatios.ContainsKey(pokemon.PokemonSettings.pokemon_id) ? GenderRatios[pokemon.PokemonSettings.pokemon_id] : null,
                                         Legacy.FastMoves.ContainsKey(pokemon.TemplateId) ? Legacy.FastMoves[pokemon.TemplateId] : null,
                                         Legacy.ChargedMoves.ContainsKey(pokemon.TemplateId) ? Legacy.ChargedMoves[pokemon.TemplateId] : null);
            }
        }
Exemple #34
0
 public Friendships.Update.Result[] Update(Friendships.Update.Command command)
 {
     return _ApiEndpoints._Client.GetResult<Friendships.Update.Command, Friendships.Update.Result[]>(command);
 }
Exemple #35
0
		/// <summary>
		/// This is a async request of \friendships\show rest call. 
		///It returns JsonResponse&lt;Stream&gt;
		/// Here comes request Comments:
		///<para>返回两个用户关注关系的详细情况 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/show.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public async Task<JsonResponse<Stream>> RequestFriendshipsShowAsync (
			Friendships.ShowRequest request,
			CancellationToken cancellationToken =default(CancellationToken),
			IProgress<ProgressReport> progress=null 
			)			
		{
			return await _requestFriendshipsShowMethod.GetResponseAsync(request, cancellationToken, progress);
		}
Exemple #36
0
		/// <summary>
		/// This is a sync execution of \friendships\show rest call. 
		/// It returns JsonResponse&lt;Friendships.ShowResponse&gt;
		/// Here comes request Comments:
		///<para>返回两个用户关注关系的详细情况 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/show.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Friendships.ShowResponse> ExecuteFriendshipsShow(Friendships.ShowRequest request)
		{
			return ExecuteFriendshipsShowAsync(request).Result;
		}
Exemple #37
0
 public async Task <IActionResult> GetUserFriends(long userId, [FromQuery] Pager pager)
 {
     return(Ok(await Friendships.GetPaginatedList(pager, userId)));
 }
Exemple #38
0
		/// <summary>
		/// This is a sync execution of \friendships\create rest call. 
		/// It returns JsonResponse&lt;Friendships.CreateResponse&gt;
		/// Here comes request Comments:
		///<para>关注一个用户。关注成功则返回关注人的资料,目前的最多关注2000人。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/create.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	POST</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Friendships.CreateResponse> ExecuteFriendshipsCreate(Friendships.CreateRequest request)
		{
			return ExecuteFriendshipsCreateAsync(request).Result;
		}
Exemple #39
0
		/// <summary>
		/// This is a sync request of \friendships\show rest call.
		///It returns JsonResponse&lt;Stream&gt;
		/// Here comes request Comments:
		///<para>返回两个用户关注关系的详细情况 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/show.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	GET</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Stream> RequestFriendshipsShow(Friendships.ShowRequest request)
		{
			return RequestFriendshipsShowAsync(request).Result;
		}
Exemple #40
0
 public override string ToString()
 {
     return($"{Name}, {nameof(Weapons)}: {Weapons.Humanize()}, {nameof(Friendships)}: {Friendships.Humanize()}");
 }
Exemple #41
0
		/// <summary>
		/// This is a sync execution of \friendships\destroy rest call. 
		/// It returns JsonResponse&lt;Friendships.DestroyResponse&gt;
		/// Here comes request Comments:
		///<para>取消对某用户的关注。 </para>
		///<para>URL:</para>
		///<para>	http://api.t.sina.com.cn/friendships/destroy.(json|xml)</para>
		///<para>支持格式:</para>
		///<para>	XML/JSON</para>
		///<para>HTTP请求方式:</para>
		///<para>	POST/DELETE</para>
		///<para>是否需要登录:</para>
		///<para>	true  关于授权机制,参见授权机制声明</para>
		///<para>请求数限制:</para>
		///<para>	true  关于请求数限制,参见接口访问权限说明</para>
		///<para></para>
		/// </summary>
		public JsonResponse<Friendships.DestroyResponse> ExecuteFriendshipsDestroy(Friendships.DestroyRequest request)
		{
			return ExecuteFriendshipsDestroyAsync(request).Result;
		}