Pass complete args struct to create_history_stream #56

Merged
glyph merged 4 commits from create_history_stream_opts into main 2022-08-09 10:15:41 +00:00
Owner

Addresses #55

The relevant changes here are in src/api/history_stream.rs and examples/streams.rs.

Previously we were simply passing the ssb_id into create_history_stream(). This PR publically exports the CreateHistoryStreamIn type from kuska and renames it as CreateHistoryStream. create_history_stream() now expects a single argument in the form of CreateHistoryStream (this is similar to how SubsetQuery is passed to get_subset_stream()).

This change allows a library user to set additional options for the create_history_stream call, including the minimum sequence number and a limit on returned messages.

One question I have for @notplants: do you think CreateHistoryStream is consistent with the naming in the rest of golgi? I'm not entirely happy with it...perhaps HistoryStreamArgs is better?


Example usage:

let history_stream = sbot_client.create_history_stream(CreateHistoryStream::new(author.to_string())).await?;

// or with more options enabled

let args = CreateHistoryStream::new(author.to_string()).keys_values(true, true).after_seq(75).limit(10);
let history_stream = sbot_client.create_history_stream(args).await?;
Addresses https://git.coopcloud.tech/golgi-ssb/golgi/issues/55 The relevant changes here are in `src/api/history_stream.rs` and `examples/streams.rs`. Previously we were simply passing the `ssb_id` into `create_history_stream()`. This PR publically exports the [CreateHistoryStreamIn](https://github.com/Kuska-ssb/ssb/blob/master/src/api/dto/history_stream.rs) type from kuska and renames it as `CreateHistoryStream`. `create_history_stream()` now expects a single argument in the form of `CreateHistoryStream` (this is similar to how `SubsetQuery` is passed to `get_subset_stream()`). This change allows a library user to set additional options for the `create_history_stream` call, including the minimum sequence number and a limit on returned messages. One question I have for @notplants: do you think `CreateHistoryStream` is consistent with the naming in the rest of golgi? I'm not entirely happy with it...perhaps `HistoryStreamArgs` is better? ----- Example usage: ```rust let history_stream = sbot_client.create_history_stream(CreateHistoryStream::new(author.to_string())).await?; // or with more options enabled let args = CreateHistoryStream::new(author.to_string()).keys_values(true, true).after_seq(75).limit(10); let history_stream = sbot_client.create_history_stream(args).await?; ```
glyph added the
enhancement
label 2022-08-09 07:36:09 +00:00
glyph added 10 commits 2022-08-09 07:36:10 +00:00
glyph requested review from notplants 2022-08-09 07:36:16 +00:00
glyph removed review request for notplants 2022-08-09 10:14:21 +00:00
glyph added 1 commit 2022-08-09 10:14:40 +00:00
glyph merged commit 9981b64bb2 into main 2022-08-09 10:15:41 +00:00
glyph deleted branch create_history_stream_opts 2022-08-09 10:15:43 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#56
No description provided.