Skip to content

Commit 6db3078

Browse files
authored
Merge pull request #263 from umbraco/v16/hubspot
V16/hubspot
2 parents 18c093b + 7ca4d75 commit 6db3078

37 files changed

+2165
-2223
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Umbraco.Cms.Api.Management.OpenApi;
2+
3+
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Configuration
4+
{
5+
public class BackOfficeSecurityRequirementsOperationFilter : BackOfficeSecurityRequirementsOperationFilterBase
6+
{
7+
protected override string ApiName => Constants.ManagementApi.ApiName;
8+
}
9+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Mvc.ApiExplorer;
3+
using Microsoft.AspNetCore.Mvc.Controllers;
4+
using Microsoft.Extensions.Options;
5+
using Umbraco.Cms.Api.Common.OpenApi;
6+
7+
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Configuration
8+
{
9+
internal class HubspotOperationIdHandler : OperationIdHandler
10+
{
11+
public HubspotOperationIdHandler(IOptions<ApiVersioningOptions> apiVersioningOptions) : base(apiVersioningOptions)
12+
{
13+
}
14+
15+
protected override bool CanHandle(ApiDescription apiDescription, ControllerActionDescriptor controllerActionDescriptor)
16+
=> controllerActionDescriptor.ControllerTypeInfo.Namespace?.StartsWith("Umbraco.Cms.Integrations.Crm.Hubspot") is true;
17+
}
18+
}

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/CheckConfigurationController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
99
{
1010
[ApiVersion("1.0")]
11-
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1211
public class CheckConfigurationController : HubspotFormsControllerBase
1312
{
1413
private readonly HubspotOAuthSettings _oauthSettings;
@@ -20,7 +19,7 @@ public CheckConfigurationController(
2019
_oauthSettings = oauthSettingsOptions.Value;
2120
}
2221

23-
[HttpGet("check-configuration")]
22+
[HttpGet("check-configuration", Name = Constants.OperationIdentifiers.CheckConfiguration)]
2423
[ProducesResponseType(typeof(HubspotFormPickerSettings), StatusCodes.Status200OK)]
2524
public IActionResult CheckConfiguration()
2625
{

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/GetAccessTokenController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
1111
{
1212
[ApiVersion("1.0")]
13-
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1413
public class GetAccessTokenController : HubspotFormsControllerBase
1514
{
1615
private readonly IHubspotAuthorizationService _authorizationService;
@@ -21,7 +20,7 @@ public GetAccessTokenController(
2120
: base(settingsOptions)
2221
=> _authorizationService = authorizationImplementationFactory(Settings.UseUmbracoAuthorization);
2322

24-
[HttpPost("access-token")]
23+
[HttpPost("access-token", Name = Constants.OperationIdentifiers.GetAccessToken)]
2524
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
2625
public async Task<IActionResult> GetAccessToken([FromBody] OAuthRequestDto authRequestDto)
2726
{

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/GetAllController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
1313
{
1414
[ApiVersion("1.0")]
15-
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1615
public class GetAllController : HubspotFormsControllerBase
1716
{
1817
private readonly ILogger<GetAllController> _logger;
@@ -31,7 +30,7 @@ public GetAllController(
3130
_httpClientFactory = httpClientFactory;
3231
}
3332

34-
[HttpGet("get")]
33+
[HttpGet("get", Name = Constants.OperationIdentifiers.GetFormsByApiKey)]
3534
[ProducesResponseType(typeof(ResponseDto), StatusCodes.Status200OK)]
3635
public async Task<ResponseDto> GetAll()
3736
{

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/GetAllOAuthController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public GetAllOAuthController(
3131
_tokenService = tokenService;
3232
}
3333

34-
[HttpGet("oauth/get")]
34+
[HttpGet("oauth/get", Name = Constants.OperationIdentifiers.GetFormsOAuth)]
3535
[ProducesResponseType(typeof(ResponseDto), StatusCodes.Status200OK)]
3636
public async Task<ResponseDto> GetAllOAuth()
3737
{

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/GetAuthorizationUrlController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public GetAuthorizationUrlController(
1919
AuthorizationImplementationFactory authorizationImplementationFactory)
2020
: base(settingsOptions) => _authorizationService = authorizationImplementationFactory(Settings.UseUmbracoAuthorization);
2121

22-
[HttpGet("authorization-url")]
22+
[HttpGet("authorization-url", Name = Constants.OperationIdentifiers.GetAuthorizationUrl)]
2323
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
2424
public IActionResult GetAuthorizationUrl() => Ok(_authorizationService.GetAuthorizationUrl());
2525
}

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/HubspotFormsControllerBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
1313
{
1414
[ApiController]
15+
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1516
[BackOfficeRoute($"{Constants.ManagementApi.RootPath}/v{{version:apiVersion}}/forms")]
1617
[Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)]
1718
[MapToApi(Constants.ManagementApi.ApiName)]

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/RefreshAccessTokenController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
1010
{
1111
[ApiVersion("1.0")]
12-
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1312
public class RefreshAccessTokenController : HubspotFormsControllerBase
1413
{
1514
private readonly IHubspotAuthorizationService _authorizationService;
@@ -19,7 +18,7 @@ public RefreshAccessTokenController(
1918
AuthorizationImplementationFactory authorizationImplementationFactory)
2019
: base(settingsOptions) => _authorizationService = authorizationImplementationFactory(Settings.UseUmbracoAuthorization);
2120

22-
[HttpPost("refresh")]
21+
[HttpPost("refresh", Name = Constants.OperationIdentifiers.RefreshAccessToken)]
2322
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
2423
public async Task<IActionResult> RefreshAccessToken()
2524
{

src/Umbraco.Cms.Integrations.Crm.Hubspot/Api/Management/Controllers/RevokeTokenController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Api.Management.Controllers
99
{
1010
[ApiVersion("1.0")]
11-
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
1211
public class RevokeTokenController : HubspotFormsControllerBase
1312
{
1413
private readonly ITokenService _tokenService;
@@ -18,7 +17,7 @@ public RevokeTokenController(
1817
ITokenService tokenService)
1918
: base(settingsOptions) => _tokenService = tokenService;
2019

21-
[HttpPost("revoke")]
20+
[HttpPost("revoke", Name = Constants.OperationIdentifiers.RevokeAccessToken)]
2221
[ProducesResponseType(StatusCodes.Status200OK)]
2322
public IActionResult RevokeAccessToken()
2423
{

0 commit comments

Comments
 (0)