···1010type t
1111(** The type representing a complete JSON Feed. *)
12121313-(** {1 Jsont Type} *)
1414-1513val jsont : t Jsont.t
1616-(** Declarative JSON type for JSON feeds.
1414+(** Declarative type that describes the structure of JSON Feeds.
17151816 Maps the complete JSON Feed 1.1 specification including all required and
1917 optional fields. *)
20182119module Unknown : sig
2220 type t = (string * Jsont.json) list
2323- (** Unknown/unrecognized JSON object members. Useful for preserving fields
2121+ (** Unknown or unrecognized JSON object members. Useful for preserving fields
2422 from custom extensions or future spec versions. *)
25232624 val empty : t
···2927 val is_empty : t -> bool
3028 (** [is_empty u] returns [true] if there are no unknown fields. *)
3129end
3030+3131+(** {1 Construction} *)
32323333val create :
3434 title:string ->
···4747 ?unknown:Unknown.t ->
4848 unit ->
4949 t
5050+(** [create ~title ~items ()] creates a new JSON Feed.
5151+5252+ @param title
5353+ The name of the feed. Required field that should be plain text, not HTML.
5454+ @param home_page_url
5555+ The URL of the resource that the feed describes. This resource may or may
5656+ not actually be a "home" page, but it should be an HTML page. If a feed is
5757+ for a podcast, for instance, the home_page_url would be the URL for the
5858+ podcast's website.
5959+ @param feed_url
6060+ The URL of the feed itself. This is the URL that was requested to get this
6161+ JSON Feed response. Helps feed readers to determine when they're being
6262+ redirected. Strongly recommended for feeds.
6363+ @param description
6464+ A plain text description of the feed, for human consumption. May contain
6565+ some formatting (like newlines).
6666+ @param user_comment
6767+ A description of the purpose of the feed, for a person looking at the raw
6868+ JSON. This is for the publisher's use only, not intended to be displayed
6969+ to the user.
7070+ @param next_url
7171+ The URL of a feed that provides the next n items, where n is determined by
7272+ the publisher. Used for pagination. A feed reader may continue to request
7373+ the URLs in next_url until it reaches a feed without a next_url.
7474+ @param icon
7575+ The URL of an image for the feed suitable to be used in a timeline, much
7676+ the way an avatar might be used. Should be square and relatively large -
7777+ such as 512 x 512 pixels - and may be cropped to a circle or rounded
7878+ corners. Should not be transparent.
7979+ @param favicon
8080+ The URL of an image for the feed suitable to be used in a source list.
8181+ Should be square and relatively small - such as 64 x 64 pixels. Should not
8282+ be transparent.
8383+ @param authors
8484+ Specifies one or more feed authors. The author object has several members
8585+ (name, url, avatar) which are all optional, but at least one must be
8686+ present for the object to be valid.
8787+ @param language
8888+ The primary language for the feed in RFC 5646 format. The value can be a
8989+ language tag such as "en" or "en-US", or a language-region combination.
9090+ @param expired
9191+ Whether or not the feed is finished - that is, whether or not it will ever
9292+ update again. A feed for a temporary event, like an instance of a
9393+ conference, may expire. If the value is [true], feed readers may stop
9494+ checking for updates.
9595+ @param hubs
9696+ Endpoints that can be used to subscribe to real-time notifications from
9797+ the publisher of this feed. Each hub object has a type (such as "rssCloud"
9898+ or "WebSub") and url.
9999+ @param items
100100+ The items in the feed. Required field, though it may be an empty array.
101101+ @param unknown
102102+ Unknown JSON object members preserved from parsing. Useful for custom
103103+ extensions. *)
104104+105105+(** {1 Accessors} *)
5010651107val version : t -> string
108108+(** [version feed] returns the URL of the version of the format the feed uses.
109109+ This will always be "https://jsonfeed.org/version/1.1" for feeds created
110110+ with this library. This is a required field in the JSON Feed spec. *)
111111+52112val title : t -> string
113113+(** [title feed] returns the name of the feed. This is plain text and should not
114114+ contain HTML. This is a required field. *)
115115+53116val home_page_url : t -> string option
117117+(** [home_page_url feed] returns the URL of the resource that the feed
118118+ describes. This resource may or may not actually be a "home" page, but it
119119+ should be an HTML page. For instance, if a feed is for a podcast, the
120120+ home_page_url would be the URL for the podcast's website. *)
121121+54122val feed_url : t -> string option
123123+(** [feed_url feed] returns the URL of the feed itself. This should be the URL
124124+ that was requested to get this JSON Feed response. It helps feed readers
125125+ determine when they're being redirected. This is strongly recommended for
126126+ feeds. *)
127127+55128val description : t -> string option
129129+(** [description feed] returns a plain text description of the feed, for human
130130+ consumption. This field may contain some formatting such as newlines. *)
131131+56132val user_comment : t -> string option
133133+(** [user_comment feed] returns a description of the purpose of the feed, for a
134134+ person looking at the raw JSON. This is for the publisher's use only and is
135135+ not intended to be displayed to end users. *)
136136+57137val next_url : t -> string option
138138+(** [next_url feed] returns the URL of a feed that provides the next n items,
139139+ where n is determined by the publisher. This is used for pagination. A feed
140140+ reader may continue to request the URLs in next_url until it reaches a feed
141141+ without a next_url. *)
142142+58143val icon : t -> string option
144144+(** [icon feed] returns the URL of an image for the feed suitable to be used in
145145+ a timeline, much the way an avatar might be used. It should be square and
146146+ relatively large (such as 512 x 512 pixels) and may be cropped to a circle
147147+ or rounded corners by feed readers. It should not be transparent. *)
148148+59149val favicon : t -> string option
150150+(** [favicon feed] returns the URL of an image for the feed suitable to be used
151151+ in a source list. It should be square and relatively small (such as 64 x 64
152152+ pixels) and should not be transparent. *)
153153+60154val authors : t -> Author.t list option
155155+(** [authors feed] returns the feed authors. Each author object has several
156156+ members (name, url, avatar) which are all optional, but at least one must be
157157+ present for the object to be valid. If a feed has multiple authors, they
158158+ should all be listed here. *)
159159+61160val language : t -> string option
161161+(** [language feed] returns the primary language for the feed in RFC 5646
162162+ format. The value can be a language tag such as "en" or "en-US", or a
163163+ language-region combination. This field helps feed readers present the feed
164164+ in the appropriate language. *)
165165+62166val expired : t -> bool option
167167+(** [expired feed] returns whether the feed is finished - that is, whether it
168168+ will ever update again. A feed for a temporary event, like an instance of a
169169+ conference, may expire. If the value is [Some true], feed readers may stop
170170+ checking for updates. *)
171171+63172val hubs : t -> Hub.t list option
173173+(** [hubs feed] returns endpoints that can be used to subscribe to real-time
174174+ notifications from the publisher of this feed. Each hub object has a type
175175+ (such as "rssCloud" or "WebSub") and a url. Feed readers can use these to
176176+ get immediate updates when new items are published. *)
177177+64178val items : t -> Item.t list
179179+(** [items feed] returns the array of items in the feed. This is a required
180180+ field, though it may be an empty list. Items represent the individual
181181+ entries in the feed - blog posts, podcast episodes, microblog posts, etc. *)
182182+65183val unknown : t -> Unknown.t
184184+(** [unknown feed] returns any unknown JSON object members that were preserved
185185+ during parsing. This is useful for custom extensions or fields from future
186186+ versions of the spec. *)
6618767188(** {1 Encoding and Decoding} *)
68189