-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0485c0e
commit 5ec6fb0
Showing
7 changed files
with
246 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/FishyFlip/Lexicon/Link/Pastesphere/ATProtoPastesphereExtensions.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// <auto-generated /> | ||
// This file was generated by FFSourceGen. | ||
// Do not modify this file. | ||
|
||
#nullable enable | ||
|
||
using FishyFlip.Lexicon.Com.Atproto.Repo; | ||
|
||
namespace FishyFlip.Lexicon.Link.Pastesphere | ||
{ | ||
|
||
/// <summary> | ||
/// Extension methods for link.pastesphere. | ||
/// </summary> | ||
public static class ATProtoPastesphereExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Create a Snippet record. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="record"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="validate"></param> | ||
/// <param name="swapCommit"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<CreateRecordOutput?>> CreateSnippetAsync(this FishyFlip.ATProtocol atp, Link.Pastesphere.Snippet record, string? rkey = default, bool? validate = default, string? swapCommit = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.CreateRecordAsync(atp.SessionManager.Session?.Did ?? throw new InvalidOperationException("Session did is required."), "link.pastesphere.snippet", record, rkey, validate, swapCommit, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// Create a Snippet record. | ||
/// </summary> | ||
/// <param name="repo"></param> | ||
/// <param name="collection"></param> | ||
/// <param name="record"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="validate"></param> | ||
/// <param name="swapCommit"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<CreateRecordOutput?>> CreateSnippetAsync(this FishyFlip.ATProtocol atp, string? title, string? type, string? body, string? description = default, DateTime? createdAt = default, string? rkey = default, bool? validate = default, string? swapCommit = default, CancellationToken cancellationToken = default) | ||
{ | ||
var record = new FishyFlip.Lexicon.Link.Pastesphere.Snippet(); | ||
record.Title = title; | ||
record.Description = description; | ||
record.TypeValue = type; | ||
record.Body = body; | ||
record.CreatedAt = createdAt ?? DateTime.UtcNow; | ||
return atp.CreateRecordAsync(atp.SessionManager.Session?.Did ?? throw new InvalidOperationException("Session did is required."), "link.pastesphere.snippet", record, rkey, validate, swapCommit, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// Delete a Snippet record. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="repo"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="swapRecord"></param> | ||
/// <param name="swapCommit"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<DeleteRecordOutput?>> DeleteSnippetAsync(this FishyFlip.ATProtocol atp, FishyFlip.Models.ATIdentifier repo, string rkey, string? swapRecord = default, string? swapCommit = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.DeleteRecordAsync(repo, "link.pastesphere.snippet", rkey, swapRecord, swapCommit, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// Put a Snippet record. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="repo"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="record"></param> | ||
/// <param name="validate"></param> | ||
/// <param name="swapRecord"></param> | ||
/// <param name="swapCommit"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<PutRecordOutput?>> PutSnippetAsync(this FishyFlip.ATProtocol atp, FishyFlip.Models.ATIdentifier repo, string rkey, Link.Pastesphere.Snippet record, bool? validate = default, string? swapRecord = default, string? swapCommit = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.PutRecordAsync(repo, "link.pastesphere.snippet", rkey, record, validate, swapRecord, swapCommit, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// List Snippet records. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="repo"></param> | ||
/// <param name="limit"></param> | ||
/// <param name="cursor"></param> | ||
/// <param name="reverse"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<ListRecordsOutput?>> ListSnippetAsync(this FishyFlip.ATProtocol atp, FishyFlip.Models.ATIdentifier repo, int? limit = 50, string? cursor = default, bool? reverse = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.ListRecordsAsync(repo, "link.pastesphere.snippet", limit, cursor, reverse, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// List Snippet records. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="limit"></param> | ||
/// <param name="cursor"></param> | ||
/// <param name="reverse"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<ListRecordsOutput?>> ListSnippetAsync(this FishyFlip.ATProtocol atp, int? limit = 50, string? cursor = default, bool? reverse = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.ListRecordsAsync(atp.SessionManager.Session?.Did ?? throw new InvalidOperationException("Session did is required."), "link.pastesphere.snippet", limit, cursor, reverse, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// Get Snippet records. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="repo"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="cid"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<GetRecordOutput?>> GetSnippetAsync(this FishyFlip.ATProtocol atp, FishyFlip.Models.ATIdentifier repo, string rkey, string? cid = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.GetRecordAsync(repo, "link.pastesphere.snippet", rkey, cid, cancellationToken); | ||
} | ||
|
||
/// <summary> | ||
/// Get Snippet records. | ||
/// </summary> | ||
/// <param name="atp"></param> | ||
/// <param name="rkey"></param> | ||
/// <param name="cid"></param> | ||
/// <param name="cancellationToken"></param> | ||
public static Task<Result<GetRecordOutput?>> GetSnippetAsync(this FishyFlip.ATProtocol atp, string rkey, string? cid = default, CancellationToken cancellationToken = default) | ||
{ | ||
return atp.GetRecordAsync(atp.SessionManager.Session?.Did ?? throw new InvalidOperationException("Session did is required."), "link.pastesphere.snippet", rkey, cid, cancellationToken); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// <auto-generated /> | ||
// This file was generated by FFSourceGen. | ||
// Do not modify this file. | ||
|
||
#nullable enable | ||
|
||
namespace FishyFlip.Lexicon.Link.Pastesphere | ||
{ | ||
/// <summary> | ||
/// Record representing a text snippet. | ||
/// </summary> | ||
public partial class Snippet : ATObject | ||
{ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Snippet"/> class. | ||
/// </summary> | ||
/// <param name="title"></param> | ||
/// <param name="type"></param> | ||
/// <param name="body"></param> | ||
/// <param name="description"></param> | ||
/// <param name="createdAt"></param> | ||
public Snippet(string? title, string? type, string? body, string? description = default, DateTime? createdAt = default) | ||
{ | ||
this.Title = title; | ||
this.Description = description; | ||
this.TypeValue = type; | ||
this.Body = body; | ||
this.CreatedAt = createdAt ?? DateTime.UtcNow; | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Snippet"/> class. | ||
/// </summary> | ||
public Snippet() | ||
{ | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Snippet"/> class. | ||
/// </summary> | ||
public Snippet(CBORObject obj) | ||
{ | ||
if (obj["title"] is not null) this.Title = obj["title"].AsString(); | ||
if (obj["description"] is not null) this.Description = obj["description"].AsString(); | ||
if (obj["type"] is not null) this.TypeValue = obj["type"].AsString(); | ||
if (obj["body"] is not null) this.Body = obj["body"].AsString(); | ||
if (obj["createdAt"] is not null) this.CreatedAt = obj["createdAt"].ToDateTime(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the title. | ||
/// </summary> | ||
[JsonPropertyName("title")] | ||
public string? Title { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the description. | ||
/// </summary> | ||
[JsonPropertyName("description")] | ||
public string? Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the type. | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
public string? TypeValue { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the body. | ||
/// </summary> | ||
[JsonPropertyName("body")] | ||
public string? Body { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the createdAt. | ||
/// </summary> | ||
[JsonPropertyName("createdAt")] | ||
public DateTime? CreatedAt { get; set; } = DateTime.UtcNow; | ||
|
||
/// <summary> | ||
/// Gets the ATRecord Type. | ||
/// </summary> | ||
[JsonPropertyName("$type")] | ||
public override string Type => "link.pastesphere.snippet"; | ||
|
||
public const string RecordType = "link.pastesphere.snippet"; | ||
|
||
public override string ToJson() | ||
{ | ||
return JsonSerializer.Serialize<Link.Pastesphere.Snippet>(this, (JsonTypeInfo<Link.Pastesphere.Snippet>)SourceGenerationContext.Default.LinkPastesphereSnippet)!; | ||
} | ||
|
||
public static Snippet FromJson(string json) | ||
{ | ||
return JsonSerializer.Deserialize<Link.Pastesphere.Snippet>(json, (JsonTypeInfo<Link.Pastesphere.Snippet>)SourceGenerationContext.Default.LinkPastesphereSnippet)!; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters