blob: fb86c94b19cdad9a544c32be4345c07e3b00f127 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
(** A footer object belonging to an embed. *)
type footer = {
text: string;
icon_url: string option;
proxy_icon_url: string option;
} [@@deriving sexp, yojson { exn = true }]
(** An image object belonging to an embed. *)
type image = {
url: string option;
proxy_url: string option;
height: int option;
width: int option;
} [@@deriving sexp, yojson { exn = true }]
(** A video object belonging to an embed. *)
type video = {
url: string option;
height: int option;
width: int option;
} [@@deriving sexp, yojson { exn = true }]
(** A provider object belonging to an embed. *)
type provider = {
name: string option;
url: string option;
} [@@deriving sexp, yojson { exn = true }]
(** An author object belonging to an embed. *)
type author = {
name: string option;
url: string option;
icon_url: string option;
proxy_icon_url: string option;
} [@@deriving sexp, yojson { exn = true }]
(** A field object belonging to an embed. *)
type field = {
name: string;
value: string;
inline: bool;
} [@@deriving sexp, yojson { exn = true }]
(** An embed object. See this {{:https://leovoel.github.io/embed-visualizer/}embed visualiser} if you need help understanding each component. *)
type t = {
title: string option;
kind: string option[@key "type"];
description: string option;
url: string option;
timestamp: string option;
colour: int option[@key "color"];
footer: footer option;
image: image option;
thumbnail: image option;
video: video option;
provider: provider option;
author: author option;
fields: field list [@default []];
} [@@deriving sexp, yojson { strict = false; exn = true }]
(** An embed where all values are empty. *)
val default : t
(** A footer where all values are empty. *)
val default_footer : footer
(** An image where all values are empty. *)
val default_image : image
(** A video where all values are empty. *)
val default_video : video
(** A provider where all values are empty. *)
val default_provider : provider
(** An author where all values are empty. *)
val default_author : author
(** Set the title of an embed. *)
val title : string -> t -> t
(** Set the description of an embed. *)
val description : string -> t -> t
(** Set the URL of an embed. *)
val url : string -> t -> t
(** Set the timestamp of an embed. *)
val timestamp : string -> t -> t
(** Set the colour of an embed. *)
val colour : int -> t -> t
(** Identical to {!colour} but with US English spelling. *)
val color : int -> t -> t
(** Set the footer of an embed. The function passes {!default_footer} and must return a footer. *)
val footer : (footer -> footer) -> t -> t
(** Set the image URL of an embed. *)
val image : string -> t -> t
(** Set the thumbnail URL of an embed. *)
val thumbnail : string -> t -> t
(** Set the author of an embed. The function passes {!default_author} and must return an author. *)
val author : (author -> author) -> t -> t
(** Add a field to an embed. Takes a tuple in [(name, value, inline)] order. {b Fields added this way will appear in reverse order in the embed.} *)
val field : string * string * bool -> t -> t
(** Set the fields of an embed. Similar to {!val:field}, but because a complete list is passed, fields preserve order. *)
val fields : (string * string * bool) list -> t -> t
(** Set the footer text. Typically used in the closure passed to {!val:footer}. *)
val footer_text : string -> footer -> footer
(** Set the footer icon URL. Typically used in the closure passed to {!val:footer}. *)
val footer_icon : string -> footer -> footer
(** Set the author name. Typically used in the closure passed to {!val:author}. *)
val author_name : string -> author -> author
(** Set the author URL. Typically used in the closure passed to {!val:author}. *)
val author_url : string -> author -> author
(** Set the author icon URL. Typically used in the closure passed to {!val:author}. *)
val author_icon : string -> author -> author
|