Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Conversation

@NoraCodes
Copy link
Contributor

Hopefully this API looks okay. My main thought would be that it might not be desirable to re-use the existing post type; if that's true, I'm happy to split that off into a separate read-specific Post type.

In addition, there's the problem of share trees. I'm tempted to provide an option that doesn't deserialize it in whole. However, because it's not permitted in the API to get a single post by ID, we can't just provide the share tree IDs and leave it at that. As I see it, the options are:

  • always provide the entire share tree, despite it probably often not being used,
  • have a generic parameter on ApiPost that allows selecting whether or not to include the post share tree, using a custom Serde deserialize implementation, or
  • have seperate ApiPost and ApiPostWithShareTree types altogether.

Personally, I favor the latter.

.map(|project| project.handle)
.collect();
if related_projects.is_empty() {
related_projects.push(api.posting_project.handle.clone());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cohost API doesn't include the poster's handle unless there is something in the share tree. For consistency I push it in here if it's missing.

Copy link
Owner

@iliana iliana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this — may make some tweaks before I release. Thank you!!

@iliana iliana merged commit f9ced88 into iliana:main Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants