Exemplo n.º 1
0
        public async ValueTask <BungieResponse <ContentTypeDescription> > GetContentType(
            string type,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Content/GetContentType/")
                      .AddUrlParam(type)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <ContentTypeDescription>(url, token));
        }
Exemplo n.º 2
0
        public async ValueTask <BungieResponse <PostSearchResponse> > GetPoll(
            long topicId,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Forum/Poll/")
                      .AddUrlParam(topicId.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <PostSearchResponse>(url, token));
        }
Exemplo n.º 3
0
        public async ValueTask <BungieResponse <long> > GetTopicForContent(
            long contentId,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Forum/GetTopicForContent/")
                      .AddUrlParam(contentId.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <long>(url, token));
        }
Exemplo n.º 4
0
        public async ValueTask <BungieResponse <TagResponse[]> > GetForumTagSuggestions(
            string partialtag,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Forum/GetForumTagSuggestions/")
                      .AddQueryParam("partialtag", partialtag)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <TagResponse[]>(url, token));
        }
Exemplo n.º 5
0
 public override string ToString()
 {
     return
         (StringBuilderPool
          .GetBuilder(CancellationToken.None)
          .Append("[").Append(Type.ToString())
          .Append("]: [")
          .Append(Time.ToString(CultureInfo.InvariantCulture))
          .Append("]: ")
          .Append(Message)
          .Build());
 }
Exemplo n.º 6
0
        public async ValueTask <BungieResponse <GroupResponse> > GetGroup(
            long groupId,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/GroupV2/")
                      .AddUrlParam(groupId.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <GroupResponse>(url, token));
        }
Exemplo n.º 7
0
        public async ValueTask <BungieResponse <GlobalAlert[]> > GetGlobalAlerts(
            bool includestreaming   = false,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/GlobalAlerts/")
                      .AddQueryParam("includestreaming", includestreaming.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <GlobalAlert[]>(url, token));
        }
Exemplo n.º 8
0
        public async ValueTask <BungieResponse <DestinyMilestone> > GetClanWeeklyRewardState(
            long groupId,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Destiny2/Clan/")
                      .AddUrlParam(groupId.ToString())
                      .Append("WeeklyRewardState/")
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <DestinyMilestone>(url, token));
        }
Exemplo n.º 9
0
        public async ValueTask <BungieResponse <DestinyClanAggregateStat[]> > GetClanAggregateStats(
            long groupId,
            DestinyActivityModeType[] modes,
            CancellationToken token = default)
        {
            var url = StringBuilderPool.GetBuilder(token)
                      .Append("/Destiny2/Stats/AggregateClanStats/")
                      .AddUrlParam(groupId.ToString())
                      .AddQueryParam("modes", string.Join(',', modes))
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <DestinyClanAggregateStat[]>(url, token));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Converts a string to an XML-encoded string
        /// </summary>
        /// <param name="value">The string to encode</param>
        /// <returns>The encoded string</returns>
        public static string XmlAttributeEncode(string value)
        {
            if (string.IsNullOrWhiteSpace(value) || !ContainsXmlAttributeEncodingChars(value))
            {
                return(value);
            }

            string        result;
            StringBuilder sb = StringBuilderPool.GetBuilder();

            using (var writer = new StringWriter(sb))
            {
                int charCount = value.Length;

                for (int charIndex = 0; charIndex < charCount; charIndex++)
                {
                    char charValue = value[charIndex];

                    switch (charValue)
                    {
                    case '"':
                        writer.Write("&quot;");
                        break;

                    case '&':
                        writer.Write("&amp;");
                        break;

                    case '<':
                        writer.Write("&lt;");
                        break;

                    case '>':
                        writer.Write("&gt;");
                        break;

                    default:
                        writer.Write(charValue);
                        break;
                    }
                }

                writer.Flush();

                result = writer.ToString();
            }

            StringBuilderPool.ReleaseBuilder(sb);

            return(result);
        }
Exemplo n.º 11
0
    public async ValueTask <BungieResponse <DestinyPublicVendorsResponse> > GetPublicVendors(
        DestinyComponentType[] componentTypes,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/Destiny2/Vendors/")
                  .AddQueryParam("components", componentTypes.ComponentsToIntString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <DestinyPublicVendorsResponse>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 12
0
    public async ValueTask <BungieResponse <UserMembershipData> > GetMembershipDataById(long id,
                                                                                        BungieMembershipType membershipType, CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/User/GetMembershipsById/")
                  .AddUrlParam(id.ToString())
                  .AddUrlParam(((int)membershipType).ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <UserMembershipData>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 13
0
    public async ValueTask <BungieResponse <GeneralUser> > GetBungieNetUserById(
        long id,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/User/GetBungieNetUserById/")
                  .AddUrlParam(id.ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <GeneralUser>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 14
0
    public async ValueTask <BungieResponse <GroupOptionalConversation[]> > GetGroupOptionalConversations(
        long groupId,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool.GetBuilder(cancellationToken)
                  .Append("/GroupV2/")
                  .AddUrlParam(groupId.ToString())
                  .Append("OptionalConversations/")
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <GroupOptionalConversation[]>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 15
0
        public async ValueTask <BungieResponse <PostSearchResponse> > GetPostAndParentAwaitingApproval(
            long childPostId,
            bool?showbanned         = null,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Forum/GetPostAndParentAwaitingApproval/")
                      .AddUrlParam(childPostId.ToString())
                      .AddQueryParam("showbanned", showbanned.ToString(), () => showbanned.HasValue)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <PostSearchResponse>(url, token));
        }
Exemplo n.º 16
0
    public async ValueTask <BungieResponse <DestinyPostGameCarnageReportData> > GetPostGameCarnageReport(
        long activityId,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/Destiny2/Stats/PostGameCarnageReport/")
                  .AddUrlParam(activityId.ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetStatsPlatform <DestinyPostGameCarnageReportData>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 17
0
        public async ValueTask <BungieResponse <SearchResultOfGroupMember> > GetAdminsAndFounderOfGroup(
            long groupId,
            int currentpage         = 1,
            CancellationToken token = default)
        {
            var url = StringBuilderPool.GetBuilder(token)
                      .Append("/GroupV2/")
                      .AddUrlParam(groupId.ToString())
                      .Append("AdminsAndFounder/")
                      .AddQueryParam("currentpage", currentpage.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <SearchResultOfGroupMember>(url, token));
        }
Exemplo n.º 18
0
        public async ValueTask <BungieResponse <SearchResultOfTrendingEntry> > GetTrendingCategory(
            string categoryId,
            int pageNumber          = 0,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Trending/Categories/")
                      .AddUrlParam(categoryId)
                      .AddUrlParam(pageNumber.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <SearchResultOfTrendingEntry>(url, token));
        }
Exemplo n.º 19
0
        public async ValueTask <BungieResponse <TrendingDetail> > GetTrendingEntryDetail(
            TrendingEntryType trendingEntryType,
            string identifier,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Trending/Details/")
                      .AddUrlParam(((int)trendingEntryType).ToString())
                      .AddUrlParam(identifier)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <TrendingDetail>(url, token));
        }
Exemplo n.º 20
0
        public async ValueTask <BungieResponse <CredentialTypeForAccount[]> > GetCredentialTypesForTargetAccount(
            long id,
            AuthorizationTokenData authToken,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/User/GetCredentialTypesForTargetAccount/")
                      .AddUrlParam(id.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <CredentialTypeForAccount[]>(url, token,
                                                                                           authToken.AccessToken));
        }
Exemplo n.º 21
0
        public async ValueTask <BungieResponse <HardLinkedUserMembership> > GetMembershipFromHardLinkedCredential(
            long credential,
            BungieCredentialType credentialType = BungieCredentialType.SteamId,
            CancellationToken token             = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/User/GetMembershipFromHardLinkedCredential/")
                      .AddUrlParam(((byte)credentialType).ToString())
                      .AddUrlParam(credential.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <HardLinkedUserMembership>(url, token));
        }
Exemplo n.º 22
0
        public async ValueTask <BungieResponse <GroupMembershipSearchResponse> > RecoverGroupForFounder(
            BungieMembershipType membershipType,
            long membershipId,
            GroupType groupType,
            CancellationToken token = default)
        {
            var url = StringBuilderPool.GetBuilder(token)
                      .Append("/GroupV2/Recover/")
                      .AddUrlParam(((int)membershipType).ToString())
                      .AddUrlParam(membershipId.ToString())
                      .AddUrlParam(((int)groupType).ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <GroupMembershipSearchResponse>(url, token));
        }
Exemplo n.º 23
0
        public async ValueTask <BungieResponse <UserInfoCard[]> > SearchDestinyPlayer(
            BungieMembershipType membershipType,
            string displayName,
            bool returnOriginalProfile = false,
            CancellationToken token    = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Destiny2/SearchDestinyPlayer/")
                      .AddUrlParam(((int)membershipType).ToString())
                      .AddUrlParam(displayName)
                      .AddQueryParam("returnOriginalProfile", returnOriginalProfile.ToString(), () => returnOriginalProfile)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <UserInfoCard[]>(url, token));
        }
Exemplo n.º 24
0
        public async ValueTask <BungieResponse <DestinyEntitySearchResult> > SearchDestinyEntities(
            DefinitionsEnum type,
            string searchTerm,
            int page = 0,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Destiny2/Armory/Search/")
                      .AddUrlParam(type.ToString())
                      .AddUrlParam(searchTerm)
                      .AddQueryParam("page", page.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <DestinyEntitySearchResult>(url, token));
        }
Exemplo n.º 25
0
    public async ValueTask <BungieResponse <GroupResponse> > GetGroupByName(
        string groupName,
        GroupType groupType,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/GroupV2/Name/")
                  .AddUrlParam(groupName)
                  .AddUrlParam(((int)groupType).ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <GroupResponse>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 26
0
    public async ValueTask <BungieResponse <UserSearchResponse> > SearchByGlobalNamePrefix(
        string displayNamePrefix,
        int page = 0,
        CancellationToken cancellationToken = default)
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/User/Search/Prefix/")
                  .AddUrlParam(displayNamePrefix)
                  .AddUrlParam(page.ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <UserSearchResponse>(url, cancellationToken)
               .ConfigureAwait(false));
    }
Exemplo n.º 27
0
        public async ValueTask <BungieResponse <PostSearchResponse> > GetCommunityContent(
            ForumTopicsSortEnum sort,
            ForumMediaType mediaFilter,
            int page = 0,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/CommunityContent/Get/")
                      .AddUrlParam(((byte)sort).ToString())
                      .AddUrlParam(((int)mediaFilter).ToString())
                      .AddUrlParam(page.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <PostSearchResponse>(url, token));
        }
Exemplo n.º 28
0
        public async ValueTask <BungieResponse <ContentItemPublicContract> > GetContentByTagAndType(
            string tag,
            string type,
            string locale,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Content/GetContentByTagAndType/")
                      .AddUrlParam(tag)
                      .AddUrlParam(type)
                      .AddUrlParam(locale)
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <ContentItemPublicContract>(url, token));
        }
Exemplo n.º 29
0
        public async ValueTask <BungieResponse <ContentItemPublicContract> > GetContentById(
            long id,
            string locale,
            bool head = false,
            CancellationToken token = default)
        {
            var url = StringBuilderPool
                      .GetBuilder(token)
                      .Append("/Content/GetContentById/")
                      .AddUrlParam(id.ToString())
                      .AddUrlParam(locale)
                      .AddQueryParam("head", head.ToString())
                      .Build();

            return(await _httpClient.GetFromBungieNetPlatform <ContentItemPublicContract>(url, token));
        }
Exemplo n.º 30
0
    public async ValueTask <BungieResponse <T> > GetDestinyEntityDefinition <T>(
        DefinitionsEnum entityType,
        uint hash,
        CancellationToken cancellationToken = default) where T : IDestinyDefinition
    {
        var url = StringBuilderPool
                  .GetBuilder(cancellationToken)
                  .Append("/Destiny2/Manifest/")
                  .AddUrlParam(entityType.ToString())
                  .AddUrlParam(hash.ToString())
                  .Build();

        return(await _dotNetBungieApiHttpClient
               .GetFromBungieNetPlatform <T>(url, cancellationToken)
               .ConfigureAwait(false));
    }