@Test public void testInvite() { Invitation invitation = Users.defaultUsers().invite("smooth"); Assert.assertNotNull(invitation); }
@Deprecated public Invitation invite(String uid) { String url = WxEndpoint.get("url.user.invite"); String json = "{\"userid\":\"%s\"}"; logger.debug("invite user: {}", String.format(json, uid)); try { String response = wxClient.post(url, String.format(json, uid)); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("type")) { return Invitation.format(Integer.valueOf(result.get("type").toString())); } else { return Invitation.FAILED; } } catch (Exception e) { if (e instanceof WxRuntimeException) { WxRuntimeException wxRuntimeException = (WxRuntimeException) e; if (60119 == wxRuntimeException.getCode()) { return Invitation.ALREADY_FOLLOWED; } if (45025 == wxRuntimeException.getCode()) { return Invitation.ALREADY_INVITED; } } return Invitation.FAILED; } }
Users { @Deprecated public Invitation invite(String uid) { String url = WxEndpoint.get("url.user.invite"); String json = "{\"userid\":\"%s\"}"; logger.debug("invite user: {}", String.format(json, uid)); try { String response = wxClient.post(url, String.format(json, uid)); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("type")) { return Invitation.format(Integer.valueOf(result.get("type").toString())); } else { return Invitation.FAILED; } } catch (Exception e) { if (e instanceof WxRuntimeException) { WxRuntimeException wxRuntimeException = (WxRuntimeException) e; if (60119 == wxRuntimeException.getCode()) { return Invitation.ALREADY_FOLLOWED; } if (45025 == wxRuntimeException.getCode()) { return Invitation.ALREADY_INVITED; } } return Invitation.FAILED; } } }
Users { @Deprecated public Invitation invite(String uid) { String url = WxEndpoint.get("url.user.invite"); String json = "{\"userid\":\"%s\"}"; logger.debug("invite user: {}", String.format(json, uid)); try { String response = wxClient.post(url, String.format(json, uid)); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("type")) { return Invitation.format(Integer.valueOf(result.get("type").toString())); } else { return Invitation.FAILED; } } catch (Exception e) { if (e instanceof WxRuntimeException) { WxRuntimeException wxRuntimeException = (WxRuntimeException) e; if (60119 == wxRuntimeException.getCode()) { return Invitation.ALREADY_FOLLOWED; } if (45025 == wxRuntimeException.getCode()) { return Invitation.ALREADY_INVITED; } } return Invitation.FAILED; } }  }
Users { @Deprecated public Invitation invite(String uid) { String url = WxEndpoint.get("url.user.invite"); String json = "{\"userid\":\"%s\"}"; logger.debug("invite user: {}", String.format(json, uid)); try { String response = wxClient.post(url, String.format(json, uid)); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("type")) { return Invitation.format(Integer.valueOf(result.get("type").toString())); } else { return Invitation.FAILED; } } catch (Exception e) { if (e instanceof WxRuntimeException) { WxRuntimeException wxRuntimeException = (WxRuntimeException) e; if (60119 == wxRuntimeException.getCode()) { return Invitation.ALREADY_FOLLOWED; } if (45025 == wxRuntimeException.getCode()) { return Invitation.ALREADY_INVITED; } } return Invitation.FAILED; } }  static Users defaultUsers(); static Users with(CorpSetting corpSetting); void setWxClient(WxClient wxClient); ReadUser get(String uid); void create(CreateUser user); void update(UpdateUser user); void delete(String uid); List<SimpleUser> simpleList(int department, boolean fetchChild, Set<UserStatus> statusSet); List<SimpleUser> simpleList(int department); List<ReadUser> list(int department, boolean fetchChild, Set<UserStatus> statusSet); List<ReadUser> list(); List<ReadUser> list(int department); void delete(List<String> users); @Deprecated Invitation invite(String uid); }
Users { @Deprecated public Invitation invite(String uid) { String url = WxEndpoint.get("url.user.invite"); String json = "{\"userid\":\"%s\"}"; logger.debug("invite user: {}", String.format(json, uid)); try { String response = wxClient.post(url, String.format(json, uid)); Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("type")) { return Invitation.format(Integer.valueOf(result.get("type").toString())); } else { return Invitation.FAILED; } } catch (Exception e) { if (e instanceof WxRuntimeException) { WxRuntimeException wxRuntimeException = (WxRuntimeException) e; if (60119 == wxRuntimeException.getCode()) { return Invitation.ALREADY_FOLLOWED; } if (45025 == wxRuntimeException.getCode()) { return Invitation.ALREADY_INVITED; } } return Invitation.FAILED; } }  static Users defaultUsers(); static Users with(CorpSetting corpSetting); void setWxClient(WxClient wxClient); ReadUser get(String uid); void create(CreateUser user); void update(UpdateUser user); void delete(String uid); List<SimpleUser> simpleList(int department, boolean fetchChild, Set<UserStatus> statusSet); List<SimpleUser> simpleList(int department); List<ReadUser> list(int department, boolean fetchChild, Set<UserStatus> statusSet); List<ReadUser> list(); List<ReadUser> list(int department); void delete(List<String> users); @Deprecated Invitation invite(String uid);  }