Skip to content

Commit

Permalink
Merge pull request #102 from umbraco/v14/feature/42959-V14-Integratio…
Browse files Browse the repository at this point in the history
…ns-(Zapier/Forms)

V14 integrations (zapier/forms)
  • Loading branch information
acoumb authored Aug 27, 2024
2 parents 2870994 + 29d28ec commit 4301fbc
Show file tree
Hide file tree
Showing 39 changed files with 65,939 additions and 1,019 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
*.userosscache
*.sln.docstates

# test site
src/Umbraco.Forms.Integrations.Testsite.V14/App_Plugins/Our.Umbraco.DashIt
src/Umbraco.Forms.Integrations.Testsite.V14/umbraco
src/Umbraco.Forms.Integrations.Testsite.V14/Views
src/Umbraco.Forms.Integrations.Testsite.V14/wwwroot
src/Umbraco.Forms.Integrations.Automation.Zapier/wwwroot

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
using System.Linq;
using Umbraco.Cms.Web.Common.Controllers;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Common.Attributes;
using Umbraco.Cms.Web.Common.Routing;
using Umbraco.Forms.Integrations.Automation.Zapier.Services;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Controllers
namespace Umbraco.Forms.Integrations.Automation.Zapier.Api.Management.Controllers
{
public class ZapierFormAuthorizedApiController : UmbracoApiController
[ApiController]
[BackOfficeRoute($"{Constants.ManagementApi.RootPath}/v{{version:apiVersion}}")]
[MapToApi(Constants.ManagementApi.ApiName)]
public class FormsControllerBase : Controller
{
private readonly IUserValidationService _userValidationService;
protected readonly ZapierFormService ZapierFormService;

public ZapierFormAuthorizedApiController(
IUserValidationService userValidationService) =>
public FormsControllerBase(
IUserValidationService userValidationService,
ZapierFormService zapierFormService)
{
_userValidationService = userValidationService;
ZapierFormService = zapierFormService;
}

public bool IsAccessValid()
protected bool IsAccessValid()
{
string username = string.Empty;
string password = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Forms.Integrations.Automation.Zapier.Extensions;
using Umbraco.Forms.Integrations.Automation.Zapier.Services;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Api.Management.Controllers
{
[ApiVersion("1.0")]
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
public class GetFormPropertiesByIdController : FormsControllerBase
{
public GetFormPropertiesByIdController(IUserValidationService userValidationService, ZapierFormService zapierFormService)
: base(userValidationService, zapierFormService)
{
}

[HttpGet("forms/{id}")]
[ProducesResponseType(typeof(List<Dictionary<string, string>>), StatusCodes.Status200OK)]
public IActionResult GetFormPropertiesById(string id)
{
var emptyList = new List<Dictionary<string, string>>();

if (!IsAccessValid()) return Ok(emptyList);

var form = ZapierFormService.GetById(id);

if (form == null) return Ok(emptyList);

return Ok(new List<Dictionary<string, string>> { form.ToEmptyFormDictionary() });
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos;
using Umbraco.Forms.Integrations.Automation.Zapier.Services;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Api.Management.Controllers
{
[ApiVersion("1.0")]
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
public class GetFormsController : FormsControllerBase
{
public GetFormsController(IUserValidationService userValidationService, ZapierFormService zapierFormService)
: base(userValidationService, zapierFormService)
{

}

[HttpGet("forms")]
[ProducesResponseType(typeof(IEnumerable<FormDto>), StatusCodes.Status200OK)]
public IActionResult GetForms()
{
if (!IsAccessValid()) return Ok(Enumerable.Empty<FormDto>());

return Ok(ZapierFormService.GetAll());
}
}
}
11 changes: 11 additions & 0 deletions src/Umbraco.Forms.Integrations.Automation.Zapier/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,16 @@ public static class EntityType
{
public const int Form = 2;
}

public static class ManagementApi
{
public const string RootPath = "zapier/forms/management/api";

public const string ApiName = "zapier-forms-management";

public const string ApiTitle = "Zapier Forms Management API";

public const string GroupName = "Zapier Forms";
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;

using Umbraco.Forms.Core.Models;
using Umbraco.Forms.Core.Models;
using Umbraco.Forms.Core.Persistence.Dtos;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Extensions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;

using Umbraco.Forms.Integrations.Automation.Zapier.Services;
using Umbraco.Forms.Integrations.Automation.Zapier.Services;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Helpers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos
{
public class FormDto
{
[JsonProperty("id")]
[JsonPropertyName("id")]
public string Id { get; set; }

[JsonProperty("name")]
[JsonPropertyName("name")]
public string Name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos
{
public class SubscriptionDto
{
[JsonProperty("id")]
[JsonPropertyName("id")]
public int Id { get; set; }

[JsonProperty("entityId")]
[JsonPropertyName("entityId")]
public string EntityId { get; set; }

[JsonProperty("type")]
[JsonPropertyName("type")]
public int Type { get; set; }

[JsonProperty("typeName")] public string TypeName => nameof(Constants.EntityType.Form);
[JsonPropertyName("typeName")]
public string TypeName => nameof(Constants.EntityType.Form);

[JsonProperty("hookUrl")]
[JsonPropertyName("hookUrl")]
public string HookUrl { get; set; }

[JsonProperty("subscribeHook")]
[JsonPropertyName("subscribeHook")]
public bool SubscribeHook { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:38889",
"sslPort": 44358
"applicationUrl": "http://localhost:18629",
"sslPort": 44339
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5220",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Umbraco.Web.UI": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:44358;http://localhost:38889",
"applicationUrl": "https://localhost:7106;http://localhost:5220",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Threading.Tasks;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
{
public interface IUserValidationService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System.Linq;
using System.Threading.Tasks;

using Microsoft.Extensions.Options;

using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;

using Umbraco.Forms.Core.Models;
using Umbraco.Forms.Core.Models;
using Umbraco.Forms.Core.Services;
using Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Microsoft.Extensions.Logging;

using System.Collections.Generic;
using System.Linq;

using Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos;
using Umbraco.Cms.Infrastructure.Scoping;
using Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
{
public class ZapierService
{
Expand Down
Loading

0 comments on commit 4301fbc

Please sign in to comment.