private BaseResponse HandleGetMyTagCount(DynamicDictionary _parameters) { User user; BaseResponse response; if (AuthHelper.IsAuthorized(Request, out user)) { HydrantWikiManager hwm = new HydrantWikiManager(); int count = hwm.GetTagCount(user.Guid); response = new TagCountResponse(true, count); hwm.LogInfo(user.Guid, "Retrieved My Tag Count"); } else { LogUnauthorized(Request); response = new BaseResponse { Success = false, Error = "Unauthorized", Message = "Reauthenticate" }; } return(response); }
/// <summary> /// Returns the number of tags that the current user has made /// </summary> /// <returns>The my tag count.</returns> /// <param name="_user">User.</param> public TagCountResponse GetMyTagCount(User _user) { HWRestRequest request = new HWRestRequest(); request.Method = HWRestMethods.Get; request.Host = m_HWManager.PlatformManager.ApiHost; request.Path = "/api/tags/mine/count"; request.Headers.Add("Username", _user.Username); request.Headers.Add("AuthorizationToken", _user.AuthorizationToken); var response = m_HWManager.PlatformManager.SendRestRequest(request); TagCountResponse responseObject = JsonConvert.DeserializeObject <TagCountResponse>(response.Body); return(responseObject); }