This commit is contained in:
Chris Chen
2023-08-20 11:28:47 -07:00
parent 2c491b63de
commit ad0bc0e49b
78 changed files with 3640 additions and 5639 deletions
+17
View File
@@ -118,6 +118,23 @@ namespace LineMessaging
});
}
public async Task PushJsonMessage(string to, string jsonMessage)
{
if (to == null)
{
throw new ArgumentNullException(nameof(to));
}
if (jsonMessage == null)
{
throw new ArgumentNullException(nameof(jsonMessage));
}
await Post(LineMessagePushApiPath,
"{\r\n \"to\": \""+ to + "\",\r\n \"messages\":["+ jsonMessage + "]\r\n}"
);
}
public async Task MulticastMessage(LineMulticastMessage multicastMessage)
{
if (multicastMessage == null)
+9 -1
View File
@@ -156,7 +156,15 @@ namespace LineMessaging
{
if (body != null)
{
string jsonContent = JsonConvert.SerializeObject(body, serializerSettings);
string jsonContent;
if (body is string)
{
jsonContent = body.ToString();
}
else
{
jsonContent = JsonConvert.SerializeObject(body, serializerSettings);
}
message.Content = new StringContent(jsonContent);
message.Content.Headers.ContentType = MediaTypeJson;
+21 -1
View File
@@ -46,8 +46,28 @@ namespace LineMessaging
public ActionType Type => ActionType.Uri;
[JsonProperty("label")]
public string Label { get; set; }
private string _uri;
[JsonProperty("uri")]
public string Uri { get; set; }
public string Uri
{
get { return _uri; }
set {
if (value.IndexOf("?") == -1)
{
value += "?openExternalBrowser=1";
}
else
{
value += "&openExternalBrowser=1";
}
_uri = value;
}
}
}
public class DatetimepickerAction : ILineAction
@@ -3,6 +3,7 @@ using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
@@ -108,11 +109,16 @@ namespace LineMessaging
}
public class LineFlexButton : ILineFlexObject
{
public LineFlexButton()
{
Height = FlexObjectSize.md;
}
public FlexObjectType Type => FlexObjectType.Button;
[JsonRequired]
public ILineAction Action { get; set; }
public FlexObjectButtonStype Style { get; set; }
//public FlexObjectSize Size { get; set; }
public FlexObjectSize Height { get; set; }
}
public class LineFlexImage : ILineFlexObject
{