public void CreateTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = GroupsApi.Create(accessToken, "测试组"); Assert.IsNotNull(result); Assert.IsTrue(result.group.id >= 100); }
public void UpdateTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = GroupsApi.Update(accessToken, 100, "测试组更新"); Assert.IsNotNull(result); Assert.IsTrue(result.errcode == ReturnCode.请求成功); }
public void GetTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = GroupsApi.Get(accessToken); Assert.IsNotNull(result); Assert.IsTrue(result.groups.Count >= 3); }
public void GetIdTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = GroupsApi.GetId(accessToken, _testOpenId); Assert.IsNotNull(result); Assert.IsTrue(result.groupid >= 0); }
//同步 protected void btnSyn_Click(object sender, EventArgs e) { string err = ""; Model.wx_userweixin weixin = GetWeiXinCode(); string accessToken = WeiXinCRMComm.getAccessToken(weixin.id, out err); if (err != "") { return; } GroupsJson gJson = GroupsApi.Get(accessToken); List <GroupsJson_Group> gjg = gJson.groups; #region 将数据插入到数据库里 BLL.wx_crm_group gBll = new BLL.wx_crm_group(); Model.wx_crm_group group = new Model.wx_crm_group(); try { gBll.DeleteByWid(weixin.id); int ttCount = gjg.Count; int insertCount = 0; for (int i = 0; i < gjg.Count; i++) { group.id = gjg[i].id; group.name = gjg[i].name; group.count = gjg[i].count; group.wid = weixin.id; bool succ = gBll.Add(group); if (succ) { insertCount++; } } if (ttCount == insertCount) { //将此次同步的日期更新到设置表里 BLL.wx_crm_setting setBll = new BLL.wx_crm_setting(); setBll.UpdateGroupSysDate(weixin.id, ttCount, DateTime.Now); JscriptMsg("分组同步成功!", "group_list.aspx", "Success"); } else { JscriptMsg("分组同步失败!", "", "Error"); return; } } catch (Exception ex) { JscriptMsg("分组同步失败!" + ex.Message, "", "Error"); return; } #endregion }
public void GroupInviteShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <GroupResponse>("/groups.invite?channel=foo&user=uid"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Invite("foo", "uid"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupHistoryShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <MessagesResponse>("/groups.history?channel=foo&inclusive=0&count=44"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.History("foo", messageCount: 44); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupCreateChildShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <GroupResponse>("/groups.createChild?channel=GROUPID"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.CreateChild("GROUPID"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupCreateShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <GroupResponse>("/groups.create?name=foo"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Create("foo"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupUnarchiveShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <ResponseBase>("/groups.unarchive?channel=foo"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Unarchive("foo"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupSetTopicShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <TopicResponse>("/groups.setTopic?channel=foo&topic=hello"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.SetTopic("foo", "hello"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupMarkShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <ResponseBase>("/groups.mark?channel=GROUPID&ts=1111.2222"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Mark("GROUPID", "1111.2222"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupListShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <GroupsResponse>("/groups.list?exclude_archived=0"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.List(); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupArchiveShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<ResponseBase>("/groups.archive?channel=GROUPID"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Archive("GROUPID"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupCreateChildShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<GroupResponse>("/groups.createChild?channel=GROUPID"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.CreateChild("GROUPID"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupCreateShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<GroupResponse>("/groups.create?name=foo"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Create("foo"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupKickShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock <ResponseBase>("/groups.kick?channel=GROUPID&user=UID"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Kick("GROUPID", "UID"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupHistoryShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<MessagesResponse>("/groups.history?channel=foo&inclusive=0&count=44"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.History("foo", messageCount: 44); requestHandlerMock.Verify(); Assert.NotNull(result); }
public IndiebackendAPI(string appId) { _http = new HttpUtils(Constants.API_GATEWAY, appId); // HTTP Services initialization Players = new PlayersApi(_http); Profiles = new ProfilesApi(_http); Groups = new GroupsApi(_http); Stats = new StatsApi(_http); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sendCountTxt = Server.MapPath("sendcount.txt"); try { ddlSendCount.SelectedValue = File.ReadAllText(sendCountTxt); } catch { File.WriteAllText(sendCountTxt, "6"); ddlSendCount.SelectedValue = "6"; } for (int i = 0; i < 23; i++) { ddlHour.Items.Add( new ListItem(i.ToString() + "点", i.ToString()) ); } for (int i = 0; i < 60; i++) { ddlMinute.Items.Add( new ListItem(i.ToString() + "分", i.ToString()) ); } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("quartz_jobs.xml")); XmlNodeList elemList = xmlDoc.GetElementsByTagName("cron-expression"); var node = elemList[0]; string[] cronList = node.InnerText.Split(' ');//0 1 9 ? * TUE ddlMinute.SelectedValue = cronList[1]; ddlHour.SelectedValue = cronList[2]; txtResult.Text = OracleHelper.CanConnect(); if (txtResult.Text != "连接成功") { var accessToken = AccessTokenContainer.TryGetToken(WebConfigurationManager.AppSettings["LongNameAppId"], WebConfigurationManager.AppSettings["LongNameAppSecret"]); var json = GroupsApi.Get(accessToken); var groupId = json.groups.Find(p => p.name == "开发小组").id.ToString(); var content = " oracle数据库无法连接 异常信息为" + txtResult.Text; var sendResult = GroupMessageApi.SendTextGroupMessageByGroupId(accessToken, groupId, content, false); } } }
public void MemberUpdateTest() { //var accessToken = AccessTokenContainer.GetAccessToken(_appId); var idArr = new[] { 0, 1, 2, 100, 0 }; foreach (var id in idArr) { var result = GroupsApi.MemberUpdate(_appId, _appSecret, _testOpenId, id); Assert.IsNotNull(result); Assert.IsTrue(result.errcode == ReturnCode.请求成功); var newGroupIdResult = GroupsApi.GetId(_appId, _appSecret, _testOpenId); Assert.AreEqual(id, newGroupIdResult.groupid); } }
/// <summary> /// Gets the DocuSign permission profiles and groups /// </summary> /// <param name="accessToken">Access Token for API call (OAuth)</param> /// <param name="basePath">BasePath for API calls (URI)</param> /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param> /// <returns>The tuple with DocuSign permission profiles and groups information</returns> public static (PermissionProfileInformation, GroupInformation) GetPermissionProfilesAndGroups( string accessToken, string basePath, string accountId) { var apiClient = new eSign.Client.ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var accountsApi = new AccountsApi(apiClient); var permissionProfiles = accountsApi.ListPermissions(accountId); var dsGroupsApi = new GroupsApi(apiClient); var groups = dsGroupsApi.ListGroups(accountId); return(permissionProfiles, groups); }
/// <summary> /// Get members of a group. /// </summary> /// <param name="group"></param> /// <param name="api"></param> /// <returns></returns> private static List <User> GetGroupMembers(GroupsSearchResponse group, GroupsApi api) { // The list that will contain group members List <User> members = new List <User>(); foreach (var grp in group.Results) { // API call to get members UserEntityListing result = api.GetGroupMembers(grp.Id, 25, null, "ASC", null); // Add the members to the list members = result.Entities; } return(members); }
protected void btnSendMessage_Click(object sender, EventArgs e) { //获取 accessToken var accessToken = AccessTokenContainer.TryGetToken(WebConfigurationManager.AppSettings["LongNameAppId"], WebConfigurationManager.AppSettings["LongNameAppSecret"]); OpenIdResultJson json = UserApi.Get(accessToken, ""); txtResult.Text += json.count; foreach (var item in json.data.openid) { var userinfo = UserApi.Info(accessToken, item); txtResult.Text += item + " : " + userinfo.nickname + " " + userinfo.sex.ToString() + " "; } var result = GroupsApi.Get(accessToken); List <GroupsJson_Group> list = result.groups; string content = "文本内容<a href='http://www.baidu.com'>百度</a>"; string groupId = "100";//分组Id var dataSevice = new DataAccessSerive(); var jobList = dataSevice.GetTopJobInfoList(); if (jobList.Count > 0) { List <Article> articles = new List <Article>(); int i = 0; foreach (var job in jobList) { string imgUrl = string.Format("{0}/image/{1}.jpg", WebConfigurationManager.AppSettings["domain"], i); var art1 = new Article() { Title = job.ComName + "诚聘" + job.JobName, Url = WebConfigurationManager.AppSettings["domain"] + "/html/detail.html?id=" + job.JobId, PicUrl = imgUrl, Description = "" }; articles.Add(art1); i++; } var rest = Senparc.Weixin.MP.AdvancedAPIs.Custom.CustomApi.SendNews(accessToken, "oJvzIt8go_mNhCAVE-M0D5EexLpU", articles); } }
////[SupportFilter(ActionName = "Index")] public JsonResult GetNetList() { WC_OfficalAccounts model = account_BLL.GetCurrentAccount(); GroupsJson groupjson = GroupsApi.Get(model.AccessToken); foreach (var item in groupjson.groups) { WC_Group entity = new WC_Group(); if (m_BLL.m_Rep.Find(item.id) == null) { entity.Name = item.name; entity.Count = item.count.ToString(); entity.OfficalAccountId = model.Id.ToString(); m_BLL.m_Rep.Create(entity); } } return(Json(JsonHandler.CreateMessage(1, "获取成功"))); }
public JsonResult GetNetList() { WC_OfficalAccountsModel model = account_BLL.GetCurrentAccount(); GroupsJson groupjson = GroupsApi.Get(model.AccessToken); foreach (var item in groupjson.groups) { WC_GroupModel entity = new WC_GroupModel(); if (m_BLL.GetById(item.id.ToString()) == null) { entity.Id = item.id.ToString(); entity.Name = item.name; entity.Count = item.count; entity.OfficalAccountId = model.Id; m_BLL.Create(ref errors, entity); } } return(Json(JsonHandler.CreateMessage(1, "获取成功"))); }
static void Main(string[] args) { // OAuth input Console.Write("Enter Client ID: "); string clientId = Console.ReadLine(); Console.Write("Enter Client Secret: "); string clientSecret = Console.ReadLine(); // Group name to get members from Console.Write("Enter Group Name: "); string groupName = Console.ReadLine(); // Configure SDK Settings string accessToken = GetToken(clientId, clientSecret); PureCloudPlatform.Client.V2.Client.Configuration.Default.AccessToken = accessToken; // Instantiate APIs GroupsApi groupsApi = new GroupsApi(); // Get the group using the group name GroupsSearchResponse theGroup = GetGroup(groupName, groupsApi); // Get members of the group List <User> users = GetGroupMembers(theGroup, groupsApi); // Build the notification handler NotificationHandler handler = new NotificationHandler(); // Subscribe the notifiaciton handler to the presence of group members SubscribeToUserGroupPresence(users, handler); // Display to confirm websocket client is listening Console.WriteLine("Websocket connected, awaiting messages..."); if (Debugger.IsAttached) { Console.ReadKey(); } }
/// <summary> /// Creates a client to work with VK API methods. /// </summary> public CitrinaClient() { AuthHelper = new AuthHelper(); Execute = new ExecuteApi(); Account = new AccountApi(); Ads = new AdsApi(); Apps = new AppsApi(); Auth = new AuthApi(); Board = new BoardApi(); Database = new DatabaseApi(); Docs = new DocsApi(); Fave = new FaveApi(); Friends = new FriendsApi(); Gifts = new GiftsApi(); Groups = new GroupsApi(); Leads = new LeadsApi(); Likes = new LikesApi(); Market = new MarketApi(); Messages = new MessagesApi(); Newsfeed = new NewsfeedApi(); Notes = new NotesApi(); Notifications = new NotificationsApi(); Orders = new OrdersApi(); Pages = new PagesApi(); Photos = new PhotosApi(); Places = new PlacesApi(); Polls = new PollsApi(); Search = new SearchApi(); Secure = new SecureApi(); Stats = new StatsApi(); Status = new StatusApi(); Storage = new StorageApi(); Users = new UsersApi(); Utils = new UtilsApi(); Video = new VideoApi(); Wall = new WallApi(); Widgets = new WidgetsApi(); }
/// <summary> /// Search and Get a PureCloud group using its name or id. /// </summary> /// <param name="name"></param> /// <param name="api"></param> /// <returns></returns> private static GroupsSearchResponse GetGroup(string name, GroupsApi api) { // Search criteria is group name with exact value GroupSearchCriteria criteria = new GroupSearchCriteria(Value: name, _Operator: GroupSearchCriteria.OperatorEnum.And, Fields: (new List <string> { "name" }), Type: GroupSearchCriteria.TypeEnum.Exact); // Add criteria to Group Search Criteria List List <GroupSearchCriteria> groupSearchCriteriaList = new List <GroupSearchCriteria>(); groupSearchCriteriaList.Add(criteria); // Build list of Group Search Criteria GroupSearchRequest request = new GroupSearchRequest(); request.Query = groupSearchCriteriaList; return(api.PostGroupsSearch(request)); }
public async Task <ActionResult> BindingUser(LoginModel model, string weChatSessionID) { if (ModelState.IsValid) { if (userService.ValidateUser(model.UserName, model.Password)) { string openId = encryptionService.Decrypt(weChatSessionID, appSecret); await AccessTokenContainer.RegisterAsync(appId, appSecret); var memberToGroupResult = GroupsApi.MemberUpdate(appId, openId, 100); if (memberToGroupResult.errcode == 0) { User user = userService.GetUser(model.UserName); user.WeChatOpenID = openId; userService.UpdateUser(user); return(View("MessagePage", new MessagePageModel { Title = "绑定成功", Message = "您已成功绑定零度云账号。" })); } else { ModelState.AddModelError(string.Empty, "指定用户分组失败"); } } else { ModelState.AddModelError(string.Empty, Resources.InvalidUserNameOrPassword); } } ViewBag.WeChatSessionID = weChatSessionID; return(View("BindingUserLogin", model)); }
/// <summary> /// Sets permission to the user group /// </summary> /// <param name="permissionProfileId">Permission profile id</param> /// <param name="userGroupId">User group id</param> /// <param name="accessToken">Access Token for API call (OAuth)</param> /// <param name="basePath">BasePath for API calls (URI)</param> /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param> /// <returns>A group information</returns> public static GroupInformation GetGroupInformation(string permissionProfileId, string userGroupId, string accessToken, string basePath, string accountId) { // Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); var groupsApi = new GroupsApi(apiClient); // Construct your request body var editedGroup = new Group { GroupId = userGroupId, PermissionProfileId = permissionProfileId }; var requestBody = new GroupInformation { Groups = new List <Group> { editedGroup } }; // Call the eSignature REST API return(groupsApi.UpdateGroups(accountId, requestBody)); }
public void GroupInviteShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<GroupResponse>("/groups.invite?channel=foo&user=uid"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Invite("foo", "uid"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void Init() { instance = new GroupsApi(); }
public OrganizationsApi(IBitmovinApiClientFactory apiClientFactory) { _apiClient = apiClientFactory.CreateClient <IOrganizationsApiClient>(); SubOrganizations = new SubOrganizationsApi(apiClientFactory); Groups = new GroupsApi(apiClientFactory); }
/// <summary> /// 同步一个用户信息,如果库里存在,则修改,不存在,则新增 /// </summary> /// <param name="userDetail"></param> private int InsertUserInfo(string wxid, string accessToken, List <string> openidStr, DateTime updateTime) { int totCount = 0; // 将数据插入到数据库里 UsersEntity uEntity = new UsersEntity(); try { UserInfoJson userDetail = new UserInfoJson(); for (int i = 0; i < openidStr.Count; i++) { userDetail = UserApi.Info(accessToken, openidStr[i]); uEntity = app.GetForm(openidStr[i]); bool isAdd = true; if (uEntity == null) { isAdd = true; uEntity = new UsersEntity(); } else { isAdd = false; } uEntity.OpenId = openidStr[i]; uEntity.Nickname = userDetail.nickname; uEntity.Sex = userDetail.sex.ToString(); uEntity.City = userDetail.city; uEntity.Country = userDetail.country; uEntity.Province = userDetail.province; uEntity.Language = userDetail.language; uEntity.HeadImgUrl = userDetail.headimgurl; uEntity.SubscribeTime = userDetail.subscribe_time.ToString(); uEntity.WeixinId = wxid; uEntity.UpdateDate = updateTime; uEntity.Status = 1; //查询分组号 GetGroupIdResult gid = GroupsApi.GetId(accessToken, openidStr[i]); uEntity.GroupId = gid.groupid; if (isAdd) { //新增 uEntity.CreateDate = DateTime.Now; app.SubmitForm(uEntity, string.Empty); totCount++; } else { //修改 app.SubmitForm(uEntity, uEntity.OpenId); totCount++; } } return(totCount); } catch (Exception ex) { throw new Exception("用户信息同步失败!" + ex.Message); } }
public void GroupListShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<GroupsResponse>("/groups.list?exclude_archived=0"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.List(); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupMarkShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<ResponseBase>("/groups.mark?channel=GROUPID&ts=1111.2222"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.Mark("GROUPID", "1111.2222"); requestHandlerMock.Verify(); Assert.NotNull(result); }
public void GroupSetTopicShouldCallCorrectEndpoint() { var requestHandlerMock = PathAndExecRequestMock<TopicResponse>("/groups.setTopic?channel=foo&topic=hello"); var subject = new GroupsApi(requestHandlerMock.Object); var result = subject.SetTopic("foo", "hello"); requestHandlerMock.Verify(); Assert.NotNull(result); }