当前位置: 首页>>代码示例>>Java>>正文


Java Parameter类代码示例

本文整理汇总了Java中com.restfb.Parameter的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Parameter类属于com.restfb包,在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchFacebookUser

import com.restfb.Parameter; //导入依赖的package包/类
private AuthUser fetchFacebookUser(String accessToken)
{
    //TODO: this takes too long, maybe cache the access token for a configurable time
    FacebookClient client = new DefaultFacebookClient(accessToken, Version.VERSION_2_5);
    try
    {
        User user = client.fetchObject("me", User.class, Parameter.with("fields", "name,email"));
        if (user != null)
        {
            AuthUser authUser = new AuthUser();
            authUser.setName(user.getName());
            authUser.setEmail(user.getEmail());
            authUser.setAuthVendor(AuthVendor.FACEBOOK);
            authUser.setSession(accessToken);

            return authUser;
        }
    }
    catch (FacebookException ex)
    {
    }

    return null;
}
 
开发者ID:touwolf,项目名称:kasije,代码行数:25,代码来源:FacebookAuthProvider.java

示例2: collectFeed

import com.restfb.Parameter; //导入依赖的package包/类
private Connection<Post> collectFeed(String pagename) {
	
	AccessToken accessToken = new DefaultFacebookClient(Version.VERSION_2_3).obtainAppAccessToken(ConfigurationObject.MY_APP_ID, ConfigurationObject.MY_APP_SECRET);
	FacebookClient facebookClient23 = new DefaultFacebookClient(accessToken.getAccessToken(), Version.VERSION_2_3);

	//User user = facebookClient23.fetchObject("me", User.class);
	Page page = facebookClient23.fetchObject(pagename, Page.class, Parameter.with("fields","name,id, picture, likes"));
	return  facebookClient23.fetchConnection(page.getId()+"/feed", Post.class, Parameter.with("fields", "comments, full_picture")); //message,picture, likes, from,
}
 
开发者ID:chenav,项目名称:orufeo,代码行数:10,代码来源:FacebookBoImpl.java

示例3: send

import com.restfb.Parameter; //导入依赖的package包/类
protected SendResponse send(MessagingType type, MessageRecipient recipient, NotificationTypeEnum notificationType, MessageTag tag,
        Parameter... parameters) {
    requireNonNull(type, "'type' must not be null");
    requireNonNull(recipient, "'recipient' must not be null");
    List<Parameter> params = new ArrayList<>();
    params.add(Parameter.with(MESSAGING_TYPE_PARAM_NAME, type.toString()));
    params.add(Parameter.with(RECIPIENT_PARAM_NAME, recipient));
    if (notificationType != null) {
        params.add(Parameter.with(NOTIFICATION_TYPE_PARAM_NAME, notificationType.name()));
    }
    if (tag != null) {
        params.add(Parameter.with(TAG_PARAM_NAME, tag.getTag()));
    }
    params.addAll(Arrays.asList(parameters));
    return send(params.toArray(new Parameter[params.size()]));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:17,代码来源:DefaultSendOperations.java

示例4: setGetStartedButton

import com.restfb.Parameter; //导入依赖的package包/类
@Override
public void setGetStartedButton(CallToAction callToAction) throws FacebookException {
    requireNonNull(callToAction, "'callToAction' must not be null");
    List<CallToAction> callToActions = Arrays.asList(callToAction);
    facebookClient.publish(THREAD_SETTINGS_PATH, SendResponse.class,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.call_to_actions),
            Parameter.with(THREAD_STATE_PARAM_NAME, ThreadStateEnum.new_thread),
            Parameter.with(CALL_TO_ACTIONS_PARAM_NAME, callToActions));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:10,代码来源:DefaultMessenger.java

示例5: testGetUserProfile

import com.restfb.Parameter; //导入依赖的package包/类
@Test
public void testGetUserProfile() {
    String userId = "user id";
    User user = new User();
    user.setFirstName("first name");
    user.setLastName("last name");
    ProfilePictureSource picture = new ProfilePictureSource();
    picture.setUrl("url");
    user.setPicture(picture);
    user.setLocale("locale");
    user.setTimezone(1.00);
    user.setGender("gender");
    when(facebookClient.fetchObject(userId, User.class, Parameter.with(USER_FIELDS_PARAM_NAME, USER_FIELDS_DEFAULT_VALUE)))
            .thenReturn(user);
    assertThat(messenger.getUserProfile(userId), is(user));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:17,代码来源:DefaultMessengerTests.java

示例6: publish

import com.restfb.Parameter; //导入依赖的package包/类
protected void publish(final SendMessage sendMessage, final Message message, final IdMessageRecipient recipient) {
	LOG.info("sending message to {}", recipient);

	if (recipient == null) {
		LOG.warn("recipient is {}", recipient);
	} else {
		final Parameter recipientParam = Parameter.with("recipient", recipient);
		final Parameter messageParam = Parameter.with("message", message);

		final FacebookClient facebookClient = provideFacebookClient(sendMessage);
		facebookClient.publish("me/messages", SendResponse.class, recipientParam, messageParam);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:14,代码来源:AbstractFacebookSendRuleImpl.java

示例7: publishMessage

import com.restfb.Parameter; //导入依赖的package包/类
String publishMessage() {
  out.println("* Feed publishing *");

  FacebookType publishMessageResponse =
      facebookClient.publish("me/feed", FacebookType.class, Parameter.with("message", "RestFB test"));

  out.println("Published message ID: " + publishMessageResponse.getId());
  return publishMessageResponse.getId();
}
 
开发者ID:restfb,项目名称:restfb-examples,代码行数:10,代码来源:GraphPublisherExample.java

示例8: publishEvent

import com.restfb.Parameter; //导入依赖的package包/类
String publishEvent() {
  out.println("* Event publishing *");

  Date tomorrow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 24L);
  Date twoDaysFromNow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 48L);

  FacebookType publishEventResponse =
      facebookClient.publish("me/events", FacebookType.class, Parameter.with("name", "Party"),
        Parameter.with("start_time", tomorrow), Parameter.with("end_time", twoDaysFromNow));

  out.println("Published event ID: " + publishEventResponse.getId());
  return publishEventResponse.getId();
}
 
开发者ID:restfb,项目名称:restfb-examples,代码行数:14,代码来源:GraphPublisherExample.java

示例9: publishPhoto

import com.restfb.Parameter; //导入依赖的package包/类
String publishPhoto() {
  out.println("* Binary file publishing *");

  FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
    BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
    Parameter.with("message", "Test cat"));

  out.println("Published photo ID: " + publishPhotoResponse.getId());
  return publishPhotoResponse.getId();
}
 
开发者ID:restfb,项目名称:restfb-examples,代码行数:11,代码来源:GraphPublisherExample.java

示例10: generateSNSConfig

import com.restfb.Parameter; //导入依赖的package包/类
@Override
public UserSNSConfigVO generateSNSConfig(String providerUserId, JSONObject additionalConfig) {
    try {
        UserSNSConfigVO userSNSConfigVO = new UserSNSConfigVO();
        userSNSConfigVO.setSnsName(getSNSServiceName());
        userSNSConfigVO.setSocialNetworkVO(facebookConfig);
        userSNSConfigVO.setNotify(false);

        FacebookClient client = new DefaultFacebookClient(additionalConfig.getString(FacebookUtil.FB_ACCESS_TOKEN_KEY), FB_API_VERSION);

        User fbUser = client.fetchObject("me", User.class, Parameter.with("fields", "name,email,gender,locale,timezone"));
        userSNSConfigVO.setSnsuid(fbUser.getId());
        additionalConfig.put("name", fbUser.getName());
        additionalConfig.put("email", fbUser.getEmail());
        additionalConfig.put("gender", fbUser.getGender());
        additionalConfig.put("locale", fbUser.getLocale());
        additionalConfig.put("timezone", fbUser.getTimezone());

        FacebookClient.AccessToken extendedAccessToken = client.obtainExtendedAccessToken(clientKey, clientSecret);
        additionalConfig.put(FacebookUtil.FB_ACCESS_TOKEN_KEY, extendedAccessToken.getAccessToken());
        additionalConfig.put(FacebookUtil.EXPIRES_KEY, extendedAccessToken.getExpires().getTime());
        userSNSConfigVO.setAdditionalConfig(additionalConfig);
        userSNSConfigVO.setUpdatedDate(new Date());

        return userSNSConfigVO;
    } catch (JSONException ex) {
        myLog.error("Error parsing JSON object.", ex);
        return null;
    }
}
 
开发者ID:SECQME,项目名称:watchoverme-server,代码行数:31,代码来源:FacebookSNSService.java

示例11: testRemoveMultipleDomainWhitelisting

import com.restfb.Parameter; //导入依赖的package包/类
@Test
public void testRemoveMultipleDomainWhitelisting() {
    List<String> urls = Arrays.asList("domain url 1", "domain url 2");
    messenger.removeDomainWhitelisting(urls);
    verify(facebookClient).publish(THREAD_SETTINGS_PATH, SendResponse.class,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.domain_whitelisting),
            Parameter.with(WHITELISTED_DOMAINS_PARAM_NAME, urls),
            Parameter.with(DOMAIN_ACTION_TYPE_PARAM_NAME, DomainActionTypeEnum.remove));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:10,代码来源:DefaultMessengerTests.java

示例12: setGreeting

import com.restfb.Parameter; //导入依赖的package包/类
@Override
public void setGreeting(Greeting greeting) throws FacebookException {
    requireNonNull(greeting, "'greeting' must not be null");
    facebookClient.publish(THREAD_SETTINGS_PATH, SendResponse.class,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.greeting),
            Parameter.with(GREETING_PARAM_NAME, greeting));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:8,代码来源:DefaultMessenger.java

示例13: setPersistentMenu

import com.restfb.Parameter; //导入依赖的package包/类
@Override
public void setPersistentMenu(List<CallToAction> callToActions) throws FacebookException {
    requireNonNull(callToActions, "'callToActions' must not be null");
    facebookClient.publish(THREAD_SETTINGS_PATH, SendResponse.class,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.call_to_actions),
            Parameter.with(THREAD_STATE_PARAM_NAME, ThreadStateEnum.existing_thread),
            Parameter.with(CALL_TO_ACTIONS_PARAM_NAME, callToActions));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:9,代码来源:DefaultMessenger.java

示例14: setAccountLinkingUrl

import com.restfb.Parameter; //导入依赖的package包/类
@Override
public void setAccountLinkingUrl(String url) throws FacebookException {
    requireNonNull(url, "'url' must not be null");
    facebookClient.publish(THREAD_SETTINGS_PATH, SendResponse.class,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.account_linking),
            Parameter.with(ACCOUNT_LINKING_URL_PARAM_NAME, url));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:8,代码来源:DefaultMessenger.java

示例15: testRemovePersistentMenu

import com.restfb.Parameter; //导入依赖的package包/类
@Test
public void testRemovePersistentMenu() {
    messenger.removePersistentMenu();
    verify(facebookClient).deleteObject(THREAD_SETTINGS_PATH,
            Parameter.with(SETTING_TYPE_PARAM_NAME, SettingTypeEnum.call_to_actions),
            Parameter.with(THREAD_STATE_PARAM_NAME, ThreadStateEnum.existing_thread));
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:8,代码来源:DefaultMessengerTests.java


注:本文中的com.restfb.Parameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。