public WeThirdPartyCorpTokenResponse get_corp_token() { string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.CORP_TOKEN, WeixinSettings.Current.CorpUserManagerSecret); var result = WeUtil.PostDataToUri(url, this.WriteJson(), new WeThirdPartyCorpTokenResponse()); return(result); }
public WeixinResult Update() { string url = WeCorpUtil.GetCorpUrl(WeCorpConst.UPDATE_DEPARTMENT, WeixinSettings.Current.CorpUserManagerSecret); return(WeUtil.PostToUri(url, this.WriteJson(WeConst.WRITE_SETTINGS), new WeixinResult())); }
public WeThirdPartyGetAgentResponse get_agent() { string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.GET_AGENT, WeixinSettings.Current.CorpUserManagerSecret); var result = WeUtil.PostToUri(url, this.WriteJson(), new WeThirdPartyGetAgentResponse()); return(result); }
public WeThirdPartyAuthInfosResponse get_auth_info() { string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.AUTH_INFO, WeixinSettings.Current.CorpUserManagerSecret); var result = WeUtil.PostDataToUri(url, this.WriteJson(), new WeThirdPartyAuthInfosResponse()); return(result); }
internal static CorpTagList GetTagList() { string url = WeCorpUtil.GetCorpUrl(WeCorpConst.QUERY_TAG, WeixinSettings.Current.CorpUserManagerSecret); CorpTagList list = WeUtil.GetFromUri(url, new CorpTagList()); return(list); }
internal static CorpDepartmentCollection GetDepartmentList() { string url = WeCorpUtil.GetCorpUrl(WeCorpConst.QUERY_DEPARTMENT, WeixinSettings.Current.CorpUserManagerSecret); CorpDepartmentCollection collection = WeUtil.GetFromUri <CorpDepartmentCollection>(url); return(collection); }
public static List <CorpAppSimpleInfo> GetAppList() { string url = WeCorpUtil.GetCorpUrl(WeCorpConst.AGENT_LIST, WeixinSettings.Current.CorpUserManagerSecret); var list = WeUtil.GetFromUri(url, new CorpAppList()); return(list.AgentList); }
public WeixinResult Update() { string url = WeCorpUtil.GetCorpUrl(WeCorpConst.AGENT_SET, WeixinSettings.Current.CorpUserManagerSecret); CorpAppUpdateInfo updateInfo = new CorpAppUpdateInfo(this); WeixinResult result = WeUtil.PostToUri(url, updateInfo.WriteJson(), new WeixinResult()); return(result); }
public static MpNewsArticle CreateArticle(string title, string content, int appId, string path) { TkDebug.AssertArgumentNullOrEmpty(path, "path", null); string secret = WeixinSettings.Current.GetCorpSecret(appId); MediaId media = WeCorpUtil.UploadFile(secret, MediaType.Image, path); return(new MpNewsArticle(title, media.Id, content)); }
public static WeixinResult BatchDelete(IEnumerable <string> userIds) { TkDebug.AssertArgumentNull(userIds, "userIds", null); CorpUserIdList id = new CorpUserIdList(userIds); string url = WeCorpUtil.GetCorpUrl(WeCorpConst.BATCH_DELETE_USER, WeixinSettings.Current.CorpUserManagerSecret); return(WeUtil.PostToUri(url, id.WriteJson(WeConst.WRITE_SETTINGS), new WeixinResult())); }
public CorpMessageResult Send(int appId) { AgentId = appId; string secret = WeixinSettings.Current.GetCorpSecret(appId); string url = WeCorpUtil.GetCorpUrl(WeCorpConst.MESSAGE_URL, secret); CorpMessageResult result = new CorpMessageResult(); result = WeUtil.PostToUri(url, ToJson(), result); return(result); }
public static WeThirdPartyPermanentCodeResponse get_permanent_code(string authCode) { TkDebug.AssertArgumentNullOrEmpty(authCode, "authCode", null); string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.PERMANENT_CODE, WeixinSettings.Current.CorpUserManagerSecret); WeThirdPartyPermanentCodeRequest request = new WeThirdPartyPermanentCodeRequest(authCode); var result = WeUtil.PostDataToUri(url, request.WriteJson(), new WeThirdPartyPermanentCodeResponse()); return(result); }
public static string get_pre_auth_code(params string[] ids) { TkDebug.AssertArgumentNull(ids, "ids", null); string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.PRE_AUTH_CODE, WeixinSettings.Current.CorpUserManagerSecret); WeThirdPartyPreAuthCodeRequest request = new WeThirdPartyPreAuthCodeRequest(ids); var result = WeUtil.PostToUri(url, request.WriteJson(), new WeThirdPartyPreAuthCodeResponse()); return(result.PreAuthCode); }
public static string get_suite_token(string suiteTicket) { TkDebug.AssertArgumentNullOrEmpty(suiteTicket, "suiteTicket", null); string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.SUITE_TOKEN, WeixinSettings.Current.CorpUserManagerSecret); WeThirdPartySuiteTokenRequest request = new WeThirdPartySuiteTokenRequest(suiteTicket); var result = WeUtil.PostDataToUri(url, request.WriteJson(), new WeThirdPartySuiteTokenResponse()); return(result.SuiteAccessToken); }
public static WeixinResult set_agent(string authCorpid, string permanentCode, WeThirdPartyAgentSet agent) { TkDebug.AssertArgumentNullOrEmpty(authCorpid, "authCorpid", null); TkDebug.AssertArgumentNullOrEmpty(permanentCode, "permanentCode", null); TkDebug.AssertArgumentNull(agent, "agent", null); string url = WeCorpUtil.GetCorpUrl(WeThirdPartyConst.SET_AGENT, WeixinSettings.Current.CorpUserManagerSecret); WeThirdPartySetAgentRequest request = new WeThirdPartySetAgentRequest(authCorpid, permanentCode, agent); var result = WeUtil.PostToUri(url, request.WriteJson(), new WeixinResult()); return(result); }
public ReceiveMessage CreateCorpReceiveMessage(string msgSignature, string timeStamp, string nonce) { var xml = WeCorpUtil.DecryptMsg(this, msgSignature, timeStamp, nonce); if (string.IsNullOrEmpty(xml)) { return(null); } return(CreateReceiveMessage(xml)); }
public static CorpTag Create(string name) { TkDebug.AssertArgumentNullOrEmpty(name, "name", null); CorpTag data = new CorpTag { Name = name }; string url = WeCorpUtil.GetCorpUrl(WeCorpConst.CREATE_TAG, WeixinSettings.Current.CorpUserManagerSecret); return(WeUtil.PostToUri(url, data.WriteJson(WeConst.WRITE_SETTINGS), data)); }
public CorpTagUserResult RemoveMembers(IEnumerable <string> userList, IEnumerable <int> partyList) { TkDebug.AssertArgument(userList != null || partyList != null, "userList", "参数userList或者partyList不能全为空", this); CorpPostTagUser postData = new CorpPostTagUser(Id, userList, partyList); string url = WeCorpUtil.GetCorpUrl(WeCorpConst.REMOVE_TAG_USER, WeixinSettings.Current.CorpUserManagerSecret); CorpTagUserResult result = WeUtil.PostToUri(url, postData.WriteJson(WeConst.WRITE_SETTINGS), new CorpTagUserResult()); return(result); }
public static InviteType Invite(string userId, string tips) { TkDebug.AssertArgumentNullOrEmpty(userId, "userId", null); TkDebug.AssertArgumentNullOrEmpty(tips, "tips", null); CorpInviteRequest request = new CorpInviteRequest(userId) { InviteTips = tips }; string url = WeCorpUtil.GetCorpUrl(WeCorpConst.INVITE_SEND, WeixinSettings.Current.CorpUserManagerSecret); var result = WeUtil.PostToUri(url, request.WriteJson(), new CorpInviteResult()); return(result.Type); }
public static CorpDepartment Create(int parentId, string name, int order) { TkDebug.AssertArgumentNullOrEmpty(name, "name", null); CorpDepartment data = new CorpDepartment { Name = name, ParentId = parentId, Order = order }; string url = WeCorpUtil.GetCorpUrl(WeCorpConst.CREATE_DEPARTMENT, WeixinSettings.Current.CorpUserManagerSecret); return(WeUtil.PostToUri(url, data.WriteJson(WeConst.WRITE_SETTINGS), data)); }
public MediaId GetWeCorpMediaId(string secret, MediaType type, string path) { DataRow row = TrySelectRowWithKeys(type.ToString(), path); if (row == null) { SetCommands(AdapterCommand.Insert); MediaId mediaId = WeCorpUtil.UploadFile(secret, type, path); row = NewRow(); row.BeginEdit(); row["MediaType"] = type.ToString(); row["MediaKey"] = path; SetMediaRow(row, mediaId); row["CorpSecret"] = secret; row.EndEdit(); UpdateDatabase(); return(mediaId); } else { DateTime validDate = row["ValidDate"].Value <DateTime>(); if (validDate > DateTime.Now) { return(new MediaId(row["MediaId"].ToString())); } else { SetCommands(AdapterCommand.Update); MediaId mediaId = WeCorpUtil.UploadFile(secret, type, path); row.BeginEdit(); SetMediaRow(row, mediaId); row.EndEdit(); UpdateDatabase(); return(mediaId); } } }
public static WeixinResult DeleteCorpMenu(int appId) { string url = WeCorpUtil.GetCorpMenuUrl(WeCorpConst.DELETE_MENU, appId); return(WeUtil.GetFromUri <WeixinResult>(url)); }
public static WeMenu QueryCorpMenu(int appId) { string url = WeCorpUtil.GetCorpMenuUrl(WeCorpConst.QUERY_MENU, appId); return(InternalQueryMenu(url)); }
public WeixinResult CreateCorpMenu(int appId) { string url = WeCorpUtil.GetCorpMenuUrl(WeCorpConst.CREATE_MENU, appId); return(InternalCreateMenu(url)); }