Skip to content

Commit

Permalink
Merge pull request #26 from drasticactions/NativeAOT
Browse files Browse the repository at this point in the history
Enable NativeAOT, add more docs.
  • Loading branch information
drasticactions authored Feb 8, 2024
2 parents 49322a8 + 8c55973 commit 361c6b8
Show file tree
Hide file tree
Showing 191 changed files with 3,111 additions and 467 deletions.
5 changes: 2 additions & 3 deletions src/FishyFlip.Tests/AuthorizedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task GetPopularFeedGeneratorsAsync()
});
}

[Fact]
[Fact(Skip = "Not working in Sandbox.")]
public async Task GetFeedAsyncTest()
{
var atUri = ATUri.Create("at://did:plc:hqmafuxb77d6cepxvqwlcekl/app.bsky.feed.generator/sandsky");
Expand All @@ -55,7 +55,7 @@ public async Task GetFeedAsyncTest()
});
}

[Fact]
[Fact(Skip = "Not working in Sandbox.")]
public async Task GetFeedGeneratorAsyncTest()
{
var atUri = ATUri.Create("at://did:plc:hqmafuxb77d6cepxvqwlcekl/app.bsky.feed.generator/sandsky");
Expand All @@ -71,7 +71,6 @@ public async Task GetFeedGeneratorAsyncTest()
});
}

[Fact]
public async Task GetProfileAsyncTest()
{
var test1did = ATDid.Create("did:plc:ix37rgpewy5wtl5qzhunsldu");
Expand Down
2 changes: 1 addition & 1 deletion src/FishyFlip.Tests/FishyFlip.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
75 changes: 0 additions & 75 deletions src/FishyFlip/ATProtoDebug.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/FishyFlip/ATProtoIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ATProtoIdentity(ATProtocol proto)
public async Task<Result<HandleResolution?>> ResolveHandleAsync(ATHandle handler, CancellationToken cancellationToken = default)
{
string url = $"{Constants.Urls.ATProtoIdentity.ResolveHandle}?handle={handler}";
return await this.Client.Get<HandleResolution>(url, this.Options.JsonSerializerOptions, cancellationToken);
return await this.Client.Get<HandleResolution>(url, this.Options.SourceGenerationContext.HandleResolution, this.Options.JsonSerializerOptions, cancellationToken);
}

/// <summary>
Expand All @@ -44,6 +44,6 @@ public ATProtoIdentity(ATProtocol proto)
/// <returns>Result of <see cref="Success"/>.</returns>
public async Task<Result<Success>> UpdateHandleAsync(ATHandle handle, CancellationToken cancellationToken = default)
{
return await this.Client.Post<UpdateHandle, Success>(Constants.Urls.ATProtoIdentity.UpdateHandle, this.Options.JsonSerializerOptions, new UpdateHandle(handle.Handle.ToString()), cancellationToken);
return await this.Client.Post<UpdateHandle, Success>(Constants.Urls.ATProtoIdentity.UpdateHandle, this.Options.SourceGenerationContext.UpdateHandle, this.Options.SourceGenerationContext.Success, this.Options.JsonSerializerOptions, new UpdateHandle(handle.Handle.ToString()), cancellationToken);
}
}
21 changes: 21 additions & 0 deletions src/FishyFlip/ATProtoModeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,41 @@ internal ATProtoModeration(ATProtocol proto)

private HttpClient Client => this.proto.Client;

/// <summary>
/// Creates a moderation report for a post asynchronously.
/// </summary>
/// <param name="reasonType">The type of the moderation reason.</param>
/// <param name="uri">The URI of the post.</param>
/// <param name="cid">The CID of the post.</param>
/// <param name="reason">The reason for the moderation report. This is optional.</param>
/// <param name="cancellationToken">A token that may be used to cancel the operation. This is optional.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="Result{ModerationRecord}"/> that represents the moderation record.</returns>
public Task<Result<ModerationRecord?>> CreateModerationReportPostAsync(ModerationReasonType reasonType, ATUri uri, Cid cid, string? reason = default, CancellationToken cancellationToken = default)
{
return this.Client.Post<CreateModerationReportPost, ModerationRecord?>(
Constants.Urls.ATProtoModeration.CreateReport,
this.Options.SourceGenerationContext.CreateModerationReportPost,
this.Options.SourceGenerationContext.ModerationRecord!,
this.Options.JsonSerializerOptions,
new CreateModerationReportPost(reasonType.ToEndpointString(), new RepoStrongRef(uri, cid), reason),
cancellationToken,
this.Options.Logger);
}

/// <summary>
/// Creates a moderation report for a repository asynchronously.
/// </summary>
/// <param name="reasonType">The type of the moderation reason.</param>
/// <param name="subject">The decentralized identifier (DID) of the subject.</param>
/// <param name="reason">The reason for the moderation report. This is optional.</param>
/// <param name="cancellationToken">A token that may be used to cancel the operation. This is optional.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a <see cref="Result{ModerationRecord}"/> that represents the moderation record.</returns>
public Task<Result<ModerationRecord?>> CreateModerationReportRepoAsync(ModerationReasonType reasonType, ATDid subject, string? reason = default, CancellationToken cancellationToken = default)
{
return this.Client.Post<CreateModerationReportRepo, ModerationRecord?>(
Constants.Urls.ATProtoModeration.CreateReport,
this.Options.SourceGenerationContext.CreateModerationReportRepo,
this.Options.SourceGenerationContext.ModerationRecord!,
this.Options.JsonSerializerOptions,
new CreateModerationReportRepo(reasonType.ToEndpointString(), new AdminRepoRef(subject), reason),
cancellationToken,
Expand Down
Loading

0 comments on commit 361c6b8

Please sign in to comment.