Skip to content

Commit

Permalink
Issue #1055 - One-time notification api added
Browse files Browse the repository at this point in the history
  • Loading branch information
nbartels committed Feb 4, 2020
1 parent f416515 commit 3df462c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
@@ -0,0 +1,38 @@
/**
* Copyright (c) 2010-2020 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.send;

import com.restfb.Facebook;
import com.restfb.types.AbstractFacebookType;

import lombok.Getter;

public class OneTimeNotifMessageRecipient extends AbstractFacebookType implements MessageRecipient {

@Getter
@Facebook("one_time_notif_token")
private String oneTimeNotifToken;

public OneTimeNotifMessageRecipient(String oneTimeNotifToken) {
this.oneTimeNotifToken = oneTimeNotifToken;
}
}
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2010-2020 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.send;

import com.restfb.Facebook;
import lombok.Getter;

public class OneTimeNotifReqTemplatePayload extends TemplatePayload {

@Getter
@Facebook
private String title;

@Getter
@Facebook
private String payload;

public OneTimeNotifReqTemplatePayload(String title, String payload) {
this.title = title;
this.payload = payload;
setTemplateType("one_time_notif_req");
}
}
19 changes: 19 additions & 0 deletions src/main/lombok/com/restfb/types/webhook/messaging/OptinItem.java
Expand Up @@ -42,6 +42,21 @@ public class OptinItem implements InnerMessagingItem {
@Facebook("user_ref")
private String userRef;

@Getter
@Setter
@Facebook
private String type;

@Getter
@Setter
@Facebook
private String payload;

@Getter
@Setter
@Facebook("one_time_notif_token")
private String oneTimeNotifToken;

@Getter
private UserRefMessageRecipient userRefMessageRecipient;

Expand All @@ -51,4 +66,8 @@ private void provideRecipient() {
userRefMessageRecipient = new UserRefMessageRecipient(userRef);
}
}

public boolean isOneTimeNotif() {
return oneTimeNotifToken != null;
}
}

0 comments on commit 3df462c

Please sign in to comment.