drasticactions / FishyFlip

Fishyflip - a .NET ATProtocol/Bluesky Library
MIT License
36 stars 3 forks source link

Add Helper for Did Parsing #8

Open drasticactions opened 11 months ago

drasticactions commented 11 months ago

When using ATDid for ATProtocol Methods, it may not be obvious what each part of the did does and where it can go. For example GetRecords takes an rkey, which is the last element of the did URL. Having a parser or extending ATDid to allow getting each element and validating them could help expose these fields.

TimBurga commented 5 months ago

Is this still worth pursuing? My current level of understanding of ATproto is that everything requires either the whole 3 part DID string or just the rkey (is rkey the official name for that last part?) Looking to contribute somewhere but just want to make sure it's useful.

drasticactions commented 5 months ago

https://github.com/drasticactions/FishyFlip/blob/main/src/FishyFlip/Models/ATUri.cs#L74-L87

https://github.com/drasticactions/FishyFlip/blob/main/src/FishyFlip/Models/ATUri.cs#L108-L120

I added a TryCreate and some helper properties for getting those values. I'm not sure if we need anything more specific beyond that now, but there could be more tests exercising the parsing code specifically to make sure it doesn't blow up when given a valid ATUri (or does blow up with a FormatException if given an invalid one). I should probably write some docs for how the tests work...