Exemplo n.º 1
0
        public WeixinResult Update()
        {
            string url = WeCorpUtil.GetCorpUrl(WeCorpConst.UPDATE_DEPARTMENT,
                                               WeixinSettings.Current.CorpUserManagerSecret);

            return(WeUtil.PostToUri(url, this.WriteJson(WeConst.WRITE_SETTINGS), new WeixinResult()));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        internal static CorpDepartmentCollection GetDepartmentList()
        {
            string url = WeCorpUtil.GetCorpUrl(WeCorpConst.QUERY_DEPARTMENT,
                                               WeixinSettings.Current.CorpUserManagerSecret);
            CorpDepartmentCollection collection = WeUtil.GetFromUri <CorpDepartmentCollection>(url);

            return(collection);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        internal static CorpTagList GetTagList()
        {
            string url = WeCorpUtil.GetCorpUrl(WeCorpConst.QUERY_TAG,
                                               WeixinSettings.Current.CorpUserManagerSecret);
            CorpTagList list = WeUtil.GetFromUri(url, new CorpTagList());

            return(list);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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()));
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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));
        }
Exemplo n.º 17
0
        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));
        }
Exemplo n.º 18
0
        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);
        }