Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated PR for Release: 37.1.0 #129

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Square.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square", "Square/Square.csproj", "{04ef846f-c031-47c3-9e43-852ccc489976}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square", "Square/Square.csproj", "{d597539f-1cd3-4697-bf09-71333f46e441}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{3758b384-176e-452a-8d49-79fc2fcc1a47}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Square.Tests", "Square.Tests/Square.Tests.csproj", "{473eb2cb-aa17-41a3-8663-831dc114e4f8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{04ef846f-c031-47c3-9e43-852ccc489976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04ef846f-c031-47c3-9e43-852ccc489976}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04ef846f-c031-47c3-9e43-852ccc489976}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04ef846f-c031-47c3-9e43-852ccc489976}.Release|Any CPU.Build.0 = Release|Any CPU
{3758b384-176e-452a-8d49-79fc2fcc1a47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3758b384-176e-452a-8d49-79fc2fcc1a47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3758b384-176e-452a-8d49-79fc2fcc1a47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3758b384-176e-452a-8d49-79fc2fcc1a47}.Release|Any CPU.Build.0 = Release|Any CPU
{d597539f-1cd3-4697-bf09-71333f46e441}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{d597539f-1cd3-4697-bf09-71333f46e441}.Debug|Any CPU.Build.0 = Debug|Any CPU
{d597539f-1cd3-4697-bf09-71333f46e441}.Release|Any CPU.ActiveCfg = Release|Any CPU
{d597539f-1cd3-4697-bf09-71333f46e441}.Release|Any CPU.Build.0 = Release|Any CPU
{473eb2cb-aa17-41a3-8663-831dc114e4f8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{473eb2cb-aa17-41a3-8663-831dc114e4f8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{473eb2cb-aa17-41a3-8663-831dc114e4f8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{473eb2cb-aa17-41a3-8663-831dc114e4f8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
135 changes: 135 additions & 0 deletions Square/Apis/EventsApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
namespace Square.Apis
{
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using APIMatic.Core;
using APIMatic.Core.Types;
using APIMatic.Core.Utilities;
using APIMatic.Core.Utilities.Date.Xml;
using Newtonsoft.Json.Converters;
using Square;
using Square.Http.Client;
using Square.Utilities;
using System.Net.Http;

/// <summary>
/// EventsApi.
/// </summary>
internal class EventsApi : BaseApi, IEventsApi
{
/// <summary>
/// Initializes a new instance of the <see cref="EventsApi"/> class.
/// </summary>
internal EventsApi(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }

/// <summary>
/// Search for Square API events that occur within a 28-day timeframe.
/// </summary>
/// <param name="body">Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details..</param>
/// <returns>Returns the Models.SearchEventsResponse response from the API call.</returns>
public Models.SearchEventsResponse SearchEvents(
Models.SearchEventsRequest body)
=> CoreHelper.RunTask(SearchEventsAsync(body));

/// <summary>
/// Search for Square API events that occur within a 28-day timeframe.
/// </summary>
/// <param name="body">Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details..</param>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.SearchEventsResponse response from the API call.</returns>
public async Task<Models.SearchEventsResponse> SearchEventsAsync(
Models.SearchEventsRequest body,
CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.SearchEventsResponse>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Post, "/v2/events")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ContextAdder((_result, _context) => _result.ContextSetter(_context)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
/// Disables events to prevent them from being searchable.
/// All events are disabled by default. You must enable events to make them searchable.
/// Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
/// </summary>
/// <returns>Returns the Models.DisableEventsResponse response from the API call.</returns>
public Models.DisableEventsResponse DisableEvents()
=> CoreHelper.RunTask(DisableEventsAsync());

/// <summary>
/// Disables events to prevent them from being searchable.
/// All events are disabled by default. You must enable events to make them searchable.
/// Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
/// </summary>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.DisableEventsResponse response from the API call.</returns>
public async Task<Models.DisableEventsResponse> DisableEventsAsync(CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.DisableEventsResponse>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Put, "/v2/events/disable")
.WithAuth("global"))
.ResponseHandler(_responseHandler => _responseHandler
.ContextAdder((_result, _context) => _result.ContextSetter(_context)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
/// Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
/// </summary>
/// <returns>Returns the Models.EnableEventsResponse response from the API call.</returns>
public Models.EnableEventsResponse EnableEvents()
=> CoreHelper.RunTask(EnableEventsAsync());

/// <summary>
/// Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
/// </summary>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.EnableEventsResponse response from the API call.</returns>
public async Task<Models.EnableEventsResponse> EnableEventsAsync(CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.EnableEventsResponse>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Put, "/v2/events/enable")
.WithAuth("global"))
.ResponseHandler(_responseHandler => _responseHandler
.ContextAdder((_result, _context) => _result.ContextSetter(_context)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
/// Lists all event types that you can subscribe to as webhooks or query using the Events API.
/// </summary>
/// <param name="apiVersion">Optional parameter: The API version for which to list event types. Setting this field overrides the default version used by the application..</param>
/// <returns>Returns the Models.ListEventTypesResponse response from the API call.</returns>
public Models.ListEventTypesResponse ListEventTypes(
string apiVersion = null)
=> CoreHelper.RunTask(ListEventTypesAsync(apiVersion));

/// <summary>
/// Lists all event types that you can subscribe to as webhooks or query using the Events API.
/// </summary>
/// <param name="apiVersion">Optional parameter: The API version for which to list event types. Setting this field overrides the default version used by the application..</param>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.ListEventTypesResponse response from the API call.</returns>
public async Task<Models.ListEventTypesResponse> ListEventTypesAsync(
string apiVersion = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.ListEventTypesResponse>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Get, "/v2/events/types")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Query(_query => _query.Setup("api_version", apiVersion))))
.ResponseHandler(_responseHandler => _responseHandler
.ContextAdder((_result, _context) => _result.ContextSetter(_context)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
88 changes: 88 additions & 0 deletions Square/Apis/IEventsApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
namespace Square.Apis
{
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Square;
using Square.Http.Client;
using Square.Http.Request;
using Square.Http.Response;
using Square.Utilities;

/// <summary>
/// IEventsApi.
/// </summary>
public interface IEventsApi
{
/// <summary>
/// Search for Square API events that occur within a 28-day timeframe.
/// </summary>
/// <param name="body">Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details..</param>
/// <returns>Returns the Models.SearchEventsResponse response from the API call.</returns>
Models.SearchEventsResponse SearchEvents(
Models.SearchEventsRequest body);

/// <summary>
/// Search for Square API events that occur within a 28-day timeframe.
/// </summary>
/// <param name="body">Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details..</param>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.SearchEventsResponse response from the API call.</returns>
Task<Models.SearchEventsResponse> SearchEventsAsync(
Models.SearchEventsRequest body,
CancellationToken cancellationToken = default);

/// <summary>
/// Disables events to prevent them from being searchable.
/// All events are disabled by default. You must enable events to make them searchable.
/// Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
/// </summary>
/// <returns>Returns the Models.DisableEventsResponse response from the API call.</returns>
Models.DisableEventsResponse DisableEvents();

/// <summary>
/// Disables events to prevent them from being searchable.
/// All events are disabled by default. You must enable events to make them searchable.
/// Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
/// </summary>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.DisableEventsResponse response from the API call.</returns>
Task<Models.DisableEventsResponse> DisableEventsAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
/// </summary>
/// <returns>Returns the Models.EnableEventsResponse response from the API call.</returns>
Models.EnableEventsResponse EnableEvents();

/// <summary>
/// Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
/// </summary>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.EnableEventsResponse response from the API call.</returns>
Task<Models.EnableEventsResponse> EnableEventsAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Lists all event types that you can subscribe to as webhooks or query using the Events API.
/// </summary>
/// <param name="apiVersion">Optional parameter: The API version for which to list event types. Setting this field overrides the default version used by the application..</param>
/// <returns>Returns the Models.ListEventTypesResponse response from the API call.</returns>
Models.ListEventTypesResponse ListEventTypes(
string apiVersion = null);

/// <summary>
/// Lists all event types that you can subscribe to as webhooks or query using the Events API.
/// </summary>
/// <param name="apiVersion">Optional parameter: The API version for which to list event types. Setting this field overrides the default version used by the application..</param>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.ListEventTypesResponse response from the API call.</returns>
Task<Models.ListEventTypesResponse> ListEventTypesAsync(
string apiVersion = null,
CancellationToken cancellationToken = default);
}
}
5 changes: 5 additions & 0 deletions Square/ISquareClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public interface ISquareClient : IConfiguration
/// </summary>
IEmployeesApi EmployeesApi { get; }

/// <summary>
/// Gets instance for IEventsApi.
/// </summary>
IEventsApi EventsApi { get; }

/// <summary>
/// Gets instance for IGiftCardsApi.
/// </summary>
Expand Down
Loading
Loading