mirror of
https://github.com/osukey/osukey.git
synced 2025-08-01 21:58:46 +09:00
Merge branch 'master' into timeshift-results-2
This commit is contained in:
34
osu.Game/Online/API/Requests/CreateChannelRequest.cs
Normal file
34
osu.Game/Online/API/Requests/CreateChannelRequest.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class CreateChannelRequest : APIRequest<APIChatChannel>
|
||||
{
|
||||
private readonly Channel channel;
|
||||
|
||||
public CreateChannelRequest(Channel channel)
|
||||
{
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
|
||||
req.AddParameter("type", $"{ChannelType.PM}");
|
||||
req.AddParameter("target_id", $"{channel.Users.First().Id}");
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => @"chat/channels";
|
||||
}
|
||||
}
|
@ -64,7 +64,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"max_combo")]
|
||||
private int? maxCombo { get; set; }
|
||||
|
||||
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
||||
public virtual BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
||||
{
|
||||
var set = BeatmapSet?.ToBeatmapSet(rulesets);
|
||||
|
||||
|
18
osu.Game/Online/API/Requests/Responses/APIChatChannel.cs
Normal file
18
osu.Game/Online/API/Requests/Responses/APIChatChannel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIChatChannel
|
||||
{
|
||||
[JsonProperty(@"channel_id")]
|
||||
public int? ChannelID { get; set; }
|
||||
|
||||
[JsonProperty(@"recent_messages")]
|
||||
public List<Message> RecentMessages { get; set; }
|
||||
}
|
||||
}
|
@ -27,7 +27,15 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
private string directionString => SortDirection == SortDirection.Descending ? @"desc" : @"asc";
|
||||
|
||||
public SearchBeatmapSetsRequest(string query, RulesetInfo ruleset, Cursor cursor = null, SearchCategory searchCategory = SearchCategory.Any, SortCriteria sortCriteria = SortCriteria.Ranked, SortDirection sortDirection = SortDirection.Descending)
|
||||
public SearchBeatmapSetsRequest(
|
||||
string query,
|
||||
RulesetInfo ruleset,
|
||||
Cursor cursor = null,
|
||||
SearchCategory searchCategory = SearchCategory.Any,
|
||||
SortCriteria sortCriteria = SortCriteria.Ranked,
|
||||
SortDirection sortDirection = SortDirection.Descending,
|
||||
SearchGenre genre = SearchGenre.Any,
|
||||
SearchLanguage language = SearchLanguage.Any)
|
||||
{
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
@ -36,8 +44,8 @@ namespace osu.Game.Online.API.Requests
|
||||
SearchCategory = searchCategory;
|
||||
SortCriteria = sortCriteria;
|
||||
SortDirection = sortDirection;
|
||||
Genre = SearchGenre.Any;
|
||||
Language = SearchLanguage.Any;
|
||||
Genre = genre;
|
||||
Language = language;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
|
Reference in New Issue
Block a user