Пример #1
0
 public async Task <McpResponse> GiftCatalogEntry(GiftCatalogEntry payload, int revision = -1)
 => await FortniteService.GiftCatalogEntry(this, payload, revision);
Пример #2
0
        internal static async Task <McpResponse> GiftCatalogEntry(OAuthSession oAuthSession, GiftCatalogEntry payload, int revision = -1)
        {
            // We're using a using statement so that the initialised client is disposed of when the code block is exited.
            using var client = new WebClient
                  {
                      Headers =
                      {
                          // This is so Epic Games' API knows what kind of data we're providing.
                          [HttpRequestHeader.ContentType] = "application/json",
                          // Set the Authorization header to the access token from the provided OAuthSession.
                          [HttpRequestHeader.Authorization] = $"bearer {oAuthSession.AccessToken}"
                      }
                  };

            // Use our request helper to make a POST request, and return the response data deserialized into the appropriate type.
            return(await client.PostDataAsync <McpResponse>(Endpoints.Fortnite.Mcp.GiftCatalogEntry(oAuthSession.AccountId, revision),
                                                            JsonConvert.SerializeObject(payload)).ConfigureAwait(false));
        }