syntax = "proto3";

package devvit.plugin.redditapi.linksandcomments;

import "devvit/plugin/redditapi/common/common_msg.proto";
import "devvit/plugin/redditapi/linksandcomments/linksandcomments_msg.proto";
import "google/protobuf/empty.proto";
import "reddit/devvit/post/v1/post.proto";

option go_package = "github.snooguts.net/reddit/reddit-devplatform-monorepo/go-common/generated/protos/types/devvit/plugin/redditapi";
option java_package = "com.reddit.devvit.plugin.redditapi.linksandcomments";

// LINKS & COMMENTS - https://www.reddit.com/dev/api#section_links_and_comments
// Note: all endpoints require oauth
service LinksAndComments {
  // Submit a new Comment
  // Note: `thing_id` refers to the Post or Comment this comment is replying to
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_comment}
  rpc Comment(CommentRequest) returns (JsonWrappedComment) {}

  // Delete a Post or Comment
  // Note: `id` must be a single thing ID for a Post or Comment
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_del}
  rpc Del(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/del';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Edit the body text of a Comment or Post
  // Note: `thing_id` refers to the Post or Comment being edited
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_editusertext}
  rpc EditUserText(CommentRequest) returns (JsonWrappedComment) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/editusertext';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
    option (devvit.plugin.redditapi.common.api_client_config).enforce_json = true;
    option (devvit.plugin.redditapi.common.api_client_config).use_custom_response_parser = true;
  }
  // Follow or unfollow a Post
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_follow_post}
  rpc FollowPost(FollowPostRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/follow_post';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Hide one or more Posts for the user
  // Note: `id` must be one or more comma-separated Post thing IDs
  //
  // @see {@link Unhide}
  // @see {@link https://www.reddit.com/dev/api#POST_api_hide}
  rpc Hide(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/hide';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Get one or more things by ID, Subreddit name, or Link Post URL
  //
  // @see {@link https://www.reddit.com/dev/api#GET_api_info}
  rpc Info(InfoRequest) returns (devvit.plugin.redditapi.common.Listing) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'GET';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/info.json?sr_name={subreddits}&id={thing_ids}&url={url}&rtj=1';
  }
  // Disable comments for a Post or Comment
  // Note: `id` must be a single thing ID for a Post or Comment
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_lock}
  rpc Lock(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/lock';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Marks a Post as Not-Safe-For-Work
  //
  // @see {@link UnmarkNSFW}
  // @see {@link https://www.reddit.com/dev/api#POST_api_marknsfw}
  rpc MarkNSFW(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/marknsfw';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Get more comments from a truncated Comment tree
  //
  // A comment tree has been truncated if it ends with an entry of kind "more"
  // instead of "t1".  Use this API to fetch the additional comments listed in
  // the "children" array of the "more" entry.
  //
  // @see {@link https://www.reddit.com/dev/api#GET_api_morechildren}
  rpc MoreChildren(MoreChildrenRequest) returns (JsonWrappedComment) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'GET';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/morechildren?children={children}&depth={depth}&id={id}&limit_children={limit_children}&link_id={link_id}&sort={sort}&api_type=json';
    option (devvit.plugin.redditapi.common.api_client_config).use_custom_response_parser = true;
  }
  // Report a Post, Comment, or Private Message
  //
  // If reporting a Post or Comment the report is sent to the moderators of the subreddit for review.
  // If reporting a Private Message the report is sent to Reddit for review.
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_report}
  rpc Report(ReportRequest) returns (devvit.plugin.redditapi.common.JsonStatus) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/report';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
    option (devvit.plugin.redditapi.common.api_client_config).enforce_json = true;
  }
  // Report an award to Reddit for review
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_report_award}
  rpc ReportAward(ReportAwardRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/report_award';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Save a Post or Comment to the user's Saved list
  //
  // @see {@link Unsave}
  // @see {@link https://www.reddit.com/dev/api#POST_api_save}
  rpc Save(SaveRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/save';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Enable or disable reply notifications for a Post or Comment
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_sendreplies}
  rpc SendReplies(SendRepliesRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/sendreplies';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Toggle Contest Mode for a Post's comments
  //
  // Contest Mode randomizes the sort order and hides the vote score for comments
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_set_contest_mode}
  rpc SetContestMode(SetContestModeRequest) returns (devvit.plugin.redditapi.common.JsonStatus) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/set_contest_mode';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
    option (devvit.plugin.redditapi.common.api_client_config).enforce_json = true;
  }
  // Edit or set fields unique to developer platform custom posts
  rpc EditCustomPost(EditCustomPostRequest) returns (devvit.plugin.redditapi.common.JsonRedditObjects);

  // Update the custom post preview content for a Custom Post.
  rpc SetCustomPostPreview(SetCustomPostPreviewRequest) returns (google.protobuf.Empty);

  // Set the "sticky" or "pinned" status of a Post
  //
  // If the post was created by the current user they can pin the post
  // to the top of their user profile.  Otherwise they must be a moderator
  // of the subreddit to stick it to the top of the subreddit it was posted in.
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_set_subreddit_sticky}
  rpc SetSubredditSticky(SetSubredditStickyRequest) returns (devvit.plugin.redditapi.common.JsonStatus) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/set_subreddit_sticky';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
    option (devvit.plugin.redditapi.common.api_client_config).enforce_json = true;
  }
  // Set the default sort order for comments in the given Post
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_set_suggested_sort}
  rpc SetSuggestedSort(SetSuggestedSortRequest) returns (devvit.plugin.redditapi.common.JsonStatus) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/set_suggested_sort';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
    option (devvit.plugin.redditapi.common.api_client_config).enforce_json = true;
  }

  // Sets the spoiler tag on a given Post to hide its contents by default
  // Note: `id` must be a single thing ID for a Post
  //
  // @see {@link Unspoiler}
  // @see {@link https://www.reddit.com/dev/api#POST_api_spoiler}
  rpc Spoiler(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/spoiler';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Create a new Post
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_submit}
  //
  // Note: not specifying ApiClientConfig to avoid automatic generation.
  // Submit has extra logic that needs to be manually implemented.
  rpc Submit(SubmitRequest) returns (SubmitResponse);
  // Create a new Custom Post
  rpc SubmitCustomPost(SubmitRequest) returns (SubmitResponse);
  // Unhide one or more Posts for the user
  // Note: `id` must be one or more comma-separated Post thing IDs
  //
  // @see {@link Hide}
  // @see {@link https://www.reddit.com/dev/api#POST_api_unhide}
  rpc Unhide(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/unhide';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Enable comments for a Post or Comment
  // Note: `id` must be a single thing ID for a Post or Comment
  //
  // @see {@link Lock}
  // @see {@link https://www.reddit.com/dev/api#POST_api_unlock}
  rpc Unlock(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/unlock';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Clears the Not-Safe-For-Work status from a Post
  //
  // @see {@link MarkNSFW}
  // @see {@link https://www.reddit.com/dev/api#POST_api_unmarknsfw}
  rpc UnmarkNSFW(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/unmarknsfw';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Remove a Post or Comment from the user's Saved list
  //
  // @see {@link Save}
  // @see {@link https://www.reddit.com/dev/api#POST_api_unsave}
  rpc Unsave(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/unsave';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Clears the spoiler tag on a given Post
  //
  // @see {@link Spoiler}
  // @see {@link https://www.reddit.com/dev/api#POST_api_unspoiler}
  rpc Unspoiler(BasicIdRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/unspoiler';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }
  // Vote or clear a vote on a Post or Comment
  //
  // @see {@link https://www.reddit.com/dev/api#POST_api_vote}
  rpc Vote(VoteRequest) returns (google.protobuf.Empty) {
    option (devvit.plugin.redditapi.common.api_client_config).method = 'POST';
    option (devvit.plugin.redditapi.common.api_client_config).path = '/api/vote';
    option (devvit.plugin.redditapi.common.api_client_config).request_body_type = FORM_SNAKE;
  }

  // Get whether a post is in its subreddit's community highlights.
  rpc GetIsPostHighlighted(GetIsPostHighlightedRequest) returns (GetIsPostHighlightedResponse);

  // Add a post to the community's highlights.
  // Calling this RPC for a post that is already highlighted will
  // overwrite the current expiration date and highlgiht label.
  rpc AddPostToHighlights(AddPostToHighlightsRequest) returns (AddPostToHighlightsResponse);

  // Remove a post from the community's highlights.
  // Calling this RPC for a post that is not highlighted is a no-op.
  rpc RemovePostFromHighlights(RemovePostFromHighlightsRequest) returns (RemovePostFromHighlightsResponse);

  // Edit or set style rules unique to developer platform custom posts
  rpc SetCustomPostStyles(SetCustomPostStylesRequest) returns (google.protobuf.Empty);

  // Get style rules unique to developer platform custom posts
  rpc GetCustomPostStyles(GetCustomPostStylesRequest) returns (.reddit.devvit.post.v1.CustomPostStyles);
}
