Skip to content

Commit

Permalink
Bump Falu from 1.14.0 to 2.0.1 (#288)
Browse files Browse the repository at this point in the history
Bumps [Falu](https://github.com/faluapp/falu-dotnet) from 1.14.0 to
2.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/faluapp/falu-dotnet/releases">Falu's
releases</a>.</em></p>
<blockquote>
<h2>2.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/250">#250</a>:
Set <code>AssemblyName</code> to <code>FaluSdk</code> and
<code>PackageId</code> to <code>Falu</code></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/faluapp/falu-dotnet/compare/2.0.0...2.0.1">https://github.com/faluapp/falu-dotnet/compare/2.0.0...2.0.1</a></p>
<h2>2.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/239">#239</a>:
Use source generators for RegEx in.NET 7 or later.</li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/242">#242</a>:
Remove <code>DataRedactionStatus</code> enum because of serialization
issues.</li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/243">#243</a>:
Added <code>Optional&lt;T&gt;</code> that creates room for JSON Merge
Patch.</li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/245">#245</a>:
Major renaming of types for patch/update and creation.</li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/244">#244</a>:
Rename <code>FaluSdk</code> -&gt; <code>Falu</code> and
<code>FaluSdk.Tests</code> -&gt; <code>Falu.Tests</code></li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/247">#247</a>:
Remove inheritance from **UpdateOptions types</li>
<li><a
href="https://redirect.github.com/faluapp/falu-dotnet/pull/248">#248</a>:
Migrate from JSON Patch to JSON Merge Patch.</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/faluapp/falu-dotnet/compare/1.14.0...2.0.0">https://github.com/faluapp/falu-dotnet/compare/1.14.0...2.0.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/db82384e5e2cec4fe4996d98f7c4514d151d0542"><code>db82384</code></a>
Set <code>AssemblyName</code> to <code>FaluSdk</code> and
<code>PackageId</code> to <code>Falu</code> (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/250">#250</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/0ac52f619eb20eec9aa0b52d1717841598231c5e"><code>0ac52f6</code></a>
No need to set <code>PackageId</code> since the project rename (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/249">#249</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/c6964b18bd8a26ffb48ba7f7bf3ff5cc505a8bb1"><code>c6964b1</code></a>
No need to set RootNamespace since renaming projects in <a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/244">#244</a></li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/82b17b1b4a2c18384b6461031d709ae933b9060c"><code>82b17b1</code></a>
Remove TODO for migrating to Polly vNext</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/4ffb0279e5b0d0bd13732190e0b964f9ae36183d"><code>4ffb027</code></a>
JSON Merge Patch Support (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/248">#248</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/ade37da2302b6725b89f62470e37ee768ad4fa45"><code>ade37da</code></a>
Switch <code>Optional\&lt;T&gt;</code> from struct to class hence hide
constructors</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/e9d54bc6c7e413934a1a092268bcb4c5e9834ab2"><code>e9d54bc</code></a>
Remove inheritance from **UpdateOptions types (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/247">#247</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/6e80699d1fa2fe4ab83f0335238adee9f8a648be"><code>6e80699</code></a>
Rename <code>FaluSdk</code> -&gt; <code>Falu</code> and
<code>FaluSdk.Tests</code> -&gt; <code>Falu.Tests</code> (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/244">#244</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/48460e370bbed220fe2005721cc62ba4fabf9307"><code>48460e3</code></a>
Renaming of types (<a
href="https://redirect.github.com/faluapp/falu-dotnet/issues/245">#245</a>)</li>
<li><a
href="https://github.com/faluapp/falu-dotnet/commit/cac505ebbc8498f1773e5ec96200aae9db049209"><code>cac505e</code></a>
Rename <code>Sc</code> to <code>SC</code></li>
<li>Additional commits viewable in <a
href="https://github.com/faluapp/falu-dotnet/compare/1.14.0...2.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Falu&package-manager=nuget&previous-version=1.14.0&new-version=2.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maxwell Weru <mburumaxwell@gmail.com>
  • Loading branch information
dependabot[bot] and mburumaxwell committed Jul 1, 2024
1 parent 83a5645 commit f6b1099
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Falu.Client.Events;

public class EventDeliveryRetry
public class EventDeliveryRetryOptions
{
[JsonPropertyName("webhook_endpoint")]
public string? WebhookEndpoint { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/FaluCli/Client/Events/ExtendedEventsServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace Falu.Client.Events;
internal class ExtendedEventsServiceClient(HttpClient backChannel, FaluClientOptions options) : EventsServiceClient(backChannel, options)
{
public virtual Task<ResourceResponse<WebhookDeliveryAttempt>> RetryAsync(string id,
EventDeliveryRetry request,
EventDeliveryRetryOptions request,
RequestOptions? options = null,
CancellationToken cancellationToken = default)
{
var uri = MakeResourcePath(id) + "/retry";
var content = JsonContent.Create(request, SC.Default.EventDeliveryRetry);
var content = JsonContent.Create(request, SC.Default.EventDeliveryRetryOptions);
return RequestAsync(uri, HttpMethod.Post, SC.Default.WebhookDeliveryAttempt, content, options, cancellationToken);
}
}
4 changes: 2 additions & 2 deletions src/FaluCli/Commands/Events/EventRetryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public override async Task<int> ExecuteAsync(CliCommandExecutionContext context,
var eventId = context.ParseResult.GetValue(eventArg)!;
var webhookEndpointId = context.ParseResult.GetValue(webhookEndpointOption);

var model = new EventDeliveryRetry { WebhookEndpoint = webhookEndpointId, };
var response = await context.Client.Events.RetryAsync(eventId, model, cancellationToken: cancellationToken);
var options = new EventDeliveryRetryOptions { WebhookEndpoint = webhookEndpointId, };
var response = await context.Client.Events.RetryAsync(eventId, options, cancellationToken: cancellationToken);
response.EnsureSuccess();

var attempt = response.Resource!;
Expand Down
34 changes: 17 additions & 17 deletions src/FaluCli/Commands/Messages/MessagesSendCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override async Task<int> ExecuteAsync(CliCommandExecutionContext context,
}

var media = mediaUrl is not null || mediaFileId is not null
? new[] { new MessageCreateRequestMedia { Url = mediaUrl?.ToString(), File = mediaFileId, }, }
? new[] { new MessageCreateOptionsMedia { Url = mediaUrl?.ToString(), File = mediaFileId, }, }
: null;

// ensure both time and delay are not specified
Expand All @@ -132,29 +132,29 @@ public override async Task<int> ExecuteAsync(CliCommandExecutionContext context,

// make the schedule
var schedule = time is not null
? (MessageCreateRequestSchedule)time
? (MessageCreateOptionsSchedule)time
: delay is not null
? (MessageCreateRequestSchedule)delay
? (MessageCreateOptionsSchedule)delay
: null;

// if there is only a single number, send a single message, otherwise use the batch
if (tos.Length == 1)
{
var target = tos[0];
var request = new MessageCreateRequest { To = target, Stream = stream, Media = media, Schedule = schedule, };
PopulateRequest(context, request);
var rr = await context.Client.Messages.CreateAsync(request, cancellationToken: cancellationToken);
var options = new MessageCreateOptions { To = target, Stream = stream, Media = media, Schedule = schedule, };
PopulateRequest(context, options);
var rr = await context.Client.Messages.CreateAsync(options, cancellationToken: cancellationToken);
rr.EnsureSuccess();

var response = rr.Resource!;
context.Logger.LogInformation("Scheduled {MessageId} for sending at {Scheduled:f}.", response.Id, (response.Schedule?.Time ?? response.Created).ToLocalTime());
}
else
{
var message = new MessageBatchCreateRequestMessage { Tos = tos, Media = media, };
var message = new MessageBatchCreateOptionsMessage { Tos = tos, Media = media, };
PopulateRequest(context, message);
var request = new MessageBatchCreateRequest { Messages = [message], Stream = stream, Schedule = schedule, };
var rr = await context.Client.MessageBatches.CreateAsync(request, cancellationToken: cancellationToken);
var options = new MessageBatchCreateOptions { Messages = [message], Stream = stream, Schedule = schedule, };
var rr = await context.Client.MessageBatches.CreateAsync(options, cancellationToken: cancellationToken);
rr.EnsureSuccess();

var response = rr.Resource!;
Expand All @@ -166,8 +166,8 @@ public override async Task<int> ExecuteAsync(CliCommandExecutionContext context,
return 0;
}

protected abstract void PopulateRequest(CliCommandExecutionContext context, MessageCreateRequest request);
protected abstract void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateRequestMessage request);
protected abstract void PopulateRequest(CliCommandExecutionContext context, MessageCreateOptions options);
protected abstract void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateOptionsMessage options);

private static bool TryValidateNumbers(string[] numbers, [NotNullWhen(false)] out string? errorMessage)
{
Expand Down Expand Up @@ -204,8 +204,8 @@ public MessagesSendRawCommand() : base("raw", "Send a message with the body defi
Add(bodyOption);
}

protected override void PopulateRequest(CliCommandExecutionContext context, MessageCreateRequest request) => request.Body = GetBody(context);
protected override void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateRequestMessage request) => request.Body = GetBody(context);
protected override void PopulateRequest(CliCommandExecutionContext context, MessageCreateOptions options) => options.Body = GetBody(context);
protected override void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateOptionsMessage options) => options.Body = GetBody(context);
private string? GetBody(CliCommandExecutionContext context) => context.ParseResult.GetValue(bodyOption);
}

Expand Down Expand Up @@ -280,16 +280,16 @@ public override Task<int> ExecuteAsync(CliCommandExecutionContext context, Cance
return base.ExecuteAsync(context, cancellationToken);
}

protected override void PopulateRequest(CliCommandExecutionContext context, MessageCreateRequest request) => request.Template = GetTemplate(context);
protected override void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateRequestMessage request) => request.Template = GetTemplate(context);
private MessageCreateRequestTemplate? GetTemplate(CliCommandExecutionContext context)
protected override void PopulateRequest(CliCommandExecutionContext context, MessageCreateOptions options) => options.Template = GetTemplate(context);
protected override void PopulateRequest(CliCommandExecutionContext context, MessageBatchCreateOptionsMessage options) => options.Template = GetTemplate(context);
private MessageCreateOptionsTemplate? GetTemplate(CliCommandExecutionContext context)
{
var id = context.ParseResult.GetValue(idOption);
var alias = context.ParseResult.GetValue(aliasOption);
var language = context.ParseResult.GetValue(languageOption);
var modelJson = context.ParseResult.GetValue(modelOption)!;
var model = new MessageTemplateModel(System.Text.Json.Nodes.JsonNode.Parse(modelJson)!.AsObject());

return new MessageCreateRequestTemplate { Id = id, Alias = alias, Language = language, Model = model, };
return new MessageCreateOptionsTemplate { Id = id, Alias = alias, Language = language, Model = model, };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ internal class MoneyBalancesRefreshCommand() : WorkspacedCommand("refresh", "Req
{
public override async Task<int> ExecuteAsync(CliCommandExecutionContext context, CancellationToken cancellationToken)
{
var request = new MoneyBalancesRefreshRequest { };
var response = await context.Client.MoneyBalances.RefreshAsync(request, cancellationToken: cancellationToken);
var options = new MoneyBalancesRefreshOptions { };
var response = await context.Client.MoneyBalances.RefreshAsync(options, cancellationToken: cancellationToken);
response.EnsureSuccess();

context.Logger.LogInformation("Refresh requested! You can check back later using 'falu money-balances get'");
Expand Down
21 changes: 11 additions & 10 deletions src/FaluCli/Commands/Templates/TemplatesPushCommand.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Falu.MessageTemplates;
using Spectre.Console;
using System.Text.Json;
using Tingle.Extensions.JsonPatch;

namespace Falu.Commands.Templates;

Expand Down Expand Up @@ -106,7 +105,7 @@ private static async Task PushTemplatesAsync(IReadOnlyList<TemplateManifest> man
if (changeType is TemplateChangeType.Added)
{
// prepare the request and send to server
var request = new MessageTemplateCreateRequest
var options = new MessageTemplateCreateOptions
{
Alias = alias,
Body = body,
Expand All @@ -115,21 +114,23 @@ private static async Task PushTemplatesAsync(IReadOnlyList<TemplateManifest> man
Metadata = metadata,
};
context.Logger.LogDebug("Creating template with alias {Alias} ...", alias);
var response = await context.Client.MessageTemplates.CreateAsync(request, cancellationToken: cancellationToken);
var response = await context.Client.MessageTemplates.CreateAsync(options, cancellationToken: cancellationToken);
response.EnsureSuccess();
context.Logger.LogDebug("Template with alias {Alias} created with Id: '{Id}'", alias, response.Resource!.Id);
}
else if (changeType is TemplateChangeType.Modified)
{
// prepare the patch details and send to server
var patch = new JsonPatchDocument<MessageTemplatePatchModel>()
.Replace(mt => mt.Alias, alias)
.Replace(mt => mt.Body, body)
.Replace(mt => mt.Translations, translations)
.Replace(mt => mt.Description, description)
.Replace(mt => mt.Metadata, metadata);
var options = new MessageTemplateUpdateOptions
{
Alias = alias,
Body = body,
Translations = translations,
Description = description,
Metadata = metadata,
};
context.Logger.LogDebug("Updating template with alias {Alias} ...", alias);
var response = await context.Client.MessageTemplates.UpdateAsync(mani.Id!, patch, cancellationToken: cancellationToken);
var response = await context.Client.MessageTemplates.UpdateAsync(mani.Id!, options, cancellationToken: cancellationToken);
response.EnsureSuccess();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/FaluCli/FaluCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageReference Include="ByteSize" Version="2.1.2" />
<PackageReference Include="CloudNative.CloudEvents.SystemTextJson" Version="2.7.1" />
<PackageReference Include="Falu" Version="1.14.0" />
<PackageReference Include="Falu" Version="2.0.1" />
<PackageReference Include="FileSignatures" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/FaluCli/FaluCliJsonSerializerContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Falu;
[JsonSerializable(typeof(List<Client.Workspaces.Workspace>))]

[JsonSerializable(typeof(Events.WebhookEvent))]
[JsonSerializable(typeof(Client.Events.EventDeliveryRetry))]
[JsonSerializable(typeof(Client.Events.EventDeliveryRetryOptions))]
[JsonSerializable(typeof(Client.Events.WebhookDeliveryAttempt))]

[JsonSerializable(typeof(List<Client.MoneyStatements.MoneyStatement>))]
Expand Down

0 comments on commit f6b1099

Please sign in to comment.