Skip to content

Commit

Permalink
Issue #1254: whatsapp business platform send location message
Browse files Browse the repository at this point in the history
  • Loading branch information
nbartels committed Sep 27, 2022
1 parent d619ccd commit 4c14c6f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
Expand Up @@ -65,6 +65,9 @@ public class SendMessage extends AbstractFacebookType {
@Facebook
private Interactive interactive;

@Facebook
private Location location;

@Facebook
@Setter
private Type type = Type.text;
Expand Down Expand Up @@ -118,7 +121,12 @@ public void setInteractive(Interactive interactive) {
this.type = Type.interactive;
}

public void setLocation(Location location) {
this.location = location;
this.type = Type.location;
}

public enum Type {
text, reaction, audio, video, document, sticker, image, interactive;
text, reaction, audio, video, document, sticker, image, interactive, location;
}
}
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2010-2022 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.whatsapp.platform.send;

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

/**
* <a href="https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#location-object">Location</a>
* object to be used in whatsapp message
*/
public class Location extends AbstractFacebookType {

@Facebook
private final Double latitude;

@Facebook
private final Double longitude;

@Setter
@Facebook
private String name;

@Setter
@Facebook
private String address;

public Location(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
}

0 comments on commit 4c14c6f

Please sign in to comment.