Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more helper methods for facets #73

Merged
merged 3 commits into from
Oct 29, 2024
Merged

Add more helper methods for facets #73

merged 3 commits into from
Oct 29, 2024

Conversation

drasticactions
Copy link
Owner

@drasticactions drasticactions commented Oct 29, 2024

Addresses #68

This creates additional helper methods for handling creating Facets, given a post text.

var postText = "@drasticactions.dev This is a #test #test of #testing the #FishyFlip #API. https://github.com/drasticactions DAHome. @drasticactions.jp https://github.com/drasticactions/FishyFlip @drasticactions.dev Weee!";
var postHandles = ATHandle.FromPostText(postText);
var feedProfiles = (await atProtocol.Actor.GetProfilesAsync(postHandles)).HandleResult();
var handleFacets = Facet.ForMentions(postText, feedProfiles!.Profiles!);
var hashtagFacets = Facet.ForHashtags(postText);
var uriFacets = Facet.ForUris(postText);
var baseUriFacets = Facet.ForUris(postText, "DAHome", "https://github.com/drasticactions");
var facets = handleFacets.Concat(hashtagFacets).Concat(uriFacets).Concat(baseUriFacets).ToArray();
var result = (await atProtocol.Repo.CreatePostAsync(postText, facets)).HandleResult();

https://bsky.app/profile/drasticactions.xn--q9jyb4c/post/3l7n4vrnoqx2k

image

@drasticactions drasticactions marked this pull request as ready for review October 29, 2024 10:46
@drasticactions drasticactions merged commit 2680d89 into develop Oct 29, 2024
3 checks passed
@drasticactions drasticactions deleted the facet-helpers branch October 29, 2024 10:47
drasticactions added a commit that referenced this pull request Nov 4, 2024
* Add more helper methods for facets

* Update API naming...

* Start adding test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant