package reddit_api_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Parameters : sig ... end
module Sequencer : sig ... end

A Sequencer.t represents an endpoint that cannot have multiple requests in flight simultaneously.

module Request : sig ... end
module Api_error : sig ... end

An Api_error.t represents a "normal" error when making an API request.

type 'a t = {
  1. request : Request.t;
  2. handle_response : (Cohttp.Response.t * Cohttp.Body.t) -> ('a, Api_error.t) Core_kernel.Result.t;
  3. sequencer : Sequencer.t option;
}

A t represents the combinaton of an HTTP request to Reddit and a function for turning the HTTP response into a typed representation.

val map : 'a t -> f:('a -> 'b) -> 'b t
type 'a with_param_override := ?param_list_override: ((string * string list) list -> (string * string list) list) -> unit -> 'a
type 'a with_listing_params := ?pagination:Listing.Pagination.t -> ?count:int -> ?limit:int -> ?show_all:unit -> 'a

A value of type _ with_listing_params is a function with optional arguments representing Reddit's "listing" pagination protocol.

Endpoints

Account

val trophies : Thing.Award.t list t with_param_override

Flair

val select_flair : ?background_color:Parameters.Color.t -> ?css_class:string -> ?flair_template_id:Uuid.t -> ?text:string -> ?text_color:Parameters.Color.t -> subreddit:Subreddit_name.t -> target:Parameters.Flair_target.t -> unit t with_param_override
val add_comment : ?return_rtjson:bool -> ?richtext_json:Json.t -> parent: [< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t | `Message of Thing.Message.Id.t ] -> text:string -> Thing.Comment.t t with_param_override
val delete : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val edit : ?return_rtjson:bool -> ?richtext_json:Json.t -> id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> text:string -> [> `Link of Thing.Link.t | `Comment of Thing.Comment.t ] t with_param_override
val hide : links:Thing.Link.Id.t list -> unit t with_param_override
val unhide : links:Thing.Link.Id.t list -> unit t with_param_override
val lock : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val unlock : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val mark_nsfw : link:Thing.Link.Id.t -> unit t with_param_override
val unmark_nsfw : link:Thing.Link.Id.t -> unit t with_param_override
val more_children : ?limit_children:bool -> link:Thing.Link.Id.t -> more_comments:Thing.More_comments.Details.By_children.t -> sort:Parameters.Comment_sort.t -> [ `Comment of Thing.Comment.t | `More_comments of Thing.More_comments.t ] list t with_param_override
val report : ?from_modmail:bool -> ?from_help_desk:bool -> ?additional_info:string -> ?custom_text:string -> ?other_reason:string -> ?rule_reason:string -> ?site_reason:string -> ?sr_name:string -> target: [< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t | `Message of Thing.Message.Id.t | `Modmail_conversation of Thing.Modmail_conversation.Id.t ] -> reason:string -> unit t with_param_override
val report_award : award_id:string -> (Cohttp.Response.t * Cohttp.Body.t) t with_param_override
val save : ?category:string -> id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val unsave : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val send_replies : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> enabled:bool -> unit t with_param_override
val set_contest_mode : link:Thing.Link.Id.t -> enabled:bool -> unit t with_param_override
val set_subreddit_sticky : ?to_profile:bool -> link:Thing.Link.Id.t -> sticky_state:Parameters.Sticky_state.t -> unit t with_param_override
val set_suggested_sort : link:Thing.Link.Id.t -> sort:Parameters.Comment_sort.t option -> unit t with_param_override
val spoiler : link:Thing.Link.Id.t -> unit t with_param_override
val unspoiler : link:Thing.Link.Id.t -> unit t with_param_override
val submit : ?ad:bool -> ?nsfw:bool -> ?resubmit:bool -> ?sendreplies:bool -> ?spoiler:bool -> ?flair_id:string -> ?flair_text:string -> ?collection_id:string -> ?event_start:Core_kernel.Time.t -> ?event_end:Core_kernel.Time.t -> ?event_tz:string -> subreddit:Subreddit_name.t -> title:string -> kind:Parameters.Link_kind.t -> (Thing.Link.Id.t * Uri.t) t with_param_override
val vote : ?rank:int -> direction:Parameters.Vote_direction.t -> target:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val info : Parameters.Info_query.t -> [ `Comment of Thing.Comment.t | `Link of Thing.Link.t | `Subreddit of Thing.Subreddit.t ] list t with_param_override

Listings

val best : (?include_categories:bool -> Thing.Link.t Listing.t t with_param_override) with_listing_params
val comments : ?subreddit:Subreddit_name.t -> ?comment:Thing.Comment.Id.t -> ?context:int -> ?depth:int -> ?limit:int -> ?showedits:bool -> ?showmore:bool -> ?sort:Parameters.Comment_sort.t -> ?threaded:bool -> ?truncate:int -> link:Thing.Link.Id.t -> Comment_response.t t with_param_override
val hot : (?location:string -> ?include_categories:bool -> ?subreddit:Subreddit_name.t -> Thing.Link.t Listing.t t with_param_override) with_listing_params
val new_ : (?include_categories:bool -> ?subreddit:Subreddit_name.t -> Thing.Link.t Listing.t t with_param_override) with_listing_params
val rising : (?include_categories:bool -> ?subreddit:Subreddit_name.t -> Thing.Link.t Listing.t t with_param_override) with_listing_params
val top : (?since:Parameters.Historical_span.t -> ?include_categories:bool -> ?subreddit:Subreddit_name.t -> Thing.Link.t Listing.t t with_param_override) with_listing_params
val controversial : (?since:Parameters.Historical_span.t -> ?include_categories:bool -> ?subreddit:Subreddit_name.t -> Thing.Link.t Listing.t t with_param_override) with_listing_params

Private messages

val block_author : id:[< `Comment of Thing.Comment.Id.t | `Message of Thing.Message.Id.t ] -> unit t with_param_override
val collapse_message : messages:Thing.Message.Id.t list -> unit t with_param_override
val uncollapse_message : messages:Thing.Message.Id.t list -> unit t with_param_override
val compose_message : ?g_recaptcha_response:string -> ?from_subreddit:Subreddit_name.t -> to_:Username.t -> subject:string -> text:string -> unit t with_param_override
val read_message : messages:Thing.Message.Id.t list -> unit t with_param_override
val unread_message : messages:Thing.Message.Id.t list -> unit t with_param_override
val inbox : (?include_categories:bool -> ?mid:string -> mark_read:bool -> Inbox_item.t Listing.t t with_param_override) with_listing_params
val unread : (?include_categories:bool -> ?mid:string -> mark_read:bool -> Inbox_item.t Listing.t t with_param_override) with_listing_params
val sent : (?include_categories:bool -> ?mid:string -> Thing.Message.t Listing.t t with_param_override) with_listing_params
val comment_replies : (?include_categories:bool -> ?mid:string -> mark_read:bool -> Inbox_item.Comment.t Listing.t t with_param_override) with_listing_params

Moderation

val reports : (?location:string -> ?only:Parameters.Links_or_comments.t -> ?subreddit:Subreddit_name.t -> [ `Link of Thing.Link.t | `Comment of Thing.Comment.t ] Listing.t t with_param_override) with_listing_params
val spam : (?location:string -> ?only:Parameters.Links_or_comments.t -> ?subreddit:Subreddit_name.t -> [ `Link of Thing.Link.t | `Comment of Thing.Comment.t ] Listing.t t with_param_override) with_listing_params
val modqueue : (?location:string -> ?only:Parameters.Links_or_comments.t -> ?subreddit:Subreddit_name.t -> [ `Link of Thing.Link.t | `Comment of Thing.Comment.t ] Listing.t t with_param_override) with_listing_params
val unmoderated : (?location:string -> ?only:Parameters.Links_or_comments.t -> ?subreddit:Subreddit_name.t -> [ `Link of Thing.Link.t | `Comment of Thing.Comment.t ] Listing.t t with_param_override) with_listing_params
val edited : (?location:string -> ?only:Parameters.Links_or_comments.t -> ?subreddit:Subreddit_name.t -> [ `Link of Thing.Link.t | `Comment of Thing.Comment.t ] Listing.t t with_param_override) with_listing_params
val accept_moderator_invite : subreddit:Subreddit_name.t -> (Cohttp.Response.t * Cohttp.Body.t) t with_param_override
val approve : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val remove : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> spam:bool -> unit t with_param_override
val distinguish : ?sticky:bool -> id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> how:Parameters.How_to_distinguish.t -> [> `Link of Thing.Link.t | `Comment of Thing.Comment.t ] t with_param_override
val ignore_reports : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val unignore_reports : id:[< `Link of Thing.Link.Id.t | `Comment of Thing.Comment.Id.t ] -> unit t with_param_override
val leavecontributor : subreddit:Thing.Subreddit.Id.t -> unit t with_param_override
val leavemoderator : subreddit:Thing.Subreddit.Id.t -> unit t with_param_override
val mute_message_author : message:Thing.Message.Id.t -> unit t with_param_override
val unmute_message_author : message:Thing.Message.Id.t -> unit t with_param_override
val stylesheet : subreddit:Subreddit_name.t -> Stylesheet.t t with_param_override

New modmail

val create_modmail_conversation : subject:string -> body:string -> subreddit:Subreddit_name.t -> to_:Parameters.Modmail_recipient.t -> hide_author:bool -> Modmail.Conversation.t t with_param_override

Subreddits

val banned : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Ban.t Listing.t t with_param_override) with_listing_params
val muted : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Mute.t Listing.t t with_param_override) with_listing_params
val wiki_banned : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Ban.t Listing.t t with_param_override) with_listing_params
val contributors : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Contributor.t Listing.t t with_param_override) with_listing_params
val wiki_contributors : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Contributor.t Listing.t t with_param_override) with_listing_params
val moderators : (?include_categories:bool -> ?user:Username.t -> subreddit:Subreddit_name.t -> Relationship.Moderator.t Listing.t t with_param_override) with_listing_params
val delete_subreddit_image : subreddit:Subreddit_name.t -> image:Parameters.Subreddit_image.t -> unit t with_param_override
val search_subreddits_by_name : ?exact:bool -> ?include_over_18:bool -> ?include_unadvertisable:bool -> query:string -> Subreddit_name.t list t with_param_override
val create_or_edit_subreddit : ?comment_score_hide_mins:int -> ?wiki_edit_age:int -> ?wiki_edit_karma:int -> all_original_content:bool -> allow_discovery:bool -> allow_images:bool -> allow_post_crossposts:bool -> allow_top:bool -> allow_videos:bool -> api_type:(string * string list) list -> collapse_deleted_comments:bool -> crowd_control_mode:bool -> description:string -> disable_contributor_requests:bool -> exclude_banned_modqueue:bool -> free_form_reports:bool -> g_recaptcha_response:string option -> header_title:string -> hide_ads:bool -> key_color:string -> lang:string -> link_type:Parameters.Link_type.t -> name:string -> original_content_tag_enabled:bool -> over_18:bool -> public_description:string -> restrict_commenting:bool -> restrict_posting:bool -> show_media:bool -> show_media_preview:bool -> spam_comments:Parameters.Spam_level.t -> spam_links:Parameters.Spam_level.t -> spam_selfposts:Parameters.Spam_level.t -> spoilers_enabled:bool -> subreddit:Subreddit_name.t -> submit_link_label:string -> submit_text:string -> submit_text_label:string -> suggested_comment_sort:Parameters.Comment_sort.t -> title:string -> type_:Parameters.Subreddit_type.t -> wiki_mode:Parameters.Wiki_mode.t -> (Cohttp.Response.t * Cohttp.Body.t) t with_param_override
val submit_text : subreddit:Subreddit_name.t -> Submit_text.t t with_param_override
val subreddit_autocomplete : ?limit:int -> ?include_categories:bool -> ?include_over_18:bool -> ?include_profiles:bool -> query:string -> Thing.Subreddit.t Listing.t t with_param_override
val set_subreddit_stylesheet : ?reason:string -> subreddit:Subreddit_name.t -> stylesheet_contents:string -> unit t with_param_override
val subscribe : ?skip_initial_defaults:bool -> action:Parameters.Subscription_action.t -> subreddits:Parameters.Subscription_list.t -> unit t with_param_override
val about_subreddit : subreddit:Subreddit_name.t -> Thing.Subreddit.t t with_param_override
val subreddit_settings : ?created:bool -> ?location:string -> subreddit:Subreddit_name.t -> Subreddit_settings.t t with_param_override
val subreddit_rules : subreddit:Subreddit_name.t -> Subreddit_rules.t t with_param_override
val subreddit_traffic : subreddit:Subreddit_name.t -> Subreddit_traffic.t t with_param_override
val get_sticky : ?number:int -> subreddit:Subreddit_name.t -> Thing.Link.Id.t t with_param_override
val get_subreddits : (?include_categories:bool -> relationship:Parameters.Subreddit_relationship.t -> Thing.Subreddit.t Listing.t t with_param_override) with_listing_params
val search_subreddits_by_title_and_description : (?show_users:bool -> ?sort:Parameters.Relevance_or_activity.t -> query:string -> Thing.Subreddit.t Listing.t t with_param_override) with_listing_params
val list_subreddits : (?include_categories:bool -> ?show_users:bool -> sort:Parameters.Subreddit_listing_sort.t -> Thing.Subreddit.t Listing.t t with_param_override) with_listing_params

Users

val about_user : username:Username.t -> Thing.User.t t with_param_override
val list_user_subreddits : (?include_categories:bool -> sort:Parameters.User_subreddit_sort.t -> Thing.Subreddit.t Listing.t t with_param_override) with_listing_params
val add_relationship : relationship:Parameters.Relationship_spec.t -> username:Username.t -> duration:Parameters.Relationship_spec.Duration.t -> ?subreddit:Subreddit_name.t -> ?note:string -> ?ban_reason:string -> ?ban_message:string -> ?ban_context:string -> unit t with_param_override
val remove_relationship : relationship:Parameters.Relationship_spec.t -> username:Username.t -> ?subreddit:Subreddit_name.t -> unit t with_param_override

Wiki

val add_wiki_editor : page:Wiki_page.Id.t -> user:Username.t -> unit t with_param_override
val remove_wiki_editor : page:Wiki_page.Id.t -> user:Username.t -> unit t with_param_override
val edit_wiki_page : ?previous:Wiki_page.Revision.Id.t -> ?reason:string -> content:string -> page:Wiki_page.Id.t -> (unit, Wiki_page.Edit_conflict.t) Core_kernel.Result.t t with_param_override
val toggle_wiki_revision_visibility : page:Wiki_page.Id.t -> revision:Wiki_page.Revision.Id.t -> [ `Became_hidden | `Became_visible ] t with_param_override
val revert_wiki_page : page:Wiki_page.Id.t -> revision:Wiki_page.Revision.Id.t -> unit t with_param_override
val wiki_pages : ?subreddit:Subreddit_name.t -> string list t with_param_override
val set_wiki_permissions : page:Wiki_page.Id.t -> listed:bool -> level:Wiki_page.Permissions.Level.t -> Wiki_page.Permissions.t t with_param_override
val wiki_page : ?compare_revisions:(string option * string option) -> page:Wiki_page.Id.t -> Wiki_page.t t with_param_override
OCaml

Innovation. Community. Security.