the browser-facing portion of osu!
at master 2.3 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Http\Controllers; 7 8use App\Libraries\BeatmapsetDiscussionVotesBundle; 9 10/** 11 * @group Beatmapset Discussions 12 */ 13class BeatmapsetDiscussionVotesController extends Controller 14{ 15 public function __construct() 16 { 17 $this->middleware('require-scopes:public'); 18 19 parent::__construct(); 20 } 21 22 /** 23 * Get Beatmapset Discussion Votes 24 * 25 * Returns the votes given to beatmapset discussions. 26 * 27 * --- 28 * 29 * ### Response Format 30 * 31 * <aside class="warning"> 32 * The response of this endpoint is likely to change soon! 33 * </aside> 34 * 35 * Field | Type | Description 36 * ------------- | ------------------------------------------------------- | ----------- 37 * cursor_string | [CursorString](#cursorstring) | | 38 * discussions | [BeatmapsetDiscussion](#beatmapsetdiscussion) | | 39 * users | [User](#user) | | 40 * votes | [BeatmapsetDiscussionVote](#beatmapsetdiscussionvote)[] | | 41 * 42 * @queryParam beatmapset_discussion_id `id` of the [BeatmapsetDiscussion](#beatmapsetdiscussion). 43 * @queryParam limit Maximum number of results. 44 * @queryParam page Search result page. 45 * @queryParam receiver The `id` of the [User](#user) receiving the votes. 46 * @queryParam score `1` for up vote, `-1` for down vote. 47 * @queryParam sort `id_desc` for newest first; `id_asc` for oldest first. Defaults to `id_desc`. 48 * @queryParam user The `id` of the [User](#user) giving the votes. 49 * @queryParam with_deleted This param has no effect as api calls do not currently receive group permissions. 50 */ 51 public function index() 52 { 53 $bundle = new BeatmapsetDiscussionVotesBundle(request()->all()); 54 55 if (is_api_request()) { 56 return $bundle->toArray(); 57 } 58 59 $votes = $bundle->getPaginator(); 60 61 return ext_view('beatmapset_discussion_votes.index', compact('votes')); 62 } 63}